diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2024-04-18 06:34:31 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-02 23:39:44 +0200 |
commit | ead083aeeed9df44fab9227e47688f7305c3a233 (patch) | |
tree | 1678d6d34fa3483f2bcfe7dea3ced9b4c6d2a9bd /block/bdev.c | |
parent | btrfs_get_bdev_and_sb(): call set_blocksize() only for exclusive opens (diff) | |
download | linux-ead083aeeed9df44fab9227e47688f7305c3a233.tar.xz linux-ead083aeeed9df44fab9227e47688f7305c3a233.zip |
set_blocksize(): switch to passing struct file *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/bdev.c')
-rw-r--r-- | block/bdev.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/block/bdev.c b/block/bdev.c index b8e32d933a63..a329ff9be11d 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -144,8 +144,11 @@ static void set_init_blocksize(struct block_device *bdev) bdev->bd_inode->i_blkbits = blksize_bits(bsize); } -int set_blocksize(struct block_device *bdev, int size) +int set_blocksize(struct file *file, int size) { + struct inode *inode = file->f_mapping->host; + struct block_device *bdev = I_BDEV(inode); + /* Size must be a power of two, and between 512 and PAGE_SIZE */ if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size)) return -EINVAL; @@ -155,9 +158,9 @@ int set_blocksize(struct block_device *bdev, int size) return -EINVAL; /* Don't change the size if it is same as current */ - if (bdev->bd_inode->i_blkbits != blksize_bits(size)) { + if (inode->i_blkbits != blksize_bits(size)) { sync_blockdev(bdev); - bdev->bd_inode->i_blkbits = blksize_bits(size); + inode->i_blkbits = blksize_bits(size); kill_bdev(bdev); } return 0; @@ -167,7 +170,7 @@ EXPORT_SYMBOL(set_blocksize); int sb_set_blocksize(struct super_block *sb, int size) { - if (set_blocksize(sb->s_bdev, size)) + if (set_blocksize(sb->s_bdev_file, size)) return 0; /* If we get here, we know size is power of two * and it's value is between 512 and PAGE_SIZE */ |