X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibzpool%2Fkernel.c;h=0e10c8951aee2ddea510a1f0a9338fc0186c7c71;hb=7973e464de4f93b6e669f7f04a316e013767224e;hp=c38efd0aad661b71bdbbd70b63d456cb1b954f69;hpb=0aebd4f9e3223e8f1e09de7b29bba4f375db840c;p=zfs.git diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index c38efd0..0e10c89 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -647,7 +647,9 @@ vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, offset_t offset, * 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; rc = pwrite64(vp->v_fd, addr, split, offset); if (rc != -1) { done = rc;