Skip to content

Commit 53cd4cd

Browse files
author
Al Viro
committed
fs/buffer.c: massage the remaining users of ->bd_inode to ->bd_mapping
both for ->i_blkbits and both want the address_space in question anyway. Signed-off-by: Al Viro <[email protected]>
1 parent 881494e commit 53cd4cd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/buffer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ EXPORT_SYMBOL(end_buffer_write_sync);
189189
static struct buffer_head *
190190
__find_get_block_slow(struct block_device *bdev, sector_t block)
191191
{
192-
struct inode *bd_inode = bdev->bd_inode;
193-
struct address_space *bd_mapping = bd_inode->i_mapping;
192+
struct address_space *bd_mapping = bdev->bd_mapping;
193+
const int blkbits = bd_mapping->host->i_blkbits;
194194
struct buffer_head *ret = NULL;
195195
pgoff_t index;
196196
struct buffer_head *bh;
@@ -199,7 +199,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
199199
int all_mapped = 1;
200200
static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
201201

202-
index = ((loff_t)block << bd_inode->i_blkbits) / PAGE_SIZE;
202+
index = ((loff_t)block << blkbits) / PAGE_SIZE;
203203
folio = __filemap_get_folio(bd_mapping, index, FGP_ACCESSED, 0);
204204
if (IS_ERR(folio))
205205
goto out;
@@ -233,7 +233,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block)
233233
(unsigned long long)block,
234234
(unsigned long long)bh->b_blocknr,
235235
bh->b_state, bh->b_size, bdev,
236-
1 << bd_inode->i_blkbits);
236+
1 << blkbits);
237237
}
238238
out_unlock:
239239
spin_unlock(&bd_mapping->i_private_lock);
@@ -1696,16 +1696,16 @@ EXPORT_SYMBOL(create_empty_buffers);
16961696
*/
16971697
void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
16981698
{
1699-
struct inode *bd_inode = bdev->bd_inode;
1700-
struct address_space *bd_mapping = bd_inode->i_mapping;
1699+
struct address_space *bd_mapping = bdev->bd_mapping;
1700+
const int blkbits = bd_mapping->host->i_blkbits;
17011701
struct folio_batch fbatch;
1702-
pgoff_t index = ((loff_t)block << bd_inode->i_blkbits) / PAGE_SIZE;
1702+
pgoff_t index = ((loff_t)block << blkbits) / PAGE_SIZE;
17031703
pgoff_t end;
17041704
int i, count;
17051705
struct buffer_head *bh;
17061706
struct buffer_head *head;
17071707

1708-
end = ((loff_t)(block + len - 1) << bd_inode->i_blkbits) / PAGE_SIZE;
1708+
end = ((loff_t)(block + len - 1) << blkbits) / PAGE_SIZE;
17091709
folio_batch_init(&fbatch);
17101710
while (filemap_get_folios(bd_mapping, &index, end, &fbatch)) {
17111711
count = folio_batch_count(&fbatch);

0 commit comments

Comments
 (0)