linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Why a lot of fses are using bdev's page cache to do super block read/write?
Date: Wed, 9 Jul 2025 18:35:00 +0930	[thread overview]
Message-ID: <5459cd6d-3fdb-4a4e-b5c7-00ef74f17f7d@gmx.com> (raw)

Hi,

Recently I'm trying to remove direct bdev's page cache usage from btrfs 
super block IOs.

And replace it with common bio interface (mostly with bdev_rw_virt()).

However I'm hitting random generic/492 failure where sometimes blkid 
failed to detect any useful super block signature of btrfs.


This leads more digging, and to my surprise using bdev's page cache to 
do superblock IOs is not an exception, in fact f2fs is doing exactly the 
same thing.


This makes me wonder:

- Should a fs use bdev's page cache directly?
   I thought a fs shouldn't do this, and bio interface should be
   enough for most if not all cases.

   Or am I wrong in the first place?

- What is keeping fs super block update from racing with user space
   device scan?

   I guess it's the regular page/folio locking of the bdev page cache.
   But that also means, pure bio based IO will always race with buffered
   read of a block device.

- If so, is there any special bio flag to prevent such race?
   So far I am unable to find out such flag.

Thanks,
Qu

             reply	other threads:[~2025-07-09  9:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  9:05 Qu Wenruo [this message]
2025-07-09 12:01 ` Why a lot of fses are using bdev's page cache to do super block read/write? Matthew Wilcox
2025-07-09 15:04 ` Darrick J. Wong
2025-07-09 20:40   ` Qu Wenruo

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=5459cd6d-3fdb-4a4e-b5c7-00ef74f17f7d@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).