public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dudupe IO commands
@ 2024-08-09  9:02 liuhuan01
  2024-08-09 15:04 ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: liuhuan01 @ 2024-08-09  9:02 UTC (permalink / raw)
  To: linux-xfs; +Cc: djwong, dchinner, liuh

From: liuh <liuhuan01@kylinos.cn>

Use FICLONE/FICLONERANGE/FIDEDUPERANGE instead of XFS_IOC_CLONE/XFS_IOC_CLONE_RANGE/XFS_IOC_FILE_EXTENT_SAME.
And remove dead code.

Signed-off-by: liuh <liuhuan01@kylinos.cn>
---
 include/xfs_fs_compat.h | 54 -----------------------------------------
 io/reflink.c            | 52 +++++++++++++++++++--------------------
 2 files changed, 26 insertions(+), 80 deletions(-)

diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h
index 0077f00c..e53dcc6e 100644
--- a/include/xfs_fs_compat.h
+++ b/include/xfs_fs_compat.h
@@ -31,60 +31,6 @@
 #define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
 #define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
 
-/*
- * Don't use this.
- * Use struct file_clone_range
- */
-struct xfs_clone_args {
-	__s64 src_fd;
-	__u64 src_offset;
-	__u64 src_length;
-	__u64 dest_offset;
-};
-
-/*
- * Don't use these.
- * Use FILE_DEDUPE_RANGE_SAME / FILE_DEDUPE_RANGE_DIFFERS
- */
-#define XFS_EXTENT_DATA_SAME	0
-#define XFS_EXTENT_DATA_DIFFERS	1
-
-/* Don't use this. Use file_dedupe_range_info */
-struct xfs_extent_data_info {
-	__s64 fd;		/* in - destination file */
-	__u64 logical_offset;	/* in - start of extent in destination */
-	__u64 bytes_deduped;	/* out - total # of bytes we were able
-				 * to dedupe from this file */
-	/* status of this dedupe operation:
-	 * < 0 for error
-	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
-	 * == XFS_EXTENT_DATA_DIFFERS if data differs
-	 */
-	__s32 status;		/* out - see above description */
-	__u32 reserved;
-};
-
-/*
- * Don't use this.
- * Use struct file_dedupe_range
- */
-struct xfs_extent_data {
-	__u64 logical_offset;	/* in - start of extent in source */
-	__u64 length;		/* in - length of extent */
-	__u16 dest_count;	/* in - total elements in info array */
-	__u16 reserved1;
-	__u32 reserved2;
-	struct xfs_extent_data_info info[0];
-};
-
-/*
- * Don't use these.
- * Use FICLONE/FICLONERANGE/FIDEDUPERANGE
- */
-#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
-#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
-#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
-
 /* 64-bit seconds counter that works independently of the C library time_t. */
 typedef long long int time64_t;
 
