diff mbox series

[v2,13/16] fsmonitor: trace the new invalidated cache-entry count

Message ID 58b36673e151ad15eb44c9ca1c03cfef51657d11.1708658300.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series FSMonitor edge cases on case-insensitive file systems | expand

Commit Message

Jeff Hostetler Feb. 23, 2024, 3:18 a.m. UTC
From: Jeff Hostetler <jeffhostetler@github.com>

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>
---
 fsmonitor.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Junio C Hamano Feb. 23, 2024, 5:53 p.m. UTC | #1
"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Jeff Hostetler <jeffhostetler@github.com>
>
> Consolidate the directory/non-directory calls to the refresh handler
> code.  Log the resulting count of invalidated cache-entries.

OK.  Again, there is nothing surprising in the changes in the patch.
Looking good.

> 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>
> ---
>  fsmonitor.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

> diff --git a/fsmonitor.c b/fsmonitor.c
> index c16ed5d8758..739ddbf7aca 100644
> --- a/fsmonitor.c
> +++ b/fsmonitor.c
> @@ -308,16 +308,21 @@ static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
>  {
>  	int len = strlen(name);
>  	int pos = index_name_pos(istate, name, len);
> +	size_t nr_in_cone;
>  
>  	trace_printf_key(&trace_fsmonitor,
>  			 "fsmonitor_refresh_callback '%s' (pos %d)",
>  			 name, pos);
>  
> -	if (name[len - 1] == '/') {
> -		handle_path_with_trailing_slash(istate, name, pos);
> -	} else {
> -		handle_path_without_trailing_slash(istate, name, pos);
> -	}
> +	if (name[len - 1] == '/')
> +		nr_in_cone = handle_path_with_trailing_slash(istate, name, pos);
> +	else
> +		nr_in_cone = handle_path_without_trailing_slash(istate, name, pos);
> +
> +	if (nr_in_cone)
> +		trace_printf_key(&trace_fsmonitor,
> +				 "fsmonitor_refresh_callback CNT: %d",
> +				 (int)nr_in_cone);
>  }
>  
>  /*
diff mbox series

Patch

diff --git a/fsmonitor.c b/fsmonitor.c
index c16ed5d8758..739ddbf7aca 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -308,16 +308,21 @@  static void fsmonitor_refresh_callback(struct index_state *istate, char *name)
 {
 	int len = strlen(name);
 	int pos = index_name_pos(istate, name, len);
+	size_t nr_in_cone;
 
 	trace_printf_key(&trace_fsmonitor,
 			 "fsmonitor_refresh_callback '%s' (pos %d)",
 			 name, pos);
 
-	if (name[len - 1] == '/') {
-		handle_path_with_trailing_slash(istate, name, pos);
-	} else {
-		handle_path_without_trailing_slash(istate, name, pos);
-	}
+	if (name[len - 1] == '/')
+		nr_in_cone = handle_path_with_trailing_slash(istate, name, pos);
+	else
+		nr_in_cone = handle_path_without_trailing_slash(istate, name, pos);
+
+	if (nr_in_cone)
+		trace_printf_key(&trace_fsmonitor,
+				 "fsmonitor_refresh_callback CNT: %d",
+				 (int)nr_in_cone);
 }
 
 /*