block_device: add a pointer to struct address_space (page cache of bdev)

points to ->i_data of coallocated inode.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20240411145346.2516848-1-viro@zeniv.linux.org.uk
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Al Viro 2024-04-11 15:53:36 +01:00
parent a09cd552e0
commit e33aef2c58
2 changed files with 2 additions and 0 deletions

View File

@ -419,6 +419,7 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
mutex_init(&bdev->bd_holder_lock); mutex_init(&bdev->bd_holder_lock);
bdev->bd_partno = partno; bdev->bd_partno = partno;
bdev->bd_inode = inode; bdev->bd_inode = inode;
bdev->bd_mapping = &inode->i_data;
bdev->bd_queue = disk->queue; bdev->bd_queue = disk->queue;
if (partno) if (partno)
bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio; bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;

View File

@ -51,6 +51,7 @@ struct block_device {
bool bd_has_submit_bio; bool bd_has_submit_bio;
dev_t bd_dev; dev_t bd_dev;
struct inode *bd_inode; /* will die */ struct inode *bd_inode; /* will die */
struct address_space *bd_mapping; /* page cache */
atomic_t bd_openers; atomic_t bd_openers;
spinlock_t bd_size_lock; /* for bd_inode->i_size updates */ spinlock_t bd_size_lock; /* for bd_inode->i_size updates */