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