Re: [PATCH] inotify to minimize stat() calls
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 25, 2013, 21:20 UTC
- Message-ID
- <CACsJy8ChXRMR93r2R5NoTL7Ly1HqWCXq=t=Kj4ma5+MyYvESpg@mail.gmail.com>
- In-Reply-To
- <CAKXa9=pt2mxwFtepoOLZ-Atw3Ey5_OHh6rzk43kVTs8=vcVuRw@mail.gmail.com>
On Fri, Apr 26, 2013 at 2:44 AM, Robert Zeh <robert.allan.zeh@gmail.com> wrote:
Show 9 quoted lines
>> 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. -- Duy