mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Introduce zfs rewrite subcommand (#17246)
This allows to rewrite content of specified file(s) as-is without modifications, but at a different location, compression, checksum, dedup, copies and other parameter values. It is faster than read plus write, since it does not require data copying to user-space. It is also faster for sync=always datasets, since without data modification it does not require ZIL writing. Also since it is protected by normal range range locks, it can be done under any other load. Also it does not affect file's modification time or other properties. Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com>
This commit is contained in:
committed by
Alexander Motin
parent
abb6211e7a
commit
809b553940
@@ -306,6 +306,18 @@ zfs_ioctl(vnode_t *vp, ulong_t com, intptr_t data, int flag, cred_t *cred,
|
||||
*(offset_t *)data = off;
|
||||
return (0);
|
||||
}
|
||||
case ZFS_IOC_REWRITE: {
|
||||
zfs_rewrite_args_t *args = (zfs_rewrite_args_t *)data;
|
||||
if ((flag & FWRITE) == 0)
|
||||
return (SET_ERROR(EBADF));
|
||||
error = vn_lock(vp, LK_SHARED);
|
||||
if (error)
|
||||
return (error);
|
||||
error = zfs_rewrite(VTOZ(vp), args->off, args->len,
|
||||
args->flags, args->arg);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
return (SET_ERROR(ENOTTY));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user