mirror of https://github.com/archzfs/archzfs
parent
d047e95813
commit
dc4ff2d8af
@ -1 +1 @@ |
||||
Subproject commit 66dd2e745124865955906685ff76de0d0161aba4 |
||||
Subproject commit 888b4c3b56a820d74fc61822a05e95bf669147ab |
@ -1 +1 @@ |
||||
Subproject commit b06cc0e568ec5b78a75331c66b9ff184945b6e5a |
||||
Subproject commit 2f25c4ed8b09ed799a3d75be0d9982d227df8de9 |
@ -1 +1 @@ |
||||
Subproject commit 8c7010a5873ff7fea945219ab559efb95cdbfe5b |
||||
Subproject commit 06cd2f639b87548cf14244e565c9955e6d3148bd |
@ -1 +1 @@ |
||||
Subproject commit c5e653772a545e4076a559d82f20f2bb3d3f260a |
||||
Subproject commit f9e13d33fdd312f15423b1cab05f6db81836e16f |
@ -1 +1 @@ |
||||
Subproject commit e72cf258d6ce143674d04a456710eb26d16b19e7 |
||||
Subproject commit c45b1cb97933f6e3b5bf10a9cace8e20608f4baa |
@ -1 +1 @@ |
||||
Subproject commit eb71b2e0e0d4f19e632eb6ee79159f022e1ef7f2 |
||||
Subproject commit 6ed34527968c28341735d4a7dd3e541d163138de |
@ -1 +1 @@ |
||||
Subproject commit 2bbf289a793145f9446ad646306e765548f2ec8b |
||||
Subproject commit 744b229831ff3c3b0ef5878a7fe9d72bac6fa40e |
@ -1 +1 @@ |
||||
Subproject commit f87708ae068b750eba5c697fadd3511c6f78e307 |
||||
Subproject commit adda567424592d4ab0ff7b8f6bc6a9f1c7d4bb07 |
@ -1 +1 @@ |
||||
Subproject commit 1d4509405be16e6a35ea36a5eb0874fce83863c6 |
||||
Subproject commit 900f6b979b228a0b0ba9f8491f7f3775bc86bed1 |
@ -1 +1 @@ |
||||
Subproject commit 14f2a5e097608cdc40d8d84638c8b6a5af2f7194 |
||||
Subproject commit b80858e1c58bc28ae95edc181d56bd7557a252be |
@ -1 +1 @@ |
||||
Subproject commit 7f3d1562f5e28143ee96d97458a67deb651fc4db |
||||
Subproject commit d1fe132af45fcd5579e5fa12e09c8cfce115b997 |
@ -1 +1 @@ |
||||
Subproject commit 3b04412f9bbb3ecc201bc591229ae3eec2de56ee |
||||
Subproject commit 4e01bb561977f88ae80571ad42018fd21e7790cb |
@ -0,0 +1 @@ |
||||
Subproject commit ac8ad862f99eece4d9f3d4ff59d0c85ecefa3a2a |
@ -0,0 +1 @@ |
||||
Subproject commit c2679ab5728b8275abfa70476da9560ad844b2a3 |
@ -0,0 +1 @@ |
||||
Subproject commit 8eca03fd95b2076f30c0972d7a3341f258a5e65e |
@ -0,0 +1 @@ |
||||
Subproject commit f02469af6e1bec435f9b83dd35eb1a20fc56c00d |
@ -1 +1 @@ |
||||
Subproject commit 1b79c9fbe1a2a6f6aa567caff01a71f4c365758a |
||||
Subproject commit 9a3bd3c64b998b5339914e94903189aa1bcdd810 |
@ -1 +1 @@ |
||||
Subproject commit 1ffed03a2691b6b11a25daaf1e113c8de4294ff5 |
||||
Subproject commit bebb9bef98a0bc8fece581b8464036b1b8012c35 |
@ -1 +1 @@ |
||||
Subproject commit 57bc32840902c1fd2238cab607fe6c949a5846bf |
||||
Subproject commit ff4d8c16348ef2af9d98d038525e8b169aa9c59d |
@ -1 +1 @@ |
||||
Subproject commit 697f793d87adbe00e12797b7d60950c1a318635a |
||||
Subproject commit 345ceddebdb5fd224c317271db94fb4cc6b8b85e |
@ -1 +1 @@ |
||||
Subproject commit b4999762c20c4cea1eb6b173651500bb32f41af3 |
||||
Subproject commit 36206b455a101b33b5ff44131d00eb102d4f63aa |
@ -1 +1 @@ |
||||
Subproject commit 3920f48d1ce3fec53015f2afca61e3ee3d8c8240 |
||||
Subproject commit 487919911f80b990b0d9691287c3ffe40e0c36f5 |
@ -1 +1 @@ |
||||
Subproject commit a7a3d0d854c9b763db942cf2efdf8dde89c78d5b |
||||
Subproject commit 6129aee0a7f57f9b08fcb716d1491b8618a38474 |
@ -1 +1 @@ |
||||
Subproject commit 19d44c1b74f022d5464f7eeb5305089590055866 |
||||
Subproject commit 726b9dc39568bc7fa7f7a4d601cf3c028969facf |
@ -0,0 +1,104 @@ |
||||
# For build.sh |
||||
mode_name="vfio" |
||||
mode_desc="Select and use the packages for the linux-vfio kernel" |
||||
|
||||
# Kernel versions for default ZFS packages |
||||
pkgrel="1" |
||||
kernel_version="4.13.12-2" |
||||
|
||||
# Kernel version for GIT packages |
||||
pkgrel_git="${pkgrel}" |
||||
kernel_version_git="${kernel_version}" |
||||
zfs_git_commit="" |
||||
spl_git_commit="" |
||||
zfs_git_url="https://github.com/zfsonlinux/zfs.git" |
||||
spl_git_url="https://github.com/zfsonlinux/spl.git" |
||||
|
||||
header="\ |
||||
# Maintainer: Jesus Alvarez <jeezusjr at gmail dot com> |
||||
# |
||||
# This PKGBUILD was generated by the archzfs build scripts located at |
||||
# |
||||
# http://github.com/archzfs/archzfs |
||||
# |
||||
# ! WARNING ! |
||||
# |
||||
# The archzfs packages are kernel modules, so these PKGBUILDS will only work with the kernel package they target. In this |
||||
# case, the archzfs-linux-vfio packages will only work with the default linux-vfio package! To have a single PKGBUILD target many |
||||
# kernels would make for a cluttered PKGBUILD! |
||||
# |
||||
# If you have a custom kernel, you will need to change things in the PKGBUILDS. If you would like to have AUR or archzfs repo |
||||
# packages for your favorite kernel package built using the archzfs build tools, submit a request in the Issue tracker on the |
||||
# archzfs github page. |
||||
#" |
||||
|
||||
update_linux_pkgbuilds() { |
||||
pkg_list=("spl-linux-vfio" "zfs-linux-vfio") |
||||
kernel_version_full=$(kernel_version_full ${kernel_version}) |
||||
kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) |
||||
kernel_version_major=${kernel_version%-*} |
||||
kernel_mod_path="${kernel_version_full}-vfio" |
||||
archzfs_package_group="archzfs-linux-vfio" |
||||
spl_pkgver=${zol_version}.${kernel_version_full_pkgver} |
||||
zfs_pkgver=${zol_version}.${kernel_version_full_pkgver} |
||||
spl_pkgrel=${pkgrel} |
||||
zfs_pkgrel=${pkgrel} |
||||
spl_conflicts="'spl-linux-vfio-git'" |
||||
zfs_conflicts="'zfs-linux-vfio-git'" |
||||
spl_utils_pkgname="spl-utils-common=${zol_version}" |
||||
spl_pkgname="spl-linux-vfio" |
||||
zfs_utils_pkgname="zfs-utils-common=${zol_version}" |
||||
zfs_pkgname="zfs-linux-vfio" |
||||
# Paths are relative to build.sh |
||||
spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" |
||||
zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" |
||||
spl_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/spl-${zol_version}.tar.gz" |
||||
zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-${zol_version}/zfs-${zol_version}.tar.gz" |
||||
spl_workdir="\${srcdir}/spl-${zol_version}" |
||||
zfs_workdir="\${srcdir}/zfs-${zol_version}" |
||||
linux_depends="\"linux-vfio=${kernel_version_full}\"" |
||||
linux_headers_depends="\"linux-vfio-headers=${kernel_version_full}\"" |
||||
zfs_makedepends="\"${spl_pkgname}-headers\"" |
||||
} |
||||
|
||||
update_linux_git_pkgbuilds() { |
||||
pkg_list=("spl-linux-vfio-git" "zfs-linux-vfio-git") |
||||
kernel_version=${kernel_version_git} |
||||
kernel_version_full=$(kernel_version_full ${kernel_version}) |
||||
kernel_version_full_pkgver=$(kernel_version_full_no_hyphen ${kernel_version}) |
||||
kernel_version_major=${kernel_version%-*} |
||||
kernel_mod_path="${kernel_version_full}-vfio" |
||||
archzfs_package_group="archzfs-linux-vfio-git" |
||||
spl_pkgver="" # Set later by call to git_calc_pkgver |
||||
zfs_pkgver="" # Set later by call to git_calc_pkgver |
||||
spl_pkgrel=${pkgrel_git} |
||||
zfs_pkgrel=${pkgrel_git} |
||||
spl_conflicts="'spl-linux-vfio'" |
||||
zfs_conflicts="'zfs-linux-vfio'" |
||||
spl_pkgname="spl-linux-vfio-git" |
||||
zfs_pkgname="zfs-linux-vfio-git" |
||||
spl_pkgbuild_path="packages/${kernel_name}/${spl_pkgname}" |
||||
zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" |
||||
spl_src_target="git+${spl_git_url}" |
||||
if [[ ${spl_git_commit} != "" ]]; then |
||||
spl_src_target="git+${spl_git_url}#commit=${spl_git_commit}" |
||||
fi |
||||
spl_src_hash="SKIP" |
||||
linux_depends="\"linux-vfio=${kernel_version_full}\"" |
||||
linux_headers_depends="\"linux-vfio-headers=${kernel_version_full}\"" |
||||
spl_makedepends="\"git\"" |
||||
zfs_src_target="git+${zfs_git_url}" |
||||
if [[ ${zfs_git_commit} != "" ]]; then |
||||
zfs_src_target="git+${zfs_git_url}#commit=${zfs_git_commit}" |
||||
fi |
||||
zfs_src_hash="SKIP" |
||||
zfs_makedepends="\"git\" \"${spl_pkgname}-headers\"" |
||||
spl_workdir="\${srcdir}/spl" |
||||
zfs_workdir="\${srcdir}/zfs" |
||||
if have_command "update"; then |
||||
git_check_repo |
||||
git_calc_pkgver |
||||
fi |
||||
spl_utils_pkgname="spl-utils-common-git>=${spl_git_ver}" |
||||
zfs_utils_pkgname="zfs-utils-common-git>=${zfs_git_ver}" |
||||
} |
@ -1,206 +0,0 @@ |
||||
From ed19bccfb651843fa208232b3a2d3d22a4152bc8 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Date: Wed, 15 Nov 2017 17:19:23 -0800
|
||||
Subject: [PATCH] Linux 4.14 compat: vfs_read & vfs_write
|
||||
|
||||
The kernel_read & kernel_write functions have always wrapped the
|
||||
vfs_read & vfs_write functions respectively. However, they could
|
||||
not be used by vn_rdwr() since the offset wasn't passed as a
|
||||
pointer. This prevented us from being able to properly update
|
||||
the file offset.
|
||||
|
||||
Linux 4.14 unexported vfs_read & vfs_write but also changed the
|
||||
signature of kernel_read & kernel_write to provide the needed
|
||||
functionality. Use these updated functions when available.
|
||||
|
||||
Reviewed-by: Pritam Baral <pritam@pritambaral.com>
|
||||
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||||
Closes #656
|
||||
Closes #667
|
||||
---
|
||||
config/spl-build.m4 | 60 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/linux/file_compat.h | 41 +++++++++++++++++++++++++++++++
|
||||
module/spl/spl-vnode.c | 21 +++-------------
|
||||
3 files changed, 105 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/config/spl-build.m4 b/config/spl-build.m4
|
||||
index 8e9dc99..7b66f2c 100644
|
||||
--- a/config/spl-build.m4
|
||||
+++ b/config/spl-build.m4
|
||||
@@ -52,6 +52,8 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||
SPL_AC_KMEM_CACHE_CREATE_USERCOPY
|
||||
SPL_AC_WAIT_QUEUE_ENTRY_T
|
||||
SPL_AC_WAIT_QUEUE_HEAD_ENTRY
|
||||
+ SPL_AC_KERNEL_WRITE
|
||||
+ SPL_AC_KERNEL_READ
|
||||
])
|
||||
|
||||
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
||||
@@ -1594,3 +1596,61 @@ AC_DEFUN([SPL_AC_WAIT_QUEUE_HEAD_ENTRY], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
+
|
||||
+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([SPL_AC_KERNEL_WRITE], [
|
||||
+ AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
|
||||
+ tmp_flags="$EXTRA_KCFLAGS"
|
||||
+ EXTRA_KCFLAGS="-Werror"
|
||||
+ SPL_LINUX_TRY_COMPILE([
|
||||
+ #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_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_KERNEL_WRITE_PPOS, 1,
|
||||
+ [kernel_write() take loff_t pointer])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ])
|
||||
+ EXTRA_KCFLAGS="$tmp_flags"
|
||||
+])
|
||||
+
|
||||
+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([SPL_AC_KERNEL_READ], [
|
||||
+ AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
|
||||
+ tmp_flags="$EXTRA_KCFLAGS"
|
||||
+ EXTRA_KCFLAGS="-Werror"
|
||||
+ SPL_LINUX_TRY_COMPILE([
|
||||
+ #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_MSG_RESULT(yes)
|
||||
+ AC_DEFINE(HAVE_KERNEL_READ_PPOS, 1,
|
||||
+ [kernel_read() take loff_t pointer])
|
||||
+ ],[
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ ])
|
||||
+ EXTRA_KCFLAGS="$tmp_flags"
|
||||
+])
|
||||
diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h
|
||||
index 7d61ba5..55ba2cc 100644
|
||||
--- a/include/linux/file_compat.h
|
||||
+++ b/include/linux/file_compat.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#define _SPL_FILE_COMPAT_H
|
||||
|
||||
#include <linux/fs.h>
|
||||
+#include <linux/uaccess.h>
|
||||
#ifdef HAVE_FDTABLE_HEADER
|
||||
#include <linux/fdtable.h>
|
||||
#endif
|
||||
@@ -70,6 +71,46 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
|
||||
return (error);
|
||||
}
|
||||
|
||||
+static inline ssize_t
|
||||
+spl_kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
|
||||
+{
|
||||
+#if defined(HAVE_KERNEL_WRITE_PPOS)
|
||||
+ return (kernel_write(file, buf, count, pos));
|
||||
+#else
|
||||
+ mm_segment_t saved_fs;
|
||||
+ ssize_t ret;
|
||||
+
|
||||
+ saved_fs = get_fs();
|
||||
+ set_fs(get_ds());
|
||||
+
|
||||
+ ret = vfs_write(file, (__force const char __user *)buf, count, pos);
|
||||
+
|
||||
+ set_fs(saved_fs);
|
||||
+
|
||||
+ return (ret);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+static inline 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(get_ds());
|
||||
+
|
||||
+ ret = vfs_read(file, (void __user *)buf, count, pos);
|
||||
+
|
||||
+ set_fs(saved_fs);
|
||||
+
|
||||
+ return (ret);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
#ifdef HAVE_2ARGS_VFS_FSYNC
|
||||
#define spl_filp_fsync(fp, sync) vfs_fsync(fp, sync)
|
||||
#else
|
||||
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
|
||||
index 0e4c386..19b3b76 100644
|
||||
--- a/module/spl/spl-vnode.c
|
||||
+++ b/module/spl/spl-vnode.c
|
||||
@@ -211,35 +211,22 @@ int
|
||||
vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
|
||||
uio_seg_t seg, int ioflag, rlim64_t x2, void *x3, ssize_t *residp)
|
||||
{
|
||||
- loff_t offset;
|
||||
- mm_segment_t saved_fs;
|
||||
- struct file *fp;
|
||||
+ struct file *fp = vp->v_file;
|
||||
+ loff_t offset = off;
|
||||
int rc;
|
||||
|
||||
ASSERT(uio == UIO_WRITE || uio == UIO_READ);
|
||||
- ASSERT(vp);
|
||||
- ASSERT(vp->v_file);
|
||||
ASSERT(seg == UIO_SYSSPACE);
|
||||
ASSERT((ioflag & ~FAPPEND) == 0);
|
||||
|
||||
- fp = vp->v_file;
|
||||
-
|
||||
- offset = off;
|
||||
if (ioflag & FAPPEND)
|
||||
offset = fp->f_pos;
|
||||
|
||||
- /* Writable user data segment must be briefly increased for this
|
||||
- * process so we can use the user space read call paths to write
|
||||
- * in to memory allocated by the kernel. */
|
||||
- saved_fs = get_fs();
|
||||
- set_fs(get_ds());
|
||||
-
|
||||
if (uio & UIO_WRITE)
|
||||
- rc = vfs_write(fp, addr, len, &offset);
|
||||
+ rc = spl_kernel_write(fp, addr, len, &offset);
|
||||
else
|
||||
- rc = vfs_read(fp, addr, len, &offset);
|
||||
+ rc = spl_kernel_read(fp, addr, len, &offset);
|
||||
|
||||
- set_fs(saved_fs);
|
||||
fp->f_pos = offset;
|
||||
|
||||
if (rc < 0)
|
||||
--
|
||||
2.15.1
|
||||
|
Loading…
Reference in new issue