diff mbox series

[2/3] xfs: clean up open-coded fs block unit conversions

Message ID 162250084368.490289.286869347542521014.stgit@locust (mailing list archive)
State Accepted
Headers show
Series xfs: various unit conversion | expand

Commit Message

Darrick J. Wong May 31, 2021, 10:40 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Replace some open-coded fs block unit conversions with the standard
conversion macro.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/libxfs/xfs_inode_buf.c |    2 +-
 fs/xfs/xfs_iops.c             |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Dave Chinner May 31, 2021, 11:33 p.m. UTC | #1
On Mon, May 31, 2021 at 03:40:43PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Replace some open-coded fs block unit conversions with the standard
> conversion macro.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

LGTM.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Carlos Maiolino June 1, 2021, 10:43 a.m. UTC | #2
On Mon, May 31, 2021 at 03:40:43PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Replace some open-coded fs block unit conversions with the standard
> conversion macro.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> ---
>  fs/xfs/libxfs/xfs_inode_buf.c |    2 +-
>  fs/xfs/xfs_iops.c             |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
> index f3254a4f4cb4..04ce361688f7 100644
> --- a/fs/xfs/libxfs/xfs_inode_buf.c
> +++ b/fs/xfs/libxfs/xfs_inode_buf.c
> @@ -612,7 +612,7 @@ xfs_inode_validate_extsize(
>  	 */
>  
>  	if (rt_flag)
> -		blocksize_bytes = mp->m_sb.sb_rextsize << mp->m_sb.sb_blocklog;
> +		blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
>  	else
>  		blocksize_bytes = mp->m_sb.sb_blocksize;
>  
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index dfe24b7f26e5..93c082db04b7 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -543,7 +543,7 @@ xfs_stat_blksize(
>  	 * always return the realtime extent size.
>  	 */
>  	if (XFS_IS_REALTIME_INODE(ip))
> -		return xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
> +		return XFS_FSB_TO_B(mp, xfs_get_extsz_hint(ip));
>  
>  	/*
>  	 * Allow large block sizes to be reported to userspace programs if the
> @@ -560,7 +560,7 @@ xfs_stat_blksize(
>  	 */
>  	if (mp->m_flags & XFS_MOUNT_LARGEIO) {
>  		if (mp->m_swidth)
> -			return mp->m_swidth << mp->m_sb.sb_blocklog;
> +			return XFS_FSB_TO_B(mp, mp->m_swidth);
>  		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
>  			return 1U << mp->m_allocsize_log;
>  	}
>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index f3254a4f4cb4..04ce361688f7 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -612,7 +612,7 @@  xfs_inode_validate_extsize(
 	 */
 
 	if (rt_flag)
-		blocksize_bytes = mp->m_sb.sb_rextsize << mp->m_sb.sb_blocklog;
+		blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
 	else
 		blocksize_bytes = mp->m_sb.sb_blocksize;
 
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index dfe24b7f26e5..93c082db04b7 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -543,7 +543,7 @@  xfs_stat_blksize(
 	 * always return the realtime extent size.
 	 */
 	if (XFS_IS_REALTIME_INODE(ip))
-		return xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
+		return XFS_FSB_TO_B(mp, xfs_get_extsz_hint(ip));
 
 	/*
 	 * Allow large block sizes to be reported to userspace programs if the
@@ -560,7 +560,7 @@  xfs_stat_blksize(
 	 */
 	if (mp->m_flags & XFS_MOUNT_LARGEIO) {
 		if (mp->m_swidth)
-			return mp->m_swidth << mp->m_sb.sb_blocklog;
+			return XFS_FSB_TO_B(mp, mp->m_swidth);
 		if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
 			return 1U << mp->m_allocsize_log;
 	}