* [PATCH 0/3] xfs_io: new functions
@ 2012-07-25 22:30 Dave Chinner
2012-07-25 22:30 ` [PATCH 1/3] xfs_io: add sync_file_range support Dave Chinner
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Dave Chinner @ 2012-07-25 22:30 UTC (permalink / raw)
To: xfs
This is just a couple of additional functions for xfs_io I have had
sitting around for a while. The first is an interface to
sync_file_range() for better control of file writeback. The second
and third introduce vectored pread/pwrite so that I could simulate
the same style of vectored IO that KVM does via direct IO (hint -
tracing indicated that the generic direct IO code doesn't handle
this particularly efficiently).
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/3] xfs_io: add sync_file_range support
2012-07-25 22:30 [PATCH 0/3] xfs_io: new functions Dave Chinner
@ 2012-07-25 22:30 ` Dave Chinner
2012-07-28 23:56 ` Christoph Hellwig
2012-07-25 22:30 ` [PATCH 2/3] xfs_io: implement preadv for vectored reads Dave Chinner
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Dave Chinner @ 2012-07-25 22:30 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
Add sync_file_range support to xfs_io to allow fine grained control
of data writeback and syncing on a given file.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
---
io/Makefile | 5 +++
io/init.c | 1 +
io/io.h | 6 +++
io/sync_file_range.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++
man/man8/xfs_io.8 | 19 +++++++++
5 files changed, 138 insertions(+)
create mode 100644 io/sync_file_range.c
diff --git a/io/Makefile b/io/Makefile
index 9d79dca..bf46d56 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -58,6 +58,11 @@ CFILES += inject.c resblks.c
LCFLAGS += -DHAVE_INJECT -DHAVE_RESBLKS
endif
+ifeq ($(PKG_PLATFORM),linux)
+CFILES += sync_file_range.c
+LCFLAGS += -DHAVE_SYNC_FILE_RANGE
+endif
+
ifeq ($(ENABLE_READLINE),yes)
LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
endif
diff --git a/io/init.c b/io/init.c
index f416acf..fb93082 100644
--- a/io/init.c
+++ b/io/init.c
@@ -78,6 +78,7 @@ init_commands(void)
sendfile_init();
shutdown_init();
truncate_init();
+ sync_range_init();
}
static int
diff --git a/io/io.h b/io/io.h
index 2923362..8151b7b 100644
--- a/io/io.h
+++ b/io/io.h
@@ -141,3 +141,9 @@ extern void fiemap_init(void);
#else
#define fiemap_init() do { } while (0)
#endif
+
+#ifdef HAVE_SYNC_FILE_RANGE
+extern void sync_range_init(void);
+#else
+#define sync_range_init() do { } while (0)
+#endif
diff --git a/io/sync_file_range.c b/io/sync_file_range.c
new file mode 100644
index 0000000..35d8cc5
--- /dev/null
+++ b/io/sync_file_range.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2012 Red Hat, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <xfs/xfs.h>
+#include <xfs/command.h>
+#include <xfs/input.h>
+#include "init.h"
+#include "io.h"
+
+static cmdinfo_t sync_range_cmd;
+
+static void
+sync_range_help(void)
+{
+ printf(_(
+"\n"
+" Trigger specific writeback commands on a range of the current file\n"
+"\n"
+" With no options, the SYNC_FILE_RANGE_WRITE is implied.\n"
+" -a -- wait for IO to finish after writing (SYNC_FILE_RANGE_WAIT_AFTER).\n"
+" -b -- wait for IO to finish before writing (SYNC_FILE_RANGE_WAIT_BEFORE).\n"
+" -w -- write dirty data in range (SYNC_FILE_RANGE_WRITE).\n"
+"\n"));
+}
+
+static int
+sync_range_f(
+ int argc,
+ char **argv)
+{
+ off64_t offset = 0, length = 0;
+ int c, sync_mode = 0;
+ size_t blocksize, sectsize;
+
+ while ((c = getopt(argc, argv, "abw")) != EOF) {
+ switch (c) {
+ case 'a':
+ sync_mode = SYNC_FILE_RANGE_WAIT_AFTER;
+ break;
+ case 'b':
+ sync_mode = SYNC_FILE_RANGE_WAIT_BEFORE;
+ break;
+ case 'w':
+ sync_mode = SYNC_FILE_RANGE_WRITE;
+ break;
+ default:
+ return command_usage(&sync_range_cmd);
+ }
+ }
+
+ /* default to just starting writeback on the range */
+ if (!sync_mode)
+ sync_mode = SYNC_FILE_RANGE_WRITE;
+
+ if (optind != argc - 2)
+ return command_usage(&sync_range_cmd);
+ init_cvtnum(&blocksize, §size);
+ offset = cvtnum(blocksize, sectsize, argv[optind]);
+ if (offset < 0) {
+ printf(_("non-numeric offset argument -- %s\n"),
+ argv[optind]);
+ return 0;
+ }
+ optind++;
+ length = cvtnum(blocksize, sectsize, argv[optind]);
+ if (length < 0) {
+ printf(_("non-numeric length argument -- %s\n"),
+ argv[optind]);
+ return 0;
+ }
+
+ if (sync_file_range(file->fd, offset, length, sync_mode) < 0) {
+ perror("sync_file_range");
+ return 0;
+ }
+ return 0;
+}
+
+void
+sync_range_init(void)
+{
+ sync_range_cmd.name = "sync_range";
+ sync_range_cmd.cfunc = sync_range_f;
+ sync_range_cmd.argmin = 2;
+ sync_range_cmd.argmax = -1;
+ sync_range_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+ sync_range_cmd.args = _("[-abw] off len");
+ sync_range_cmd.oneline = _("Control writeback on a range of a file");
+ sync_range_cmd.help = sync_range_help;
+
+ add_command(&sync_range_cmd);
+}
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index ebbfdec..a185798 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -273,6 +273,25 @@ See the
.B fsync
command.
.TP
+.BI "sync_range [ \-a | \-b | \-w ] offset length "
+On platforms which support it, allows control of syncing a range of the file to
+disk. With no options, SYNC_FILE_RANGE_WRITE is implied on the range supplied.
+.RS 1.0i
+.PD 0
+.TP 0.4i
+.B \-a
+wait for IO in the given range to finish after writing
+(SYNC_FILE_RANGE_WAIT_AFTER).
+.TP
+.B \-b
+wait for IO in the given range to finish before writing
+(SYNC_FILE_RANGE_WAIT_BEFORE).
+.TP
+.B \-w
+start writeback of dirty data in the given range (SYNC_FILE_RANGE_WRITE).
+.RE
+.PD
+.TP
.BI resvsp " offset length"
Allocates reserved, unwritten space for part of a file using the
XFS_IOC_RESVSP system call described in the
--
1.7.10
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] xfs_io: implement preadv for vectored reads
2012-07-25 22:30 [PATCH 0/3] xfs_io: new functions Dave Chinner
2012-07-25 22:30 ` [PATCH 1/3] xfs_io: add sync_file_range support Dave Chinner
@ 2012-07-25 22:30 ` Dave Chinner
2012-07-28 23:57 ` Christoph Hellwig
2012-08-09 20:08 ` Mark Tinguely
2012-07-25 22:30 ` [PATCH 3/3] xfs_io: implement pwritev for vectored writes Dave Chinner
2012-09-24 21:51 ` [PATCH 0/3] xfs_io: new functions Mark Tinguely
3 siblings, 2 replies; 13+ messages in thread
From: Dave Chinner @ 2012-07-25 22:30 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
When looking at KVM based direct IO patterns, I noticed that it was
using preadv and pwritev, and I could not use xfs_io to simulate
these IO patterns. Extend the pread command to be able to issue
vectored read IO to enable use to simulate KVM style direct IO.
Also document the new parameters as well as all the missing pread
command parameters in the xfs_io(8) man page.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
io/pread.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++-----
man/man8/xfs_io.8 | 21 ++++++++-
2 files changed, 136 insertions(+), 12 deletions(-)
diff --git a/io/pread.c b/io/pread.c
index 705dc69..f6e4ca2 100644
--- a/io/pread.c
+++ b/io/pread.c
@@ -46,6 +46,8 @@ pread_help(void)
" -R -- read at random offsets in the range of bytes\n"
" -Z N -- zeed the random number generator (used when reading randomly)\n"
" (heh, zorry, the -s/-S arguments were already in use in pwrite)\n"
+" -V N -- use vectored IO with N iovecs of blocksize each (preadv)\n"
+"\n"
" When in \"random\" mode, the number of read operations will equal the\n"
" number required to do a complete forward/backward scan of the range.\n"
" Note that the offset within the range is chosen at random each time\n"
@@ -56,6 +58,42 @@ pread_help(void)
void *buffer;
size_t highwater;
size_t buffersize;
+int vectors;
+struct iovec *iov;
+
+static int
+alloc_iovec(
+ size_t bsize,
+ int uflag,
+ unsigned int seed)
+{
+ int i;
+
+ iov = calloc(vectors, sizeof(struct iovec));
+ if (!iov)
+ return -1;
+
+ buffersize = 0;
+ for (i = 0; i < vectors; i++) {
+ iov[i].iov_base = memalign(pagesize, bsize);
+ buffer = memalign(pagesize, bsize);
+ if (!buffer) {
+ perror("memalign");
+ goto unwind;
+ }
+ iov[i].iov_len = bsize;
+ if (!uflag)
+ memset(iov[i].iov_base, seed, bsize);
+ }
+ buffersize = bsize * vectors;
+ return 0;
+unwind:
+ for( ; i >= 0; i--)
+ free(iov[i].iov_base);
+ free(iov);
+ iov = NULL;
+ return -1;
+}
int
alloc_buffer(
@@ -63,6 +101,9 @@ alloc_buffer(
int uflag,
unsigned int seed)
{
+ if (vectors)
+ return alloc_iovec(bsize, uflag, seed);
+
if (bsize > highwater) {
if (buffer)
free(buffer);
@@ -81,7 +122,8 @@ alloc_buffer(
}
void
-dump_buffer(
+__dump_buffer(
+ void *buf,
off64_t offset,
ssize_t len)
{
@@ -105,6 +147,64 @@ dump_buffer(
}
}
+void
+dump_buffer(
+ off64_t offset,
+ ssize_t len)
+{
+ int i, l;
+
+ if (!vectors) {
+ __dump_buffer(buffer, offset, len);
+ return;
+ }
+
+ for (i = 0; len > 0 && i < vectors; i++) {
+ l = min(len, iov[i].iov_len);
+
+ __dump_buffer(iov[i].iov_base, offset, l);
+ len -= l;
+ offset += l;
+ }
+}
+
+static int
+do_pread(
+ int fd,
+ off64_t offset,
+ ssize_t count,
+ ssize_t buffer_size)
+{
+ int vecs = 0;
+ ssize_t oldlen = 0;
+ ssize_t bytes = 0;
+
+
+ if (!vectors)
+ return pread64(fd, buffer, min(count, buffer_size), offset);
+
+ /* trim the iovec if necessary */
+ if (count < buffersize) {
+ size_t len = 0;
+ while (len + iov[vecs].iov_len < count) {
+ len += iov[vecs].iov_len;
+ vecs++;
+ }
+ oldlen = iov[vecs].iov_len;
+ iov[vecs].iov_len = count - len;
+ vecs++;
+ } else {
+ vecs = vectors;
+ }
+ bytes = preadv(fd, iov, vectors, offset);
+
+ /* restore trimmed iov */
+ if (oldlen)
+ iov[vecs - 1].iov_len = oldlen;
+
+ return bytes;
+}
+
static int
read_random(
int fd,
@@ -132,7 +232,7 @@ read_random(
*total = 0;
while (count > 0) {
off = ((random() % range) / buffersize) * buffersize;
- bytes = pread64(fd, buffer, buffersize, off);
+ bytes = do_pread(fd, off, buffersize, buffersize);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -173,9 +273,8 @@ read_backward(
/* Do initial unaligned read if needed */
if ((bytes_requested = (off % buffersize))) {
- bytes_requested = min(cnt, bytes_requested);
off -= bytes_requested;
- bytes = pread(fd, buffer, bytes_requested, off);
+ bytes = do_pread(fd, off, bytes_requested, buffersize);
if (bytes == 0)
return ops;
if (bytes < 0) {
@@ -193,7 +292,7 @@ read_backward(
while (cnt > end) {
bytes_requested = min(cnt, buffersize);
off -= bytes_requested;
- bytes = pread64(fd, buffer, bytes_requested, off);
+ bytes = do_pread(fd, off, cnt, buffersize);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -219,14 +318,12 @@ read_forward(
int onlyone,
int eof)
{
- size_t bytes_requested;
ssize_t bytes;
int ops = 0;
*total = 0;
while (count > 0 || eof) {
- bytes_requested = min(count, buffersize);
- bytes = pread64(fd, buffer, bytes_requested, offset);
+ bytes = do_pread(fd, offset, count, buffersize);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -237,7 +334,7 @@ read_forward(
if (verbose)
dump_buffer(offset, bytes);
*total += bytes;
- if (onlyone || bytes < bytes_requested)
+ if (onlyone || bytes < min(count, buffersize))
break;
offset += bytes;
count -= bytes;
@@ -278,7 +375,7 @@ pread_f(
init_cvtnum(&fsblocksize, &fssectsize);
bsize = fsblocksize;
- while ((c = getopt(argc, argv, "b:BCFRquvZ:")) != EOF) {
+ while ((c = getopt(argc, argv, "b:BCFRquvV:Z:")) != EOF) {
switch (c) {
case 'b':
tmp = cvtnum(fsblocksize, fssectsize, optarg);
@@ -309,6 +406,14 @@ pread_f(
case 'v':
vflag = 1;
break;
+ case 'V':
+ vectors = strtoul(optarg, &sp, 0);
+ if (!sp || sp == optarg) {
+ printf(_("non-numberic vector count == %s\n"),
+ optarg);
+ return 0;
+ }
+ break;
case 'Z':
zeed = strtoul(optarg, &sp, 0);
if (!sp || sp == optarg) {
@@ -393,7 +498,7 @@ pread_init(void)
pread_cmd.argmin = 2;
pread_cmd.argmax = -1;
pread_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
- pread_cmd.args = _("[-b bs] [-v] off len");
+ pread_cmd.args = _("[-b bs] [-v] [-i N] [-FBR [-Z N]] off len");
pread_cmd.oneline = _("reads a number of bytes at a specified offset");
pread_cmd.help = pread_help;
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index a185798..ae707f4 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -131,7 +131,7 @@ See the
.B close
command.
.TP
-.BI "pread [ \-b " bsize " ] [ \-v ] " "offset length"
+.BI "pread [ \-b " bsize " ] [ \-v ] [ \-FBR [ \-Z " seed " ] ] [ \-V " vectors " ] " "offset length"
Reads a range of bytes in a specified blocksize from the given
.IR offset .
.RS 1.0i
@@ -145,6 +145,25 @@ requests will be split. The default blocksize is 4096 bytes.
.B \-v
dump the contents of the buffer after reading,
by default only the count of bytes actually read is dumped.
+.TP
+.B \-F
+read the buffers in a forwards sequential direction.
+.TP
+.B \-B
+read the buffers in a reserve sequential direction.
+.TP
+.B \-R
+read the buffers in the give range in a random order.
+.TP
+.B \-Z seed
+specify the random number seed used for random reads.
+.TP
+.B \-V vectors
+Use the vectored IO read syscall
+.BR preadv (2)
+with a number of blocksize length iovecs. The number of iovecs is set by the
+.I vectors
+parameter.
.PD
.RE
.TP
--
1.7.10
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/3] xfs_io: implement pwritev for vectored writes
2012-07-25 22:30 [PATCH 0/3] xfs_io: new functions Dave Chinner
2012-07-25 22:30 ` [PATCH 1/3] xfs_io: add sync_file_range support Dave Chinner
2012-07-25 22:30 ` [PATCH 2/3] xfs_io: implement preadv for vectored reads Dave Chinner
@ 2012-07-25 22:30 ` Dave Chinner
2012-07-28 23:57 ` Christoph Hellwig
2012-09-24 21:51 ` [PATCH 0/3] xfs_io: new functions Mark Tinguely
3 siblings, 1 reply; 13+ messages in thread
From: Dave Chinner @ 2012-07-25 22:30 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
When looking at KVM based direct IO patterns, I noticed that it was
using preadv and pwritev, and I could not use xfs_io to simulate
these IO patterns. Extend the pwrite command to be able to issue
vectored write IO to enable use to simulate KVM style direct IO.
Also document the new parameters as well as all the missing pwrite
command parameters in the xfs_io(8) man page.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
io/io.h | 2 ++
io/pwrite.c | 61 +++++++++++++++++++++++++++++++++++++++++++++--------
man/man8/xfs_io.8 | 31 ++++++++++++++++++++++++++-
3 files changed, 84 insertions(+), 10 deletions(-)
diff --git a/io/io.h b/io/io.h
index 8151b7b..91f0e3e 100644
--- a/io/io.h
+++ b/io/io.h
@@ -82,6 +82,8 @@ extern unsigned int recurse_dir;
extern void *buffer;
extern size_t buffersize;
+extern int vectors;
+extern struct iovec *iov;
extern int alloc_buffer(size_t, int, unsigned int);
extern int read_buffer(int, off64_t, long long, long long *,
int, int);
diff --git a/io/pwrite.c b/io/pwrite.c
index 7c3932c..3689960 100644
--- a/io/pwrite.c
+++ b/io/pwrite.c
@@ -50,10 +50,47 @@ pwrite_help(void)
" -R -- write at random offsets in the specified range of bytes\n"
" -Z N -- zeed the random number generator (used when writing randomly)\n"
" (heh, zorry, the -s/-S arguments were already in use in pwrite)\n"
+" -V N -- use vectored IO with N iovecs of blocksize each (pwritev)\n"
"\n"));
}
static int
+do_pwrite(
+ int fd,
+ off64_t offset,
+ ssize_t count,
+ ssize_t buffer_size)
+{
+ int vecs = 0;
+ ssize_t oldlen = 0;
+ ssize_t bytes = 0;
+
+
+ if (!vectors)
+ return pwrite64(fd, buffer, min(count, buffer_size), offset);
+
+ /* trim the iovec if necessary */
+ if (count < buffersize) {
+ size_t len = 0;
+ while (len + iov[vecs].iov_len < count) {
+ len += iov[vecs].iov_len;
+ vecs++;
+ }
+ oldlen = iov[vecs].iov_len;
+ iov[vecs].iov_len = count - len;
+ vecs++;
+ } else {
+ vecs = vectors;
+ }
+ bytes = pwritev(fd, iov, vectors, offset);
+
+ /* restore trimmed iov */
+ if (oldlen)
+ iov[vecs - 1].iov_len = oldlen;
+
+ return bytes;
+}
+static int
write_random(
off64_t offset,
long long count,
@@ -76,7 +113,7 @@ write_random(
*total = 0;
while (count > 0) {
off = ((random() % range) / buffersize) * buffersize;
- bytes = pwrite64(file->fd, buffer, buffersize, off);
+ bytes = do_pwrite(file->fd, off, buffersize, buffersize);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -114,7 +151,7 @@ write_backward(
if ((bytes_requested = (off % buffersize))) {
bytes_requested = min(cnt, bytes_requested);
off -= bytes_requested;
- bytes = pwrite(file->fd, buffer, bytes_requested, off);
+ bytes = do_pwrite(file->fd, off, bytes_requested, buffersize);
if (bytes == 0)
return ops;
if (bytes < 0) {
@@ -132,7 +169,7 @@ write_backward(
while (cnt > end) {
bytes_requested = min(cnt, buffersize);
off -= bytes_requested;
- bytes = pwrite64(file->fd, buffer, bytes_requested, off);
+ bytes = do_pwrite(file->fd, off, cnt, buffersize);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -157,7 +194,6 @@ write_buffer(
off64_t skip,
long long *total)
{
- size_t bytes_requested;
ssize_t bytes;
long long bar = min(bs, count);
int ops = 0;
@@ -168,8 +204,7 @@ write_buffer(
if (read_buffer(fd, skip + *total, bs, &bar, 0, 1) < 0)
break;
}
- bytes_requested = min(bar, count);
- bytes = pwrite64(file->fd, buffer, bytes_requested, offset);
+ bytes = do_pwrite(file->fd, offset, count, bar);
if (bytes == 0)
break;
if (bytes < 0) {
@@ -178,7 +213,7 @@ write_buffer(
}
ops++;
*total += bytes;
- if (bytes < bytes_requested)
+ if (bytes < min(count, bar))
break;
offset += bytes;
count -= bytes;
@@ -209,7 +244,7 @@ pwrite_f(
init_cvtnum(&fsblocksize, &fssectsize);
bsize = fsblocksize;
- while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uwWZ:")) != EOF) {
+ while ((c = getopt(argc, argv, "b:Cdf:i:qs:S:uV:wWZ:")) != EOF) {
switch (c) {
case 'b':
tmp = cvtnum(fsblocksize, fssectsize, optarg);
@@ -258,6 +293,14 @@ pwrite_f(
case 'u':
uflag = 1;
break;
+ case 'V':
+ vectors = strtoul(optarg, &sp, 0);
+ if (!sp || sp == optarg) {
+ printf(_("non-numberic vector count == %s\n"),
+ optarg);
+ return 0;
+ }
+ break;
case 'w':
wflag = 1;
break;
@@ -356,7 +399,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] off len");
+_("[-i infile [-d] [-s skip]] [-b bs] [-S seed] [-wW] [-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 ae707f4..f7c6935 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -172,7 +172,7 @@ See the
.B pread
command.
.TP
-.BI "pwrite [ \-i " file " ] [ \-d ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] " "offset length"
+.BI "pwrite [ \-i " file " ] [ \-d ] [ \-s " skip " ] [ \-b " size " ] [ \-S " seed " ] [ \-FBR [ \-Z " zeed " ] ] [ \-wW ] [ \-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
@@ -203,6 +203,35 @@ requests will be split. The default blocksize is 4096 bytes.
used to set the (repeated) fill pattern which
is used when the data to write is not coming from a file.
The default buffer fill pattern value is 0xcdcdcdcd.
+.TP
+.B \-F
+write the buffers in a forwards sequential direction.
+.TP
+.B \-B
+write the buffers in a reserve sequential direction.
+.TP
+.B \-R
+write the buffers in the give range in a random order.
+.TP
+.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)
+with a number of blocksize length iovecs. The number of iovecs is set by the
+.I vectors
+parameter.
.RE
.PD
.TP
--
1.7.10
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] xfs_io: add sync_file_range support
2012-07-25 22:30 ` [PATCH 1/3] xfs_io: add sync_file_range support Dave Chinner
@ 2012-07-28 23:56 ` Christoph Hellwig
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2012-07-28 23:56 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Thu, Jul 26, 2012 at 08:30:48AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Add sync_file_range support to xfs_io to allow fine grained control
> of data writeback and syncing on a given file.
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] xfs_io: implement preadv for vectored reads
2012-07-25 22:30 ` [PATCH 2/3] xfs_io: implement preadv for vectored reads Dave Chinner
@ 2012-07-28 23:57 ` Christoph Hellwig
2012-08-09 20:08 ` Mark Tinguely
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2012-07-28 23:57 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Thu, Jul 26, 2012 at 08:30:49AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> When looking at KVM based direct IO patterns, I noticed that it was
> using preadv and pwritev, and I could not use xfs_io to simulate
> these IO patterns. Extend the pread command to be able to issue
> vectored read IO to enable use to simulate KVM style direct IO.
>
> Also document the new parameters as well as all the missing pread
> command parameters in the xfs_io(8) man page.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] xfs_io: implement pwritev for vectored writes
2012-07-25 22:30 ` [PATCH 3/3] xfs_io: implement pwritev for vectored writes Dave Chinner
@ 2012-07-28 23:57 ` Christoph Hellwig
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2012-07-28 23:57 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Thu, Jul 26, 2012 at 08:30:50AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> When looking at KVM based direct IO patterns, I noticed that it was
> using preadv and pwritev, and I could not use xfs_io to simulate
> these IO patterns. Extend the pwrite command to be able to issue
> vectored write IO to enable use to simulate KVM style direct IO.
>
> Also document the new parameters as well as all the missing pwrite
> command parameters in the xfs_io(8) man page.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] xfs_io: implement preadv for vectored reads
2012-07-25 22:30 ` [PATCH 2/3] xfs_io: implement preadv for vectored reads Dave Chinner
2012-07-28 23:57 ` Christoph Hellwig
@ 2012-08-09 20:08 ` Mark Tinguely
1 sibling, 0 replies; 13+ messages in thread
From: Mark Tinguely @ 2012-08-09 20:08 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On 07/25/12 17:30, Dave Chinner wrote:
> From: Dave Chinner<dchinner@redhat.com>
>
> When looking at KVM based direct IO patterns, I noticed that it was
> using preadv and pwritev, and I could not use xfs_io to simulate
> these IO patterns. Extend the pread command to be able to issue
> vectored read IO to enable use to simulate KVM style direct IO.
>
> Also document the new parameters as well as all the missing pread
> command parameters in the xfs_io(8) man page.
>
> Signed-off-by: Dave Chinner<dchinner@redhat.com>
> ---
+int vectors;
> +struct iovec *iov;
> +
> +static int
> +alloc_iovec(
> + size_t bsize,
> + int uflag,
> + unsigned int seed)
> +{
> + int i;
> +
> + iov = calloc(vectors, sizeof(struct iovec));
> + if (!iov)
> + return -1;
> +
> + buffersize = 0;
> + for (i = 0; i< vectors; i++) {
> + iov[i].iov_base = memalign(pagesize, bsize);
^^^^^
Okay, make sense.
> + buffer = memalign(pagesize, bsize);
> + if (!buffer) {
^^^^^^
Here I am bit confused. Did you want to allocate to the buffer for the
iovec case?
Thank-you,
Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] xfs_io: new functions
2012-07-25 22:30 [PATCH 0/3] xfs_io: new functions Dave Chinner
` (2 preceding siblings ...)
2012-07-25 22:30 ` [PATCH 3/3] xfs_io: implement pwritev for vectored writes Dave Chinner
@ 2012-09-24 21:51 ` Mark Tinguely
2012-10-09 19:07 ` Eric Sandeen
3 siblings, 1 reply; 13+ messages in thread
From: Mark Tinguely @ 2012-09-24 21:51 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On 07/25/12 17:30, Dave Chinner wrote:
> This is just a couple of additional functions for xfs_io I have had
> sitting around for a while. The first is an interface to
> sync_file_range() for better control of file writeback. The second
> and third introduce vectored pread/pwrite so that I could simulate
> the same style of vectored IO that KVM does via direct IO (hint -
> tracing indicated that the generic direct IO code doesn't handle
> this particularly efficiently).
>
> _____________________________________________
This series has been committed to
git://oss.sgi.com/xfs/cmds/xfsprogs.git
-Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] xfs_io: new functions
2012-09-24 21:51 ` [PATCH 0/3] xfs_io: new functions Mark Tinguely
@ 2012-10-09 19:07 ` Eric Sandeen
2012-10-09 20:47 ` Mark Tinguely
0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2012-10-09 19:07 UTC (permalink / raw)
To: Mark Tinguely; +Cc: xfs
On 9/24/12 4:51 PM, Mark Tinguely wrote:
> On 07/25/12 17:30, Dave Chinner wrote:
>> This is just a couple of additional functions for xfs_io I have had
>> sitting around for a while. The first is an interface to
>> sync_file_range() for better control of file writeback. The second
>> and third introduce vectored pread/pwrite so that I could simulate
>> the same style of vectored IO that KVM does via direct IO (hint -
>> tracing indicated that the generic direct IO code doesn't handle
>> this particularly efficiently).
>>
>> _____________________________________________
>
> This series has been committed to
> git://oss.sgi.com/xfs/cmds/xfsprogs.git
>
> -Mark.
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
Looks like this might need some config-fu:
pread.o: In function `do_pread':
/src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
/src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
pwrite.o: In function `do_pwrite':
/src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
/src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
sync_file_range.o: In function `sync_range_f':
/src/git/xfsprogs/io/sync_file_range.c:87: undefined reference to `sync_file_range'
(on a Centos5 box)
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] xfs_io: new functions
2012-10-09 19:07 ` Eric Sandeen
@ 2012-10-09 20:47 ` Mark Tinguely
2012-10-09 20:51 ` Eric Sandeen
0 siblings, 1 reply; 13+ messages in thread
From: Mark Tinguely @ 2012-10-09 20:47 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs
On 10/09/12 14:07, Eric Sandeen wrote:
> On 9/24/12 4:51 PM, Mark Tinguely wrote:
>> On 07/25/12 17:30, Dave Chinner wrote:
>>> This is just a couple of additional functions for xfs_io I have had
>>> sitting around for a while. The first is an interface to
>>> sync_file_range() for better control of file writeback. The second
>>> and third introduce vectored pread/pwrite so that I could simulate
>>> the same style of vectored IO that KVM does via direct IO (hint -
>>> tracing indicated that the generic direct IO code doesn't handle
>>> this particularly efficiently).
>>>
>>> _____________________________________________
>>
>> This series has been committed to
>> git://oss.sgi.com/xfs/cmds/xfsprogs.git
>>
>> -Mark.
>>
>> _______________________________________________
>> xfs mailing list
>> xfs@oss.sgi.com
>> http://oss.sgi.com/mailman/listinfo/xfs
>>
>
> Looks like this might need some config-fu:
>
> pread.o: In function `do_pread':
> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
> pwrite.o: In function `do_pwrite':
> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
> sync_file_range.o: In function `sync_range_f':
> /src/git/xfsprogs/io/sync_file_range.c:87: undefined reference to `sync_file_range'
>
>
> (on a Centos5 box)
Thanks Eric, I will take a look at it.
--Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] xfs_io: new functions
2012-10-09 20:47 ` Mark Tinguely
@ 2012-10-09 20:51 ` Eric Sandeen
2012-10-09 21:53 ` Mark Tinguely
0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2012-10-09 20:51 UTC (permalink / raw)
To: Mark Tinguely; +Cc: xfs
On 10/9/12 3:47 PM, Mark Tinguely wrote:
> On 10/09/12 14:07, Eric Sandeen wrote:
>> On 9/24/12 4:51 PM, Mark Tinguely wrote:
>>> On 07/25/12 17:30, Dave Chinner wrote:
>>>> This is just a couple of additional functions for xfs_io I have had
>>>> sitting around for a while. The first is an interface to
>>>> sync_file_range() for better control of file writeback. The second
>>>> and third introduce vectored pread/pwrite so that I could simulate
>>>> the same style of vectored IO that KVM does via direct IO (hint -
>>>> tracing indicated that the generic direct IO code doesn't handle
>>>> this particularly efficiently).
>>>>
>>>> _____________________________________________
>>>
>>> This series has been committed to
>>> git://oss.sgi.com/xfs/cmds/xfsprogs.git
>>>
>>> -Mark.
>>>
>>> _______________________________________________
>>> xfs mailing list
>>> xfs@oss.sgi.com
>>> http://oss.sgi.com/mailman/listinfo/xfs
>>>
>>
>> Looks like this might need some config-fu:
>>
>> pread.o: In function `do_pread':
>> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
>> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
>> pwrite.o: In function `do_pwrite':
>> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
>> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
>> sync_file_range.o: In function `sync_range_f':
>> /src/git/xfsprogs/io/sync_file_range.c:87: undefined reference to `sync_file_range'
>>
>>
>> (on a Centos5 box)
>
>
> Thanks Eric, I will take a look at it.
I actually started (sorry, should have just done it before sending the mail)
I'll take care of it, I'm halfway there.
-Eric
> --Mark.
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] xfs_io: new functions
2012-10-09 20:51 ` Eric Sandeen
@ 2012-10-09 21:53 ` Mark Tinguely
0 siblings, 0 replies; 13+ messages in thread
From: Mark Tinguely @ 2012-10-09 21:53 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs
On 10/09/12 15:51, Eric Sandeen wrote:
> On 10/9/12 3:47 PM, Mark Tinguely wrote:
>> On 10/09/12 14:07, Eric Sandeen wrote:
>>> On 9/24/12 4:51 PM, Mark Tinguely wrote:
>>>> On 07/25/12 17:30, Dave Chinner wrote:
>>>>> This is just a couple of additional functions for xfs_io I have had
>>>>> sitting around for a while. The first is an interface to
>>>>> sync_file_range() for better control of file writeback. The second
>>>>> and third introduce vectored pread/pwrite so that I could simulate
>>>>> the same style of vectored IO that KVM does via direct IO (hint -
>>>>> tracing indicated that the generic direct IO code doesn't handle
>>>>> this particularly efficiently).
>>>>>
>>>>> _____________________________________________
>>>>
>>>> This series has been committed to
>>>> git://oss.sgi.com/xfs/cmds/xfsprogs.git
>>>>
>>>> -Mark.
>>>>
>>>> _______________________________________________
>>>> xfs mailing list
>>>> xfs@oss.sgi.com
>>>> http://oss.sgi.com/mailman/listinfo/xfs
>>>>
>>>
>>> Looks like this might need some config-fu:
>>>
>>> pread.o: In function `do_pread':
>>> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
>>> /src/git/xfsprogs/io/pread.c:198: undefined reference to `preadv'
>>> pwrite.o: In function `do_pwrite':
>>> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
>>> /src/git/xfsprogs/io/pwrite.c:85: undefined reference to `pwritev'
>>> sync_file_range.o: In function `sync_range_f':
>>> /src/git/xfsprogs/io/sync_file_range.c:87: undefined reference to `sync_file_range'
>>>
>>>
>>> (on a Centos5 box)
>>
>>
>> Thanks Eric, I will take a look at it.
>
> I actually started (sorry, should have just done it before sending the mail)
>
> I'll take care of it, I'm halfway there.
>
> -Eric
>
>> --Mark.
>>
>
Excellent. That is easy!
--Mark.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-10-09 21:52 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 22:30 [PATCH 0/3] xfs_io: new functions Dave Chinner
2012-07-25 22:30 ` [PATCH 1/3] xfs_io: add sync_file_range support Dave Chinner
2012-07-28 23:56 ` Christoph Hellwig
2012-07-25 22:30 ` [PATCH 2/3] xfs_io: implement preadv for vectored reads Dave Chinner
2012-07-28 23:57 ` Christoph Hellwig
2012-08-09 20:08 ` Mark Tinguely
2012-07-25 22:30 ` [PATCH 3/3] xfs_io: implement pwritev for vectored writes Dave Chinner
2012-07-28 23:57 ` Christoph Hellwig
2012-09-24 21:51 ` [PATCH 0/3] xfs_io: new functions Mark Tinguely
2012-10-09 19:07 ` Eric Sandeen
2012-10-09 20:47 ` Mark Tinguely
2012-10-09 20:51 ` Eric Sandeen
2012-10-09 21:53 ` Mark Tinguely
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.