lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176246795872.2864310.1277365977805843124.stgit@frogsfrogsfrogs>
Date: Thu, 06 Nov 2025 14:47:35 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 17/23] cache: support updating maxcount and flags

From: Darrick J. Wong <djwong@...nel.org>

A future patchset will create a new io cache manager that uses the
hashtable in cache.c  It's desirable for fuse4fs to be able to control
the maximum number of buffers in the IO cache, so add a simple API so
that cache users can set a new max item count.

Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
 lib/support/cache.h |    2 ++
 lib/support/cache.c |   10 ++++++++++
 2 files changed, 12 insertions(+)


diff --git a/lib/support/cache.h b/lib/support/cache.h
index ae37945c545f46..75e61c92a1fd35 100644
--- a/lib/support/cache.h
+++ b/lib/support/cache.h
@@ -144,6 +144,8 @@ void cache_walk(struct cache *cache, cache_walk_t fn, void *data);
 void cache_purge(struct cache *);
 bool cache_flush(struct cache *cache);
 
+void cache_set_maxcount(struct cache *cache, unsigned int maxcount);
+
 /* don't allocate a new node */
 #define CACHE_GET_INCORE	(1U << 0)
 int cache_node_get(struct cache *c, cache_key_t key, unsigned int cgflags,
diff --git a/lib/support/cache.c b/lib/support/cache.c
index dbaddc1bd36d3d..e2f9e722eb2ef1 100644
--- a/lib/support/cache.c
+++ b/lib/support/cache.c
@@ -87,6 +87,16 @@ cache_init(
 	return 0;
 }
 
+void
+cache_set_maxcount(
+	struct cache		*cache,
+	unsigned int		maxcount)
+{
+	pthread_mutex_lock(&cache->c_mutex);
+	cache->c_maxcount = maxcount;
+	pthread_mutex_unlock(&cache->c_mutex);
+}
+
 static void
 cache_expand(
 	struct cache *		cache)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