diff mbox series

[20/20] xfs: merge _xfs_dic2xflags into xfs_ip2xflags

Message ID 20210329053829.1851318-21-hch@lst.de (mailing list archive)
State Accepted
Headers show
Series [01/20] xfs: split xfs_imap_to_bp | expand

Commit Message

Christoph Hellwig March 29, 2021, 5:38 a.m. UTC
Merge _xfs_dic2xflags into its only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_inode.c | 54 +++++++++++++++++++---------------------------
 1 file changed, 22 insertions(+), 32 deletions(-)

Comments

Darrick J. Wong March 30, 2021, 3:25 p.m. UTC | #1
On Mon, Mar 29, 2021 at 07:38:29AM +0200, Christoph Hellwig wrote:
> Merge _xfs_dic2xflags into its only caller.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

/me wonders if/how this will clash with Miklos' fileattr series, but eh,
whatever, I don't think it will, and if it does it's easy enough to fix.

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

--D

> ---
>  fs/xfs/xfs_inode.c | 54 +++++++++++++++++++---------------------------
>  1 file changed, 22 insertions(+), 32 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 3006cfbd072617..9100a9b7aa80cb 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -598,65 +598,55 @@ xfs_lock_two_inodes(
>  	}
>  }
>  
> -STATIC uint
> -_xfs_dic2xflags(
> -	uint16_t		di_flags,
> -	uint64_t		di_flags2,
> -	bool			has_attr)
> +uint
> +xfs_ip2xflags(
> +	struct xfs_inode	*ip)
>  {
>  	uint			flags = 0;
>  
> -	if (di_flags & XFS_DIFLAG_ANY) {
> -		if (di_flags & XFS_DIFLAG_REALTIME)
> +	if (ip->i_diflags & XFS_DIFLAG_ANY) {
> +		if (ip->i_diflags & XFS_DIFLAG_REALTIME)
>  			flags |= FS_XFLAG_REALTIME;
> -		if (di_flags & XFS_DIFLAG_PREALLOC)
> +		if (ip->i_diflags & XFS_DIFLAG_PREALLOC)
>  			flags |= FS_XFLAG_PREALLOC;
> -		if (di_flags & XFS_DIFLAG_IMMUTABLE)
> +		if (ip->i_diflags & XFS_DIFLAG_IMMUTABLE)
>  			flags |= FS_XFLAG_IMMUTABLE;
> -		if (di_flags & XFS_DIFLAG_APPEND)
> +		if (ip->i_diflags & XFS_DIFLAG_APPEND)
>  			flags |= FS_XFLAG_APPEND;
> -		if (di_flags & XFS_DIFLAG_SYNC)
> +		if (ip->i_diflags & XFS_DIFLAG_SYNC)
>  			flags |= FS_XFLAG_SYNC;
> -		if (di_flags & XFS_DIFLAG_NOATIME)
> +		if (ip->i_diflags & XFS_DIFLAG_NOATIME)
>  			flags |= FS_XFLAG_NOATIME;
> -		if (di_flags & XFS_DIFLAG_NODUMP)
> +		if (ip->i_diflags & XFS_DIFLAG_NODUMP)
>  			flags |= FS_XFLAG_NODUMP;
> -		if (di_flags & XFS_DIFLAG_RTINHERIT)
> +		if (ip->i_diflags & XFS_DIFLAG_RTINHERIT)
>  			flags |= FS_XFLAG_RTINHERIT;
> -		if (di_flags & XFS_DIFLAG_PROJINHERIT)
> +		if (ip->i_diflags & XFS_DIFLAG_PROJINHERIT)
>  			flags |= FS_XFLAG_PROJINHERIT;
> -		if (di_flags & XFS_DIFLAG_NOSYMLINKS)
> +		if (ip->i_diflags & XFS_DIFLAG_NOSYMLINKS)
>  			flags |= FS_XFLAG_NOSYMLINKS;
> -		if (di_flags & XFS_DIFLAG_EXTSIZE)
> +		if (ip->i_diflags & XFS_DIFLAG_EXTSIZE)
>  			flags |= FS_XFLAG_EXTSIZE;
> -		if (di_flags & XFS_DIFLAG_EXTSZINHERIT)
> +		if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT)
>  			flags |= FS_XFLAG_EXTSZINHERIT;
> -		if (di_flags & XFS_DIFLAG_NODEFRAG)
> +		if (ip->i_diflags & XFS_DIFLAG_NODEFRAG)
>  			flags |= FS_XFLAG_NODEFRAG;
> -		if (di_flags & XFS_DIFLAG_FILESTREAM)
> +		if (ip->i_diflags & XFS_DIFLAG_FILESTREAM)
>  			flags |= FS_XFLAG_FILESTREAM;
>  	}
>  
> -	if (di_flags2 & XFS_DIFLAG2_ANY) {
> -		if (di_flags2 & XFS_DIFLAG2_DAX)
> +	if (ip->i_diflags2 & XFS_DIFLAG2_ANY) {
> +		if (ip->i_diflags2 & XFS_DIFLAG2_DAX)
>  			flags |= FS_XFLAG_DAX;
> -		if (di_flags2 & XFS_DIFLAG2_COWEXTSIZE)
> +		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
>  			flags |= FS_XFLAG_COWEXTSIZE;
>  	}
>  
> -	if (has_attr)
> +	if (XFS_IFORK_Q(ip))
>  		flags |= FS_XFLAG_HASATTR;
> -
>  	return flags;
>  }
>  
> -uint
> -xfs_ip2xflags(
> -	struct xfs_inode	*ip)
> -{
> -	return _xfs_dic2xflags(ip->i_diflags, ip->i_diflags2, XFS_IFORK_Q(ip));
> -}
> -
>  /*
>   * Lookups up an inode from "name". If ci_name is not NULL, then a CI match
>   * is allowed, otherwise it has to be an exact match. If a CI match is found,
> -- 
> 2.30.1
>
Christoph Hellwig March 30, 2021, 5:31 p.m. UTC | #2
On Tue, Mar 30, 2021 at 08:25:38AM -0700, Darrick J. Wong wrote:
> On Mon, Mar 29, 2021 at 07:38:29AM +0200, Christoph Hellwig wrote:
> > Merge _xfs_dic2xflags into its only caller.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> /me wonders if/how this will clash with Miklos' fileattr series, but eh,
> whatever, I don't think it will, and if it does it's easy enough to fix.

Feel free to drop the patch for now, it is not in any way urgent.
Darrick J. Wong March 30, 2021, 6:06 p.m. UTC | #3
On Tue, Mar 30, 2021 at 07:31:54PM +0200, Christoph Hellwig wrote:
> On Tue, Mar 30, 2021 at 08:25:38AM -0700, Darrick J. Wong wrote:
> > On Mon, Mar 29, 2021 at 07:38:29AM +0200, Christoph Hellwig wrote:
> > > Merge _xfs_dic2xflags into its only caller.
> > > 
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > 
> > /me wonders if/how this will clash with Miklos' fileattr series, but eh,
> > whatever, I don't think it will, and if it does it's easy enough to fix.
> 
> Feel free to drop the patch for now, it is not in any way urgent.

I'll take it for now, since I have no idea if that fileattr series is
targeted for 5.13.

--D
diff mbox series

Patch

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 3006cfbd072617..9100a9b7aa80cb 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -598,65 +598,55 @@  xfs_lock_two_inodes(
 	}
 }
 
-STATIC uint
-_xfs_dic2xflags(
-	uint16_t		di_flags,
-	uint64_t		di_flags2,
-	bool			has_attr)
+uint
+xfs_ip2xflags(
+	struct xfs_inode	*ip)
 {
 	uint			flags = 0;
 
-	if (di_flags & XFS_DIFLAG_ANY) {
-		if (di_flags & XFS_DIFLAG_REALTIME)
+	if (ip->i_diflags & XFS_DIFLAG_ANY) {
+		if (ip->i_diflags & XFS_DIFLAG_REALTIME)
 			flags |= FS_XFLAG_REALTIME;
-		if (di_flags & XFS_DIFLAG_PREALLOC)
+		if (ip->i_diflags & XFS_DIFLAG_PREALLOC)
 			flags |= FS_XFLAG_PREALLOC;
-		if (di_flags & XFS_DIFLAG_IMMUTABLE)
+		if (ip->i_diflags & XFS_DIFLAG_IMMUTABLE)
 			flags |= FS_XFLAG_IMMUTABLE;
-		if (di_flags & XFS_DIFLAG_APPEND)
+		if (ip->i_diflags & XFS_DIFLAG_APPEND)
 			flags |= FS_XFLAG_APPEND;
-		if (di_flags & XFS_DIFLAG_SYNC)
+		if (ip->i_diflags & XFS_DIFLAG_SYNC)
 			flags |= FS_XFLAG_SYNC;
-		if (di_flags & XFS_DIFLAG_NOATIME)
+		if (ip->i_diflags & XFS_DIFLAG_NOATIME)
 			flags |= FS_XFLAG_NOATIME;
-		if (di_flags & XFS_DIFLAG_NODUMP)
+		if (ip->i_diflags & XFS_DIFLAG_NODUMP)
 			flags |= FS_XFLAG_NODUMP;
-		if (di_flags & XFS_DIFLAG_RTINHERIT)
+		if (ip->i_diflags & XFS_DIFLAG_RTINHERIT)
 			flags |= FS_XFLAG_RTINHERIT;
-		if (di_flags & XFS_DIFLAG_PROJINHERIT)
+		if (ip->i_diflags & XFS_DIFLAG_PROJINHERIT)
 			flags |= FS_XFLAG_PROJINHERIT;
-		if (di_flags & XFS_DIFLAG_NOSYMLINKS)
+		if (ip->i_diflags & XFS_DIFLAG_NOSYMLINKS)
 			flags |= FS_XFLAG_NOSYMLINKS;
-		if (di_flags & XFS_DIFLAG_EXTSIZE)
+		if (ip->i_diflags & XFS_DIFLAG_EXTSIZE)
 			flags |= FS_XFLAG_EXTSIZE;
-		if (di_flags & XFS_DIFLAG_EXTSZINHERIT)
+		if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT)
 			flags |= FS_XFLAG_EXTSZINHERIT;
-		if (di_flags & XFS_DIFLAG_NODEFRAG)
+		if (ip->i_diflags & XFS_DIFLAG_NODEFRAG)
 			flags |= FS_XFLAG_NODEFRAG;
-		if (di_flags & XFS_DIFLAG_FILESTREAM)
+		if (ip->i_diflags & XFS_DIFLAG_FILESTREAM)
 			flags |= FS_XFLAG_FILESTREAM;
 	}
 
-	if (di_flags2 & XFS_DIFLAG2_ANY) {
-		if (di_flags2 & XFS_DIFLAG2_DAX)
+	if (ip->i_diflags2 & XFS_DIFLAG2_ANY) {
+		if (ip->i_diflags2 & XFS_DIFLAG2_DAX)
 			flags |= FS_XFLAG_DAX;
-		if (di_flags2 & XFS_DIFLAG2_COWEXTSIZE)
+		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 			flags |= FS_XFLAG_COWEXTSIZE;
 	}
 
-	if (has_attr)
+	if (XFS_IFORK_Q(ip))
 		flags |= FS_XFLAG_HASATTR;
-
 	return flags;
 }
 
-uint
-xfs_ip2xflags(
-	struct xfs_inode	*ip)
-{
-	return _xfs_dic2xflags(ip->i_diflags, ip->i_diflags2, XFS_IFORK_Q(ip));
-}
-
 /*
  * Lookups up an inode from "name". If ci_name is not NULL, then a CI match
  * is allowed, otherwise it has to be an exact match. If a CI match is found,