diff mbox series

[01/11] block_device: add a pointer to struct address_space (page cache of bdev)

Message ID 20240411145346.2516848-1-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [01/11] block_device: add a pointer to struct address_space (page cache of bdev) | expand

Commit Message

Al Viro April 11, 2024, 2:53 p.m. UTC
points to ->i_data of coallocated inode.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 block/bdev.c              | 1 +
 include/linux/blk_types.h | 1 +
 2 files changed, 2 insertions(+)

Comments

Christian Brauner April 17, 2024, 11:05 a.m. UTC | #1
On Thu, Apr 11, 2024 at 03:53:36PM +0100, Al Viro wrote:
> points to ->i_data of coallocated inode.
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

I've picked all of this into vfs.super btw. I still want to go through
your reply but as you know I'm a bit time-constrained for a bit more. :/
diff mbox series

Patch

diff --git a/block/bdev.c b/block/bdev.c
index dd26d37356aa..1c3462fba6ce 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -413,6 +413,7 @@  struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
 	mutex_init(&bdev->bd_holder_lock);
 	bdev->bd_partno = partno;
 	bdev->bd_inode = inode;
+	bdev->bd_mapping = &inode->i_data;
 	bdev->bd_queue = disk->queue;
 	if (partno)
 		bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index cb1526ec44b5..6438c75cbb35 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -51,6 +51,7 @@  struct block_device {
 	bool			bd_has_submit_bio;
 	dev_t			bd_dev;
 	struct inode		*bd_inode;	/* will die */
+	struct address_space	*bd_mapping;	/* page cache */
 
 	atomic_t		bd_openers;
 	spinlock_t		bd_size_lock; /* for bd_inode->i_size updates */