]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
buffer: Remove b_end_io
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 28 May 2026 17:31:45 +0000 (18:31 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 4 Jun 2026 08:28:10 +0000 (10:28 +0200)
This shrinks buffer_head by 8 bytes, letting us pack more buffer heads
per slab.  With a Debian config, it shrinks from 104 bytes to 96 bytes
which is 42 objects per 4KiB page rather than 39, a 7% reduction in the
amount of memory used.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20260528173150.1093780-33-willy@infradead.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Documentation/filesystems/locking.rst
drivers/md/raid5.h
fs/buffer.c
include/linux/buffer_head.h

index 8421ea21bd35e3bbe0a07cef8a2c971c88c75da9..a27aca42fd8573ef3bbea68dd916bf4ceb4fd5e6 100644 (file)
@@ -416,20 +416,6 @@ lm_open_conflict   yes             no                      no
 lm_breaker_timedout     yes             no                      no
 ====================== =============   =================       =========
 
-buffer_head
-===========
-
-prototypes::
-
-       void (*b_end_io)(struct buffer_head *bh, int uptodate);
-
-locking rules:
-
-called from interrupts. In other words, extreme care is needed here.
-bh is locked, but that's all warranties we have here. Currently only RAID1,
-highmem, fs/buffer.c, and fs/ntfs/aops.c are providing these. Block devices
-call this method upon the IO completion.
-
 block_device_operations
 =======================
 prototypes::
index 1c7b710fc9c1f293a5ce820680597c58d441f390..1dfa60a41d91f8a6af00c21839464967f74ad287 100644 (file)
@@ -38,7 +38,7 @@
  *  Clean -> Dirty  - on compute_parity to satisfy write/sync (RECONSTRUCT or RMW)
  *
  * The Want->Empty, Want->Clean, Dirty->Clean, transitions
- * all happen in b_end_io at interrupt time.
+ * all happen in end_io at interrupt time.
  * Each sets the Uptodate bit before releasing the Lock bit.
  * This leaves one multi-stage transition:
  *    Want->Dirty->Clean
@@ -64,7 +64,7 @@
  * together, but we are not guaranteed of that so we allow for more.
  *
  * If a buffer is on the read list when the associated cache buffer is
- * Uptodate, the data is copied into the read buffer and it's b_end_io
+ * Uptodate, the data is copied into the read buffer and it's end_io
  * routine is called.  This may happen in the end_request routine only
  * if the buffer has just successfully been read.  end_request should
  * remove the buffers from the list and then set the Uptodate bit on
@@ -76,7 +76,7 @@
  * into the cache buffer, which is then marked dirty, and moved onto a
  * third list, the written list (bh_written).  Once both the parity
  * block and the cached buffer are successfully written, any buffer on
- * a written list can be returned with b_end_io.
+ * a written list can be returned with end_io.
  *
  * The write list and read list both act as fifos.  The read list,
  * write list and written list are protected by the device_lock.
index 3df0ea1a6342e52be86954255ac57351743f328f..ccda92920175d3e245d6f8402771f9518b59108f 100644 (file)
@@ -946,7 +946,6 @@ static sector_t folio_init_buffers(struct folio *folio,
 
        do {
                if (!buffer_mapped(bh)) {
-                       bh->b_end_io = NULL;
                        bh->b_private = NULL;
                        bh->b_bdev = bdev;
                        bh->b_blocknr = block;
index 7629130d42c44bfef45738accba5085464fc8666..1ee56c9f2327ae744517609f9ac95d967bea8edb 100644 (file)
@@ -46,7 +46,6 @@ enum bh_state_bits {
 struct page;
 struct buffer_head;
 struct address_space;
-typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
 
 /*
  * Historically, a buffer_head was used to map a single block
@@ -70,8 +69,7 @@ struct buffer_head {
        char *b_data;                   /* pointer to data within the page */
 
        struct block_device *b_bdev;
-       bh_end_io_t *b_end_io;          /* I/O completion */
-       void *b_private;                /* reserved for b_end_io */
+       void *b_private;                /* reserved for bio_end_io */
        struct list_head b_assoc_buffers; /* associated with another mapping */
        struct mapping_metadata_bhs *b_mmb; /* head of the list of metadata bhs
                                             * this buffer is associated with */