All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: axboe@kernel.dk, brauner@kernel.org, hch@lst.de
Subject: [PATCHES part 2 05/10] fs/buffer.c: massage the remaining users of ->bd_inode to ->bd_mapping
Date: Wed,  8 May 2024 07:44:47 +0100	[thread overview]
Message-ID: <20240508064452.3797817-5-viro@zeniv.linux.org.uk> (raw)
In-Reply-To: <20240508064452.3797817-1-viro@zeniv.linux.org.uk>

both for ->i_blkbits and both want the address_space in question anyway.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/buffer.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 78a4e95ba2f2..ac29e0f221bc 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -189,8 +189,8 @@ 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 address_space *bd_mapping = bd_inode->i_mapping;
+	struct address_space *bd_mapping = bdev->bd_mapping;
+	const int blkbits = bd_mapping->host->i_blkbits;
 	struct buffer_head *ret = NULL;
 	pgoff_t index;
 	struct buffer_head *bh;
@@ -199,7 +199,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
 	int all_mapped = 1;
 	static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
 
-	index = ((loff_t)block << bd_inode->i_blkbits) / PAGE_SIZE;
+	index = ((loff_t)block << blkbits) / PAGE_SIZE;
 	folio = __filemap_get_folio(bd_mapping, index, FGP_ACCESSED, 0);
 	if (IS_ERR(folio))
 		goto out;
@@ -233,7 +233,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
 		       (unsigned long long)block,
 		       (unsigned long long)bh->b_blocknr,
 		       bh->b_state, bh->b_size, bdev,
-		       1 << bd_inode->i_blkbits);
+		       1 << blkbits);
 	}
 out_unlock:
 	spin_unlock(&bd_mapping->i_private_lock);
@@ -1696,16 +1696,16 @@ 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 address_space *bd_mapping = bd_inode->i_mapping;
+	struct address_space *bd_mapping = bdev->bd_mapping;
+	const int blkbits = bd_mapping->host->i_blkbits;
 	struct folio_batch fbatch;
-	pgoff_t index = ((loff_t)block << bd_inode->i_blkbits) / PAGE_SIZE;
+	pgoff_t index = ((loff_t)block << blkbits) / PAGE_SIZE;
 	pgoff_t end;
 	int i, count;
 	struct buffer_head *bh;
 	struct buffer_head *head;
 
-	end = ((loff_t)(block + len - 1) << bd_inode->i_blkbits) / PAGE_SIZE;
+	end = ((loff_t)(block + len - 1) << blkbits) / PAGE_SIZE;
 	folio_batch_init(&fbatch);
 	while (filemap_get_folios(bd_mapping, &index, end, &fbatch)) {
 		count = folio_batch_count(&fbatch);
-- 
2.39.2


  parent reply	other threads:[~2024-05-08  6:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  6:35 [PATCHES] ->bd_inode elimination Al Viro
2024-05-08  6:42 ` [PATCHES part 1 1/7] ext4: remove block_device_ejected() Al Viro
2024-05-08  6:42   ` [PATCHES part 1 2/7] bcachefs: remove dead function bdev_sectors() Al Viro
2024-05-08  6:42   ` [PATCHES part 1 3/7] blkdev_write_iter(): saner way to get inode and bdev Al Viro
2024-05-08  6:42   ` [PATCHES part 1 4/7] dm-vdo: use bdev_nr_bytes(bdev) instead of i_size_read(bdev->bd_inode) Al Viro
2024-05-08  6:42   ` [PATCHES part 1 5/7] block2mtd: prevent direct access of bd_inode Al Viro
2024-05-08  6:43   ` [PATCHES part 1 6/7] block: move two helpers into bdev.c Al Viro
2024-05-08  6:43   ` [PATCHES part 1 7/7] missing helpers: bdev_unhash(), bdev_drop() Al Viro
2024-05-08  6:44 ` [PATCHES part 2 01/10] block_device: add a pointer to struct address_space (page cache of bdev) Al Viro
2024-05-08  6:44   ` [PATCHES part 2 02/10] use ->bd_mapping instead of ->bd_inode->i_mapping Al Viro
2024-05-08  6:44   ` [PATCHES part 2 03/10] grow_dev_folio(): we only want ->bd_inode->i_mapping there Al Viro
2024-05-08  6:44   ` [PATCHES part 2 04/10] blk_ioctl_{discard,zeroout}(): we only want ->bd_inode->i_mapping here Al Viro
2024-05-08  6:44   ` Al Viro [this message]
2024-05-08  6:44   ` [PATCHES part 2 06/10] gfs2: more obvious initializations of mapping->host Al Viro
2024-05-08  6:44   ` [PATCHES part 2 07/10] block/bdev.c: use the knowledge of inode/bdev coallocation Al Viro
2024-05-08  6:44   ` [PATCHES part 2 08/10] nilfs_attach_log_writer(): use ->bd_mapping->host instead of ->bd_inode Al Viro
2024-05-08  6:44   ` [PATCHES part 2 09/10] dasd_format(): killing the last remaining user " Al Viro
2024-05-08  6:44   ` [PATCHES part 2 10/10] RIP ->bd_inode Al Viro

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=20240508064452.3797817-5-viro@zeniv.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.