This may be a bad idea. I can't really think of any pros or cons,
other than a general principle of "when feasible, prefer random over
deterministic".



Index: softraid_raid1.c
===================================================================
RCS file: /cvs/src/sys/dev/softraid_raid1.c,v
retrieving revision 1.54
diff -u -p -r1.54 softraid_raid1.c
--- softraid_raid1.c    1 Nov 2013 17:36:19 -0000       1.54
+++ softraid_raid1.c    7 Nov 2013 14:32:33 -0000
@@ -350,8 +350,8 @@ sr_raid1_rw(struct sr_workunit *wu)
                        rt = 0;
 ragain:
                        /* interleave reads */
-                       chunk = sd->mds.mdd_raid1.sr1_counter++ %
-                           sd->sd_meta->ssdi.ssd_chunk_no;
+                       chunk =
+                           arc4random_uniform(sd->sd_meta->ssdi.ssd_chunk_no);
                        scp = sd->sd_vol.sv_chunks[chunk];
                        switch (scp->src_meta.scm_status) {
                        case BIOC_SDONLINE:
Index: softraidvar.h
===================================================================
RCS file: /cvs/src/sys/dev/softraidvar.h,v
retrieving revision 1.140
diff -u -p -r1.140 softraidvar.h
--- softraidvar.h       4 Nov 2013 21:02:57 -0000       1.140
+++ softraidvar.h       7 Nov 2013 14:32:33 -0000
@@ -417,7 +417,7 @@ struct sr_raid0 {
 /* RAID 1 */
 #define SR_RAID1_NOWU          16
 struct sr_raid1 {
-       u_int32_t               sr1_counter;
+       u_int32_t               sr1_unused;
 };
 
 /* RAID 4 */

Reply via email to