On Sun, Apr 07, 2024 at 06:11:19AM +0100, Al Viro wrote: > On Sun, Apr 07, 2024 at 05:57:58AM +0100, Al Viro wrote: > > > PS: in grow_dev_folio() we probably want > > struct address_space *mapping = bdev->bd_inode->i_mapping; > > instead of > > struct inode *inode = bdev->bd_inode; > > as one of the preliminary chunks. > > FWIW, it really looks like address_space (== page cache of block device, > > not an unreasonably candidate for primitive) and block size (well, > > logarithm thereof) cover the majority of what remains, with device > > size possibly being (remote) third... > > Incidentally, how painful would it be to switch __bread_gfp() and __bread() > to passing *logarithm* of block size instead of block size? And possibly > supply the same to clean_bdev_aliases()... I've looked at it because blksize_bits() was pretty horrid. But I got scared because I couldn't figure out how to make unconverted places fail to compile, without doing something ugly like -__bread(struct block_device *bdev, sector_t block, unsigned size) +__bread(unsigned shift, struct block_device *bdev, sector_t block) I assume you're not talking about changing bh->b_size, just passing in the log and comparing bh->b_size to 1<<shift?