--- a/usr/src/lib/libzpool/common/kernel.c Sun May 20 02:46:39 2012 -0500
+++ b/usr/src/lib/libzpool/common/kernel.c Mon May 21 12:11:39 2012 -0700
@@ -426,7 +426,9 @@
* 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);