add a mechanism to use random LBA in scsi read/write
authorroot <root@rcn1.VSOFS1.COM>
Wed, 22 Jul 2009 02:31:27 +0000 (12:31 +1000)
committerroot <root@rcn1.VSOFS1.COM>
Wed, 22 Jul 2009 02:31:27 +0000 (12:31 +1000)
dbench.c
linux_scsi.c
loadfiles/scsi.txt

index acc4d27c703ca9ff8e58c395b3a615f6c7dac9c9..857fc3db6f0b31a302f4fadd59106b8adf36a401 100644 (file)
--- a/dbench.c
+++ b/dbench.c
@@ -276,6 +276,7 @@ static void create_procs(int nprocs, void (*fn)(struct child_struct *, const cha
                        int j;
 
                        setlinebuf(stdout);
+                       srandom(getpid() ^ time(NULL));
 
                        for (j=0;j<options.clients_per_process;j++) {
                                nb_ops->setup(&children[i*options.clients_per_process + j]);
index b2e1b7a61dac90c70cb50a23e967d327517e1304..5dbc167ca60fd34a50f4c37b3def9a769d5fd41d 100644 (file)
@@ -225,6 +225,10 @@ static void scsi_read6(struct dbench_op *op)
        char data[data_size];
        unsigned char sc;
 
+       if (lba == 0xffffffff) {
+               lba = random();
+       }
+
        /* we only have 24 bit addresses in read 6 */
        if (lba > 0x00ffffff) {
                lba &= 0x00ffffff;
@@ -274,6 +278,10 @@ static void scsi_read10(struct dbench_op *op)
        char data[data_size];
        unsigned char sc;
 
+       if (lba == 0xffffffff) {
+               lba = random();
+       }
+
        /* make sure we wrap properly instead of failing if the loadfile
           is bigger than our device
        */
@@ -329,6 +337,10 @@ static void scsi_write10(struct dbench_op *op)
                return;
        }
 
+       if (lba == 0xffffffff) {
+               lba = random();
+       }
+
        /* make sure we wrap properly instead of failing if the loadfile
           is bigger than our device
        */
index 7e0d7ddaf54ba5dbdbd4013070699158c6534d9d..47a88c0d1327c82007cd036a0377d1100eae6a69 100644 (file)
@@ -4,28 +4,38 @@
 # timestamp TESTUNITREADY sense
 0.000 TESTUNITREADY 0x00
 #
+#
 # timestamp READ6 lba #xferlen sense
+#    if lba is 0xffffffff this means to use a random lba
 0.000 READ6    0 1 0x00
 #
+#
 # timestamp READ10 lba #xferlen rd grp sense
-# rd is :
-# 3 bits     0xe0 : RDPROTECT
-# 1 bit      0x10 : DPO
-# 1 bit      0x08 : FUA
-# 1 bit      0x02 : FUA_NV
+#   if lba is 0xffffffff this means to use a random lba
+#
+#   rd is :
+#     3 bits     0xe0 : RDPROTECT
+#     1 bit      0x10 : DPO
+#     1 bit      0x08 : FUA
+#     1 bit      0x02 : FUA_NV
 0.000 READ10    0 256 0 0 0x00
 0.000 READ10 1000 256 0 0 0x00
 0.000 READ10 2000 256 0 0 0x00
 0.000 READ10 5000 256 0 0 0x00
 #
+#
 # timestamp READCAPACITY10 lba pmi(0/1) sense
 0.000 READCAPACITY10 0 0 0x00
 #
-# timestamp WRITE10 lba #xferlen FUAbits
+#
+# timestamp WRITE10 lba #xferlen FUAbits grp sense
+# WRITES are ignored by default and must be activated using --allow-scsi-writes
+#
+#   if lba is 0xffffffff this means to use a random lba
+#
 #   FUAbits are cdb byte#1 in SBC:
 #     a value of 0x06 will force the data to be written to the medium
 #     a value of 0x00 allow the device to only write to nv-ram and not medium
-#   WRITES are ignored by default and must be activated using --allow-scsi-writes
 0.000 WRITE10 5000 1 0x06 0 0x00