diff mbox series

[09/15] xfs: cleanup xfs_fill_fsxattr

Message ID 20200620071102.462554-10-hch@lst.de (mailing list archive)
State Superseded, archived
Headers show
Series [01/15] xfs: don't clear the "dinode core" in xfs_inode_alloc | expand

Commit Message

Christoph Hellwig June 20, 2020, 7:10 a.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

Chandan Babu R June 22, 2020, 11:01 a.m. UTC | #1
On Saturday 20 June 2020 12:40:56 PM IST Christoph Hellwig wrote:
> Add a local xfs_mount variable, and use the XFS_FSB_TO_B helper.
>

The changes look good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  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 60544dd0f875b8..cabc86ed6756bc 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1104,15 +1104,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);
>
Darrick J. Wong June 30, 2020, 5:52 p.m. UTC | #2
On Sat, Jun 20, 2020 at 09:10:56AM +0200, 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>

Yes thank you!

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--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 60544dd0f875b8..cabc86ed6756bc 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1104,15 +1104,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.26.2
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 60544dd0f875b8..cabc86ed6756bc 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1104,15 +1104,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);