linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
	Brian Foster <bfoster@redhat.com>
Subject: [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE
Date: Thu, 3 Oct 2024 14:37:14 -0700	[thread overview]
Message-ID: <20241003213714.GH21840@frogsfrogsfrogs> (raw)
In-Reply-To: <172780126017.3586479.18209378224774919872.stgit@frogsfrogsfrogs>

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)
 {

  parent reply	other threads:[~2024-10-03 21:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Darrick J. Wong [this message]
2024-10-07 13:18   ` [PATCH] fsstress: add support for FALLOC_FL_UNSHARE_RANGE Brian Foster
2024-10-11  5:13   ` Zorro Lang
2024-10-11  5:21     ` Zorro Lang
2024-10-11 16:08       ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241003213714.GH21840@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).