linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET v31.1 2/2] fstests: atomic file content commits
@ 2024-10-01 16:48 Darrick J. Wong
  2024-10-01 16:49 ` [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-01 16:48 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, linux-xfs

Hi all,

This series creates XFS_IOC_START_COMMIT and XFS_IOC_COMMIT_RANGE ioctls
to perform the exchange only if the target file has not been changed
since a given sampling point.

This new functionality uses the mechanism underlying EXCHANGE_RANGE to
stage and commit file updates such that reader programs will see either
the old contents or the new contents in their entirety, with no chance
of torn writes.  A successful call completion guarantees that the new
contents will be seen even if the system fails.  The pair of ioctls
allows userspace to perform what amounts to a compare and exchange
operation on entire file contents.

Note that there are ongoing arguments in the community about how best to
implement some sort of file data write counter that nfsd could also use
to signal invalidations to clients.  Until such a thing is implemented,
this patch will rely on ctime/mtime updates.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been running on the djcloud for months with no problems.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=atomic-file-commits

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=atomic-file-commits

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=atomic-file-commits
---
Commits in this patchset:
 * src/fiexchange.h: add the start-commit/commit-range ioctls
 * xfs/122: add tests for commitrange structures
---
 m4/package_xfslibs.m4 |    2 ++
 src/fiexchange.h      |   26 ++++++++++++++++++++++++++
 src/global.h          |    4 ++++
 tests/xfs/122.out     |    1 +
 4 files changed, 33 insertions(+)


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

* [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls
  2024-10-01 16:48 [PATCHSET v31.1 2/2] fstests: atomic file content commits Darrick J. Wong
@ 2024-10-01 16:49 ` Darrick J. Wong
  2024-10-02  5:45   ` Christoph Hellwig
  2024-10-01 16:49 ` [PATCH 2/2] xfs/122: add tests for commitrange structures Darrick J. Wong
  2024-10-03 21:37 ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Darrick J. Wong
  2 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-01 16:49 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Add these two ioctls as well, since they're a part of the file content
exchange functionality.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 m4/package_xfslibs.m4 |    2 ++
 src/fiexchange.h      |   26 ++++++++++++++++++++++++++
 src/global.h          |    4 ++++
 3 files changed, 32 insertions(+)


diff --git a/m4/package_xfslibs.m4 b/m4/package_xfslibs.m4
index 5604989e34..ec7b91986c 100644
--- a/m4/package_xfslibs.m4
+++ b/m4/package_xfslibs.m4
@@ -100,7 +100,9 @@ AC_DEFUN([AC_NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE],
 #include <xfs/xfs.h>
     ]], [[
          struct xfs_exchange_range obj;
+         struct xfs_commit_range obj2;
          ioctl(-1, XFS_IOC_EXCHANGE_RANGE, &obj);
+         ioctl(-1, XFS_IOC_COMMIT_RANGE, &obj2);
     ]])],[AC_MSG_RESULT(yes)],
          [need_internal_xfs_ioc_exchange_range=yes
           AC_MSG_RESULT(no)])
diff --git a/src/fiexchange.h b/src/fiexchange.h
index 02eb0027d1..b9eb2a7e26 100644
--- a/src/fiexchange.h
+++ b/src/fiexchange.h
@@ -26,6 +26,30 @@ struct xfs_exchange_range {
 	__u64		flags;		/* see XFS_EXCHANGE_RANGE_* below */
 };
 
