Re: [PATCH] inotify to minimize stat() calls
- From
- Robert Zeh <robert.allan.zeh@gmail.com>
- Date
- Apr 26, 2013, 15:35 UTC
- Message-ID
- <CAKXa9=rjQJMwgcAs9ic3XSqFh40NYrQt217QS_VUw7ifKihqdA@mail.gmail.com>
- In-Reply-To
- <CACsJy8ChXRMR93r2R5NoTL7Ly1HqWCXq=t=Kj4ma5+MyYvESpg@mail.gmail.com>
On Thu, Apr 25, 2013 at 4:20 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 16 quoted lines
> On Fri, Apr 26, 2013 at 2:44 AM, Robert Zeh <robert.allan.zeh@gmail.com> wrote: >>> Can you just replace lstat/stat with cached_lstat/stat inside >>> git-compat-util.h and not touch all files at once? I think you may >>> need to deal with paths outside working directory. But because you're >>> using lookup table, that should be no problem. >> >> That's a good idea; but there are a few places where you want to call >> the uncached stat because calling the cache leads to recursion or >> you bump into things that haven't been setup yet. Any ideas how to >> handle that? > > On second thought, no my idea was stupid. We only need to optimize > lstat for certain cases and naming cached_lstat is much clearer. I > suspect read-cache.c and maybe dir.c and unpack-trees.c are the only > places that need cached_lstat. Other places should not issue many > lstats and we don't need to touch them.
ok. The only reason I did it for all of them was the it was a simple search and replace, and I didn't know how often lstat was called from various locations.