Merge branch 'master' of ssh://brick.kernel.dk/data/git/fio
authorJens Axboe <axboe@kernel.dk>
Fri, 21 Sep 2012 06:36:24 +0000 (08:36 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Sep 2012 06:36:24 +0000 (08:36 +0200)
HOWTO
engines/falloc.c
examples/e4defrag
examples/e4defrag2 [new file with mode: 0644]
examples/falloc [new file with mode: 0644]
fio.1
options.c
os/os-linux.h
parse.h

diff --git a/HOWTO b/HOWTO
index 3eb551070e60e3ea97eae5a266e139aae5e8a069..ec7005fe5b44e1c70c2ff6e2195849599a24e0ca 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -602,8 +602,16 @@ ioengine=str       Defines how the job issues io to the file. The following
                                channel semantics (Send/Recv) for the
                                InfiniBand, RoCE and iWARP protocols.
 
-                       falloc  Perform fallocate/punch_hole to files
-       
+                       falloc   IO engine that does regular fallocate to
+                                simulate data transfer as fio ioengine.
+                                DDIR_READ  does fallocate(,mode = keep_size,)
+                                DDIR_WRITE does fallocate(,mode = 0)
+                                DDIR_TRIM  does fallocate(,mode = punch_hole)
+
+                       e4defrag IO engine that does regular EXT4_IOC_MOVE_EXT
+                                ioctls to simulate defragment activity in
+                                request to DDIR_WRITE event
+
                        external Prefix to specify loading an external
                                IO engine object file. Append the engine
                                filename, eg ioengine=external:/tmp/foo.o
@@ -1318,6 +1326,14 @@ that defines them is selected.
 [net] listen   For TCP network connections, tell fio to listen for incoming
                connections rather than initiating an outgoing connection. The
                hostname must be omitted if this option is used.
+[e4defrag] donorname=str
+               File will be used as a block donor(swap extents between files)
+[e4defrag] inplace=int
+               Configure donor file blocks allocation strategy         
+               0(default): Preallocate donor's file on init
+               1         : allocate space immidietly inside defragment event,
+                           and free right after event
+
 
 
 6.0 Interpreting the output
index cbb30cbf9ad215f17dd8704230a68638f5a7bbd1..4977d9e2bcd178b30c08e467a31102390322b903 100644 (file)
@@ -91,8 +91,6 @@ static int fio_fallocate_queue(struct thread_data *td, struct io_u *io_u)
                if (io_u->error)
                        td_verror(td, io_u->error, "xfer");
        }
-       if (io_u->ddir == DDIR_TRIM && !ret)
-               return io_u->xfer_buflen;
 
        if (io_u->file && ret == 0 && ddir_rw(io_u->ddir))
                io_u->file->file_pos = io_u->offset + ret;
index d39214903a418777de5f8c1a4aa01da7e321438a..cb94e85acae407669b0d13997067349f7a50f0f6 100644 (file)
@@ -1,32 +1,41 @@
 [global]
-
-direct=0
-buffered=0
+ioengine=e4defrag
 directory=/scratch
-
 nrfiles=1
+filesize=100M
+size=100M
+bs=32k
+#group_reporting
 
-filesize=4G
-fadvise_hint=0
-
-group_reporting
+[isolated-e4defrag]
+# It is important to disable buffered io
+buffered=0
+donorname=file.def
+filename=file1
+inplace=0
+rw=write
 
-[defrag-fuzzer-8k]
+# Run e4defrag and aio-dio workers in parallel
+[e4defrag]
+stonewall
+time_based=30
+runtime=30
 ioengine=e4defrag
-iodepth=1
-size=1G
-bs=8k
+buffered=0
 donorname=file.def
-filename=file
+filename=file1
 inplace=0
-rw=randwrite
-numjobs=1
+rw=write
 
 [random-aio-32k]
 ioengine=libaio
+runtime=30
+verify=md5
+direct=1
+bs=64k
 iodepth=128
