From: Yu Kuai <yukuai1@huaweicloud.com>
To: hch@infradead.org, ming.lei@redhat.com, axboe@kernel.dk,
roger.pau@citrix.com, colyli@suse.de, kent.overstreet@gmail.com,
joern@lazybastard.org, miquel.raynal@bootlin.com, richard@nod.at,
vigneshr@ti.com, sth@linux.ibm.com, hoeppner@linux.ibm.com,
hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
jejb@linux.ibm.com, martin.petersen@oracle.com, clm@fb.com,
josef@toxicpanda.com, dsterba@suse.com, viro@zeniv.linux.org.uk,
brauner@kernel.org, nico@fluxnic.net, xiang@kernel.org,
chao@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca,
agruenba@redhat.com, jack@suse.com, konishi.ryusuke@gmail.com,
dchinner@redhat.com, linux@weissschuh.net, min15.li@samsung.com,
yukuai3@huawei.com, dlemoal@kernel.org, willy@infradead.org,
akpm@linux-foundation.org, hare@suse.de, p.raghav@samsung.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org,
linux-mtd@lists.infradead.org, linux-s390@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-bcachefs@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org,
gfs2@lists.linux.dev, linux-nilfs@vger.kernel.org,
yukuai1@huaweicloud.com, yi.zhang@huawei.com,
yangerkun@huawei.com
Subject: [PATCH block/for-next v2 15/16] buffer: use new helper to get inode from block_device
Date: Mon, 27 Nov 2023 14:22:51 +0800 [thread overview]
Message-ID: <20231127062252.2367645-6-yukuai1@huaweicloud.com> (raw)
In-Reply-To: <20231127062252.2367645-1-yukuai1@huaweicloud.com>
From: Yu Kuai <yukuai3@huawei.com>
Which is more efficiency, and also prepare to remove the field
'bd_inode' from block_device.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
fs/buffer.c | 8 ++++----
include/linux/buffer_head.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 967f34b70aa8..bf993198f881 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(end_buffer_write_sync);
static struct buffer_head *
__find_get_block_slow(struct block_device *bdev, sector_t block)
{
- struct inode *bd_inode = bdev->bd_inode;
+ struct inode *bd_inode = bdev_inode(bdev);
struct address_space *bd_mapping = bd_inode->i_mapping;
struct buffer_head *ret = NULL;
pgoff_t index;
@@ -1032,7 +1032,7 @@ static int
grow_dev_page(struct block_device *bdev, sector_t block,
pgoff_t index, int size, int sizebits, gfp_t gfp)
{
- struct inode *inode = bdev->bd_inode;
+ struct inode *inode = bdev_inode(bdev);
struct folio *folio;
struct buffer_head *bh;
sector_t end_block;
@@ -1463,7 +1463,7 @@ __bread_gfp(struct block_device *bdev, sector_t block,
{
struct buffer_head *bh;
- gfp |= mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
+ gfp |= mapping_gfp_constraint(bdev_inode(bdev)->i_mapping, ~__GFP_FS);
/*
* Prefer looping in the allocator rather than here, at least that
@@ -1696,7 +1696,7 @@ EXPORT_SYMBOL(create_empty_buffers);
*/
void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
{
- struct inode *bd_inode = bdev->bd_inode;
+ struct inode *bd_inode = bdev_inode(bdev);
struct address_space *bd_mapping = bd_inode->i_mapping;
struct folio_batch fbatch;
pgoff_t index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5f23ee599889..da9ee62e3aa9 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -341,7 +341,7 @@ static inline struct buffer_head *getblk_unmovable(struct block_device *bdev,
{
gfp_t gfp;
- gfp = mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
+ gfp = mapping_gfp_constraint(bdev_inode(bdev)->i_mapping, ~__GFP_FS);
gfp |= __GFP_NOFAIL;
return bdev_getblk(bdev, block, size, gfp);
@@ -352,7 +352,7 @@ static inline struct buffer_head *__getblk(struct block_device *bdev,
{
gfp_t gfp;
- gfp = mapping_gfp_constraint(bdev->bd_inode->i_mapping, ~__GFP_FS);
+ gfp = mapping_gfp_constraint(bdev_inode(bdev)->i_mapping, ~__GFP_FS);
gfp |= __GFP_MOVABLE | __GFP_NOFAIL;
return bdev_getblk(bdev, block, size, gfp);
--
2.39.2
next prev parent reply other threads:[~2023-11-27 6:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 6:22 [PATCH block/for-next v2 10/16] erofs: use new helper to get inode from block_device Yu Kuai
2023-11-27 6:22 ` [PATCH block/for-next v2 11/16] ext4: " Yu Kuai
2023-11-27 6:22 ` [PATCH block/for-next v2 12/16] gfs2: " Yu Kuai
2023-11-27 6:22 ` [PATCH block/for-next v2 13/16] jbd2: " Yu Kuai
2023-11-27 6:22 ` [PATCH block/for-next v2 14/16] nilfs2: " Yu Kuai
2023-11-27 6:22 ` Yu Kuai [this message]
2023-11-27 6:22 ` [PATCH block/for-next v2 16/16] block: " Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231127062252.2367645-6-yukuai1@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=agordeev@linux.ibm.com \
--cc=agruenba@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=clm@fb.com \
--cc=colyli@suse.de \
--cc=dchinner@redhat.com \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=gfs2@lists.linux.dev \
--cc=gor@linux.ibm.com \
--cc=hare@suse.de \
--cc=hca@linux.ibm.com \
--cc=hch@infradead.org \
--cc=hoeppner@linux.ibm.com \
--cc=jack@suse.com \
--cc=jejb@linux.ibm.com \
--cc=joern@lazybastard.org \
--cc=josef@toxicpanda.com \
--cc=kent.overstreet@gmail.com \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=martin.petersen@oracle.com \
--cc=min15.li@samsung.com \
--cc=ming.lei@redhat.com \
--cc=miquel.raynal@bootlin.com \
--cc=nico@fluxnic.net \
--cc=p.raghav@samsung.com \
--cc=richard@nod.at \
--cc=roger.pau@citrix.com \
--cc=sth@linux.ibm.com \
--cc=tytso@mit.edu \
--cc=vigneshr@ti.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xiang@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).