+/*
+ * Using the same definition of file2 as struct xfs_exchange_range, commit the
+ * contents of file1 into file2 if file2 has the same inode number, mtime, and
+ * ctime as the arguments provided to the call.  The old contents of file2 will
+ * be moved to file1.
+ *
+ * Returns -EBUSY if there isn't an exact match for the file2 fields.
+ *
+ * Filesystems must be able to restart and complete the operation even after
+ * the system goes down.
+ */
+struct xfs_commit_range {
+	__s32		file1_fd;
+	__u32		pad;		/* must be zeroes */
+	__u64		file1_offset;	/* file1 offset, bytes */
+	__u64		file2_offset;	/* file2 offset, bytes */
+	__u64		length;		/* bytes to exchange */
+
+	__u64		flags;		/* see XFS_EXCHANGE_RANGE_* below */
+
+	/* opaque file2 metadata for freshness checks */
+	__u64		file2_freshness[5];
+};
+
 /*
  * Exchange file data all the way to the ends of both files, and then exchange
  * the file sizes.  This flag can be used to replace a file's contents with a
@@ -53,5 +77,7 @@ struct xfs_exchange_range {
 					 XFS_EXCHANGE_RANGE_FILE1_WRITTEN)
 
 #define XFS_IOC_EXCHANGE_RANGE	     _IOW ('X', 129, struct xfs_exchange_range)
+#define XFS_IOC_START_COMMIT	     _IOR ('X', 130, struct xfs_commit_range)
+#define XFS_IOC_COMMIT_RANGE	     _IOW ('X', 131, struct xfs_commit_range)
 
 #endif /* _LINUX_FIEXCHANGE_H */
diff --git a/src/global.h b/src/global.h
index fc48d82e03..fbc0a0b5e1 100644
--- a/src/global.h
+++ b/src/global.h
@@ -12,6 +12,7 @@
 #ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
 /* Override struct xfs_exchange_range in xfslibs */
 # define xfs_exchange_range		sys_xfs_exchange_range
+# define xfs_commit_range		sys_xfs_commit_range
 #endif
 
 #ifdef HAVE_XFS_XFS_H
@@ -20,7 +21,10 @@
 
 #ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
 # undef xfs_exchange_range
+# undef xfs_commit_range
 # undef XFS_IOC_EXCHANGE_RANGE
+# undef XFS_IOC_START_COMMIT
+# undef XFS_IOC_COMMIT_RANGE
 #endif
 
 #ifdef HAVE_XFS_LIBXFS_H


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

