equal
deleted
inserted
replaced
424 } else { |
424 } else { |
425 /* |
425 /* |
426 * To simulate partial disk writes, we split writes into two |
426 * To simulate partial disk writes, we split writes into two |
427 * system calls so that the process can be killed in between. |
427 * system calls so that the process can be killed in between. |
428 */ |
428 */ |
429 split = (len > 0 ? rand() % len : 0); |
429 int sectors = len >> SPA_MINBLOCKSHIFT; |
|
430 split = (sectors > 0 ? rand() % sectors : 0) << |
|
431 SPA_MINBLOCKSHIFT; |
430 iolen = pwrite64(vp->v_fd, addr, split, offset); |
432 iolen = pwrite64(vp->v_fd, addr, split, offset); |
431 iolen += pwrite64(vp->v_fd, (char *)addr + split, |
433 iolen += pwrite64(vp->v_fd, (char *)addr + split, |
432 len - split, offset + split); |
434 len - split, offset + split); |
433 } |
435 } |
434 |
436 |