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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 25, 2013 at 12:20 AM, Robert Zeh <robert.allan.zeh@xxxxxxxxx> 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_return_value = lstat(path, buf);
> +
> +       if (entry && (stat_return_value != entry->stat_return) &&
> +           (memcpy(&entry->st, buf, sizeof(*buf)))) {
> +               abort();
> +       }
> +
> +       return stat_return_value;
> +}

I must be missing something. If you always do lstat() in
cached_lstat(), what's the point of the cache? If you worry about
integrity (in the abort case), it'll be easier if you just record and
send paths from the daemon to git. Then you do lstat at one place
(git). This function may become more complex if still want to watch a
worktree way bigger that inotify limit. But I guess for now we could
just exit the daemon early in that case and fall back to normal lstat.
--
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]