git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v10 5/5] lstat_cache(): introduce clear_lstat_cache() function

From
KBKjetil Barvik <barvik@broadpark.no>
Date
Jan 18, 2009, 15:14 UTC
Message-ID
<1232291694-18083-6-git-send-email-barvik@broadpark.no>
In-Reply-To
<1232291694-18083-1-git-send-email-barvik@broadpark.no>

If you want to completely clear the contents of the lstat_cache(), then call this new function.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
---
 cache.h    |    1 +
 symlinks.c |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cache.h b/cache.h
index efcceec..8e22c27 100644
--- a/cache.h
+++ b/cache.h
@@ -720,6 +720,7 @@ extern int has_symlink_leading_path(int len, const char *name);
 extern int has_symlink_or_noent_leading_path(int len, const char *name);
 extern int has_dirs_only_path(int len, const char *name, int prefix_len);
 extern void invalidate_lstat_cache(int len, const char *name);
+extern void clear_lstat_cache(void);
 
 extern struct alternate_object_database {
 	struct alternate_object_database *next;
diff --git a/symlinks.c b/symlinks.c
index dbdfec4..83cecd7 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -195,6 +195,14 @@ void invalidate_lstat_cache(int len, const char *name)
 	}
 }
 
+/*
+ * Completely clear the contents of the cache
+ */
+void clear_lstat_cache(void)
+{
+	reset_lstat_cache(0, 0);
+}
+
 #define USE_ONLY_LSTAT  0
 
 /*
-- 
1.6.1.83.gd727f
Previous: Kjetil Barvik
Message 6 of 6 in “git checkout: optimise away lots of lstat() calls”
  1. 0/5 git checkout: optimise away lots of lstat() callsKjetil Barvik, Jan 18, 2009
  2. 1/5 lstat_cache(): more cache effective symlink/directory detectionKjetil Barvik, Jan 18, 2009
  3. 2/5 lstat_cache(): introduce has_symlink_or_noent_leading_path() functionKjetil Barvik, Jan 18, 2009
  4. 3/5 lstat_cache(): introduce has_dirs_only_path() functionKjetil Barvik, Jan 18, 2009
  5. 4/5 lstat_cache(): introduce invalidate_lstat_cache() functionKjetil Barvik, Jan 18, 2009
  6. 5/5 lstat_cache(): introduce clear_lstat_cache() functionKjetil Barvik, Jan 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.