* [PATCH v1] xfs_io: add RWF_ATOMIC support to pwrite
@ 2024-10-01 18:28 Catherine Hoang
2024-10-02 1:01 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Catherine Hoang @ 2024-10-01 18:28 UTC (permalink / raw)
To: linux-xfs
Enable testing write behavior with the per-io RWF_ATOMIC flag.
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
include/linux.h | 5 +++++
io/pwrite.c | 8 ++++++--
man/man8/xfs_io.8 | 8 +++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/include/linux.h b/include/linux.h
index a13072d2..e9eb7bfb 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -231,6 +231,11 @@ struct fsxattr {
#define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
#endif
+/* Atomic Write */
+#ifndef RWF_ATOMIC
+#define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
+#endif
+
/*
* Reminder: anything added to this file will be compiled into downstream
* userspace projects!
diff --git a/io/pwrite.c b/io/pwrite.c
index a88cecc7..fab59be4 100644
--- a/io/pwrite.c
+++ b/io/pwrite.c
@@ -44,6 +44,7 @@ pwrite_help(void)
#ifdef HAVE_PWRITEV2
" -N -- Perform the pwritev2() with RWF_NOWAIT\n"
" -D -- Perform the pwritev2() with RWF_DSYNC\n"
+" -A -- Perform the pwritev2() with RWF_ATOMIC\n"
#endif
"\n"));
}
@@ -284,7 +285,7 @@ pwrite_f(
init_cvtnum(&fsblocksize, &fssectsize);
bsize = fsblocksize;
- while ((c = getopt(argc, argv, "b:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
+ while ((c = getopt(argc, argv, "Ab:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
switch (c) {
case 'b':
tmp = cvtnum(fsblocksize, fssectsize, optarg);
@@ -324,6 +325,9 @@ pwrite_f(
case 'D':
pwritev2_flags |= RWF_DSYNC;
break;
+ case 'A':
+ pwritev2_flags |= RWF_ATOMIC;
+ break;
#endif
case 's':
skip = cvtnum(fsblocksize, fssectsize, optarg);
@@ -476,7 +480,7 @@ pwrite_init(void)
pwrite_cmd.argmax = -1;
pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
pwrite_cmd.args =
-_("[-i infile [-qdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
+_("[-i infile [-qAdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
pwrite_cmd.oneline =
_("writes a number of bytes at a specified offset");
pwrite_cmd.help = pwrite_help;
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 303c6447..1e790139 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -244,7 +244,7 @@ See the
.B pread
command.
.TP
-.BI "pwrite [ \-i " file " ] [ \-qdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
+.BI "pwrite [ \-i " file " ] [ \-qAdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
Writes a range of bytes in a specified blocksize from the given
.IR offset .
The bytes written can be either a set pattern or read in from another
@@ -281,6 +281,12 @@ Perform the
call with
.IR RWF_DSYNC .
.TP
+.B \-A
+Perform the
+.BR pwritev2 (2)
+call with
+.IR RWF_ATOMIC .
+.TP
.B \-O
perform pwrite once and return the (maybe partial) bytes written.
.TP
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] xfs_io: add RWF_ATOMIC support to pwrite
2024-10-01 18:28 [PATCH v1] xfs_io: add RWF_ATOMIC support to pwrite Catherine Hoang
@ 2024-10-02 1:01 ` Darrick J. Wong
2024-10-02 7:06 ` John Garry
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2024-10-02 1:01 UTC (permalink / raw)
To: Catherine Hoang; +Cc: linux-xfs
On Tue, Oct 01, 2024 at 11:28:49AM -0700, Catherine Hoang wrote:
> Enable testing write behavior with the per-io RWF_ATOMIC flag.
>
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Looks ok, though are there testcases for us to look at as well?
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> include/linux.h | 5 +++++
> io/pwrite.c | 8 ++++++--
> man/man8/xfs_io.8 | 8 +++++++-
> 3 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux.h b/include/linux.h
> index a13072d2..e9eb7bfb 100644
> --- a/include/linux.h
> +++ b/include/linux.h
> @@ -231,6 +231,11 @@ struct fsxattr {
> #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
> #endif
>
> +/* Atomic Write */
> +#ifndef RWF_ATOMIC
> +#define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
> +#endif
> +
> /*
> * Reminder: anything added to this file will be compiled into downstream
> * userspace projects!
> diff --git a/io/pwrite.c b/io/pwrite.c
> index a88cecc7..fab59be4 100644
> --- a/io/pwrite.c
> +++ b/io/pwrite.c
> @@ -44,6 +44,7 @@ pwrite_help(void)
> #ifdef HAVE_PWRITEV2
> " -N -- Perform the pwritev2() with RWF_NOWAIT\n"
> " -D -- Perform the pwritev2() with RWF_DSYNC\n"
> +" -A -- Perform the pwritev2() with RWF_ATOMIC\n"
> #endif
> "\n"));
> }
> @@ -284,7 +285,7 @@ pwrite_f(
> init_cvtnum(&fsblocksize, &fssectsize);
> bsize = fsblocksize;
>
> - while ((c = getopt(argc, argv, "b:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
> + while ((c = getopt(argc, argv, "Ab:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
> switch (c) {
> case 'b':
> tmp = cvtnum(fsblocksize, fssectsize, optarg);
> @@ -324,6 +325,9 @@ pwrite_f(
> case 'D':
> pwritev2_flags |= RWF_DSYNC;
> break;
> + case 'A':
> + pwritev2_flags |= RWF_ATOMIC;
> + break;
> #endif
> case 's':
> skip = cvtnum(fsblocksize, fssectsize, optarg);
> @@ -476,7 +480,7 @@ pwrite_init(void)
> pwrite_cmd.argmax = -1;
> pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
> pwrite_cmd.args =
> -_("[-i infile [-qdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
> +_("[-i infile [-qAdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
> pwrite_cmd.oneline =
> _("writes a number of bytes at a specified offset");
> pwrite_cmd.help = pwrite_help;
> diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
> index 303c6447..1e790139 100644
> --- a/man/man8/xfs_io.8
> +++ b/man/man8/xfs_io.8
> @@ -244,7 +244,7 @@ See the
> .B pread
> command.
> .TP
> -.BI "pwrite [ \-i " file " ] [ \-qdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
> +.BI "pwrite [ \-i " file " ] [ \-qAdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
> Writes a range of bytes in a specified blocksize from the given
> .IR offset .
> The bytes written can be either a set pattern or read in from another
> @@ -281,6 +281,12 @@ Perform the
> call with
> .IR RWF_DSYNC .
> .TP
> +.B \-A
> +Perform the
> +.BR pwritev2 (2)
> +call with
> +.IR RWF_ATOMIC .
> +.TP
> .B \-O
> perform pwrite once and return the (maybe partial) bytes written.
> .TP
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] xfs_io: add RWF_ATOMIC support to pwrite
2024-10-02 1:01 ` Darrick J. Wong
@ 2024-10-02 7:06 ` John Garry
0 siblings, 0 replies; 3+ messages in thread
From: John Garry @ 2024-10-02 7:06 UTC (permalink / raw)
To: Darrick J. Wong, Catherine Hoang; +Cc: linux-xfs
On 02/10/2024 02:01, Darrick J. Wong wrote:
> On Tue, Oct 01, 2024 at 11:28:49AM -0700, Catherine Hoang wrote:
>> Enable testing write behavior with the per-io RWF_ATOMIC flag.
>>
>> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
>
> Looks ok, though are there testcases for us to look at as well?
Since we are now decoupling forcealign from atomic writes, those test
cases will require some rewriting.
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
>
> --D
>
>> ---
>> include/linux.h | 5 +++++
>> io/pwrite.c | 8 ++++++--
>> man/man8/xfs_io.8 | 8 +++++++-
>> 3 files changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux.h b/include/linux.h
>> index a13072d2..e9eb7bfb 100644
>> --- a/include/linux.h
>> +++ b/include/linux.h
>> @@ -231,6 +231,11 @@ struct fsxattr {
>> #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
>> #endif
>>
>> +/* Atomic Write */
>> +#ifndef RWF_ATOMIC
>> +#define RWF_ATOMIC ((__kernel_rwf_t)0x00000040)
>> +#endif
>> +
>> /*
>> * Reminder: anything added to this file will be compiled into downstream
>> * userspace projects!
>> diff --git a/io/pwrite.c b/io/pwrite.c
>> index a88cecc7..fab59be4 100644
>> --- a/io/pwrite.c
>> +++ b/io/pwrite.c
>> @@ -44,6 +44,7 @@ pwrite_help(void)
>> #ifdef HAVE_PWRITEV2
>> " -N -- Perform the pwritev2() with RWF_NOWAIT\n"
>> " -D -- Perform the pwritev2() with RWF_DSYNC\n"
>> +" -A -- Perform the pwritev2() with RWF_ATOMIC\n"
>> #endif
>> "\n"));
>> }
>> @@ -284,7 +285,7 @@ pwrite_f(
>> init_cvtnum(&fsblocksize, &fssectsize);
>> bsize = fsblocksize;
>>
>> - while ((c = getopt(argc, argv, "b:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
>> + while ((c = getopt(argc, argv, "Ab:BCdDf:Fi:NqRs:OS:uV:wWZ:")) != EOF) {
>> switch (c) {
>> case 'b':
>> tmp = cvtnum(fsblocksize, fssectsize, optarg);
>> @@ -324,6 +325,9 @@ pwrite_f(
>> case 'D':
>> pwritev2_flags |= RWF_DSYNC;
>> break;
>> + case 'A':
>> + pwritev2_flags |= RWF_ATOMIC;
>> + break;
>> #endif
>> case 's':
>> skip = cvtnum(fsblocksize, fssectsize, optarg);
>> @@ -476,7 +480,7 @@ pwrite_init(void)
>> pwrite_cmd.argmax = -1;
>> pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
>> pwrite_cmd.args =
>> -_("[-i infile [-qdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
>> +_("[-i infile [-qAdDwNOW] [-s skip]] [-b bs] [-S seed] [-FBR [-Z N]] [-V N] off len");
>> pwrite_cmd.oneline =
>> _("writes a number of bytes at a specified offset");
>> pwrite_cmd.help = pwrite_help;
>> diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
>> index 303c6447..1e790139 100644
>> --- a/man/man8/xfs_io.8
>> +++ b/man/man8/xfs_io.8
>> @@ -244,7 +244,7 @@ See the
>> .B pread
>> command.
>> .TP
>> -.BI "pwrite [ \-i " file " ] [ \-qdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
>> +.BI "pwrite [ \-i " file " ] [ \-qAdDwNOW ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-V " vectors " ] " "offset length"
>> Writes a range of bytes in a specified blocksize from the given
>> .IR offset .
>> The bytes written can be either a set pattern or read in from another
>> @@ -281,6 +281,12 @@ Perform the
>> call with
>> .IR RWF_DSYNC .
>> .TP
>> +.B \-A
>> +Perform the
>> +.BR pwritev2 (2)
>> +call with
>> +.IR RWF_ATOMIC .
>> +.TP
>> .B \-O
>> perform pwrite once and return the (maybe partial) bytes written.
>> .TP
>> --
>> 2.34.1
>>
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-02 7:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 18:28 [PATCH v1] xfs_io: add RWF_ATOMIC support to pwrite Catherine Hoang
2024-10-02 1:01 ` Darrick J. Wong
2024-10-02 7:06 ` John Garry
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).