Hi, Christoph!
在 2024/03/18 9:51, Yu Kuai 写道:
Hi,
在 2024/03/18 9:32, Christoph Hellwig 写道:
On Mon, Mar 18, 2024 at 09:26:48AM +0800, Yu Kuai wrote:
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,
But file->f_mapping->host should still point to the bdevfs inode,
and file->f_mapping->host is what everything in the I/O path should
be using.
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.
We can just pass the file down in iomap_iter.private
I can do this for blkdev_read_folio(), however, for other ops like
blkdev_writepages(), I can't find a way to pass the file to
iomap_iter.private yet.
Any suggestions?
I come up with an ideal:
While opening the block_device the first time, store the generated new
file in "bd_inode->i_private". And release it after the last opener
close the block_device.
The advantages are:
- multiple openers can share the same bdev_file;
- raw block device ops can use the bdev_file as well, and there is no
need to distinguish iomap/buffer_head for raw block_device;
Please let me know what do you think?
Thanks,
Kuai
Thanks,
Kuai
.
.