xfs: refactor backing memory allocations for buffers
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Mar 2025 13:19:08 +0000 (14:19 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 10 Mar 2025 13:29:44 +0000 (14:29 +0100)
commit50a524e0ef9be0e862207fc822ab4b7dcb0c4310
tree030142b56e1f8a8b971a5d190cdcfe6ba0f1c519
parent48a325a4eec3251c2ead7ad7dad304bbdc1460a0
xfs: refactor backing memory allocations for buffers

Lift handling of shmem and slab backed buffers into xfs_buf_alloc_pages
and rename the result to xfs_buf_alloc_backing_mem.  This shares more
code and ensures uncached buffers can also use slab, which slightly
reduces the memory usage of growfs on 512 byte sector size file systems,
but more importantly means the allocation invariants are the same for
cached and uncached buffers.  Document these new invariants with a big
fat comment mostly stolen from a patch by Dave Chinner.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c