-bs=32k
-size=4G
-filename=file
-rw=randwrite
-numjobs=1
+filename=file1
+rw=randrw
+numjobs=4
+
+
diff --git a/examples/e4defrag2 b/examples/e4defrag2
new file mode 100644 (file)
index 0000000..818618a
--- /dev/null
@@ -0,0 +1,88 @@
+#################################################
+# Hardcode defragmentation patterns
+# Please be carefull, it can trigger kernel panic
+#################################################
+[global]
+ioengine=e4defrag
+group_reporting
+directory=/scratch
+nrfiles=1
+filesize=100M
+size=100M
+donorname=file.def
+bs=32k
+
+###########
+# Run several defragmentation threads for different files, but
+# use shared donor file
+[parallel-e4defrag]
+buffered=0
+inplace=0
+rw=write
+numjobs=4
+
+########
+# Run two defragmentation threads, each thread use another's file
+# as donor file
+
+[e4defrag-1]
+stonewall
+inplace=0
+rw=write
+donorname=e4defrag-2
+
+[e4defrag-2]
+inplace=0
+rw=write
+donorname=e4defrag-1
+
+###########
+# Run random defragment activity 
+[e4defrag-fuzzer-4k]
+stonewall
+inplace=1
+bs=4k
+rw=randwrite
+filename=file
+donorname=file.def
+
+########
+# Run random e4defrag and various aio workers in parallel
+[e4defrag-fuzzer-4k]
+stonewall
+continue_on_error=all
+inplace=1
+bs=4k
+donorname=file3.def
+filename=file3
+time_based=30
+rw=randwrite
+
+[buffered-aio-32k]
+continue_on_error=none
+verify=md5
+buffered=1
+ioengine=libaio
+iodepth=128
+bs=32k
+filename=file3
+rw=randrw
+runtime=30
+time_based=30
+numjobs=4
+
+[direct-aio-32k]
+continue_on_error=none
+verify=md5
+buffered=0
+direct=1
+ioengine=libaio
+iodepth=128
+bs=32k
+filename=file3
+rw=randrw
+runtime=30
+time_based=30
+numjobs=4
+
+
diff --git a/examples/falloc b/examples/falloc
new file mode 100644 (file)
index 0000000..fa30731
--- /dev/null
@@ -0,0 +1,54 @@
+[global]
+ioengine=falloc
+iodepth=1
+direct=0
+buffered=0
+directory=/scratch
+nrfiles=1
+size=100M
+filesize=100M
+group_reporting
+
+
+# Run falloc and punch_hole threads in parallel
+# After activity file will be highly fragmented
+[falloc-fuzzer]
+stonewall
+runtime=10
+time_based=10
+bssplit=4k/10:64k/50:32k/40
+rw=randwrite
+numjobs=1
+filename=fragmented_file
+
+[punch hole-fuzzer]
+bs=4k
+runtime=10
+time_based=10
+rw=randtrim
+numjobs=2
+filename=fragmented_file
+
+## Mesure IO performance on fragmented file
+[sequential aio-dio write]
+stonewall
+ioengine=libaio
+numjobs=1
+iodepth=128
+buffered=0
+direct=1
+rw=write
+bs=64k
+filename=fragmented_file
+
+[sequential buffered read]
+stonewall
+ioengine=sync
+numjobs=1
+iodepth=1
+buffered=1
+direct=0
+rw=read
+bs=64k
+filename=fragmented_file
+
diff --git a/fio.1 b/fio.1
index 086cf9d007a157735e4c213ffd97c71d94dcdb82..c22d8b28490e6f694ed051f095c2ff6670bf5ff4 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -472,6 +472,21 @@ and channel semantics (Send/Recv) for the InfiniBand, RoCE and iWARP protocols.
 .B external
 Loads an external I/O engine object file.  Append the engine filename as
 `:\fIenginepath\fR'.
+.TP
+.B falloc
+   IO engine that does regular linux native fallocate callt to simulate data
+transfer as fio ioengine
+.br
+  DDIR_READ  does fallocate(,mode = FALLOC_FL_KEEP_SIZE,)
+.br
+  DIR_WRITE does fallocate(,mode = 0)
+.br
+  DDIR_TRIM does fallocate(,mode = FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE)
+.TP
+.B e4defrag
+IO engine that does regular EXT4_IOC_MOVE_EXT ioctls to simulate defragment activity
+request to DDIR_WRITE event
+.TP
 .RE
 .RE
 .TP
@@ -1057,6 +1072,20 @@ used and the port is invalid.
 For TCP network connections, tell fio to listen for incoming
 connections rather than initiating an outgoing connection. The
 hostname must be omitted if this option is used.
+.TP
+.BI (e4defrag,donorname) \fR=\fPstr
+File will be used as a block donor (swap extents between files)
+.TP
+.BI (e4defrag,inplace) \fR=\fPint
+Configure donor file block allocation strategy         
+.RS
+.BI 0(default) :
+Preallocate donor's file on init
+.TP
+.BI 1:
+allocate space immidietly inside defragment event, and free right after event
+.RE
+.TP
 .SH OUTPUT
 While running, \fBfio\fR will display the status of the created jobs.  For
 example:
index 8fa50a8f5d987ebfa73098b0c5a17de5e2969940..d1cf7e8a70ba6480c9dc1b1021b5a739c5dec9f9 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1082,6 +1082,16 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                          { .ival = "fusion-aw-sync",
                            .help = "Fusion-io atomic write engine",
                          },
+#endif
+#ifdef FIO_HAVE_E4_ENG
+                         { .ival = "e4defrag",
+                           .help = "ext4 defrag engine",
+                         },
+#endif
+#ifdef FIO_HAVE_FALLOC_ENG
+                         { .ival = "falloc",
+                           .help = "fallocate() file based engine",
+                         },
 #endif
                          { .ival = "external",
                            .help = "Load external engine (append name)",
index d5c3f76e03fb40afe8c3807f0ded8620f50b1d1e..9b7ff29e50af7f07d656cf3e763e7fafe409a669 100644 (file)
@@ -45,6 +45,7 @@
 #define FIO_HAVE_CLOCK_MONOTONIC
 #define FIO_HAVE_GETTID
 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
+#define FIO_HAVE_E4_ENG
 
 /*
  * Can only enable this for newer glibcs, or the header and defines are
 #define FIO_HAVE_LINUX_FALLOCATE
 #endif
 
+#ifdef FIO_HAVE_LINUX_FALLOCATE
+#define FIO_HAVE_FALLOC_ENG
+#endif
+
 #ifdef SYNC_FILE_RANGE_WAIT_BEFORE
 #define FIO_HAVE_SYNC_FILE_RANGE
 #endif
diff --git a/parse.h b/parse.h
index 8a9e2f4a495d87cf513a16fc2338f312beef14c0..71190ea010e470bd7f1c7ad4b8846a2749c36da1 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -33,7 +33,7 @@ struct value_pair {
 };
 
 #define OPT_LEN_MAX    4096
-#define PARSE_MAX_VP   16
+#define PARSE_MAX_VP   24
 
 /*
  * Option define