Hi,
在 2024/03/18 5:38, Christoph Hellwig 写道:
On Thu, Feb 22, 2024 at 08:45:55PM +0800, Yu Kuai wrote:
The only user that doesn't rely on files is the block layer itself in
block/fops.c where we only have access to the block device. As the bdev
filesystem doesn't open block devices as files obviously.
Why is that obvious? Maybe I'm just thick but this seems odd to me.
Because there is a real filesystem(devtmpfs) used for raw block devcie
file operations, open syscall to devtmpfs:
blkdev_open
bdev = blkdev_get_no_open
bdev_open -> pass in file is from devtmpfs
-> in this case, file inode is from devtmpfs,
Then later, in blkdev_iomap_begin(), bd_inode is passed in and there is
no access to the devtmpfs file, we can't use s_bdev_file() as other
filesystems here.
Thanks,
Kuai
.