Add a new directive WRITEPATTERN that specifies the pattern to use when writing throu...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 28 Oct 2010 06:15:07 +0000 (17:15 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 28 Oct 2010 06:15:07 +0000 (17:15 +1100)
child.c
dbench.h
loadfiles/nfs_3.load [new file with mode: 0644]
nfsio.c

diff --git a/child.c b/child.c
index 57fb2df43df7fa9aee41c2dcf5ce3709052eaa8c..e25cb8e6c3a843942afa1d8ce25f1c12b42559f2 100644 (file)
--- a/child.c
+++ b/child.c
@@ -30,6 +30,9 @@
 
 #define ival(s) strtoll(s, NULL, 0)
 
+#define RWBUFSIZE 1024*1024
+char rw_buf[RWBUFSIZE];
+
 static void nb_sleep(int usec)
 {
        usleep(usec);
@@ -408,6 +411,26 @@ loop_again:
                }
 
 
+               /* WRITEPATTERN */
+               if (strncmp(line, "WRITEPATTERN", 12) == 0) {
+                       char *ptr = rw_buf;
+                       int count = RWBUFSIZE;
+                       
+                       while (count > 0) {
+                             int len;
+
+                             len = count;
+                             if (len > strlen(line +13)) {
+                                     len = strlen(line +13);
+                             }
+                             memcpy(ptr, line+13, len);
+                             ptr += len;
+                             count -= len;
+                       }
+                       goto again;
+               }
+
+
                /* RANDOMSTRING */
                if (strncmp(line, "RANDOMSTRING", 12) == 0) {
                        have_random = 1;
index 0b3c9c4c75e8aa7a25acb9ed10f4cc78850ef3d5..9781a6a008b672e3fb8c4d5178a5dbc9256365a5 100644 (file)
--- a/dbench.h
+++ b/dbench.h
@@ -217,3 +217,4 @@ struct nfsio;
 
 extern struct options options;
 extern int global_random;
+extern char rw_buf[];
diff --git a/loadfiles/nfs_3.load b/loadfiles/nfs_3.load
new file mode 100644 (file)
index 0000000..1dfcf04
--- /dev/null
@@ -0,0 +1,41 @@
+MKDIR3 "/clients" *
+MKDIR3 "/clients/client1" *
+LOOKUP3 "/clients/client1" 0x00000000
+#
+#
+# Writepattern sets the pattern to write. this pattern is repeated to fill the write buffer.
+#
+WRITEPATTERN 1234567890
+CREATE3  "/clients/client1/test.file" 0x00000000
+WRITE3 "/clients/client1/test.file" 0 32768 0 0x00000000
+REPEAT 1000
+WRITE3 "/clients/client1/test.file" +32768 32768 0 0x00000000
+COMMIT3 "/clients/client1/test.file" 0x00000000
+
+
+
+
+
+# The READ3/WRITE3 commands takes an offset. This can be specified either as
+# an absolute number, but also as a simple expression for generation of
+# random I/O
+#
+# Offset is then a string starting with a '*' followed by one or more
+# qualifier :
+# '*'    : Random 64 bit integer
+# '/yyy' : align the number to yyy. This is the same as x = (x/y)*y
+# '%yyy' : modulo yyy. This is the same as x = x%y
+# '+yyy' : Add y
+#
+# Examples :
+# '*'         A random offset between 0 and 2**64-1
+# '*/0x1000'  A random offset aligned to a page boundary (4096)
+# '*/0x1000%5000000' A random offset between 0 and 500000 aligned to page
+#                    boundary
+#
+# '*%100+25'  A random offset between 25 and 124
+#
+#
+# You can also use lines of the type "REPEAT <number>"
+# This means that the loadfile will repeat the next line
+# <number> times.
diff --git a/nfsio.c b/nfsio.c
index 08fcc0f1aee71578f03168b1d55e9cc310a451bc..c9ed44b84c5926b90aafb160060a6d41a1086912 100644 (file)
--- a/nfsio.c
+++ b/nfsio.c
@@ -29,9 +29,6 @@
 
 #define MAX_FILES 200
 
-static char rw_buf[1024*1024];
-
-
 struct cb_data {
        struct nfsio *nfsio;
        char *dirname;