Re: [PATCH] inotify to minimize stat() calls

2013-04-27 Thread Duy Nguyen
On Thu, Apr 25, 2013 at 12:20 AM, Robert Zeh wrote: > +int cached_lstat(const char *path, struct stat *buf) > +{ > + int stat_return_value = 0; > + struct stat_cache_entry *entry = 0; > + > + read_stat_cache(); > + > + entry = get_stat_cache_entry(path); > + > + stat_

Re: [PATCH] inotify to minimize stat() calls

2013-04-27 Thread Thomas Rast
Thomas Rast writes: > Robert Zeh writes: > >> On Thu, Apr 25, 2013 at 3:18 AM, Thomas Rast wrote: >>> >>> I don't get this bit. The lstat() are run over all files listed in the >>> index. So shouldn't your daemon watch exactly those (or rather, all >>> dirnames of such files)? >> I believe th

Re: [PATCH] inotify to minimize stat() calls

2013-04-26 Thread Robert Zeh
On Thu, Apr 25, 2013 at 4:20 PM, Duy Nguyen wrote: > On Fri, Apr 26, 2013 at 2:44 AM, Robert Zeh > 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

Re: [PATCH] inotify to minimize stat() calls

2013-04-25 Thread Duy Nguyen
On Fri, Apr 26, 2013 at 2:44 AM, Robert Zeh 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 n

Re: [PATCH] inotify to minimize stat() calls

2013-04-25 Thread Thomas Rast
Robert Zeh writes: > On Thu, Apr 25, 2013 at 3:18 AM, Thomas Rast wrote: >> >> I don't get this bit. The lstat() are run over all files listed in the >> index. So shouldn't your daemon watch exactly those (or rather, all >> dirnames of such files)? > I believe that fill_directory is handling w

Re: [PATCH] inotify to minimize stat() calls

2013-04-25 Thread Robert Zeh
On Wed, Apr 24, 2013 at 4:32 PM, Duy Nguyen wrote: > On Thu, Apr 25, 2013 at 3:20 AM, Robert Zeh > wrote: >> Here is a patch that creates a daemon that tracks file >> state with inotify, writes it out to a file upon request, >> and changes most of the calls to stat to use said cache. >> >> It ha

Re: [PATCH] inotify to minimize stat() calls

2013-04-25 Thread Robert Zeh
On Thu, Apr 25, 2013 at 3:18 AM, Thomas Rast wrote: > > Robert Zeh writes: > > > Here is a patch that creates a daemon that tracks file > > state with inotify, writes it out to a file upon request, > > and changes most of the calls to stat to use said cache. > > > > It has bugs, but I figured it

Re: [PATCH] inotify to minimize stat() calls

2013-04-25 Thread Thomas Rast
Robert Zeh writes: > Here is a patch that creates a daemon that tracks file > state with inotify, writes it out to a file upon request, > and changes most of the calls to stat to use said cache. > > It has bugs, but I figured it would be smarter to see > if the approach was acceptable at all befo

Re: [PATCH] inotify to minimize stat() calls

2013-04-24 Thread Duy Nguyen
On Thu, Apr 25, 2013 at 3:20 AM, Robert Zeh wrote: > Here is a patch that creates a daemon that tracks file > state with inotify, writes it out to a file upon request, > and changes most of the calls to stat to use said cache. > > It has bugs, but I figured it would be smarter to see > if the appr

Re: [PATCH] inotify to minimize stat() calls

2013-04-24 Thread Robert Zeh
Here is a patch that creates a daemon that tracks file state with inotify, writes it out to a file upon request, and changes most of the calls to stat to use said cache. It has bugs, but I figured it would be smarter to see if the approach was acceptable at all before spending the time to root th