add a parameter trunc-io-X when used it will truncate all reads/writes larger...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 22 Aug 2008 07:28:46 +0000 (17:28 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 22 Aug 2008 07:28:46 +0000 (17:28 +1000)
this to allow loadfiles to run on nfs servers that habve a small limit for rpc pdu sizes

dbench.c
dbench.h
nfsio.c

index c5f5688c7f1a5d27f1d1ea73798c890204715260..6e6f1361c49bc60e45795ab8755c595af00880eb 100644 (file)
--- a/dbench.c
+++ b/dbench.c
@@ -45,6 +45,7 @@ struct options options = {
        .export              = "/tmp",
        .protocol            = "tcp",
        .run_once            = 0,
+       .trunc_io            = 0,
 };
 
 static struct timeval tv_start;
@@ -370,6 +371,8 @@ static void process_opts(int argc, const char **argv)
                  "disable name resolution simulation", NULL },
                { "clients-per-process", 0, POPT_ARG_INT, &options.clients_per_process, 0, 
                  "number of clients per process", NULL },
+               { "trunc-io", 0, POPT_ARG_INT, &options.trunc_io, 0, 
+                 "truncate all io to this size", NULL },
                { "one-byte-write-fix", 0, POPT_ARG_NONE, &options.one_byte_write_fix, 0, 
                  "try to fix 1 byte writes", NULL },
                { "stat-check", 0, POPT_ARG_NONE, &options.stat_check, 0, 
index f410bd9190a25cc2a9df85b72d2861858580b663..56ab2d37a2011bc94952e81842bdcdb19dbec9ba 100644 (file)
--- a/dbench.h
+++ b/dbench.h
@@ -151,6 +151,7 @@ struct options {
        const char *export;
        const char *protocol;
        int run_once;
+       int trunc_io;
 };
 
 
diff --git a/nfsio.c b/nfsio.c
index 30ad91dd102fe04ec5d40f5c5fc98627f0aaf514..42ef47a8f987cd1ccd24ac4e22e612315c85952f 100644 (file)
--- a/nfsio.c
+++ b/nfsio.c
@@ -222,6 +222,10 @@ static void nfs3_write(struct dbench_op *op)
        int stable = op->params[2];
        nfsstat3 res;
 
+       if ((options.trunc_io > 0) && (len > options.trunc_io)) {
+               len = options.trunc_io;
+       }
+
        res = nfsio_write(op->child->private, op->fname, rw_buf, offset, len, stable);
        if (!check_status(res, op->status)) {
                printf("[%d] WRITE \"%s\" failed (%x) - expected %s\n", 
@@ -251,6 +255,10 @@ static void nfs3_read(struct dbench_op *op)
        int len = op->params[1];
        nfsstat3 res = 0;
 
+       if ((options.trunc_io > 0) && (len > options.trunc_io)) {
+               len = options.trunc_io;
+       }
+
        res = nfsio_read(op->child->private, op->fname, rw_buf, offset, len, NULL, NULL);
        if (!check_status(res, op->status)) {
                printf("[%d] READ \"%s\" failed (%x) - expected %s\n",