mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
ioctl: remove FICLONE/FICLONERANGE/FIDEDUPERANGE compat
These are only required to support these ioctls on Linux <4.5. Since 4.18 is our cutoff, we don't need this code anymore. Also removing related test things that will never match again. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17308
This commit is contained in:
@@ -1004,12 +1004,6 @@ zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
return (zpl_ioctl_getdosflags(filp, (void *)arg));
|
||||
case ZFS_IOC_SETDOSFLAGS:
|
||||
return (zpl_ioctl_setdosflags(filp, (void *)arg));
|
||||
case ZFS_IOC_COMPAT_FICLONE:
|
||||
return (zpl_ioctl_ficlone(filp, (void *)arg));
|
||||
case ZFS_IOC_COMPAT_FICLONERANGE:
|
||||
return (zpl_ioctl_ficlonerange(filp, (void *)arg));
|
||||
case ZFS_IOC_COMPAT_FIDEDUPERANGE:
|
||||
return (zpl_ioctl_fideduperange(filp, (void *)arg));
|
||||
default:
|
||||
return (-ENOTTY);
|
||||
}
|
||||
|
||||
@@ -212,85 +212,3 @@ zpl_dedupe_file_range(struct file *src_file, loff_t src_off,
|
||||
return (-EOPNOTSUPP);
|
||||
}
|
||||
#endif /* HAVE_VFS_DEDUPE_FILE_RANGE */
|
||||
|
||||
/* Entry point for FICLONE, before Linux 4.5. */
|
||||
long
|
||||
zpl_ioctl_ficlone(struct file *dst_file, void *arg)
|
||||
{
|
||||
unsigned long sfd = (unsigned long)arg;
|
||||
|
||||
struct file *src_file = fget(sfd);
|
||||
if (src_file == NULL)
|
||||
return (-EBADF);
|
||||
|
||||
if (dst_file->f_op != src_file->f_op) {
|
||||
fput(src_file);
|
||||
return (-EXDEV);
|
||||
}
|
||||
|
||||
size_t len = i_size_read(file_inode(src_file));
|
||||
|
||||
ssize_t ret = zpl_clone_file_range_impl(src_file, 0, dst_file, 0, len);
|
||||
|
||||
fput(src_file);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret == -EOPNOTSUPP)
|
||||
return (-ENOTTY);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (ret != len)
|
||||
return (-EINVAL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Entry point for FICLONERANGE, before Linux 4.5. */
|
||||
long
|
||||
zpl_ioctl_ficlonerange(struct file *dst_file, void __user *arg)
|
||||
{
|
||||
zfs_ioc_compat_file_clone_range_t fcr;
|
||||
|
||||
if (copy_from_user(&fcr, arg, sizeof (fcr)))
|
||||
return (-EFAULT);
|
||||
|
||||
struct file *src_file = fget(fcr.fcr_src_fd);
|
||||
if (src_file == NULL)
|
||||
return (-EBADF);
|
||||
|
||||
if (dst_file->f_op != src_file->f_op) {
|
||||
fput(src_file);
|
||||
return (-EXDEV);
|
||||
}
|
||||
|
||||
size_t len = fcr.fcr_src_length;
|
||||
if (len == 0)
|
||||
len = i_size_read(file_inode(src_file)) - fcr.fcr_src_offset;
|
||||
|
||||
ssize_t ret = zpl_clone_file_range_impl(src_file, fcr.fcr_src_offset,
|
||||
dst_file, fcr.fcr_dest_offset, len);
|
||||
|
||||
fput(src_file);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret == -EOPNOTSUPP)
|
||||
return (-ENOTTY);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if (ret != len)
|
||||
return (-EINVAL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Entry point for FIDEDUPERANGE, before Linux 4.5. */
|
||||
long
|
||||
zpl_ioctl_fideduperange(struct file *filp, void *arg)
|
||||
{
|
||||
(void) arg;
|
||||
|
||||
/* No support for dedup yet */
|
||||
return (-ENOTTY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user