diff --git a/io/reflink.c b/io/reflink.c
index b6a3c05a..154ca65b 100644
--- a/io/reflink.c
+++ b/io/reflink.c
@@ -43,49 +43,49 @@ dedupe_ioctl(
 	uint64_t	len,
 	int		*ops)
 {
-	struct xfs_extent_data		*args;
-	struct xfs_extent_data_info	*info;
+	struct file_dedupe_range	*args;
+	struct file_dedupe_range_info	*info;
 	int				error;
 	uint64_t			deduped = 0;
 
-	args = calloc(1, sizeof(struct xfs_extent_data) +
-			 sizeof(struct xfs_extent_data_info));
+	args = calloc(1, sizeof(struct file_dedupe_range) +
+			 sizeof(struct file_dedupe_range_info));
 	if (!args)
 		goto done;
-	info = (struct xfs_extent_data_info *)(args + 1);
-	args->logical_offset = soffset;
-	args->length = len;
+	info = (struct file_dedupe_range_info *)(args + 1);
+	args->src_offset = soffset;
+	args->src_length = len;
 	args->dest_count = 1;
-	info->fd = file->fd;
-	info->logical_offset = doffset;
+	info->dest_fd = file->fd;
+	info->dest_offset = doffset;
 
-	while (args->length > 0 || !*ops) {
-		error = ioctl(fd, XFS_IOC_FILE_EXTENT_SAME, args);
+	while (args->src_length > 0 || !*ops) {
+		error = ioctl(fd, FIDEDUPERANGE, args);
 		if (error) {
-			perror("XFS_IOC_FILE_EXTENT_SAME");
+			perror("FIDEDUPERANGE");
 			exitcode = 1;
 			goto done;
 		}
 		if (info->status < 0) {
-			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
+			fprintf(stderr, "FIDEDUPERANGE: %s\n",
 					_(strerror(-info->status)));
 			goto done;
 		}
-		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
+		if (info->status == FILE_DEDUPE_RANGE_DIFFERS) {
+			fprintf(stderr, "FIDEDUPERANGE: %s\n",
 					_("Extents did not match."));
 			goto done;
 		}
-		if (args->length != 0 &&
+		if (args->src_length != 0 &&
 		    (info->bytes_deduped == 0 ||
-		     info->bytes_deduped > args->length))
+		     info->bytes_deduped > args->src_length))
 			break;
 
 		(*ops)++;
-		args->logical_offset += info->bytes_deduped;
-		info->logical_offset += info->bytes_deduped;
-		if (args->length >= info->bytes_deduped)
-			args->length -= info->bytes_deduped;
+		args->src_offset += info->bytes_deduped;
+		info->dest_offset += info->bytes_deduped;
+		if (args->src_length >= info->bytes_deduped)
+			args->src_length -= info->bytes_deduped;
 		deduped += info->bytes_deduped;
 	}
 done:
@@ -200,21 +200,21 @@ reflink_ioctl(
 	uint64_t		len,
 	int			*ops)
 {
-	struct xfs_clone_args	args;
+	struct file_clone_range	args;
 	int			error;
 
 	if (soffset == 0 && doffset == 0 && len == 0) {
-		error = ioctl(file->fd, XFS_IOC_CLONE, fd);
+		error = ioctl(file->fd, FICLONE, fd);
 		if (error)
-			perror("XFS_IOC_CLONE");
+			perror("FICLONE");
 	} else {
 		args.src_fd = fd;
 		args.src_offset = soffset;
 		args.src_length = len;
 		args.dest_offset = doffset;
-		error = ioctl(file->fd, XFS_IOC_CLONE_RANGE, &args);
+		error = ioctl(file->fd, FICLONERANGE, &args);
 		if (error)
-			perror("XFS_IOC_CLONE_RANGE");
+			perror("FICLONERANGE");
 	}
 	if (!error)
 		(*ops)++;
-- 
2.43.0


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

* Re: [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dudupe IO commands
  2024-08-09  9:02 [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dudupe IO commands liuhuan01
@ 2024-08-09 15:04 ` Darrick J. Wong
  2024-08-17  6:48   ` [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe " liuhuan01
  2024-08-17  6:50   ` [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases liuhuan01
  0 siblings, 2 replies; 5+ messages in thread
From: Darrick J. Wong @ 2024-08-09 15:04 UTC (permalink / raw)
  To: liuhuan01; +Cc: linux-xfs, dchinner

On Fri, Aug 09, 2024 at 05:02:26PM +0800, liuhuan01@kylinos.cn wrote:
> From: liuh <liuhuan01@kylinos.cn>
> 
> Use FICLONE/FICLONERANGE/FIDEDUPERANGE instead of XFS_IOC_CLONE/XFS_IOC_CLONE_RANGE/XFS_IOC_FILE_EXTENT_SAME.
> And remove dead code.

Where was the dead code?

> Signed-off-by: liuh <liuhuan01@kylinos.cn>
> ---
>  include/xfs_fs_compat.h | 54 -----------------------------------------
>  io/reflink.c            | 52 +++++++++++++++++++--------------------
>  2 files changed, 26 insertions(+), 80 deletions(-)
> 
> diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h
> index 0077f00c..e53dcc6e 100644
> --- a/include/xfs_fs_compat.h
> +++ b/include/xfs_fs_compat.h
> @@ -31,60 +31,6 @@
>  #define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
>  #define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
>  
> -/*
> - * Don't use this.
> - * Use struct file_clone_range
> - */
> -struct xfs_clone_args {
> -	__s64 src_fd;
> -	__u64 src_offset;
> -	__u64 src_length;
> -	__u64 dest_offset;
> -};
> -
> -/*
> - * Don't use these.
> - * Use FILE_DEDUPE_RANGE_SAME / FILE_DEDUPE_RANGE_DIFFERS
> - */
> -#define XFS_EXTENT_DATA_SAME	0
> -#define XFS_EXTENT_DATA_DIFFERS	1
> -
> -/* Don't use this. Use file_dedupe_range_info */
> -struct xfs_extent_data_info {
> -	__s64 fd;		/* in - destination file */
> -	__u64 logical_offset;	/* in - start of extent in destination */
> -	__u64 bytes_deduped;	/* out - total # of bytes we were able
> -				 * to dedupe from this file */
> -	/* status of this dedupe operation:
> -	 * < 0 for error
> -	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
> -	 * == XFS_EXTENT_DATA_DIFFERS if data differs
> -	 */
> -	__s32 status;		/* out - see above description */
> -	__u32 reserved;
> -};
> -
> -/*
> - * Don't use this.
> - * Use struct file_dedupe_range
> - */
> -struct xfs_extent_data {
> -	__u64 logical_offset;	/* in - start of extent in source */
> -	__u64 length;		/* in - length of extent */
> -	__u16 dest_count;	/* in - total elements in info array */
> -	__u16 reserved1;
> -	__u32 reserved2;
> -	struct xfs_extent_data_info info[0];
> -};
> -
> -/*
> - * Don't use these.
> - * Use FICLONE/FICLONERANGE/FIDEDUPERANGE
> - */
> -#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
> -#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
> -#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
> -
>  /* 64-bit seconds counter that works independently of the C library time_t. */
>  typedef long long int time64_t;
>  
> diff --git a/io/reflink.c b/io/reflink.c
> index b6a3c05a..154ca65b 100644
> --- a/io/reflink.c
> +++ b/io/reflink.c
> @@ -43,49 +43,49 @@ dedupe_ioctl(
>  	uint64_t	len,
>  	int		*ops)
>  {
> -	struct xfs_extent_data		*args;
> -	struct xfs_extent_data_info	*info;
> +	struct file_dedupe_range	*args;
> +	struct file_dedupe_range_info	*info;
>  	int				error;
>  	uint64_t			deduped = 0;
>  
> -	args = calloc(1, sizeof(struct xfs_extent_data) +
> -			 sizeof(struct xfs_extent_data_info));
> +	args = calloc(1, sizeof(struct file_dedupe_range) +
> +			 sizeof(struct file_dedupe_range_info));
>  	if (!args)
>  		goto done;
> -	info = (struct xfs_extent_data_info *)(args + 1);
> -	args->logical_offset = soffset;
> -	args->length = len;
> +	info = (struct file_dedupe_range_info *)(args + 1);
> +	args->src_offset = soffset;
> +	args->src_length = len;
>  	args->dest_count = 1;
> -	info->fd = file->fd;
> -	info->logical_offset = doffset;
> +	info->dest_fd = file->fd;
> +	info->dest_offset = doffset;
>  
> -	while (args->length > 0 || !*ops) {
> -		error = ioctl(fd, XFS_IOC_FILE_EXTENT_SAME, args);
> +	while (args->src_length > 0 || !*ops) {
> +		error = ioctl(fd, FIDEDUPERANGE, args);
>  		if (error) {
> -			perror("XFS_IOC_FILE_EXTENT_SAME");
> +			perror("FIDEDUPERANGE");

If you update these error message prefixes, you'll likely need to update
fstests too:

tests/generic/122.out:7:XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
tests/generic/136.out:10:XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
tests/generic/157.out:5:XFS_IOC_CLONE_RANGE: Invalid cross-device link
tests/generic/157.out:7:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:9:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:11:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:13:XFS_IOC_CLONE_RANGE: Is a directory
tests/generic/157.out:15:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:19:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:21:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/157.out:23:XFS_IOC_CLONE_RANGE: Bad file descriptor
tests/generic/158.out:5:XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link
tests/generic/158.out:7:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:9:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:11:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:13:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:15:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:17:XFS_IOC_FILE_EXTENT_SAME: Is a directory
tests/generic/158.out:19:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:23:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/158.out:25:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/303.out:7:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/303.out:10:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/303.out:12:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/303.out:14:XFS_IOC_CLONE_RANGE: Invalid argument
tests/generic/304.out:5:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:7:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:9:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:11:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:13:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:15:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/304.out:17:XFS_IOC_FILE_EXTENT_SAME: Invalid argument
tests/generic/493.out:5:XFS_IOC_FILE_EXTENT_SAME: Text file busy
tests/generic/493.out:6:XFS_IOC_FILE_EXTENT_SAME: Text file busy
tests/generic/516.out:7:XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
tests/generic/518.out:6:XFS_IOC_CLONE_RANGE: Invalid argument
tests/xfs/319.out:10:XFS_IOC_CLONE_RANGE: Input/output error
tests/xfs/321.out:9:XFS_IOC_CLONE_RANGE: Input/output error
tests/xfs/322.out:9:XFS_IOC_CLONE_RANGE: Input/output error
tests/xfs/323.out:9:XFS_IOC_CLONE_RANGE: Input/output error

(or leave the prefixes alone)

--D

>  			exitcode = 1;
>  			goto done;
>  		}
>  		if (info->status < 0) {
> -			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
> +			fprintf(stderr, "FIDEDUPERANGE: %s\n",
>  					_(strerror(-info->status)));
>  			goto done;
>  		}
> -		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
> -			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
> +		if (info->status == FILE_DEDUPE_RANGE_DIFFERS) {
> +			fprintf(stderr, "FIDEDUPERANGE: %s\n",
>  					_("Extents did not match."));
>  			goto done;
>  		}
> -		if (args->length != 0 &&
> +		if (args->src_length != 0 &&
>  		    (info->bytes_deduped == 0 ||
> -		     info->bytes_deduped > args->length))
> +		     info->bytes_deduped > args->src_length))
>  			break;
>  
>  		(*ops)++;
> -		args->logical_offset += info->bytes_deduped;
> -		info->logical_offset += info->bytes_deduped;
> -		if (args->length >= info->bytes_deduped)
> -			args->length -= info->bytes_deduped;
> +		args->src_offset += info->bytes_deduped;
> +		info->dest_offset += info->bytes_deduped;
> +		if (args->src_length >= info->bytes_deduped)
> +			args->src_length -= info->bytes_deduped;
>  		deduped += info->bytes_deduped;
>  	}
>  done:
> @@ -200,21 +200,21 @@ reflink_ioctl(
>  	uint64_t		len,
>  	int			*ops)
>  {
> -	struct xfs_clone_args	args;
> +	struct file_clone_range	args;
>  	int			error;
>  
>  	if (soffset == 0 && doffset == 0 && len == 0) {
> -		error = ioctl(file->fd, XFS_IOC_CLONE, fd);
> +		error = ioctl(file->fd, FICLONE, fd);
>  		if (error)
> -			perror("XFS_IOC_CLONE");
> +			perror("FICLONE");
>  	} else {
>  		args.src_fd = fd;
>  		args.src_offset = soffset;
>  		args.src_length = len;
>  		args.dest_offset = doffset;
> -		error = ioctl(file->fd, XFS_IOC_CLONE_RANGE, &args);
> +		error = ioctl(file->fd, FICLONERANGE, &args);
>  		if (error)
> -			perror("XFS_IOC_CLONE_RANGE");
> +			perror("FICLONERANGE");
>  	}
>  	if (!error)
>  		(*ops)++;
> -- 
> 2.43.0
> 
> 

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

* [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe IO commands
  2024-08-09 15:04 ` Darrick J. Wong
@ 2024-08-17  6:48   ` liuhuan01
  2024-08-17  6:50   ` [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases liuhuan01
  1 sibling, 0 replies; 5+ messages in thread
From: liuhuan01 @ 2024-08-17  6:48 UTC (permalink / raw)
  To: djwong; +Cc: dchinner, linux-xfs, fstests, liuhuan01

From: liuh <liuhuan01@kylinos.cn>

Use FICLONE/FICLONERANGE/FIDEDUPERANGE instead of XFS_IOC_CLONE/XFS_IOC_CLONE_RANGE/XFS_IOC_FILE_EXTENT_SAME.
And the declaration becomes useless, delete it.

Signed-off-by: liuh <liuhuan01@kylinos.cn>
---
 include/xfs_fs_compat.h | 54 -----------------------------------------
 io/reflink.c            | 52 +++++++++++++++++++--------------------
 2 files changed, 26 insertions(+), 80 deletions(-)

diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h
index 0077f00c..e53dcc6e 100644
--- a/include/xfs_fs_compat.h
+++ b/include/xfs_fs_compat.h
@@ -31,60 +31,6 @@
 #define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
 #define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
 
-/*
- * Don't use this.
- * Use struct file_clone_range
- */
-struct xfs_clone_args {
-	__s64 src_fd;
-	__u64 src_offset;
-	__u64 src_length;
-	__u64 dest_offset;
-};
-
-/*
- * Don't use these.
- * Use FILE_DEDUPE_RANGE_SAME / FILE_DEDUPE_RANGE_DIFFERS
- */
-#define XFS_EXTENT_DATA_SAME	0
-#define XFS_EXTENT_DATA_DIFFERS	1
-
-/* Don't use this. Use file_dedupe_range_info */
-struct xfs_extent_data_info {
-	__s64 fd;		/* in - destination file */
-	__u64 logical_offset;	/* in - start of extent in destination */
-	__u64 bytes_deduped;	/* out - total # of bytes we were able
-				 * to dedupe from this file */
-	/* status of this dedupe operation:
-	 * < 0 for error
-	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
-	 * == XFS_EXTENT_DATA_DIFFERS if data differs
-	 */
-	__s32 status;		/* out - see above description */
-	__u32 reserved;
-};
-
-/*
- * Don't use this.
- * Use struct file_dedupe_range
- */
-struct xfs_extent_data {
-	__u64 logical_offset;	/* in - start of extent in source */
-	__u64 length;		/* in - length of extent */
-	__u16 dest_count;	/* in - total elements in info array */
-	__u16 reserved1;
-	__u32 reserved2;
-	struct xfs_extent_data_info info[0];
-};
-
-/*
- * Don't use these.
- * Use FICLONE/FICLONERANGE/FIDEDUPERANGE
- */
-#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
-#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
-#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
-
 /* 64-bit seconds counter that works independently of the C library time_t. */
 typedef long long int time64_t;
 
diff --git a/io/reflink.c b/io/reflink.c
index b6a3c05a..154ca65b 100644
--- a/io/reflink.c
+++ b/io/reflink.c
@@ -43,49 +43,49 @@ dedupe_ioctl(
 	uint64_t	len,
 	int		*ops)
 {
-	struct xfs_extent_data		*args;
-	struct xfs_extent_data_info	*info;
+	struct file_dedupe_range	*args;
+	struct file_dedupe_range_info	*info;
 	int				error;
 	uint64_t			deduped = 0;
 
-	args = calloc(1, sizeof(struct xfs_extent_data) +
-			 sizeof(struct xfs_extent_data_info));
+	args = calloc(1, sizeof(struct file_dedupe_range) +
+			 sizeof(struct file_dedupe_range_info));
 	if (!args)
 		goto done;
-	info = (struct xfs_extent_data_info *)(args + 1);
-	args->logical_offset = soffset;
-	args->length = len;
+	info = (struct file_dedupe_range_info *)(args + 1);
+	args->src_offset = soffset;
+	args->src_length = len;
 	args->dest_count = 1;
-	info->fd = file->fd;
-	info->logical_offset = doffset;
+	info->dest_fd = file->fd;
+	info->dest_offset = doffset;
 
-	while (args->length > 0 || !*ops) {
-		error = ioctl(fd, XFS_IOC_FILE_EXTENT_SAME, args);
+	while (args->src_length > 0 || !*ops) {
+		error = ioctl(fd, FIDEDUPERANGE, args);
 		if (error) {
-			perror("XFS_IOC_FILE_EXTENT_SAME");
+			perror("FIDEDUPERANGE");
 			exitcode = 1;
 			goto done;
 		}
 		if (info->status < 0) {
-			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
+			fprintf(stderr, "FIDEDUPERANGE: %s\n",
 					_(strerror(-info->status)));
 			goto done;
 		}
-		if (info->status == XFS_EXTENT_DATA_DIFFERS) {
-			fprintf(stderr, "XFS_IOC_FILE_EXTENT_SAME: %s\n",
+		if (info->status == FILE_DEDUPE_RANGE_DIFFERS) {
+			fprintf(stderr, "FIDEDUPERANGE: %s\n",
 					_("Extents did not match."));
 			goto done;
 		}
-		if (args->length != 0 &&
+		if (args->src_length != 0 &&
 		    (info->bytes_deduped == 0 ||
-		     info->bytes_deduped > args->length))
+		     info->bytes_deduped > args->src_length))
 			break;
 
 		(*ops)++;
-		args->logical_offset += info->bytes_deduped;
-		info->logical_offset += info->bytes_deduped;
-		if (args->length >= info->bytes_deduped)
-			args->length -= info->bytes_deduped;
+		args->src_offset += info->bytes_deduped;
+		info->dest_offset += info->bytes_deduped;
+		if (args->src_length >= info->bytes_deduped)
+			args->src_length -= info->bytes_deduped;
 		deduped += info->bytes_deduped;
 	}
 done:
@@ -200,21 +200,21 @@ reflink_ioctl(
 	uint64_t		len,
 	int			*ops)
 {
-	struct xfs_clone_args	args;
+	struct file_clone_range	args;
 	int			error;
 
 	if (soffset == 0 && doffset == 0 && len == 0) {
-		error = ioctl(file->fd, XFS_IOC_CLONE, fd);
+		error = ioctl(file->fd, FICLONE, fd);
 		if (error)
-			perror("XFS_IOC_CLONE");
+			perror("FICLONE");
 	} else {
 		args.src_fd = fd;
 		args.src_offset = soffset;
 		args.src_length = len;
 		args.dest_offset = doffset;
-		error = ioctl(file->fd, XFS_IOC_CLONE_RANGE, &args);
+		error = ioctl(file->fd, FICLONERANGE, &args);
 		if (error)
-			perror("XFS_IOC_CLONE_RANGE");
+			perror("FICLONERANGE");
 	}
 	if (!error)
 		(*ops)++;
-- 
2.25.1


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

* [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases
  2024-08-09 15:04 ` Darrick J. Wong
  2024-08-17  6:48   ` [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe " liuhuan01
@ 2024-08-17  6:50   ` liuhuan01
  2024-08-21 17:14     ` Darrick J. Wong
  1 sibling, 1 reply; 5+ messages in thread
From: liuhuan01 @ 2024-08-17  6:50 UTC (permalink / raw)
  To: djwong; +Cc: dchinner, linux-xfs, fstests, liuhuan01

From: liuh <liuhuan01@kylinos.cn>

With the patch "xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe IO commands", and modify relevant test cases.

Signed-off-by: liuh <liuhuan01@kylinos.cn>
---
 common/reflink        |  2 +-
 tests/generic/122.out |  2 +-
 tests/generic/136.out |  2 +-
 tests/generic/157.out | 18 +++++++++---------
 tests/generic/158.out | 20 ++++++++++----------
 tests/generic/303.out |  8 ++++----
 tests/generic/304.out | 14 +++++++-------
 tests/generic/493.out |  4 ++--
 tests/generic/516.out |  2 +-
 tests/generic/518.out |  2 +-
 tests/xfs/319.out     |  2 +-
 tests/xfs/321.out     |  2 +-
 tests/xfs/322.out     |  2 +-
 tests/xfs/323.out     |  2 +-
 14 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/common/reflink b/common/reflink
index 22adc444..21df20e2 100644
--- a/common/reflink
+++ b/common/reflink
@@ -261,7 +261,7 @@ _dedupe_range() {
 # Unify xfs_io dedupe ioctl error message prefix
 _filter_dedupe_error()
 {
-	sed -e 's/^dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g'
+	sed -e 's/^dedupe:/FIDEDUPERANGE:/g'
 }
 
 # Create a file of interleaved unwritten and reflinked blocks
diff --git a/tests/generic/122.out b/tests/generic/122.out
index 4459985c..f243d153 100644
--- a/tests/generic/122.out
+++ b/tests/generic/122.out
@@ -4,7 +4,7 @@ Create the original files
 5e3501f97fd2669babfcbd3e1972e833  TEST_DIR/test-122/file2
 Files 1-2 do not match (intentional)
 (Fail to) dedupe the middle blocks together
-XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
+FIDEDUPERANGE: Extents did not match.
 Compare sections
 35ac8d7917305c385c30f3d82c30a8f6  TEST_DIR/test-122/file1
 5e3501f97fd2669babfcbd3e1972e833  TEST_DIR/test-122/file2
diff --git a/tests/generic/136.out b/tests/generic/136.out
index 508953f6..eee44f07 100644
--- a/tests/generic/136.out
+++ b/tests/generic/136.out
@@ -7,7 +7,7 @@ c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file2
 Dedupe the last blocks together
 1->2
 1->3
-XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
+FIDEDUPERANGE: Extents did not match.
 c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file1
 c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file2
 07ac67bf7f271195442509e79cde4cee  TEST_DIR/test-136/file3
diff --git a/tests/generic/157.out b/tests/generic/157.out
index d4f64b44..0ef12f80 100644
--- a/tests/generic/157.out
+++ b/tests/generic/157.out
@@ -2,23 +2,23 @@ QA output created by 157
 Format and mount
 Create the original files
 Try cross-device reflink
-XFS_IOC_CLONE_RANGE: Invalid cross-device link
+FICLONERANGE: Invalid cross-device link
 Try unaligned reflink
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try overlapping reflink
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try reflink past EOF
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try to reflink a dir
-XFS_IOC_CLONE_RANGE: Is a directory
+FICLONERANGE: Is a directory
 Try to reflink a device
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try to reflink to a dir
 TEST_DIR/test-157/dir1: Is a directory
 Try to reflink to a device
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try to reflink to a fifo
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Try to reflink an append-only file
-XFS_IOC_CLONE_RANGE: Bad file descriptor
+FICLONERANGE: Bad file descriptor
 Reflink two files
diff --git a/tests/generic/158.out b/tests/generic/158.out
index 8df9d9a5..2b304820 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -2,26 +2,26 @@ QA output created by 158
 Format and mount
 Create the original files
 Try cross-device dedupe
-XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link
+FIDEDUPERANGE: Invalid cross-device link
 Try unaligned dedupe
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try overlapping dedupe
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try dedupe from past EOF
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try dedupe to past EOF, destination offset beyond EOF
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try dedupe to past EOF, destination offset behind EOF
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try to dedupe a dir
-XFS_IOC_FILE_EXTENT_SAME: Is a directory
+FIDEDUPERANGE: Is a directory
 Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try to dedupe to a dir
 TEST_DIR/test-158/dir1: Is a directory
 Try to dedupe to a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try to dedupe to a fifo
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Try to dedupe an append-only file
 Dedupe two files
diff --git a/tests/generic/303.out b/tests/generic/303.out
index 39a88038..256ef66f 100644
--- a/tests/generic/303.out
+++ b/tests/generic/303.out
@@ -4,14 +4,14 @@ Create the original files
 Reflink large single byte file
 Reflink large empty file
 Reflink past maximum file size in dest file (should fail)
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Reflink high offset to low offset
 Reflink past source file EOF (should fail)
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Reflink max size at nonzero offset (should fail)
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Reflink with huge off/len (should fail)
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 Check file creation
 file3
 7ffffffffffffffe:  61  a
diff --git a/tests/generic/304.out b/tests/generic/304.out
index a979099b..d43dd70c 100644
--- a/tests/generic/304.out
+++ b/tests/generic/304.out
@@ -2,19 +2,19 @@ QA output created by 304
 Format and mount
 Create the original files
 Dedupe large single byte file
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe large empty file
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe past maximum file size in dest file (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe high offset to low offset
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe past source file EOF (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe max size at nonzero offset (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Dedupe with huge off/len (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+FIDEDUPERANGE: Invalid argument
 Check file creation
 file3
 7ffffffffffffffe:  61  a
diff --git a/tests/generic/493.out b/tests/generic/493.out
index d3426ee6..8bb71d3b 100644
--- a/tests/generic/493.out
+++ b/tests/generic/493.out
@@ -2,6 +2,6 @@ QA output created by 493
 Format and mount
 Initialize file
 Try to dedupe
-XFS_IOC_FILE_EXTENT_SAME: Text file busy
-XFS_IOC_FILE_EXTENT_SAME: Text file busy
+FIDEDUPERANGE: Text file busy
+FIDEDUPERANGE: Text file busy
 Tear it down
diff --git a/tests/generic/516.out b/tests/generic/516.out
index 90308c49..53611b3b 100644
--- a/tests/generic/516.out
+++ b/tests/generic/516.out
@@ -4,7 +4,7 @@ Create the original files
 39578c21e2cb9f6049b1cf7fc7be12a6  TEST_DIR/test-516/file2
 Files 1-2 do not match (intentional)
 (partial) dedupe the middle blocks together
-XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
+FIDEDUPERANGE: Extents did not match.
 Compare sections
 35ac8d7917305c385c30f3d82c30a8f6  TEST_DIR/test-516/file1
 39578c21e2cb9f6049b1cf7fc7be12a6  TEST_DIR/test-516/file2
diff --git a/tests/generic/518.out b/tests/generic/518.out
index 726c2073..57ae9155 100644
--- a/tests/generic/518.out
+++ b/tests/generic/518.out
@@ -3,7 +3,7 @@ wrote 262244/262244 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 1048576/1048576 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-XFS_IOC_CLONE_RANGE: Invalid argument
+FICLONERANGE: Invalid argument
 File content after failed reflink:
 0000000 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5
 *
diff --git a/tests/xfs/319.out b/tests/xfs/319.out
index 160f5fd2..25f1ed2e 100644
--- a/tests/xfs/319.out
+++ b/tests/xfs/319.out
@@ -7,7 +7,7 @@ Check files
 4155b81ac6d45c0182fa2bc03960f230  SCRATCH_MNT/file3
 Inject error
 Try to reflink
-XFS_IOC_CLONE_RANGE: Input/output error
+FICLONERANGE: Input/output error
 FS should be shut down, touch will fail
 touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
 Remount to replay log
diff --git a/tests/xfs/321.out b/tests/xfs/321.out
index c0abd52b..59fd7b7b 100644
--- a/tests/xfs/321.out
+++ b/tests/xfs/321.out
@@ -6,7 +6,7 @@ Check files
 b5cfa9d6c8febd618f91ac2843d50a1c  SCRATCH_MNT/file3
 Inject error
 Try to reflink
-XFS_IOC_CLONE_RANGE: Input/output error
+FICLONERANGE: Input/output error
 FS should be shut down, touch will fail
 touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
 Remount to replay log
diff --git a/tests/xfs/322.out b/tests/xfs/322.out
index b3fba5d0..695dd48b 100644
--- a/tests/xfs/322.out
+++ b/tests/xfs/322.out
@@ -6,7 +6,7 @@ Check files
 b5cfa9d6c8febd618f91ac2843d50a1c  SCRATCH_MNT/file3
 Inject error
 Try to reflink
-XFS_IOC_CLONE_RANGE: Input/output error
+FICLONERANGE: Input/output error
 FS should be shut down, touch will fail
 touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
 Remount to replay log
diff --git a/tests/xfs/323.out b/tests/xfs/323.out
index 99b9688c..f7f36c05 100644
--- a/tests/xfs/323.out
+++ b/tests/xfs/323.out
@@ -6,7 +6,7 @@ Check files
 4155b81ac6d45c0182fa2bc03960f230  SCRATCH_MNT/file3
 Inject error
 Try to reflink
-XFS_IOC_CLONE_RANGE: Input/output error
+FICLONERANGE: Input/output error
 FS should be shut down, touch will fail
 touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
 Remount to replay log
-- 
2.43.0


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

* Re: [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases
  2024-08-17  6:50   ` [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases liuhuan01
@ 2024-08-21 17:14     ` Darrick J. Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2024-08-21 17:14 UTC (permalink / raw)
  To: liuhuan01; +Cc: dchinner, linux-xfs, fstests

On Sat, Aug 17, 2024 at 02:50:27PM +0800, liuhuan01@kylinos.cn wrote:
> From: liuh <liuhuan01@kylinos.cn>
> 
> With the patch "xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe IO commands", and modify relevant test cases.
> 
> Signed-off-by: liuh <liuhuan01@kylinos.cn>
> ---
>  common/reflink        |  2 +-
>  tests/generic/122.out |  2 +-
>  tests/generic/136.out |  2 +-
>  tests/generic/157.out | 18 +++++++++---------
>  tests/generic/158.out | 20 ++++++++++----------
>  tests/generic/303.out |  8 ++++----
>  tests/generic/304.out | 14 +++++++-------
>  tests/generic/493.out |  4 ++--
>  tests/generic/516.out |  2 +-
>  tests/generic/518.out |  2 +-
>  tests/xfs/319.out     |  2 +-
>  tests/xfs/321.out     |  2 +-
>  tests/xfs/322.out     |  2 +-
>  tests/xfs/323.out     |  2 +-
>  14 files changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/common/reflink b/common/reflink
> index 22adc444..21df20e2 100644
> --- a/common/reflink
> +++ b/common/reflink
> @@ -261,7 +261,7 @@ _dedupe_range() {
>  # Unify xfs_io dedupe ioctl error message prefix
>  _filter_dedupe_error()
>  {
> -	sed -e 's/^dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g'
> +	sed -e 's/^dedupe:/FIDEDUPERANGE:/g'

Hmm, don't you have to squash both "dedupe:" and
"XFS_IOC_FILE_EXTENT_SAME:" to "FIDEDUPERANGE:" here?  Or else you break
the intermediate xfs_io versions that emit "XFS_IOC_FILE_EXTENT_SAME:"?

And apply the same filtering for the clone and clonerange ioctls?

(Or just leave the error message prefixes in xfs_io the way they are!)

--D

>  }
>  
>  # Create a file of interleaved unwritten and reflinked blocks
> diff --git a/tests/generic/122.out b/tests/generic/122.out
> index 4459985c..f243d153 100644
> --- a/tests/generic/122.out
> +++ b/tests/generic/122.out
> @@ -4,7 +4,7 @@ Create the original files
>  5e3501f97fd2669babfcbd3e1972e833  TEST_DIR/test-122/file2
>  Files 1-2 do not match (intentional)
>  (Fail to) dedupe the middle blocks together
> -XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
> +FIDEDUPERANGE: Extents did not match.
>  Compare sections
>  35ac8d7917305c385c30f3d82c30a8f6  TEST_DIR/test-122/file1
>  5e3501f97fd2669babfcbd3e1972e833  TEST_DIR/test-122/file2
> diff --git a/tests/generic/136.out b/tests/generic/136.out
> index 508953f6..eee44f07 100644
> --- a/tests/generic/136.out
> +++ b/tests/generic/136.out
> @@ -7,7 +7,7 @@ c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file2
>  Dedupe the last blocks together
>  1->2
>  1->3
> -XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
> +FIDEDUPERANGE: Extents did not match.
>  c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file1
>  c4fd505be25a0c91bcca9f502b9a8156  TEST_DIR/test-136/file2
>  07ac67bf7f271195442509e79cde4cee  TEST_DIR/test-136/file3
> diff --git a/tests/generic/157.out b/tests/generic/157.out
> index d4f64b44..0ef12f80 100644
> --- a/tests/generic/157.out
> +++ b/tests/generic/157.out
> @@ -2,23 +2,23 @@ QA output created by 157
>  Format and mount
>  Create the original files
>  Try cross-device reflink
> -XFS_IOC_CLONE_RANGE: Invalid cross-device link
> +FICLONERANGE: Invalid cross-device link
>  Try unaligned reflink
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try overlapping reflink
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try reflink past EOF
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try to reflink a dir
> -XFS_IOC_CLONE_RANGE: Is a directory
> +FICLONERANGE: Is a directory
>  Try to reflink a device
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try to reflink to a dir
>  TEST_DIR/test-157/dir1: Is a directory
>  Try to reflink to a device
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try to reflink to a fifo
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Try to reflink an append-only file
> -XFS_IOC_CLONE_RANGE: Bad file descriptor
> +FICLONERANGE: Bad file descriptor
>  Reflink two files
> diff --git a/tests/generic/158.out b/tests/generic/158.out
> index 8df9d9a5..2b304820 100644
> --- a/tests/generic/158.out
> +++ b/tests/generic/158.out
> @@ -2,26 +2,26 @@ QA output created by 158
>  Format and mount
>  Create the original files
>  Try cross-device dedupe
> -XFS_IOC_FILE_EXTENT_SAME: Invalid cross-device link
> +FIDEDUPERANGE: Invalid cross-device link
>  Try unaligned dedupe
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try overlapping dedupe
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try dedupe from past EOF
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try dedupe to past EOF, destination offset beyond EOF
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try dedupe to past EOF, destination offset behind EOF
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try to dedupe a dir
> -XFS_IOC_FILE_EXTENT_SAME: Is a directory
> +FIDEDUPERANGE: Is a directory
>  Try to dedupe a device
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try to dedupe to a dir
>  TEST_DIR/test-158/dir1: Is a directory
>  Try to dedupe to a device
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try to dedupe to a fifo
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Try to dedupe an append-only file
>  Dedupe two files
> diff --git a/tests/generic/303.out b/tests/generic/303.out
> index 39a88038..256ef66f 100644
> --- a/tests/generic/303.out
> +++ b/tests/generic/303.out
> @@ -4,14 +4,14 @@ Create the original files
>  Reflink large single byte file
>  Reflink large empty file
>  Reflink past maximum file size in dest file (should fail)
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Reflink high offset to low offset
>  Reflink past source file EOF (should fail)
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Reflink max size at nonzero offset (should fail)
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Reflink with huge off/len (should fail)
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  Check file creation
>  file3
>  7ffffffffffffffe:  61  a
> diff --git a/tests/generic/304.out b/tests/generic/304.out
> index a979099b..d43dd70c 100644
> --- a/tests/generic/304.out
> +++ b/tests/generic/304.out
> @@ -2,19 +2,19 @@ QA output created by 304
>  Format and mount
>  Create the original files
>  Dedupe large single byte file
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe large empty file
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe past maximum file size in dest file (should fail)
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe high offset to low offset
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe past source file EOF (should fail)
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe max size at nonzero offset (should fail)
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Dedupe with huge off/len (should fail)
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +FIDEDUPERANGE: Invalid argument
>  Check file creation
>  file3
>  7ffffffffffffffe:  61  a
> diff --git a/tests/generic/493.out b/tests/generic/493.out
> index d3426ee6..8bb71d3b 100644
> --- a/tests/generic/493.out
> +++ b/tests/generic/493.out
> @@ -2,6 +2,6 @@ QA output created by 493
>  Format and mount
>  Initialize file
>  Try to dedupe
> -XFS_IOC_FILE_EXTENT_SAME: Text file busy
> -XFS_IOC_FILE_EXTENT_SAME: Text file busy
> +FIDEDUPERANGE: Text file busy
> +FIDEDUPERANGE: Text file busy
>  Tear it down
> diff --git a/tests/generic/516.out b/tests/generic/516.out
> index 90308c49..53611b3b 100644
> --- a/tests/generic/516.out
> +++ b/tests/generic/516.out
> @@ -4,7 +4,7 @@ Create the original files
>  39578c21e2cb9f6049b1cf7fc7be12a6  TEST_DIR/test-516/file2
>  Files 1-2 do not match (intentional)
>  (partial) dedupe the middle blocks together
> -XFS_IOC_FILE_EXTENT_SAME: Extents did not match.
> +FIDEDUPERANGE: Extents did not match.
>  Compare sections
>  35ac8d7917305c385c30f3d82c30a8f6  TEST_DIR/test-516/file1
>  39578c21e2cb9f6049b1cf7fc7be12a6  TEST_DIR/test-516/file2
> diff --git a/tests/generic/518.out b/tests/generic/518.out
> index 726c2073..57ae9155 100644
> --- a/tests/generic/518.out
> +++ b/tests/generic/518.out
> @@ -3,7 +3,7 @@ wrote 262244/262244 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  wrote 1048576/1048576 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -XFS_IOC_CLONE_RANGE: Invalid argument
> +FICLONERANGE: Invalid argument
>  File content after failed reflink:
>  0000000 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5
>  *
> diff --git a/tests/xfs/319.out b/tests/xfs/319.out
> index 160f5fd2..25f1ed2e 100644
> --- a/tests/xfs/319.out
> +++ b/tests/xfs/319.out
> @@ -7,7 +7,7 @@ Check files
>  4155b81ac6d45c0182fa2bc03960f230  SCRATCH_MNT/file3
>  Inject error
>  Try to reflink
> -XFS_IOC_CLONE_RANGE: Input/output error
> +FICLONERANGE: Input/output error
>  FS should be shut down, touch will fail
>  touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
>  Remount to replay log
> diff --git a/tests/xfs/321.out b/tests/xfs/321.out
> index c0abd52b..59fd7b7b 100644
> --- a/tests/xfs/321.out
> +++ b/tests/xfs/321.out
> @@ -6,7 +6,7 @@ Check files
>  b5cfa9d6c8febd618f91ac2843d50a1c  SCRATCH_MNT/file3
>  Inject error
>  Try to reflink
> -XFS_IOC_CLONE_RANGE: Input/output error
> +FICLONERANGE: Input/output error
>  FS should be shut down, touch will fail
>  touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
>  Remount to replay log
> diff --git a/tests/xfs/322.out b/tests/xfs/322.out
> index b3fba5d0..695dd48b 100644
> --- a/tests/xfs/322.out
> +++ b/tests/xfs/322.out
> @@ -6,7 +6,7 @@ Check files
>  b5cfa9d6c8febd618f91ac2843d50a1c  SCRATCH_MNT/file3
>  Inject error
>  Try to reflink
> -XFS_IOC_CLONE_RANGE: Input/output error
> +FICLONERANGE: Input/output error
>  FS should be shut down, touch will fail
>  touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
>  Remount to replay log
> diff --git a/tests/xfs/323.out b/tests/xfs/323.out
> index 99b9688c..f7f36c05 100644
> --- a/tests/xfs/323.out
> +++ b/tests/xfs/323.out
> @@ -6,7 +6,7 @@ Check files
>  4155b81ac6d45c0182fa2bc03960f230  SCRATCH_MNT/file3
>  Inject error
>  Try to reflink
> -XFS_IOC_CLONE_RANGE: Input/output error
> +FICLONERANGE: Input/output error
>  FS should be shut down, touch will fail
>  touch: cannot touch 'SCRATCH_MNT/badfs': Input/output error
>  Remount to replay log
> -- 
> 2.43.0
> 
> 

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

end of thread, other threads:[~2024-08-21 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  9:02 [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dudupe IO commands liuhuan01
2024-08-09 15:04 ` Darrick J. Wong
2024-08-17  6:48   ` [PATCH] xfs_io: use FICLONE/FICLONERANGE/FIDEDUPERANGE for reflink/dedupe " liuhuan01
2024-08-17  6:50   ` [PATCH] xfs: use FICLONE/FICLONERANGE/FIDEDUPERANGE for test cases liuhuan01
2024-08-21 17:14     ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox