]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: Add RWF_NOWAIT to pwritev2()
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Thu, 9 Nov 2017 20:56:28 +0000 (14:56 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 9 Nov 2017 20:56:28 +0000 (14:56 -0600)
This allows to make pwritev2() calls with RWF_NOWAIT,
which would fail in case the call blocks.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
[sandeen@sandeen.net: combine all optional args in short help]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/pwrite.c
man/man8/xfs_io.8

index abd3a184dc34fd6208c9c035cfb22aa846f3c95a..c36a661a87c5646daa8d3958c3ae042068e8e374 100644 (file)
@@ -53,6 +53,9 @@ pwrite_help(void)
 #ifdef HAVE_PWRITEV
 " -V N -- use vectored IO with N iovecs of blocksize each (pwritev)\n"
 #endif
+#ifdef HAVE_PWRITEV2
+" -N   -- Perform the pwritev2() with RWF_NOWAIT\n"
+#endif
 "\n"));
 }
 
@@ -279,7 +282,7 @@ pwrite_f(
        init_cvtnum(&fsblocksize, &fssectsize);
        bsize = fsblocksize;
 
-       while ((c = getopt(argc, argv, "b:BCdf:Fi:qRs:S:uV:wWZ:")) != EOF) {
+       while ((c = getopt(argc, argv, "b:BCdf:Fi:NqRs:S:uV:wWZ:")) != EOF) {
                switch (c) {
                case 'b':
                        tmp = cvtnum(fsblocksize, fssectsize, optarg);
@@ -308,6 +311,11 @@ pwrite_f(
                case 'i':
                        infile = optarg;
                        break;
+#ifdef HAVE_PWRITEV2
+               case 'N':
+                       pwritev2_flags |= RWF_NOWAIT;
+                       break;
+#endif
                case 's':
                        skip = cvtnum(fsblocksize, fssectsize, optarg);
                        if (skip < 0) {
@@ -438,7 +446,7 @@ pwrite_init(void)
        pwrite_cmd.argmax = -1;
        pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
        pwrite_cmd.args =
-_("[-i infile [-d] [-s skip]] [-b bs] [-S seed] [-wW] [-FBR [-Z N]] [-V N] off len");
+_("[-i infile [-dwNW] [-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;
index 0fd9b951199c60eb488183f5397f4aa8b7c3b4b1..c2fe6aae7537b898033919c80b09fd2f1e02530c 100644 (file)
@@ -222,7 +222,7 @@ See the
 .B pread
 command.
 .TP
-.BI "pwrite [ \-i " file " ] [ \-d ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-wW ] [ \-V " vectors " ] " "offset length"
+.BI "pwrite [ \-i " file " ] [ \-dwNW ] [ \-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
@@ -239,6 +239,22 @@ to be specified as the source of the data to be written.
 causes direct I/O, rather than the usual buffered
 I/O, to be used when reading the input file.
 .TP
+.B \-w
+call
+.BR fdatasync (2)
+once all writes are complete (included in timing results)
+.TP
+.B \-N
+Perform the
+.BR pwritev2 (2)
+call with
+.I RWF_NOWAIT.
+.TP
+.B \-W
+call
+.BR fsync (2)
+once all writes are complete (included in timing results)
+.TP
 .B \-s
 specifies the number of bytes to
 .I skip
@@ -266,16 +282,6 @@ write the buffers in the give range in a random order.
 .B \-Z seed
 specify the random number seed used for random write
 .TP
-.B \-w
-call
-.BR fdatasync (2)
-once all writes are complete (included in timing results)
-.TP
-.B \-W
-call
-.BR fsync (2)
-once all writes are complete (included in timing results)
-.TP
 .B \-V vectors
 Use the vectored IO write syscall
 .BR pwritev (2)