Re: [PATCH v6 20/28] fsmonitor: optimize processing of directory events
- From
- Jeff Hostetler <git@jeffhostetler.com>
- Date
- May 17, 2022, 20:17 UTC
- Message-ID
- <c716b1d6-a0a8-6d03-dfe5-70613e4ed942@jeffhostetler.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.2205121708400.352@tvgsbejvaqbjf.bet>
On 5/12/22 11:08 AM, Johannes Schindelin wrote:
Show 9 quoted lines
> Hi Jeff, > > On Fri, 22 Apr 2022, Jeff Hostetler via GitGitGadget wrote: > >> 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. >>
[...]
Show 10 quoted lines
>> static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
>> {
>> int i, len = strlen(name);
>> - if (name[len - 1] == '/') {
>> + int pos = index_name_pos(istate, name, len);
>> +
>> + trace_printf_key(&trace_fsmonitor,
>> + "fsmonitor_refresh_callback '%s' (pos %d)",
>> + name, pos);
>>[...]
>> + if (name[len - 1] == '/') {[...]
>> }
Show 9 quoted lines
>> @@ -215,7 +253,6 @@ static void fsmonitor_refresh_callback(struct index_state *istate, char *name) >> * Mark the untracked cache dirty even if it wasn't found in the index >> * as it could be a new untracked file. >> */ >> - trace_printf_key(&trace_fsmonitor, "fsmonitor_refresh_callback '%s'", name); > > Did you mean to remove this statement in this patch? Not a big issue, but > I wonder what the rationale for it is, and since I have an inquisitive > mind, I figured I'd just ask.
I just moved it to the top of the function. That lets me see `name` before it is modified in one of the else arms (it was helpful to see whether the daemon sent a trailing slash or not). And I also wanted to see the computed value of `pos` (before the "-pos - 1" tricks).
Jeff