[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231211140552.973290-4-yukuai1@huaweicloud.com>
Date: Mon, 11 Dec 2023 22:05:37 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: 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, willy@...radead.org,
akpm@...ux-foundation.org, p.raghav@...sung.com, hare@...e.de
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,
yukuai3@...wei.com, yukuai1@...weicloud.com, yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH RFC v2 for-6.8/block 03/18] bcache: use bdev api in read_super()
From: Yu Kuai <yukuai3@...wei.com>
On the one hand covert to use folio while reading bdev inode, on the
other hand prevent to access bd_inode directly.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
drivers/md/bcache/super.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index bfe1685dbae5..23892b32c582 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -168,14 +168,13 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev,
{
const char *err;
struct cache_sb_disk *s;
- struct page *page;
+ struct folio *folio;
unsigned int i;
- page = read_cache_page_gfp(bdev->bd_inode->i_mapping,
- SB_OFFSET >> PAGE_SHIFT, GFP_KERNEL);
- if (IS_ERR(page))
+ folio = bdev_read_folio(bdev, SB_OFFSET);
+ if (IS_ERR(folio))
return "IO error";
- s = page_address(page) + offset_in_page(SB_OFFSET);
+ s = folio_address(folio) + offset_in_folio(folio, SB_OFFSET);
sb->offset = le64_to_cpu(s->offset);
sb->version = le64_to_cpu(s->version);
@@ -272,7 +271,7 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev,
*res = s;
return NULL;
err:
- put_page(page);
+ folio_put(folio);
return err;
}
--
2.39.2
Powered by blists - more mailing lists