mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Chris S <coshi036@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
	brauner@kernel.org, linux-kernel@vger.kernel.org,
	Sungwoo Kim <iam@sung-woo.kim>, Dave Tian <daveti@purdue.edu>,
	Weidong Zhu <weizhu@fiu.edu>
Subject: Re: [PATCH v2] fs/buffer: serialize set_buffer_uptodate against concurrent clears
Date: Fri, 31 Jul 2026 01:45:35 +0100	[thread overview]
Message-ID: <amvwL-diBsUo2ouS@casper.infradead.org> (raw)
In-Reply-To: <CACd_6n3C1btK38SdwiG_RPdxxCQ2qUtp4o-aODhhRzH3LNn+yA@mail.gmail.com>

On Thu, Jul 30, 2026 at 06:09:24PM -0400, Chris S wrote:
> Yes, that works. And appreciate your reply.
>   I prototyped it, and it survives a journal replay.
> 
> Six sites, with bio_add_virt_nofail() covering the submit side:
> 
>   bh_offset()                     b_page may be NULL
>   buffer_set_crypto_ctx()         NULL guard
>   __bh_submit()                   bio_add_virt_nofail() when !b_folio, and
>                                   skip wbc_account_cgroup_owner()
>   jbd2_journal_write_metadata_buffer()
>                                   b_folio = NULL, b_data =
>                                   jh->b_frozen_data, not folio_set_bh()
>   jbd2_checksum_data(), jbd2_block_tag_csum_set()   both kmap the temp bh
>                                   (fs/jbd2/commit.c:705 and :745)
> 
> 4 files, +38/-12.  I'll send it as the first patch of the series.

Fantastic.  Would you care to also include this patch as part of your
series?

From f7cd3419ce0518ba429ac854282888833bf60147 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Date: Thu, 30 Jul 2026 20:43:22 -0400
Subject: [PATCH] buffer_head: Remove b_page

All users except bh_offset() have been converted to use b_folio instead.
Convert bh_offset() and remove b_page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/buffer_head.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 8b23bc9a244c..3881141a3ff1 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -59,10 +59,7 @@ struct address_space;
 struct buffer_head {
 	unsigned long b_state;		/* buffer state bitmap (see above) */
 	struct buffer_head *b_this_page;/* circular list of page's buffers */
-	union {
-		struct page *b_page;	/* the page this bh is mapped to */
-		struct folio *b_folio;	/* the folio this bh is mapped to */
-	};
+	struct folio *b_folio;		/* the folio this bh is mapped to */
 
 	sector_t b_blocknr;		/* start block number */
 	size_t b_size;			/* size of mapping */
@@ -172,7 +169,7 @@ static __always_inline int buffer_uptodate(const struct buffer_head *bh)
 
 static inline unsigned long bh_offset(const struct buffer_head *bh)
 {
-	return (unsigned long)(bh)->b_data & (page_size(bh->b_page) - 1);
+	return (unsigned long)(bh)->b_data & (folio_size(bh->b_folio) - 1);
 }
 
 /* If we *know* page->private refers to buffer_heads */
-- 
2.47.3


  reply	other threads:[~2026-07-31  0:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  5:36 Chao Shi
2026-04-30  7:28 ` Jan Kara
2026-07-19  6:28   ` Chao S
2026-07-28 19:45     ` Jan Kara
2026-07-29  7:54       ` Chris S
2026-07-30 19:47       ` Chris S
2026-07-30 20:20         ` Matthew Wilcox
2026-07-30 22:09           ` Chris S
2026-07-31  0:45             ` Matthew Wilcox [this message]
2026-07-31 15:12               ` Chris S
2026-07-31 17:51         ` Jan Kara
2026-07-31 17:59           ` Chris S

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=amvwL-diBsUo2ouS@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=brauner@kernel.org \
    --cc=coshi036@gmail.com \
    --cc=daveti@purdue.edu \
    --cc=iam@sung-woo.kim \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=weizhu@fiu.edu \
    /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

all inboxes | Powered by JetHome®