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:
Rob Norris 2025-05-09 00:32:52 +10:00 committed by GitHub
parent 78628a5c15
commit 4800181b3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 0 additions and 196 deletions

View File

@ -123,41 +123,6 @@ extern int zpl_clone_file_range(struct file *src_file, loff_t src_off,
extern int zpl_dedupe_file_range(struct file *src_file, loff_t src_off,
struct file *dst_file, loff_t dst_off, uint64_t len);
/* compat for FICLONE/FICLONERANGE/FIDEDUPERANGE ioctls */
typedef struct {
int64_t fcr_src_fd;
uint64_t fcr_src_offset;
uint64_t fcr_src_length;
uint64_t fcr_dest_offset;
} zfs_ioc_compat_file_clone_range_t;
typedef struct {
int64_t fdri_dest_fd;
uint64_t fdri_dest_offset;
uint64_t fdri_bytes_deduped;
int32_t fdri_status;
uint32_t fdri_reserved;
} zfs_ioc_compat_dedupe_range_info_t;
typedef struct {
uint64_t fdr_src_offset;
uint64_t fdr_src_length;
uint16_t fdr_dest_count;
uint16_t fdr_reserved1;
uint32_t fdr_reserved2;
zfs_ioc_compat_dedupe_range_info_t fdr_info[];
} zfs_ioc_compat_dedupe_range_t;
#define ZFS_IOC_COMPAT_FICLONE _IOW(0x94, 9, int)
#define ZFS_IOC_COMPAT_FICLONERANGE \
_IOW(0x94, 13, zfs_ioc_compat_file_clone_range_t)
#define ZFS_IOC_COMPAT_FIDEDUPERANGE \
_IOWR(0x94, 54, zfs_ioc_compat_dedupe_range_t)
extern long zpl_ioctl_ficlone(struct file *filp, void *arg);
extern long zpl_ioctl_ficlonerange(struct file *filp, void *arg);
extern long zpl_ioctl_fideduperange(struct file *filp, void *arg);
#if defined(HAVE_INODE_TIMESTAMP_TRUNCATE)
#define zpl_inode_timestamp_truncate(ts, ip) timestamp_truncate(ts, ip)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -31,13 +31,6 @@ export RECORDSIZE=$(zfs get -Hp -o value recordsize $TESTPOOL/$TESTFS)
MINBLKSIZE1=512
MINBLKSIZE2=1024
function verify_block_cloning
{
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
}
function verify_crossfs_block_cloning
{
if is_linux && [[ $(linux_version) -lt $(linux_version "5.3") ]]; then

View File

@ -30,7 +30,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify various corner cases in block cloning across datasets"

View File

@ -30,7 +30,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify various corner cases in block cloning across datasets"

View File

@ -30,7 +30,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning properly clones regular files across datasets"

View File

@ -30,7 +30,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning properly clones small files (with embedded blocks) across datasets"

View File

@ -30,7 +30,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning properly clones sparse files (files with holes) across datasets"

View File

@ -31,7 +31,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning across datasets with different properties"

View File

@ -32,7 +32,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning across datasets with different checksum properties"

View File

@ -32,7 +32,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning across datasets with different compression properties"

View File

@ -32,7 +32,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning across datasets with different copies properties"

View File

@ -32,7 +32,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning across datasets with different recordsize properties"

View File

@ -32,7 +32,6 @@
verify_runnable "both"
verify_block_cloning
verify_crossfs_block_cloning
log_assert "Verify block cloning with all sync property settings"

View File

@ -30,8 +30,6 @@
verify_runnable "both"
verify_block_cloning
log_assert "Verify various corner cases in block cloning within the same dataset"
# Disable compression to make sure we won't use embedded blocks.

View File

@ -30,8 +30,6 @@
verify_runnable "both"
verify_block_cloning
log_assert "Verify various corner cases in block cloning within the same dataset"
# Disable compression to make sure we won't use embedded blocks.

View File

@ -30,8 +30,6 @@
verify_runnable "both"
verify_block_cloning
log_assert "Verify block cloning properly clones regular files within the same dataset"
# Disable compression to make sure we won't use embedded blocks.

View File

@ -30,8 +30,6 @@
verify_runnable "both"
verify_block_cloning
log_assert "Verify block cloning properly clones small files (with embedded blocks) within the same dataset"
# Enable ZLE compression to make sure what is the maximum amount of data we

View File

@ -30,8 +30,6 @@
verify_runnable "both"
verify_block_cloning
log_assert "Verify block cloning properly clones sparse files (files with holes) within the same dataset"
# Compression doesn't matter here.

View File

@ -40,10 +40,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
VDIR=$TEST_BASE_DIR/disk-bclone
VDEV="$VDIR/a"

View File

@ -41,10 +41,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
VDIR=$TEST_BASE_DIR/disk-bclone
VDEV="$VDIR/a"

View File

@ -30,10 +30,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="The copy_file_range syscall can clone whole files."
log_assert $claim

View File

@ -31,10 +31,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="copy_file_range will fall back to copy when cloning not possible."
log_assert $claim

View File

@ -31,10 +31,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="copy_file_range will fall back to copy when cloning on same txg"
log_assert $claim

View File

@ -30,10 +30,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="The copy_file_range syscall can clone parts of a file."
log_assert $claim

View File

@ -30,10 +30,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="The copy_file_range syscall copies files when block cloning is disabled."
log_assert $claim

View File

@ -37,10 +37,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
claim="The first clone at a large offset is functional"
log_assert $claim

View File

@ -46,10 +46,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
VDIR=$TEST_BASE_DIR/disk-bclone
VDEV="$VDIR/a $VDIR/b $VDIR/c"
LDEV="$VDIR/e $VDIR/f"

View File

@ -43,10 +43,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
export VDIR=$TEST_BASE_DIR/disk-bclone
export VDEV="$VDIR/a $VDIR/b $VDIR/c"
export LDEV="$VDIR/e $VDIR/f"

View File

@ -43,10 +43,6 @@
verify_runnable "global"
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi
export VDIR=$TEST_BASE_DIR/disk-bclone
export VDEV="$VDIR/a $VDIR/b $VDIR/c"
export LDEV="$VDIR/e $VDIR/f"

View File

@ -47,7 +47,6 @@
#
verify_runnable "global"
verify_block_cloning
if ! is_linux; then
log_unsupported "cp --reflink is a GNU coreutils option"