Linux-XFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS.
@ 2020-07-27  9:27 Xiao Yang
  2020-07-28 15:57 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Yang @ 2020-07-27  9:27 UTC (permalink / raw)
  To: darrick.wong, ira.weiny; +Cc: linux-xfs, Xiao Yang

1) FS_DAX_FL has been introduced by commit b383a73f2b83.
2) In future, chattr/lsattr command from e2fsprogs can set/get
   inode DAX on XFS by calling ioctl(SETXFLAGS/GETXFLAGS).

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 fs/xfs/xfs_ioctl.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index a190212ca85d..6f22a66777cd 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags(
 		xflags |= FS_XFLAG_NODUMP;
 	else
 		xflags &= ~FS_XFLAG_NODUMP;
+	if (flags & FS_DAX_FL)
+		xflags |= FS_XFLAG_DAX;
+	else
+		xflags &= ~FS_XFLAG_DAX;
 
 	return xflags;
 }
 
 STATIC unsigned int
 xfs_di2lxflags(
-	uint16_t	di_flags)
+	uint16_t	di_flags,
+	uint64_t	di_flags2)
 {
 	unsigned int	flags = 0;
 
@@ -1095,6 +1100,9 @@ xfs_di2lxflags(
 		flags |= FS_NOATIME_FL;
 	if (di_flags & XFS_DIFLAG_NODUMP)
 		flags |= FS_NODUMP_FL;
+	if (di_flags2 & XFS_DIFLAG2_DAX) {
+		flags |= FS_DAX_FL;
+	}
 	return flags;
 }
 
@@ -1565,7 +1573,7 @@ xfs_ioc_getxflags(
 {
 	unsigned int		flags;
 
-	flags = xfs_di2lxflags(ip->i_d.di_flags);
+	flags = xfs_di2lxflags(ip->i_d.di_flags, ip->i_d.di_flags2);
 	if (copy_to_user(arg, &flags, sizeof(flags)))
 		return -EFAULT;
 	return 0;
@@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(
 
 	if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
 		      FS_NOATIME_FL | FS_NODUMP_FL | \
-		      FS_SYNC_FL))
+		      FS_SYNC_FL | FS_DAX_FL))
 		return -EOPNOTSUPP;
 
 	fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip));
-- 
2.21.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS.
  2020-07-27  9:27 [PATCH] fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS Xiao Yang
@ 2020-07-28 15:57 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2020-07-28 15:57 UTC (permalink / raw)
  To: Xiao Yang; +Cc: ira.weiny, linux-xfs

On Mon, Jul 27, 2020 at 05:27:44PM +0800, Xiao Yang wrote:
> 1) FS_DAX_FL has been introduced by commit b383a73f2b83.
> 2) In future, chattr/lsattr command from e2fsprogs can set/get
>    inode DAX on XFS by calling ioctl(SETXFLAGS/GETXFLAGS).
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Looks fine to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_ioctl.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index a190212ca85d..6f22a66777cd 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1075,13 +1075,18 @@ xfs_merge_ioc_xflags(
>  		xflags |= FS_XFLAG_NODUMP;
>  	else
>  		xflags &= ~FS_XFLAG_NODUMP;
> +	if (flags & FS_DAX_FL)
> +		xflags |= FS_XFLAG_DAX;
> +	else
> +		xflags &= ~FS_XFLAG_DAX;
>  
>  	return xflags;
>  }
>  
>  STATIC unsigned int
>  xfs_di2lxflags(
> -	uint16_t	di_flags)
> +	uint16_t	di_flags,
> +	uint64_t	di_flags2)
>  {
>  	unsigned int	flags = 0;
>  
> @@ -1095,6 +1100,9 @@ xfs_di2lxflags(
>  		flags |= FS_NOATIME_FL;
>  	if (di_flags & XFS_DIFLAG_NODUMP)
>  		flags |= FS_NODUMP_FL;
> +	if (di_flags2 & XFS_DIFLAG2_DAX) {
> +		flags |= FS_DAX_FL;
> +	}
>  	return flags;
>  }
>  
> @@ -1565,7 +1573,7 @@ xfs_ioc_getxflags(
>  {
>  	unsigned int		flags;
>  
> -	flags = xfs_di2lxflags(ip->i_d.di_flags);
> +	flags = xfs_di2lxflags(ip->i_d.di_flags, ip->i_d.di_flags2);
>  	if (copy_to_user(arg, &flags, sizeof(flags)))
>  		return -EFAULT;
>  	return 0;
> @@ -1588,7 +1596,7 @@ xfs_ioc_setxflags(
>  
>  	if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
>  		      FS_NOATIME_FL | FS_NODUMP_FL | \
> -		      FS_SYNC_FL))
> +		      FS_SYNC_FL | FS_DAX_FL))
>  		return -EOPNOTSUPP;
>  
>  	fa.fsx_xflags = xfs_merge_ioc_xflags(flags, xfs_ip2xflags(ip));
> -- 
> 2.21.0
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  9:27 [PATCH] fs/xfs: Support that ioctl(SETXFLAGS/GETXFLAGS) can set/get inode DAX on XFS Xiao Yang
2020-07-28 15:57 ` Darrick J. Wong

Linux-XFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-xfs/0 linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ https://lore.kernel.org/linux-xfs \
		linux-xfs@vger.kernel.org
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-xfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git