Re: [PATCH 03/19] jbd2: point the shadow buffer at the frozen data directly
Matthew Wilcox <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.file-systems,gmane.comp.file-systems.ext4,gmane.linux.hardware.karma.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Aug 01, 2026 at 06:00:47PM -0400, Chao Shi wrote:
> @@ -330,6 +330,8 @@ static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh)
> char *addr;
> __u32 checksum;
>
> + if (!bh->b_folio)
> + return crc32_be(crc32_sum, bh->b_data, bh->b_size);
> addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
> checksum = crc32_be(crc32_sum, addr, bh->b_size);
> kunmap_local(addr);
This is awkward. How about ...
static inline void *kmap_local_bh(const struct buffer_head *bh)
{
if (bh->b_folio)
return kmap_local_folio(bh->b_folio, bh_offset(bh));
return kmap_local_page(virt_to_page(bh->b_data);
}
(this is also somewhat awkward because it feels like we could just
return bh->b_data, but kunmap_local_indexed() does some ... stuff)
Anyway, it all gets optimised away on non-HIGHMEM. Or if it doesn't,
you can force it to ;-)