Re: [PATCH 21/23] fsmonitor: optimize processing of directory events
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Feb 24, 2022, 16:13 UTC
- Message-ID
- <932d7a6a-010d-f659-137e-bf59f0e0b6a8@github.com>
- In-Reply-To
- <07a9c7542be79fb60861253848eca258bec87694.1644940774.git.gitgitgadget@gmail.com>
On 2/15/2022 10:59 AM, Jeff Hostetler via GitGitGadget wrote:
Show 17 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com> > > Teach Git to perform binary search over the cache-entries for a directory > notification and then linearly scan forward to find the immediate children. > > Previously, when the FSMonitor reported a modified directory Git would > perform a linear search on the entire cache-entry array for all > entries matching that directory prefix and invalidate them. Since the > cache-entry array is already sorted, we can use a binary search to > find the first matching entry and then only linearly walk forward and > invalidate entries until the prefix changes. > > Also, the original code would invalidate anything having the same > directory prefix. Since a directory event should only be received for > items that are immediately within the directory (and not within > sub-directories of it), only invalidate those entries and not the > whole subtree.
This makes sense as an optimization. I've also taken a close look at the code to be sure this makes sense if the file system events are for a directory within a sparse directory entry, and the end result will be that the sparse directory is marked as invalid, which is fine.
Thanks, -Stolee