kernel.c (225736) | kernel.c (243674) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 460 unchanged lines hidden (view full) --- 469 470 if (uio == UIO_READ) { 471 iolen = pread64(vp->v_fd, addr, len, offset); 472 } else { 473 /* 474 * To simulate partial disk writes, we split writes into two 475 * system calls so that the process can be killed in between. 476 */ | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 460 unchanged lines hidden (view full) --- 469 470 if (uio == UIO_READ) { 471 iolen = pread64(vp->v_fd, addr, len, offset); 472 } else { 473 /* 474 * To simulate partial disk writes, we split writes into two 475 * system calls so that the process can be killed in between. 476 */ |
477 split = (len > 0 ? rand() % len : 0); | 477 int sectors = len >> SPA_MINBLOCKSHIFT; 478 split = (sectors > 0 ? rand() % sectors : 0) << 479 SPA_MINBLOCKSHIFT; |
478 iolen = pwrite64(vp->v_fd, addr, split, offset); 479 iolen += pwrite64(vp->v_fd, (char *)addr + split, 480 len - split, offset + split); 481 } 482 483 if (iolen == -1) 484 return (errno); 485 if (residp) --- 559 unchanged lines hidden --- | 480 iolen = pwrite64(vp->v_fd, addr, split, offset); 481 iolen += pwrite64(vp->v_fd, (char *)addr + split, 482 len - split, offset + split); 483 } 484 485 if (iolen == -1) 486 return (errno); 487 if (residp) --- 559 unchanged lines hidden --- |