]> www.infradead.org Git - users/willy/pagecache.git/commit
jbd2: Remove page size assumptions
authorRitesh Harjani (IBM) <ritesh.list@gmail.com>
Thu, 7 Sep 2023 13:47:32 +0000 (09:47 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 7 Sep 2023 13:47:32 +0000 (09:47 -0400)
commitfc0a6fa4a2c7b434665f087801a06c544b16f085
treea87913925d2f44b3035863489dda53d8f27882d0
parentf27d9df68aa7aea5bec39251cb65827516b218a0
jbd2: Remove page size assumptions

jbd2_alloc() allocates a buffer from slab when the block size is smaller
than PAGE_SIZE, and slab may be using a compound page.  Before commit
8147c4c4546f, we set b_page to the precise page containing the buffer
and this code worked well.  Now we set b_page to the head page of the
allocation, so we can no longer use offset_in_page().  While we could
do a 1:1 replacement with offset_in_folio(), use the more idiomatic
bh_offset() and the folio APIs to map the buffer.

This isn't enough to support a b_size larger than PAGE_SIZE on HIGHMEM
machines, but this is good enough to fix the actual bug we're seeing.

Fixes: 8147c4c4546f ("jbd2: use a folio in jbd2_journal_write_metadata_buffer()")
Reported-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
[converted to be more folio]
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/jbd2/commit.c
fs/jbd2/transaction.c