Re: [PATCH v2 00/34] Open block devices as files
From: Christian Brauner <brauner@kernel.org>
Date: 2024-02-05 11:55:22
Also in:
linux-fsdevel
On Tue, Jan 23, 2024 at 02:26:17PM +0100, Christian Brauner wrote:
Hey Christoph, Hey Jan, Hey Jens, This opens block devices as files. Instead of introducing a separate indirection into bdev_open_by_*() vis struct bdev_handle we can just make bdev_file_open_by_*() return a struct file. Opening and closing a block device from setup_bdev_super() and in all other places just becomes equivalent to opening and closing a file. This has held up in xfstests and in blktests so far and it seems stable and clean. The equivalence of opening and closing block devices to regular files is a win in and of itself imho. Added to that is the ability to do away with struct bdev_handle completely and make various low-level helpers private to the block layer. All places were we currently stash a struct bdev_handle we just stash a file and use an accessor such as file_bdev() akin to I_BDEV() to get to the block device. It's now also possible to use file->f_mapping as a replacement for bdev->bd_inode->i_mapping and file->f_inode or file->f_mapping->host as an alternative to bdev->bd_inode allowing us to significantly reduce or even fully remove bdev->bd_inode in follow-up patches. In addition, we could get rid of sb->s_bdev and various other places that stash the block device directly and instead stash the block device file. Again, this is follow-up work. Thanks! Christian Signed-off-by: Christian Brauner <brauner@kernel.org> ---
With all fixes applied I've moved this into vfs.super on vfs/vfs.git so this gets some exposure in -next asap. Please let me know if you have quarrels with that.