diff mbox series

fsstress: add support for FALLOC_FL_UNSHARE_RANGE

Message ID 20241003213714.GH21840@frogsfrogsfrogs (mailing list archive)
State Not Applicable, archived
Headers show
Series fsstress: add support for FALLOC_FL_UNSHARE_RANGE | expand

Commit Message

Darrick J. Wong Oct. 3, 2024, 9:37 p.m. UTC
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(+)

Comments

Brian Foster Oct. 7, 2024, 1:18 p.m. UTC | #1
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)
>  {
>
Zorro Lang Oct. 11, 2024, 5:13 a.m. UTC | #2
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)
>  {
>
Zorro Lang Oct. 11, 2024, 5:21 a.m. UTC | #3
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)
> >  {
> >
Darrick J. Wong Oct. 11, 2024, 4:08 p.m. UTC | #4
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)
> > >  {
> > > 
> 
>
diff mbox series

Patch

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