On Fri, May 03, 2024 at 04:23:27AM +0100, Al Viro wrote: > btrfs_get_bdev_and_sb() has two callers - btrfs_open_one_device(), > which asks for open to be exclusive and btrfs_get_dev_args_from_path(), > which doesn't. Currently it does set_blocksize() in all cases. > > I'm rather dubious about the need to do set_blocksize() anywhere in btrfs, > to be honest - there's some access to page cache of underlying block > devices in there, but it's nowhere near the hot paths, AFAICT. > > In any case, btrfs_get_dev_args_from_path() only needs to read > the on-disk superblock and copy several fields out of it; all > callers are only interested in devices that are already opened > and brought into per-filesystem set, so setting the block size > is redundant for those and actively harmful if we are given > a pathname of unrelated device. > > So we only need btrfs_get_bdev_and_sb() to call set_blocksize() > when it's asked to open exclusive. > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Reviewed-by: Christian Brauner <brauner@xxxxxxxxxx> > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Acked-by: David Sterba <dsterba@xxxxxxxx>