[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231127062116.2355129-9-yukuai1@huaweicloud.com>
Date: Mon, 27 Nov 2023 14:21:08 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: hch@...radead.org,
ming.lei@...hat.com,
axboe@...nel.dk,
roger.pau@...rix.com,
colyli@...e.de,
kent.overstreet@...il.com,
joern@...ybastard.org,
miquel.raynal@...tlin.com,
richard@....at,
vigneshr@...com,
sth@...ux.ibm.com,
hoeppner@...ux.ibm.com,
hca@...ux.ibm.com,
gor@...ux.ibm.com,
agordeev@...ux.ibm.com,
jejb@...ux.ibm.com,
martin.petersen@...cle.com,
clm@...com,
josef@...icpanda.com,
dsterba@...e.com,
viro@...iv.linux.org.uk,
brauner@...nel.org,
nico@...xnic.net,
xiang@...nel.org,
chao@...nel.org,
tytso@....edu,
adilger.kernel@...ger.ca,
agruenba@...hat.com,
jack@...e.com,
konishi.ryusuke@...il.com,
dchinner@...hat.com,
linux@...ssschuh.net,
min15.li@...sung.com,
yukuai3@...wei.com,
dlemoal@...nel.org,
willy@...radead.org,
akpm@...ux-foundation.org,
hare@...e.de,
p.raghav@...sung.com
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
xen-devel@...ts.xenproject.org,
linux-bcache@...r.kernel.org,
linux-mtd@...ts.infradead.org,
linux-s390@...r.kernel.org,
linux-scsi@...r.kernel.org,
linux-bcachefs@...r.kernel.org,
linux-btrfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-erofs@...ts.ozlabs.org,
linux-ext4@...r.kernel.org,
gfs2@...ts.linux.dev,
linux-nilfs@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH block/for-next v2 08/16] btrfs: use new helper to get inode from block_device
From: Yu Kuai <yukuai3@...wei.com>
Which is more efficiency, and also prepare to remove the field
'bd_inode' from block_device.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
fs/btrfs/disk-io.c | 6 +++---
fs/btrfs/volumes.c | 4 ++--
fs/btrfs/zoned.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 401ea09ae4b8..88b20cd4d046 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3653,7 +3653,7 @@ struct btrfs_super_block *btrfs_read_dev_one_super(struct block_device *bdev,
struct btrfs_super_block *super;
struct page *page;
u64 bytenr, bytenr_orig;
- struct address_space *mapping = bdev->bd_inode->i_mapping;
+ struct address_space *mapping = bdev_inode(bdev)->i_mapping;
int ret;
bytenr_orig = btrfs_sb_offset(copy_num);
@@ -3740,7 +3740,7 @@ static int write_dev_supers(struct btrfs_device *device,
struct btrfs_super_block *sb, int max_mirrors)
{
struct btrfs_fs_info *fs_info = device->fs_info;
- struct address_space *mapping = device->bdev->bd_inode->i_mapping;
+ struct address_space *mapping = bdev_inode(device->bdev)->i_mapping;
SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
int i;
int errors = 0;
@@ -3857,7 +3857,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
device->commit_total_bytes)
break;
- page = find_get_page(device->bdev->bd_inode->i_mapping,
+ page = find_get_page(bdev_inode(device->bdev)->i_mapping,
bytenr >> PAGE_SHIFT);
if (!page) {
errors++;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c6f16625af51..bbf157cedab7 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1257,8 +1257,8 @@ static struct btrfs_super_block *btrfs_read_disk_super(struct block_device *bdev
return ERR_PTR(-EINVAL);
/* pull in the page with our super */
- page = read_cache_page_gfp(bdev->bd_inode->i_mapping, index, GFP_KERNEL);
-
+ page = read_cache_page_gfp(bdev_inode(bdev)->i_mapping, index,
+ GFP_KERNEL);
if (IS_ERR(page))
return ERR_CAST(page);
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 188378ca19c7..a5f7f1458edf 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -120,7 +120,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,
return -ENOENT;
} else if (full[0] && full[1]) {
/* Compare two super blocks */
- struct address_space *mapping = bdev->bd_inode->i_mapping;
+ struct address_space *mapping = bdev_inode(bdev)->i_mapping;
struct page *page[BTRFS_NR_SB_LOG_ZONES];
struct btrfs_super_block *super[BTRFS_NR_SB_LOG_ZONES];
int i;
--
2.39.2
Powered by blists - more mailing lists