[RFC PATCH 06/15] turn bh_cachep static-duration

From: Al Viro

Date: Fri Jan 09 2026 - 23:01:00 EST


Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
fs/buffer.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 838c0c571022..c8ec1b440880 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -50,6 +50,7 @@
#include <linux/fscrypt.h>
#include <linux/fsverity.h>
#include <linux/sched/isolation.h>
+#include <linux/slab-static.h>

#include "internal.h"

@@ -2990,7 +2991,8 @@ EXPORT_SYMBOL(try_to_free_buffers);
/*
* Buffer-head allocation
*/
-static struct kmem_cache *bh_cachep __ro_after_init;
+static struct kmem_cache_opaque bh_cache;
+#define bh_cachep to_kmem_cache(&bh_cache)

/*
* Once the number of bh's in the machine exceeds this level, we start
@@ -3149,7 +3151,7 @@ void __init buffer_init(void)
unsigned long nrpages;
int ret;

- bh_cachep = KMEM_CACHE(buffer_head,
+ KMEM_CACHE_SETUP(bh_cachep, buffer_head,
SLAB_RECLAIM_ACCOUNT|SLAB_PANIC);
/*
* Limit the bh occupancy to 10% of ZONE_NORMAL
--
2.47.3