config: remove HAVE_KERNEL_(READ|WRITE)_PPOS

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16479
This commit is contained in:
Rob Norris 2024-08-24 20:46:34 +10:00 committed by Brian Behlendorf
parent 80d7f0f98e
commit a5b3a87030
4 changed files with 5 additions and 135 deletions

View File

@ -1,69 +0,0 @@
dnl #
dnl # 4.14 API change
dnl # kernel_write() which was introduced in 3.9 was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITE], [
ZFS_LINUX_TEST_SRC([kernel_write], [
#include <linux/fs.h>
],[
struct file *file = NULL;
const void *buf = NULL;
size_t count = 0;
loff_t *pos = NULL;
ssize_t ret;
ret = kernel_write(file, buf, count, pos);
])
])
AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
ZFS_LINUX_TEST_RESULT([kernel_write], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
[kernel_write() take loff_t pointer])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 4.14 API change
dnl # kernel_read() which has existed for forever was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_READ], [
ZFS_LINUX_TEST_SRC([kernel_read], [
#include <linux/fs.h>
],[
struct file *file = NULL;
void *buf = NULL;
size_t count = 0;
loff_t *pos = NULL;
ssize_t ret;
ret = kernel_read(file, buf, count, pos);
])
])
AC_DEFUN([ZFS_AC_KERNEL_READ], [
AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
ZFS_LINUX_TEST_RESULT([kernel_read], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
[kernel_read() take loff_t pointer])
],[
AC_MSG_RESULT(no)
])
])
AC_DEFUN([ZFS_AC_KERNEL_SRC_RW], [
ZFS_AC_KERNEL_SRC_WRITE
ZFS_AC_KERNEL_SRC_READ
])
AC_DEFUN([ZFS_AC_KERNEL_RW], [
ZFS_AC_KERNEL_WRITE
ZFS_AC_KERNEL_READ
])

View File

@ -50,7 +50,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL
ZFS_AC_KERNEL_SRC_WAIT
ZFS_AC_KERNEL_SRC_INODE_TIMES
ZFS_AC_KERNEL_SRC_RW
ZFS_AC_KERNEL_SRC_TIMER_SETUP
ZFS_AC_KERNEL_SRC_PROC_OPERATIONS
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS
@ -171,7 +170,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL
ZFS_AC_KERNEL_WAIT
ZFS_AC_KERNEL_INODE_TIMES
ZFS_AC_KERNEL_RW
ZFS_AC_KERNEL_TIMER_SETUP
ZFS_AC_KERNEL_PROC_OPERATIONS
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS

View File

@ -623,26 +623,6 @@ ddi_copyout(const void *from, void *to, size_t len, int flags)
}
EXPORT_SYMBOL(ddi_copyout);
static ssize_t
spl_kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
{
#if defined(HAVE_KERNEL_READ_PPOS)
return (kernel_read(file, buf, count, pos));
#else
mm_segment_t saved_fs;
ssize_t ret;
saved_fs = get_fs();
set_fs(KERNEL_DS);
ret = vfs_read(file, (void __user *)buf, count, pos);
set_fs(saved_fs);
return (ret);
#endif
}
static int
spl_getattr(struct file *filp, struct kstat *stat)
{
@ -730,7 +710,7 @@ hostid_read(uint32_t *hostid)
* Read directly into the variable like eglibc does.
* Short reads are okay; native behavior is preserved.
*/
error = spl_kernel_read(filp, &value, sizeof (value), &off);
error = kernel_read(filp, &value, sizeof (value), &off);
if (error < 0) {
filp_close(filp, 0);
return (EIO);

View File

@ -69,26 +69,6 @@ zfs_file_close(zfs_file_t *fp)
filp_close(fp, 0);
}
static ssize_t
zfs_file_write_impl(zfs_file_t *fp, const void *buf, size_t count, loff_t *off)
{
#if defined(HAVE_KERNEL_WRITE_PPOS)
return (kernel_write(fp, buf, count, off));
#else
mm_segment_t saved_fs;
ssize_t rc;
saved_fs = get_fs();
set_fs(KERNEL_DS);
rc = vfs_write(fp, (__force const char __user __user *)buf, count, off);
set_fs(saved_fs);
return (rc);
#endif
}
/*
* Stateful write - use os internal file pointer to determine where to
* write and update on successful completion.
@ -106,7 +86,7 @@ zfs_file_write(zfs_file_t *fp, const void *buf, size_t count, ssize_t *resid)
loff_t off = fp->f_pos;
ssize_t rc;
rc = zfs_file_write_impl(fp, buf, count, &off);
rc = kernel_write(fp, buf, count, &off);
if (rc < 0)
return (-rc);
@ -138,7 +118,7 @@ zfs_file_pwrite(zfs_file_t *fp, const void *buf, size_t count, loff_t off,
{
ssize_t rc;
rc = zfs_file_write_impl(fp, buf, count, &off);
rc = kernel_write(fp, buf, count, &off);
if (rc < 0)
return (-rc);
@ -151,25 +131,6 @@ zfs_file_pwrite(zfs_file_t *fp, const void *buf, size_t count, loff_t off,
return (0);
}
static ssize_t
zfs_file_read_impl(zfs_file_t *fp, void *buf, size_t count, loff_t *off)
{
#if defined(HAVE_KERNEL_READ_PPOS)
return (kernel_read(fp, buf, count, off));
#else
mm_segment_t saved_fs;
ssize_t rc;
saved_fs = get_fs();
set_fs(KERNEL_DS);
rc = vfs_read(fp, (void __user *)buf, count, off);
set_fs(saved_fs);
return (rc);
#endif
}
/*
* Stateful read - use os internal file pointer to determine where to
* read and update on successful completion.
@ -187,7 +148,7 @@ zfs_file_read(zfs_file_t *fp, void *buf, size_t count, ssize_t *resid)
loff_t off = fp->f_pos;
ssize_t rc;
rc = zfs_file_read_impl(fp, buf, count, &off);
rc = kernel_read(fp, buf, count, &off);
if (rc < 0)
return (-rc);
@ -219,7 +180,7 @@ zfs_file_pread(zfs_file_t *fp, void *buf, size_t count, loff_t off,
{
ssize_t rc;
rc = zfs_file_read_impl(fp, buf, count, &off);
rc = kernel_read(fp, buf, count, &off);
if (rc < 0)
return (-rc);