On Wed, Jan 17, 2024 at 05:15:00PM +0100, Jan Kara wrote: > > > iomap->bdev = bdev; > > > + BUG_ON(true /* TODO(brauner): This is the only place where we don't go from inode->i_sb->s_f_bdev for obvious reasons. Thoughts? */); > > > > Maybe block devices should have their own struct file created when the > > block device is instantiated and torn down when the block device is > > trashed? > > OK, but is there a problem with I_BDEV() which is currently used in > blkdev_iomap_begin()? Well, blkdev_iomap_begin is always called on the the actual bdev fs inode that is allocated together with the bdev itself. So we'll always be able to get to it using container_of variants.