RE:
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:46:43
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Thu, 7 May 2009, Bevan Watkiss wrote:
Looking at the trace it does appear that most of this is the lstat. It's the problem of having many tiny files on a network drive, and trying to use git for something it's not meant. The log has 265430 lines of lstat and 10887 other lines. If you still want the log file I'll strip out the directory names and send it off.
Actually, if it's just the lstat's, then it's not all that interesting any more, it's a known problem with at least a known _partial_ solution. However, I think it turns out that we've only enabled the index preloading with "git diff" and "git commit". Not on "git checkout". So start off doing that
[core] preloadindex = true
AND apply the following patch to git, and see how much (if any) that helps. It sounds like you have a pretty damn large repository, together with a slow filesystem. It really could be a big improvement. The patch is TOTALLY UNTESTED. It also worries me that 'git checkout' seems to do _two_ 'lstat()' calls per file. I didn't look any more closely, but there may be other issues here. Linus --- builtin-checkout.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 15f0c32..3100ccd 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c@@ -216,7 +216,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec, struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file)); newfd = hold_locked_index(lock_file, 1); - if (read_cache() < 0) + if (read_cache_preload(pathspec) < 0) return error("corrupt index file"); if (source_tree)
@@ -367,7 +367,7 @@ static int merge_working_tree(struct checkout_opts *opts, int newfd = hold_locked_index(lock_file, 1); int reprime_cache_tree = 0; - if (read_cache() < 0) + if (read_cache_preload(NULL) < 0) return error("corrupt index file"); cache_tree_free(&active_cache_tree);