fsmonitor: trace the new invalidated cache-entry count

Consolidate the directory/non-directory calls to the refresh handler code. Log the resulting count of invalidated cache-entries. The nr_in_cone value will be used in a later commit to decide if we also need to try to do case-insensitive lookups. Signed-off-by: Jeff Hostetler <jeffhostetler@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Feb 26, 2024 at 21:39 UTC 84d441f2f09d2974aac75ba93ff3a562d7d31469
1 file changed +10 -5
fsmonitor.c
+10 -5
@@ -308,16 +308,21 @@ static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
308 {
309 int len = strlen(name);
310 int pos = index_name_pos(istate, name, len);
311 + size_t nr_in_cone;
312
313 trace_printf_key(&trace_fsmonitor,
314 "fsmonitor_refresh_callback '%s' (pos %d)",
315 name, pos);
316
316 - if (name[len - 1] == '/') {
317 - handle_path_with_trailing_slash(istate, name, pos);
318 - } else {
319 - handle_path_without_trailing_slash(istate, name, pos);
320 - }
317 + if (name[len - 1] == '/')
318 + nr_in_cone = handle_path_with_trailing_slash(istate, name, pos);
319 + else
320 + nr_in_cone = handle_path_without_trailing_slash(istate, name, pos);
321 +
322 + if (nr_in_cone)
323 + trace_printf_key(&trace_fsmonitor,
324 + "fsmonitor_refresh_callback CNT: %d",
325 + (int)nr_in_cone);
326 }
327
328 /*