* [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-01 16:48 [PATCHSET v31.1 2/2] fstests: atomic file content commits Darrick J. Wong
  2024-10-01 16:49 ` [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls Darrick J. Wong
@ 2024-10-01 16:49 ` Darrick J. Wong
  2024-10-02  5:45   ` Christoph Hellwig
  2024-10-03 21:37 ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Darrick J. Wong
  2 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-01 16:49 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/122.out |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 60d8294551..4dc7d7d0a3 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -76,6 +76,7 @@ sizeof(struct xfs_bulk_ireq) = 64
 sizeof(struct xfs_bulkstat) = 192
 sizeof(struct xfs_bulkstat_req) = 64
 sizeof(struct xfs_clone_args) = 32
+sizeof(struct xfs_commit_range) = 88
 sizeof(struct xfs_cud_log_format) = 16
 sizeof(struct xfs_cui_log_format) = 16
 sizeof(struct xfs_da3_blkinfo) = 56


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

* Re: [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls
  2024-10-01 16:49 ` [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls Darrick J. Wong
@ 2024-10-02  5:45   ` Christoph Hellwig
  0 siblings, 0 replies; 15+ messages in thread
From: Christoph Hellwig @ 2024-10-02  5:45 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-01 16:49 ` [PATCH 2/2] xfs/122: add tests for commitrange structures Darrick J. Wong
@ 2024-10-02  5:45   ` Christoph Hellwig
  2024-10-02 22:47     ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2024-10-02  5:45 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

On Tue, Oct 01, 2024 at 09:49:27AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.

Meh.  Can we please not add more to xfs/122, as that's alway just
a pain?  We can just static_assert the size in xfsprogs (or the
xfstests code using it) instead of this mess.


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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-02  5:45   ` Christoph Hellwig
@ 2024-10-02 22:47     ` Darrick J. Wong
  2024-10-03 12:10       ` Christoph Hellwig
  2024-10-11  6:28       ` Zorro Lang
  0 siblings, 2 replies; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-02 22:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs

On Tue, Oct 01, 2024 at 10:45:50PM -0700, Christoph Hellwig wrote:
> On Tue, Oct 01, 2024 at 09:49:27AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.
> 
> Meh.  Can we please not add more to xfs/122, as that's alway just
> a pain?  We can just static_assert the size in xfsprogs (or the
> xfstests code using it) instead of this mess.

Oh right, we had a plan to autotranslate the xfs/122 stuff to
xfs_ondisk.h didn't we... I'll put that back on my list.

--D

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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-02 22:47     ` Darrick J. Wong
@ 2024-10-03 12:10       ` Christoph Hellwig
  2024-10-11  6:28       ` Zorro Lang
  1 sibling, 0 replies; 15+ messages in thread
From: Christoph Hellwig @ 2024-10-03 12:10 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, linux-xfs

On Wed, Oct 02, 2024 at 03:47:00PM -0700, Darrick J. Wong wrote:
> Oh right, we had a plan to autotranslate the xfs/122 stuff to
> xfs_ondisk.h didn't we... I'll put that back on my list.

xfs_ondisk.h should be fully covered.  You pointed out that were
are missing ioctls, though.  Let me find some time to add those
as well.


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

* [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
  2024-10-01 16:48 [PATCHSET v31.1 2/2] fstests: atomic file content commits Darrick J. Wong
  2024-10-01 16:49 ` [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls Darrick J. Wong
  2024-10-01 16:49 ` [PATCH 2/2] xfs/122: add tests for commitrange structures Darrick J. Wong
@ 2024-10-03 21:37 ` Darrick J. Wong
  2024-10-07 13:18   ` Brian Foster
  2024-10-11  5:13   ` Zorro Lang
  2 siblings, 2 replies; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-03 21:37 UTC (permalink / raw)
  To: zlang; +Cc: fstests, linux-xfs, Brian Foster

From: Darrick J. Wong <djwong@kernel.org>

Teach fsstress to try to unshare file blocks on filesystems, seeing how
the recent addition to fsx has uncovered a lot of bugs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 ltp/fsstress.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index b8d025d3a0..8cd45c7a85 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -139,6 +139,7 @@ typedef enum {
 	OP_TRUNCATE,
 	OP_UNLINK,
 	OP_UNRESVSP,
+	OP_UNSHARE,
 	OP_URING_READ,
 	OP_URING_WRITE,
 	OP_WRITE,
@@ -246,6 +247,7 @@ void	punch_f(opnum_t, long);
 void	zero_f(opnum_t, long);
 void	collapse_f(opnum_t, long);
 void	insert_f(opnum_t, long);
+void	unshare_f(opnum_t, long);
 void	read_f(opnum_t, long);
 void	readlink_f(opnum_t, long);
 void	readv_f(opnum_t, long);
@@ -339,6 +341,7 @@ struct opdesc	ops[OP_LAST]	= {
 	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
 	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
 	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
+	[OP_UNSHARE]	   = {"unshare",       unshare_f,	1, 1 },
 	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
 	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
 	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
@@ -3767,6 +3770,7 @@ struct print_flags falloc_flags [] = {
 	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
 	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
 	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
+	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
 	{ -1, NULL}
 };
 
@@ -4469,6 +4473,16 @@ insert_f(opnum_t opno, long r)
 #endif
 }
 
+void
+unshare_f(opnum_t opno, long r)
+{
+#ifdef HAVE_LINUX_FALLOC_H
+# ifdef FALLOC_FL_UNSHARE_RANGE
+	do_fallocate(opno, r, FALLOC_FL_UNSHARE_RANGE);
+# endif
+#endif
+}
+
 void
 read_f(opnum_t opno, long r)
 {

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

* Re: [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
  2024-10-03 21:37 ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Darrick J. Wong
@ 2024-10-07 13:18   ` Brian Foster
  2024-10-11  5:13   ` Zorro Lang
  1 sibling, 0 replies; 15+ messages in thread
From: Brian Foster @ 2024-10-07 13:18 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

On Thu, Oct 03, 2024 at 02:37:14PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Teach fsstress to try to unshare file blocks on filesystems, seeing how
> the recent addition to fsx has uncovered a lot of bugs.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

LGTM. Thanks for sending this:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  ltp/fsstress.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index b8d025d3a0..8cd45c7a85 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -139,6 +139,7 @@ typedef enum {
>  	OP_TRUNCATE,
>  	OP_UNLINK,
>  	OP_UNRESVSP,
> +	OP_UNSHARE,
>  	OP_URING_READ,
>  	OP_URING_WRITE,
>  	OP_WRITE,
> @@ -246,6 +247,7 @@ void	punch_f(opnum_t, long);
>  void	zero_f(opnum_t, long);
>  void	collapse_f(opnum_t, long);
>  void	insert_f(opnum_t, long);
> +void	unshare_f(opnum_t, long);
>  void	read_f(opnum_t, long);
>  void	readlink_f(opnum_t, long);
>  void	readv_f(opnum_t, long);
> @@ -339,6 +341,7 @@ struct opdesc	ops[OP_LAST]	= {
>  	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
>  	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
>  	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
> +	[OP_UNSHARE]	   = {"unshare",       unshare_f,	1, 1 },
>  	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
>  	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
>  	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
> @@ -3767,6 +3770,7 @@ struct print_flags falloc_flags [] = {
>  	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
>  	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
>  	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
> +	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
>  	{ -1, NULL}
>  };
>  
> @@ -4469,6 +4473,16 @@ insert_f(opnum_t opno, long r)
>  #endif
>  }
>  
> +void
> +unshare_f(opnum_t opno, long r)
> +{
> +#ifdef HAVE_LINUX_FALLOC_H
> +# ifdef FALLOC_FL_UNSHARE_RANGE
> +	do_fallocate(opno, r, FALLOC_FL_UNSHARE_RANGE);
> +# endif
> +#endif
> +}
> +
>  void
>  read_f(opnum_t opno, long r)
>  {
> 


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

* Re: [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
  2024-10-03 21:37 ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Darrick J. Wong
  2024-10-07 13:18   ` Brian Foster
@ 2024-10-11  5:13   ` Zorro Lang
  2024-10-11  5:21     ` Zorro Lang
  1 sibling, 1 reply; 15+ messages in thread
From: Zorro Lang @ 2024-10-11  5:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs, Brian Foster

On Thu, Oct 03, 2024 at 02:37:14PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Teach fsstress to try to unshare file blocks on filesystems, seeing how
> the recent addition to fsx has uncovered a lot of bugs.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Thanks for this new test coverage on fsstress. Although it's conflict with
current for-next branch, I've merged it manually, don't need one more
version :)

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  ltp/fsstress.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> index b8d025d3a0..8cd45c7a85 100644
> --- a/ltp/fsstress.c
> +++ b/ltp/fsstress.c
> @@ -139,6 +139,7 @@ typedef enum {
>  	OP_TRUNCATE,
>  	OP_UNLINK,
>  	OP_UNRESVSP,
> +	OP_UNSHARE,
>  	OP_URING_READ,
>  	OP_URING_WRITE,
>  	OP_WRITE,
> @@ -246,6 +247,7 @@ void	punch_f(opnum_t, long);
>  void	zero_f(opnum_t, long);
>  void	collapse_f(opnum_t, long);
>  void	insert_f(opnum_t, long);
> +void	unshare_f(opnum_t, long);
>  void	read_f(opnum_t, long);
>  void	readlink_f(opnum_t, long);
>  void	readv_f(opnum_t, long);
> @@ -339,6 +341,7 @@ struct opdesc	ops[OP_LAST]	= {
>  	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
>  	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
>  	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
> +	[OP_UNSHARE]	   = {"unshare",       unshare_f,	1, 1 },
>  	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
>  	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
>  	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
> @@ -3767,6 +3770,7 @@ struct print_flags falloc_flags [] = {
>  	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
>  	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
>  	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
> +	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
>  	{ -1, NULL}
>  };
>  
> @@ -4469,6 +4473,16 @@ insert_f(opnum_t opno, long r)
>  #endif
>  }
>  
> +void
> +unshare_f(opnum_t opno, long r)
> +{
> +#ifdef HAVE_LINUX_FALLOC_H
> +# ifdef FALLOC_FL_UNSHARE_RANGE
> +	do_fallocate(opno, r, FALLOC_FL_UNSHARE_RANGE);
> +# endif
> +#endif
> +}
> +
>  void
>  read_f(opnum_t opno, long r)
>  {
> 


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

* Re: [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
  2024-10-11  5:13   ` Zorro Lang
@ 2024-10-11  5:21     ` Zorro Lang
  2024-10-11 16:08       ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Zorro Lang @ 2024-10-11  5:21 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs, Brian Foster

On Fri, Oct 11, 2024 at 01:13:56PM +0800, Zorro Lang wrote:
> On Thu, Oct 03, 2024 at 02:37:14PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Teach fsstress to try to unshare file blocks on filesystems, seeing how
> > the recent addition to fsx has uncovered a lot of bugs.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> 
> Thanks for this new test coverage on fsstress. Although it's conflict with
> current for-next branch, I've merged it manually, don't need one more
> version :)
> 
> Reviewed-by: Zorro Lang <zlang@redhat.com>

And...

I'm not sure why this patch is contained in this patchset:
[PATCHSET v31.1 2/2] fstests: atomic file content commits

As that patchset still need change, I'll merge this patch singly this week.

Thanks,
Zorro

> 
> >  ltp/fsstress.c |   14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> > index b8d025d3a0..8cd45c7a85 100644
> > --- a/ltp/fsstress.c
> > +++ b/ltp/fsstress.c
> > @@ -139,6 +139,7 @@ typedef enum {
> >  	OP_TRUNCATE,
> >  	OP_UNLINK,
> >  	OP_UNRESVSP,
> > +	OP_UNSHARE,
> >  	OP_URING_READ,
> >  	OP_URING_WRITE,
> >  	OP_WRITE,
> > @@ -246,6 +247,7 @@ void	punch_f(opnum_t, long);
> >  void	zero_f(opnum_t, long);
> >  void	collapse_f(opnum_t, long);
> >  void	insert_f(opnum_t, long);
> > +void	unshare_f(opnum_t, long);
> >  void	read_f(opnum_t, long);
> >  void	readlink_f(opnum_t, long);
> >  void	readv_f(opnum_t, long);
> > @@ -339,6 +341,7 @@ struct opdesc	ops[OP_LAST]	= {
> >  	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
> >  	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
> >  	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
> > +	[OP_UNSHARE]	   = {"unshare",       unshare_f,	1, 1 },
> >  	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
> >  	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
> >  	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
> > @@ -3767,6 +3770,7 @@ struct print_flags falloc_flags [] = {
> >  	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
> >  	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
> >  	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
> > +	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
> >  	{ -1, NULL}
> >  };
> >  
> > @@ -4469,6 +4473,16 @@ insert_f(opnum_t opno, long r)
> >  #endif
> >  }
> >  
> > +void
> > +unshare_f(opnum_t opno, long r)
> > +{
> > +#ifdef HAVE_LINUX_FALLOC_H
> > +# ifdef FALLOC_FL_UNSHARE_RANGE
> > +	do_fallocate(opno, r, FALLOC_FL_UNSHARE_RANGE);
> > +# endif
> > +#endif
> > +}
> > +
> >  void
> >  read_f(opnum_t opno, long r)
> >  {
> > 


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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-02 22:47     ` Darrick J. Wong
  2024-10-03 12:10       ` Christoph Hellwig
@ 2024-10-11  6:28       ` Zorro Lang
  2024-10-11 18:19         ` Darrick J. Wong
  1 sibling, 1 reply; 15+ messages in thread
From: Zorro Lang @ 2024-10-11  6:28 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, fstests, linux-xfs

On Wed, Oct 02, 2024 at 03:47:00PM -0700, Darrick J. Wong wrote:
> On Tue, Oct 01, 2024 at 10:45:50PM -0700, Christoph Hellwig wrote:
> > On Tue, Oct 01, 2024 at 09:49:27AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.
> > 
> > Meh.  Can we please not add more to xfs/122, as that's alway just
> > a pain?  We can just static_assert the size in xfsprogs (or the
> > xfstests code using it) instead of this mess.
> 
> Oh right, we had a plan to autotranslate the xfs/122 stuff to
> xfs_ondisk.h didn't we... I'll put that back on my list.

Hi Darrick,

Do you want to have this patch at first, or just wait for your
next version which does the "autotranslate"?

Thanks,
Zorro

> 
> --D
> 


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

* Re: [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
  2024-10-11  5:21     ` Zorro Lang
@ 2024-10-11 16:08       ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-11 16:08 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests, linux-xfs, Brian Foster

On Fri, Oct 11, 2024 at 01:21:33PM +0800, Zorro Lang wrote:
> On Fri, Oct 11, 2024 at 01:13:56PM +0800, Zorro Lang wrote:
> > On Thu, Oct 03, 2024 at 02:37:14PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Teach fsstress to try to unshare file blocks on filesystems, seeing how
> > > the recent addition to fsx has uncovered a lot of bugs.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > 
> > Thanks for this new test coverage on fsstress. Although it's conflict with
> > current for-next branch, I've merged it manually, don't need one more
> > version :)
> > 
> > Reviewed-by: Zorro Lang <zlang@redhat.com>
> 
> And...
> 
> I'm not sure why this patch is contained in this patchset:
> [PATCHSET v31.1 2/2] fstests: atomic file content commits

I hit reply-all to get the same to/cc list and forgot to strip out the
in-reply-to header. :(

> As that patchset still need change, I'll merge this patch singly this week.

Thanks. :)

--D

> Thanks,
> Zorro
> 
> > 
> > >  ltp/fsstress.c |   14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > > 
> > > diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> > > index b8d025d3a0..8cd45c7a85 100644
> > > --- a/ltp/fsstress.c
> > > +++ b/ltp/fsstress.c
> > > @@ -139,6 +139,7 @@ typedef enum {
> > >  	OP_TRUNCATE,
> > >  	OP_UNLINK,
> > >  	OP_UNRESVSP,
> > > +	OP_UNSHARE,
> > >  	OP_URING_READ,
> > >  	OP_URING_WRITE,
> > >  	OP_WRITE,
> > > @@ -246,6 +247,7 @@ void	punch_f(opnum_t, long);
> > >  void	zero_f(opnum_t, long);
> > >  void	collapse_f(opnum_t, long);
> > >  void	insert_f(opnum_t, long);
> > > +void	unshare_f(opnum_t, long);
> > >  void	read_f(opnum_t, long);
> > >  void	readlink_f(opnum_t, long);
> > >  void	readv_f(opnum_t, long);
> > > @@ -339,6 +341,7 @@ struct opdesc	ops[OP_LAST]	= {
> > >  	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
> > >  	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
> > >  	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
> > > +	[OP_UNSHARE]	   = {"unshare",       unshare_f,	1, 1 },
> > >  	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
> > >  	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
> > >  	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
> > > @@ -3767,6 +3770,7 @@ struct print_flags falloc_flags [] = {
> > >  	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
> > >  	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
> > >  	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
> > > +	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
> > >  	{ -1, NULL}
> > >  };
> > >  
> > > @@ -4469,6 +4473,16 @@ insert_f(opnum_t opno, long r)
> > >  #endif
> > >  }
> > >  
> > > +void
> > > +unshare_f(opnum_t opno, long r)
> > > +{
> > > +#ifdef HAVE_LINUX_FALLOC_H
> > > +# ifdef FALLOC_FL_UNSHARE_RANGE
> > > +	do_fallocate(opno, r, FALLOC_FL_UNSHARE_RANGE);
> > > +# endif
> > > +#endif
> > > +}
> > > +
> > >  void
> > >  read_f(opnum_t opno, long r)
> > >  {
> > > 
> 
> 

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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-11  6:28       ` Zorro Lang
@ 2024-10-11 18:19         ` Darrick J. Wong
  2024-10-12 14:05           ` Zorro Lang
  0 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2024-10-11 18:19 UTC (permalink / raw)
  To: Zorro Lang; +Cc: Christoph Hellwig, fstests, linux-xfs

On Fri, Oct 11, 2024 at 02:28:58PM +0800, Zorro Lang wrote:
> On Wed, Oct 02, 2024 at 03:47:00PM -0700, Darrick J. Wong wrote:
> > On Tue, Oct 01, 2024 at 10:45:50PM -0700, Christoph Hellwig wrote:
> > > On Tue, Oct 01, 2024 at 09:49:27AM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.
> > > 
> > > Meh.  Can we please not add more to xfs/122, as that's alway just
> > > a pain?  We can just static_assert the size in xfsprogs (or the
> > > xfstests code using it) instead of this mess.
> > 
> > Oh right, we had a plan to autotranslate the xfs/122 stuff to
> > xfs_ondisk.h didn't we... I'll put that back on my list.
> 
> Hi Darrick,
> 
> Do you want to have this patch at first, or just wait for your
> next version which does the "autotranslate"?

Let's drop this for now, machine-converting xfs/122 to xfs_ondisk.h
wasn't as hard as I thought it might be.  Would you be ok with merging
the fiexchange.h patch and the fsstress funshare patch this week?

--D

> Thanks,
> Zorro
> 
> > 
> > --D
> > 
> 
> 

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

* Re: [PATCH 2/2] xfs/122: add tests for commitrange structures
  2024-10-11 18:19         ` Darrick J. Wong
@ 2024-10-12 14:05           ` Zorro Lang
  0 siblings, 0 replies; 15+ messages in thread
From: Zorro Lang @ 2024-10-12 14:05 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, fstests, linux-xfs

On Fri, Oct 11, 2024 at 11:19:20AM -0700, Darrick J. Wong wrote:
> On Fri, Oct 11, 2024 at 02:28:58PM +0800, Zorro Lang wrote:
> > On Wed, Oct 02, 2024 at 03:47:00PM -0700, Darrick J. Wong wrote:
> > > On Tue, Oct 01, 2024 at 10:45:50PM -0700, Christoph Hellwig wrote:
> > > > On Tue, Oct 01, 2024 at 09:49:27AM -0700, Darrick J. Wong wrote:
> > > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > > 
> > > > > Update this test to check the ioctl structure for XFS_IOC_COMMIT_RANGE.
> > > > 
> > > > Meh.  Can we please not add more to xfs/122, as that's alway just
> > > > a pain?  We can just static_assert the size in xfsprogs (or the
> > > > xfstests code using it) instead of this mess.
> > > 
> > > Oh right, we had a plan to autotranslate the xfs/122 stuff to
> > > xfs_ondisk.h didn't we... I'll put that back on my list.
> > 
> > Hi Darrick,
> > 
> > Do you want to have this patch at first, or just wait for your
> > next version which does the "autotranslate"?
> 
> Let's drop this for now, machine-converting xfs/122 to xfs_ondisk.h
> wasn't as hard as I thought it might be.  Would you be ok with merging
> the fiexchange.h patch and the fsstress funshare patch this week?

Sure, if you hope so :)

> 
> --D
> 
> > Thanks,
> > Zorro
> > 
> > > 
> > > --D
> > > 
> > 
> > 
> 


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

end of thread, other threads:[~2024-10-12 14:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 16:48 [PATCHSET v31.1 2/2] fstests: atomic file content commits Darrick J. Wong
2024-10-01 16:49 ` [PATCH 1/2] src/fiexchange.h: add the start-commit/commit-range ioctls Darrick J. Wong
2024-10-02  5:45   ` Christoph Hellwig
2024-10-01 16:49 ` [PATCH 2/2] xfs/122: add tests for commitrange structures Darrick J. Wong
2024-10-02  5:45   ` Christoph Hellwig
2024-10-02 22:47     ` Darrick J. Wong
2024-10-03 12:10       ` Christoph Hellwig
2024-10-11  6:28       ` Zorro Lang
2024-10-11 18:19         ` Darrick J. Wong
2024-10-12 14:05           ` Zorro Lang
2024-10-03 21:37 ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Darrick J. Wong
2024-10-07 13:18   ` Brian Foster
2024-10-11  5:13   ` Zorro Lang
2024-10-11  5:21     ` Zorro Lang
2024-10-11 16:08       ` 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;
as well as URLs for NNTP newsgroup(s).