Print this page
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
        
@@ -424,11 +424,13 @@
         } else {
                 /*
                  * To simulate partial disk writes, we split writes into two
                  * system calls so that the process can be killed in between.
                  */
-                split = (len > 0 ? rand() % len : 0);
+                int sectors = len >> SPA_MINBLOCKSHIFT;
+                split = (sectors > 0 ? rand() % sectors : 0) <<
+                    SPA_MINBLOCKSHIFT;
                 iolen = pwrite64(vp->v_fd, addr, split, offset);
                 iolen += pwrite64(vp->v_fd, (char *)addr + split,
                     len - split, offset + split);
         }