[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176246795890.2864310.7871055253361068028.stgit@frogsfrogsfrogs>
Date: Thu, 06 Nov 2025 14:47:51 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 18/23] cache: support channging flags
From: Darrick J. Wong <djwong@...nel.org>
Make it so that we can change the flags in use by a given cache.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
lib/support/cache.h | 4 ++++
lib/support/cache.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/support/cache.h b/lib/support/cache.h
index 75e61c92a1fd35..32b99b5fe733e3 100644
--- a/lib/support/cache.h
+++ b/lib/support/cache.h
@@ -16,6 +16,8 @@
*/
#define CACHE_MISCOMPARE_PURGE (1 << 0)
+#define CACHE_FLAGS_ALL (CACHE_MISCOMPARE_PURGE)
+
/*
* cache object campare return values
*/
@@ -145,6 +147,8 @@ void cache_purge(struct cache *);
bool cache_flush(struct cache *cache);
void cache_set_maxcount(struct cache *cache, unsigned int maxcount);
+int cache_set_flag(struct cache *cache, int flags);
+int cache_clear_flag(struct cache *cache, int flags);
/* don't allocate a new node */
#define CACHE_GET_INCORE (1U << 0)
diff --git a/lib/support/cache.c b/lib/support/cache.c
index e2f9e722eb2ef1..99044248b85d38 100644
--- a/lib/support/cache.c
+++ b/lib/support/cache.c
@@ -97,6 +97,24 @@ cache_set_maxcount(
pthread_mutex_unlock(&cache->c_mutex);
}
+int
+cache_set_flag(
+ struct cache *cache,
+ int flags)
+{
+ cache->c_flags |= (flags & CACHE_FLAGS_ALL);
+ return 0;
+}
+
+int
+cache_clear_flag(
+ struct cache *cache,
+ int flags)
+{
+ cache->c_flags &= ~flags;
+ return 0;
+}
+
static void
cache_expand(
struct cache * cache)
Powered by blists - more mailing lists