diff mbox series

[27/30] jfs: use sb_bdev_nr_blocks

Message ID 20211015132643.1621913-28-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/30] block: move the SECTOR_SIZE related definitions to blk_types.h | expand

Commit Message

Christoph Hellwig Oct. 15, 2021, 1:26 p.m. UTC
Use the sb_bdev_nr_blocks helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
---
 fs/jfs/resize.c | 3 +--
 fs/jfs/super.c  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Dave Kleikamp Oct. 15, 2021, 2:16 p.m. UTC | #1
On 10/15/21 8:26AM, Christoph Hellwig wrote:
> Use the sb_bdev_nr_blocks helper instead of open coding it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Kees Cook <keescook@chromium.org>

Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>

> ---
>   fs/jfs/resize.c | 3 +--
>   fs/jfs/super.c  | 3 +--
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
> index a42dbb0d3d28a..8b9a72ae5efa7 100644
> --- a/fs/jfs/resize.c
> +++ b/fs/jfs/resize.c
> @@ -86,8 +86,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
>   		goto out;
>   	}
>   
> -	VolumeSize = i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits;
> -
> +	VolumeSize = sb_bdev_nr_blocks(sb);
>   	if (VolumeSize) {
>   		if (newLVSize > VolumeSize) {
>   			printk(KERN_WARNING "jfs_extendfs: invalid size\n");
> diff --git a/fs/jfs/super.c b/fs/jfs/super.c
> index 9241caa161163..24cbc9946e01c 100644
> --- a/fs/jfs/super.c
> +++ b/fs/jfs/super.c
> @@ -284,8 +284,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
>   		}
>   		case Opt_resize_nosize:
>   		{
> -			*newLVSize = i_size_read(sb->s_bdev->bd_inode) >>
> -				sb->s_blocksize_bits;
> +			*newLVSize = sb_bdev_nr_blocks(sb);
>   			if (*newLVSize == 0)
>   				pr_err("JFS: Cannot determine volume size\n");
>   			break;
>
diff mbox series

Patch

diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
index a42dbb0d3d28a..8b9a72ae5efa7 100644
--- a/fs/jfs/resize.c
+++ b/fs/jfs/resize.c
@@ -86,8 +86,7 @@  int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
 		goto out;
 	}
 
-	VolumeSize = i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits;
-
+	VolumeSize = sb_bdev_nr_blocks(sb);
 	if (VolumeSize) {
 		if (newLVSize > VolumeSize) {
 			printk(KERN_WARNING "jfs_extendfs: invalid size\n");
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 9241caa161163..24cbc9946e01c 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -284,8 +284,7 @@  static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
 		}
 		case Opt_resize_nosize:
 		{
-			*newLVSize = i_size_read(sb->s_bdev->bd_inode) >>
-				sb->s_blocksize_bits;
+			*newLVSize = sb_bdev_nr_blocks(sb);
 			if (*newLVSize == 0)
 				pr_err("JFS: Cannot determine volume size\n");
 			break;