Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_vnops.c.new
Show First 20 Lines • Show All 3,332 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
VOP_UNLOCK(outvp); | VOP_UNLOCK(outvp); | ||||
} | } | ||||
if (mp != NULL) | if (mp != NULL) | ||||
vn_finished_write(mp); | vn_finished_write(mp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
if (holein == 0 && holeout > 0) { | |||||
asomers: Do you really need this special case? I would think that the "else" clause's value of MAX(in… | |||||
rmacklemAuthorUnsubmitted Done Inline ActionsWell, yes and no. If there was a filesystem that reported Are there any such file systems right now? ZFS does this now, except the hole_size == 512 is bogus, rmacklem: Well, yes and no. If there was a filesystem that reported
f_iosize == 131072 and hole_size ==… | |||||
/* | /* | ||||
* Set the blksize to the larger of the hole sizes for invp and outvp. | * For this special case, the input data will be scanned | ||||
* If hole sizes aren't available, set the blksize to the larger | * for blocks of all 0 bytes. For these blocks, the | ||||
* f_iosize of invp and outvp. | * write can be skipped for the output file to create | ||||
* This code expects the hole sizes and f_iosizes to be powers of 2. | * an unallocated region. | ||||
* This value is clipped at 4Kbytes and 1Mbyte. | * Therefore, use the appropriate size for the output file. | ||||
*/ | */ | ||||
blksize = MAX(holein, holeout); | blksize = holeout; | ||||
if (blksize <= 512) { | |||||
/* Clip len to end at an exact multiple of hole size. */ | /* | ||||
if (blksize > 1) { | * Use 512 since ZFS reports a _PC_MIN_HOLE_SIZE | ||||
asomersUnsubmitted Not Done Inline Actionss/512/f_iosize/ asomers: s/512/f_iosize/ | |||||
rmacklemAuthorUnsubmitted Done Inline ActionsThanks, I will fix this typo. rmacklem: Thanks, I will fix this typo.
| |||||
rem = *inoffp % blksize; | * of 512, although it actually only creates | ||||
if (rem > 0) | * unallocated regions for blocks >= f_iosize. | ||||
rem = blksize - rem; | */ | ||||
if (len > rem && len - rem > blksize) | blksize = outvp->v_mount->mnt_stat.f_iosize; | ||||
len = savlen = rounddown(len - rem, blksize) + rem; | |||||
} | } | ||||
} else { | |||||
if (blksize <= 1) | /* | ||||
* Use the larger of the two f_iosize values. If they are | |||||
* not the same size, one will normally be an exact multiple of | |||||
* the other, since they are both likely to be a power of 2. | |||||
*/ | |||||
blksize = MAX(invp->v_mount->mnt_stat.f_iosize, | blksize = MAX(invp->v_mount->mnt_stat.f_iosize, | ||||
outvp->v_mount->mnt_stat.f_iosize); | outvp->v_mount->mnt_stat.f_iosize); | ||||
} | |||||
/* Clip to sane limits. */ | |||||
if (blksize < 4096) | if (blksize < 4096) | ||||
blksize = 4096; | blksize = 4096; | ||||
else if (blksize > 1024 * 1024) | else if (blksize > maxphys) | ||||
blksize = 1024 * 1024; | blksize = maxphys; | ||||
dat = malloc(blksize, M_TEMP, M_WAITOK); | dat = malloc(blksize, M_TEMP, M_WAITOK); | ||||
/* | /* | ||||
* If VOP_IOCTL(FIOSEEKHOLE) works for invp, use it and FIOSEEKDATA | * If VOP_IOCTL(FIOSEEKHOLE) works for invp, use it and FIOSEEKDATA | ||||
* to find holes. Otherwise, just scan the read block for all 0s | * to find holes. Otherwise, just scan the read block for all 0s | ||||
* in the inner loop where the data copying is done. | * in the inner loop where the data copying is done. | ||||
* Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may | * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may | ||||
* support holes on the server, but do not support FIOSEEKHOLE. | * support holes on the server, but do not support FIOSEEKHOLE. | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |
Do you really need this special case? I would think that the "else" clause's value of MAX(in f_iosize, out f_iosize) would still be appropriate here.