mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
config: remove HAVE_VFS_RW_ITERATE
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:
parent
f3d30f1ce0
commit
72be1f4062
29
config/kernel-vfs-new-sync-rw.m4
Normal file
29
config/kernel-vfs-new-sync-rw.m4
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
dnl #
|
||||||
|
dnl # Linux 4.1 API
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_NEW_SYNC_RW], [
|
||||||
|
ZFS_LINUX_TEST_SRC([new_sync_rw], [
|
||||||
|
#include <linux/fs.h>
|
||||||
|
],[
|
||||||
|
ssize_t ret __attribute__ ((unused));
|
||||||
|
struct file *filp = NULL;
|
||||||
|
char __user *rbuf = NULL;
|
||||||
|
const char __user *wbuf = NULL;
|
||||||
|
size_t len = 0;
|
||||||
|
loff_t ppos;
|
||||||
|
|
||||||
|
ret = new_sync_read(filp, rbuf, len, &ppos);
|
||||||
|
ret = new_sync_write(filp, wbuf, len, &ppos);
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_VFS_NEW_SYNC_RW], [
|
||||||
|
AC_MSG_CHECKING([whether new_sync_read/write() are available])
|
||||||
|
ZFS_LINUX_TEST_RESULT([new_sync_rw], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
|
||||||
|
[new_sync_read()/new_sync_write() are available])
|
||||||
|
],[
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
])
|
||||||
|
])
|
@ -1,56 +0,0 @@
|
|||||||
dnl #
|
|
||||||
dnl # Linux 3.16 API
|
|
||||||
dnl #
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE], [
|
|
||||||
ZFS_LINUX_TEST_SRC([file_operations_rw], [
|
|
||||||
#include <linux/fs.h>
|
|
||||||
|
|
||||||
static ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
|
|
||||||
{ return 0; }
|
|
||||||
static ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
|
|
||||||
{ return 0; }
|
|
||||||
|
|
||||||
static const struct file_operations
|
|
||||||
fops __attribute__ ((unused)) = {
|
|
||||||
.read_iter = test_read,
|
|
||||||
.write_iter = test_write,
|
|
||||||
};
|
|
||||||
],[])
|
|
||||||
|
|
||||||
ZFS_LINUX_TEST_SRC([new_sync_rw], [
|
|
||||||
#include <linux/fs.h>
|
|
||||||
],[
|
|
||||||
ssize_t ret __attribute__ ((unused));
|
|
||||||
struct file *filp = NULL;
|
|
||||||
char __user *rbuf = NULL;
|
|
||||||
const char __user *wbuf = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
loff_t ppos;
|
|
||||||
|
|
||||||
ret = new_sync_read(filp, rbuf, len, &ppos);
|
|
||||||
ret = new_sync_write(filp, wbuf, len, &ppos);
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE], [
|
|
||||||
AC_MSG_CHECKING([whether fops->read/write_iter() are available])
|
|
||||||
ZFS_LINUX_TEST_RESULT([file_operations_rw], [
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
|
|
||||||
[fops->read/write_iter() are available])
|
|
||||||
|
|
||||||
dnl #
|
|
||||||
dnl # Linux 4.1 API
|
|
||||||
dnl #
|
|
||||||
AC_MSG_CHECKING([whether new_sync_read/write() are available])
|
|
||||||
ZFS_LINUX_TEST_RESULT([new_sync_rw], [
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
|
|
||||||
[new_sync_read()/new_sync_write() are available])
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
])
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
])
|
|
||||||
])
|
|
@ -104,7 +104,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
|||||||
ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO
|
ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO
|
||||||
ZFS_AC_KERNEL_SRC_VFS_READPAGES
|
ZFS_AC_KERNEL_SRC_VFS_READPAGES
|
||||||
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||||
ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE
|
ZFS_AC_KERNEL_SRC_VFS_NEW_SYNC_RW
|
||||||
ZFS_AC_KERNEL_SRC_VFS_IOV_ITER
|
ZFS_AC_KERNEL_SRC_VFS_IOV_ITER
|
||||||
ZFS_AC_KERNEL_SRC_VFS_COPY_FILE_RANGE
|
ZFS_AC_KERNEL_SRC_VFS_COPY_FILE_RANGE
|
||||||
ZFS_AC_KERNEL_SRC_VFS_GENERIC_COPY_FILE_RANGE
|
ZFS_AC_KERNEL_SRC_VFS_GENERIC_COPY_FILE_RANGE
|
||||||
@ -245,7 +245,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
|||||||
ZFS_AC_KERNEL_VFS_DIRECT_IO
|
ZFS_AC_KERNEL_VFS_DIRECT_IO
|
||||||
ZFS_AC_KERNEL_VFS_READPAGES
|
ZFS_AC_KERNEL_VFS_READPAGES
|
||||||
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||||
ZFS_AC_KERNEL_VFS_RW_ITERATE
|
ZFS_AC_KERNEL_VFS_NEW_SYNC_RW
|
||||||
ZFS_AC_KERNEL_VFS_IOV_ITER
|
ZFS_AC_KERNEL_VFS_IOV_ITER
|
||||||
ZFS_AC_KERNEL_VFS_COPY_FILE_RANGE
|
ZFS_AC_KERNEL_VFS_COPY_FILE_RANGE
|
||||||
ZFS_AC_KERNEL_VFS_GENERIC_COPY_FILE_RANGE
|
ZFS_AC_KERNEL_VFS_GENERIC_COPY_FILE_RANGE
|
||||||
|
@ -240,8 +240,6 @@ zpl_file_accessed(struct file *filp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_VFS_RW_ITERATE)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When HAVE_VFS_IOV_ITER is defined the iov_iter structure supports
|
* When HAVE_VFS_IOV_ITER is defined the iov_iter structure supports
|
||||||
* iovecs, kvevs, bvecs and pipes, plus all the required interfaces to
|
* iovecs, kvevs, bvecs and pipes, plus all the required interfaces to
|
||||||
@ -342,91 +340,6 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
|
|||||||
return (wrote);
|
return (wrote);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !HAVE_VFS_RW_ITERATE */
|
|
||||||
|
|
||||||
static ssize_t
|
|
||||||
zpl_aio_read(struct kiocb *kiocb, const struct iovec *iov,
|
|
||||||
unsigned long nr_segs, loff_t pos)
|
|
||||||
{
|
|
||||||
cred_t *cr = CRED();
|
|
||||||
fstrans_cookie_t cookie;
|
|
||||||
struct file *filp = kiocb->ki_filp;
|
|
||||||
size_t count;
|
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
ret = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
|
|
||||||
if (ret)
|
|
||||||
return (ret);
|
|
||||||
|
|
||||||
zfs_uio_t uio;
|
|
||||||
zfs_uio_iovec_init(&uio, iov, nr_segs, kiocb->ki_pos, UIO_USERSPACE,
|
|
||||||
count, 0);
|
|
||||||
|
|
||||||
crhold(cr);
|
|
||||||
cookie = spl_fstrans_mark();
|
|
||||||
|
|
||||||
ret = -zfs_read(ITOZ(filp->f_mapping->host), &uio,
|
|
||||||
flip->f_flags | zfs_io_flags(kiocb), cr);
|
|
||||||
|
|
||||||
spl_fstrans_unmark(cookie);
|
|
||||||
crfree(cr);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
return (ret);
|
|
||||||
|
|
||||||
ssize_t read = count - uio.uio_resid;
|
|
||||||
kiocb->ki_pos += read;
|
|
||||||
|
|
||||||
zpl_file_accessed(filp);
|
|
||||||
|
|
||||||
return (read);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t
|
|
||||||
zpl_aio_write(struct kiocb *kiocb, const struct iovec *iov,
|
|
||||||
unsigned long nr_segs, loff_t pos)
|
|
||||||
{
|
|
||||||
cred_t *cr = CRED();
|
|
||||||
fstrans_cookie_t cookie;
|
|
||||||
struct file *filp = kiocb->ki_filp;
|
|
||||||
struct inode *ip = filp->f_mapping->host;
|
|
||||||
size_t count;
|
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
ret = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ);
|
|
||||||
if (ret)
|
|
||||||
return (ret);
|
|
||||||
|
|
||||||
ret = generic_write_checks(filp, &pos, &count, S_ISBLK(ip->i_mode));
|
|
||||||
if (ret)
|
|
||||||
return (ret);
|
|
||||||
|
|
||||||
kiocb->ki_pos = pos;
|
|
||||||
|
|
||||||
zfs_uio_t uio;
|
|
||||||
zfs_uio_iovec_init(&uio, iov, nr_segs, kiocb->ki_pos, UIO_USERSPACE,
|
|
||||||
count, 0);
|
|
||||||
|
|
||||||
crhold(cr);
|
|
||||||
cookie = spl_fstrans_mark();
|
|
||||||
|
|
||||||
ret = -zfs_write(ITOZ(ip), &uio,
|
|
||||||
filp->f_flags | zfs_io_flags(kiocb), cr);
|
|
||||||
|
|
||||||
spl_fstrans_unmark(cookie);
|
|
||||||
crfree(cr);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
return (ret);
|
|
||||||
|
|
||||||
ssize_t wrote = count - uio.uio_resid;
|
|
||||||
kiocb->ki_pos += wrote;
|
|
||||||
|
|
||||||
return (wrote);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* HAVE_VFS_RW_ITERATE */
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
zpl_direct_IO_impl(void)
|
zpl_direct_IO_impl(void)
|
||||||
{
|
{
|
||||||
@ -440,7 +353,6 @@ zpl_direct_IO_impl(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_VFS_RW_ITERATE)
|
|
||||||
#if defined(HAVE_VFS_DIRECT_IO_ITER)
|
#if defined(HAVE_VFS_DIRECT_IO_ITER)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
zpl_direct_IO(struct kiocb *kiocb, struct iov_iter *iter)
|
zpl_direct_IO(struct kiocb *kiocb, struct iov_iter *iter)
|
||||||
@ -463,27 +375,6 @@ zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
|
|||||||
#error "Unknown Direct I/O interface"
|
#error "Unknown Direct I/O interface"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* HAVE_VFS_RW_ITERATE */
|
|
||||||
|
|
||||||
#if defined(HAVE_VFS_DIRECT_IO_IOVEC)
|
|
||||||
static ssize_t
|
|
||||||
zpl_direct_IO(int rw, struct kiocb *kiocb, const struct iovec *iov,
|
|
||||||
loff_t pos, unsigned long nr_segs)
|
|
||||||
{
|
|
||||||
return (zpl_direct_IO_impl());
|
|
||||||
}
|
|
||||||
#elif defined(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET)
|
|
||||||
static ssize_t
|
|
||||||
zpl_direct_IO(int rw, struct kiocb *kiocb, struct iov_iter *iter, loff_t pos)
|
|
||||||
{
|
|
||||||
return (zpl_direct_IO_impl());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#error "Unknown Direct I/O interface"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* HAVE_VFS_RW_ITERATE */
|
|
||||||
|
|
||||||
static loff_t
|
static loff_t
|
||||||
zpl_llseek(struct file *filp, loff_t offset, int whence)
|
zpl_llseek(struct file *filp, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
@ -1250,7 +1141,6 @@ const struct file_operations zpl_file_operations = {
|
|||||||
.open = zpl_open,
|
.open = zpl_open,
|
||||||
.release = zpl_release,
|
.release = zpl_release,
|
||||||
.llseek = zpl_llseek,
|
.llseek = zpl_llseek,
|
||||||
#ifdef HAVE_VFS_RW_ITERATE
|
|
||||||
#ifdef HAVE_NEW_SYNC_READ
|
#ifdef HAVE_NEW_SYNC_READ
|
||||||
.read = new_sync_read,
|
.read = new_sync_read,
|
||||||
.write = new_sync_write,
|
.write = new_sync_write,
|
||||||
@ -1264,12 +1154,6 @@ const struct file_operations zpl_file_operations = {
|
|||||||
.splice_read = generic_file_splice_read,
|
.splice_read = generic_file_splice_read,
|
||||||
#endif
|
#endif
|
||||||
.splice_write = iter_file_splice_write,
|
.splice_write = iter_file_splice_write,
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
.read = do_sync_read,
|
|
||||||
.write = do_sync_write,
|
|
||||||
.aio_read = zpl_aio_read,
|
|
||||||
.aio_write = zpl_aio_write,
|
|
||||||
#endif
|
#endif
|
||||||
.mmap = zpl_mmap,
|
.mmap = zpl_mmap,
|
||||||
.fsync = zpl_fsync,
|
.fsync = zpl_fsync,
|
||||||
|
Loading…
Reference in New Issue
Block a user