Simplify offset and length limit in zfs_write
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11176
This commit is contained in:
parent
9a764716fc
commit
d1dd72a2c5
|
@ -326,8 +326,6 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
|
|||
if (n == 0)
|
||||
return (0);
|
||||
|
||||
const rlim64_t limit = MAXOFFSET_T;
|
||||
|
||||
zfsvfs_t *zfsvfs = ZTOZSB(zp);
|
||||
ZFS_ENTER(zfsvfs);
|
||||
ZFS_VERIFY_ZP(zp);
|
||||
|
@ -417,13 +415,15 @@ zfs_write(znode_t *zp, uio_t *uio, int ioflag, cred_t *cr)
|
|||
return (EFBIG);
|
||||
}
|
||||
|
||||
const rlim64_t limit = MAXOFFSET_T;
|
||||
|
||||
if (woff >= limit) {
|
||||
zfs_rangelock_exit(lr);
|
||||
ZFS_EXIT(zfsvfs);
|
||||
return (SET_ERROR(EFBIG));
|
||||
}
|
||||
|
||||
if ((woff + n) > limit || woff > (limit - n))
|
||||
if (n > limit - woff)
|
||||
n = limit - woff;
|
||||
|
||||
uint64_t end_size = MAX(zp->z_size, woff + n);
|
||||
|
|
Loading…
Reference in New Issue