diff mbox series

[14/18] xfs: cleanup xfs_fill_fsxattr

Message ID 20210324142129.1011766-15-hch@lst.de (mailing list archive)
State Superseded
Headers show
Series [01/18] xfs: split xfs_imap_to_bp | expand

Commit Message

Christoph Hellwig March 24, 2021, 2:21 p.m. UTC
Add a local xfs_mount variable, and use the XFS_FSB_TO_B helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_ioctl.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Darrick J. Wong March 24, 2021, 6:34 p.m. UTC | #1
On Wed, Mar 24, 2021 at 03:21:25PM +0100, Christoph Hellwig wrote:
> Add a local xfs_mount variable, and use the XFS_FSB_TO_B helper.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Yay!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_ioctl.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 3405a5f5bacfda..2b32dd4e14890b 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1117,15 +1117,14 @@ xfs_fill_fsxattr(
>  	bool			attr,
>  	struct fsxattr		*fa)
>  {
> +	struct xfs_mount	*mp = ip->i_mount;
>  	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
>  
>  	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
> -	fa->fsx_extsize = ip->i_extsize << ip->i_mount->m_sb.sb_blocklog;
> -	if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) &&
> -	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE)) {
> -		fa->fsx_cowextsize =
> -			ip->i_cowextsize << ip->i_mount->m_sb.sb_blocklog;
> -	}
> +	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
> +	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
> +	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
> +		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
>  	fa->fsx_projid = ip->i_projid;
>  	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
>  		fa->fsx_nextents = xfs_iext_count(ifp);
> -- 
> 2.30.1
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 3405a5f5bacfda..2b32dd4e14890b 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1117,15 +1117,14 @@  xfs_fill_fsxattr(
 	bool			attr,
 	struct fsxattr		*fa)
 {
+	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
 
 	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
-	fa->fsx_extsize = ip->i_extsize << ip->i_mount->m_sb.sb_blocklog;
-	if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) &&
-	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE)) {
-		fa->fsx_cowextsize =
-			ip->i_cowextsize << ip->i_mount->m_sb.sb_blocklog;
-	}
+	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
+	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
+	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
+		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
 	fa->fsx_projid = ip->i_projid;
 	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
 		fa->fsx_nextents = xfs_iext_count(ifp);