]> www.infradead.org Git - users/willy/pagecache.git/commit
buffer: Make bh_offset() work for compound pages
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 7 Sep 2023 13:40:07 +0000 (09:40 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 7 Sep 2023 13:40:07 +0000 (09:40 -0400)
commitf27d9df68aa7aea5bec39251cb65827516b218a0
treebd1e5b4ee37c1b5d484bb74c302aff948902d8ae
parent7ba2090ca64ea1aa435744884124387db1fac70f
buffer: Make bh_offset() work for compound pages

If the buffer pointed to by the buffer_head is part of a compound page,
bh_offset() assumes that b_page is the precise page that contains
the data.  A recent change to jbd2 inadvertently violated that assumption.

By using page_size(), we support both b_page being set to the head page
(as page_size() will return the size of the entire folio) and the precise
page (as it will return PAGE_SIZE for a tail page).

Fixes: 8147c4c4546f ("jbd2: use a folio in jbd2_journal_write_metadata_buffer()")
Reported-by: Zorro Lang <zlang@kernel.org>
Tested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
include/linux/buffer_head.h