From: Matthew Wilcox <willy@infradead.org>
To: Chris S <coshi036@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Baokun Li <libaokun@linux.alibaba.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
Ritesh Harjani <ritesh.list@gmail.com>,
Zhang Yi <yi.zhang@huawei.com>, Bob Copeland <me@bobcopeland.com>,
Namjae Jeon <linkinjeon@kernel.org>,
Sungjong Seo <sj1557.seo@samsung.com>,
Yuezhang Mo <yuezhang.mo@sony.com>,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
Joseph Qi <joseph.qi@linux.alibaba.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
linux-ext4@vger.kernel.org, ocfs2-devel@lists.linux.dev,
gfs2@lists.linux.dev, linux-karma-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/19] jbd2: point the shadow buffer at the frozen data directly
Date: Wed, 5 Aug 2026 21:41:06 +0100 [thread overview]
Message-ID: <anOf4vNU_XPvyhb0@casper.infradead.org> (raw)
In-Reply-To: <CACd_6n2GY2RRQPeKtJEuVkHcSBN-Ne2gJdHRfwxg2i=OT06MFg@mail.gmail.com>
On Wed, Aug 05, 2026 at 03:02:05PM -0400, Chris S wrote:
> Thank you so much.
> Taken, with a change: the helper needs a matching unmap, and must not map
> the folio-less case at all.
>
> static inline void *kmap_local_bh(const struct buffer_head *bh)
> {
> if (!bh->b_folio)
> return bh->b_data;
> return kmap_local_folio(bh->b_folio, bh_offset(bh));
> }
>
> static inline void kunmap_local_bh(const struct buffer_head *bh, void *addr)
> {
> if (bh->b_folio)
> kunmap_local(addr);
> }
Ah, I hadn't considered that option. Yes, I think this is the right
approach. Thanks!
> Two reasons. kmap_local_page(virt_to_page(bh->b_data)) loses the offset
> within the page, and b_frozen_data is kmalloc(b_size), which is only
> guaranteed page aligned when the block size is at least PAGE_SIZE.
Yeah; my bad. I should have added in PAGE_MASK(bh->b_data) to that,
but what you have is better.
> The second one is your other point. With CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP,
> __kmap_local_page_prot() maps even a lowmem page, one page at a time. So
> mapping memory that is already permanently mapped would walk this path
> straight into the bs>PS problem you just described, which it is otherwise
> immune to - b_data covers the whole block whatever its size. Returning
> b_data and calling kunmap_local() on it anyway is not an option either:
> kunmap_local_indexed() WARNs on an address outside the fixmap range under
> that config. Hence the pair.
>
> On the bs>PS folio path itself: agreed it is real and predates this series.
> I would rather not fold a fix into this one, but I will take it - I'll look
> at it separately once this has settled.
I've been considering adding a folio_vmap() which would be a nop for
!highmem, kmap_local() for order-0 highmem folios and vmap() for
large highmem folios. It's not reached the top of my todo list yet.
next prev parent reply other threads:[~2026-08-05 20:41 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 22:00 [PATCH 00/19] buffer: stop clearing BH_Uptodate when a write fails Chao Shi
2026-08-01 22:00 ` [PATCH 01/19] buffer_head: Remove b_page Chao Shi
2026-08-03 16:03 ` Jan Kara
2026-08-01 22:00 ` [PATCH 02/19] buffer: allow a buffer_head to point at memory outside the page cache Chao Shi
2026-08-03 16:13 ` Jan Kara
2026-08-03 17:59 ` Matthew Wilcox
2026-08-04 8:07 ` Jan Kara
2026-08-04 14:07 ` Matthew Wilcox
2026-08-04 23:06 ` Chris S
2026-08-05 17:42 ` Chris S
2026-08-05 20:08 ` Chris S
2026-08-01 22:00 ` [PATCH 03/19] jbd2: point the shadow buffer at the frozen data directly Chao Shi
2026-08-03 18:11 ` Matthew Wilcox
2026-08-04 3:11 ` Matthew Wilcox
2026-08-05 19:02 ` Chris S
2026-08-05 20:41 ` Matthew Wilcox [this message]
2026-08-04 8:28 ` Jan Kara
2026-08-05 19:02 ` Chris S
2026-08-01 22:00 ` [PATCH 04/19] buffer: clear BH_Write_EIO when a buffer is forgotten Chao Shi
2026-08-04 8:29 ` Jan Kara
2026-08-01 22:00 ` [PATCH 05/19] buffer: discard BH_Write_EIO along with the rest of the buffer state Chao Shi
2026-08-04 8:29 ` Jan Kara
2026-08-01 22:00 ` [PATCH 06/19] buffer: detect metadata write errors with buffer_write_io_error() Chao Shi
2026-08-04 8:30 ` Jan Kara
2026-08-01 22:00 ` [PATCH 07/19] adfs: check for a directory write error " Chao Shi
2026-08-01 22:00 ` [PATCH 08/19] ext2: check for an xattr block " Chao Shi
2026-08-04 8:40 ` Jan Kara
2026-08-01 22:00 ` [PATCH 09/19] omfs: check for an inode " Chao Shi
2026-08-01 22:00 ` [PATCH 10/19] exfat: check for a directory " Chao Shi
2026-08-01 22:00 ` [PATCH 11/19] fat: check for a metadata " Chao Shi
2026-08-01 22:00 ` [PATCH 12/19] ext4: " Chao Shi
2026-08-04 8:41 ` Jan Kara
2026-08-01 22:00 ` [PATCH 13/19] ocfs2: " Chao Shi
2026-08-04 8:49 ` Jan Kara
2026-08-05 20:30 ` Chris S
2026-08-01 22:00 ` [PATCH 14/19] ocfs2: check for a stale write error before reusing a metadata buffer Chao Shi
2026-08-04 8:50 ` Jan Kara
2026-08-01 22:00 ` [PATCH 15/19] gfs2: check for a metadata write error with buffer_write_io_error() Chao Shi
2026-08-01 22:01 ` [PATCH 16/19] jbd2: report journal write errors with BH_Write_EIO Chao Shi
2026-08-04 8:54 ` Jan Kara
2026-08-04 9:10 ` Jan Kara
2026-08-05 20:33 ` Chris S
2026-08-01 22:01 ` [PATCH 17/19] jbd2: assert on a failed write, not on a buffer that is not up to date Chao Shi
2026-08-04 9:04 ` Jan Kara
2026-08-05 20:33 ` Chris S
2026-08-01 22:01 ` [PATCH 18/19] ext4, jbd2: report fast commit write errors with BH_Write_EIO Chao Shi
2026-08-04 9:07 ` Jan Kara
2026-08-05 20:35 ` Chris S
2026-08-01 22:01 ` [PATCH 19/19] buffer: stop clearing BH_Uptodate when a write fails Chao Shi
2026-08-04 9:18 ` Jan Kara
2026-08-04 23:01 ` Chris S
2026-08-05 4:52 ` Zhang Yi
2026-08-05 9:00 ` Jan Kara
2026-08-05 10:55 ` Zhang Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anOf4vNU_XPvyhb0@casper.infradead.org \
--to=willy@infradead.org \
--cc=adilger.kernel@dilger.ca \
--cc=agruenba@redhat.com \
--cc=brauner@kernel.org \
--cc=coshi036@gmail.com \
--cc=gfs2@lists.linux.dev \
--cc=hirofumi@mail.parknet.co.jp \
--cc=jack@suse.cz \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=libaokun@linux.alibaba.com \
--cc=linkinjeon@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-karma-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=me@bobcopeland.com \
--cc=ocfs2-devel@lists.linux.dev \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=sj1557.seo@samsung.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=yi.zhang@huawei.com \
--cc=yuezhang.mo@sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox