Hi, Christian 在 2024/01/29 18:56, Christian Brauner 写道:
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. This introduces a union into struct buffer_head and struct iomap. The union encompasses both struct block_device and struct file. In both cases a flag is used to differentiate whether a block device or a proper file was stashed. Simple accessors bh_bdev() and iomap_bdev() are used to return the block device in the really low-level functions where it's needed. These are overall just a few callsites.
I just realize that your implementation for iomap and buffer_head is better, if you don't mind. I'll split related changes into a seperate patch, and send out together. Thanks, Kuai