ocfs2-1.6: pipe operation pin() changes to confirm()
PATCH 1/4 ocfs2-1.6: pipe operation pin() changes to confirm()
commit cac36bb06efe4880234524e117e0e712b10b1f16 in mainline changes pipe_buf_operations->pin() to ->confirm(). This patch allows building ocfs2 with kernels having/not having this change.
--- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ kapi-compat/include/pipe_buf_operations.h | 10 ++++++++++ 5 files changed, 23 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/pipe_buf_operations.h
Config.make.in +1 -0
@@ -78,6 +78,7 @@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ +NO_CONFIRM_IN_PIPE_OPERATIONS = @NO_CONFIRM_IN_PIPE_OPERATIONS@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@
Makefile +2 -1
@@ -42,7 +42,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/compat_kobject.h \ kapi-compat/include/quotas.h \ kapi-compat/include/cancel_work_sync.h \ - kapi-compat/include/fiemap_shared.h + kapi-compat/include/fiemap_shared.h \ + kapi-compat/include/pipe_buf_operations.h PATCH_FILES =
configure.in +6 -0
@@ -414,6 +414,12 @@ OCFS2_CHECK_KERNEL([ fops->sendfile() in fs.h], fs.h, HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)]) AC_SUBST(HAS_FOPS_SENDFILE) +NO_CONFIRM_IN_PIPE_OPERATIONS= +OCFS2_CHECK_KERNEL([confirm() in struct pipe_buf_operations in pipe_fs_i.h], pipe_fs_i.h, + , NO_CONFIRM_IN_PIPE_OPERATIONS=pipe_buf_operations.h, [int (\*confirm)(struct pipe_inode_info \*]) +AC_SUBST(NO_CONFIRM_IN_PIPE_OPERATIONS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_CONFIRM_IN_PIPE_OPERATIONS" + SKIP_SPLICE= OCFS2_CHECK_KERNEL([splice.h], splice.h, , SKIP_SPLICE=yes, [struct splice_desc {])
fs/ocfs2/Makefile +4 -0
@@ -112,6 +112,10 @@ ifdef HAS_FOPS_SENDFILE EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE endif +ifdef NO_CONFIRM_IN_PIPE_OPERATIONS +EXTRA_CFLAGS += -DNO_CONFIRM_IN_PIPE_OPERATIONS +endif + ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE endif
kapi-compat/include/pipe_buf_operations.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef KAPI_PIPE_BUF_OPERATIONS_H +#define KAPI_PIPE_BUF_OPERATIONS_H + +#ifdef NO_CONFIRM_IN_PIPE_OPERATIONS +# define kapi_confirm (a, b) pin(a, b) +#else +# define kapi_confirm (a, b) confirm(a, b) +#endif + +#endif
Signature · 1 line
1.5.2.3
PATCH 2/4 ocfs2-1.6: Add inode_double_lock()/unlock()
commit 62752ee198dca9209b7dee504763e51b11e9e0ca in mainline added these two functions. This patch allows building ocfs2 with kernels having/not having this chang
--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++++ fs/ocfs2/Makefile | 4 +++ kapi-compat/include/inode_double_lock.h | 36 +++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/inode_double_lock.h
Config.make.in +1 -0
@@ -79,6 +79,7 @@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ NO_CONFIRM_IN_PIPE_OPERATIONS = @NO_CONFIRM_IN_PIPE_OPERATIONS@ +NO_INODE_DOUBLE_LOCK = @NO_INODE_DOUBLE_LOCK@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@
Makefile +2 -1
@@ -43,7 +43,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/quotas.h \ kapi-compat/include/cancel_work_sync.h \ kapi-compat/include/fiemap_shared.h \ - kapi-compat/include/pipe_buf_operations.h + kapi-compat/include/pipe_buf_operations.h \ + kapi-compat/include/inode_double_lock.h PATCH_FILES =
configure.in +6 -0
@@ -420,6 +420,12 @@ OCFS2_CHECK_KERNEL([confirm() in struct pipe_buf_operations in pipe_fs_i.h], pip AC_SUBST(NO_CONFIRM_IN_PIPE_OPERATIONS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_CONFIRM_IN_PIPE_OPERATIONS" +NO_INODE_DOUBLE_LOCK= +OCFS2_CHECK_KERNEL([inode_double_lock() in fs.h], fs.h, + , NO_INODE_DOUBLE_LOCK=inode_double_lock.h, [^extern void inode_double_lock]) +AC_SUBST(NO_INODE_DOUBLE_LOCK) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_INODE_DOUBLE_LOCK" + SKIP_SPLICE= OCFS2_CHECK_KERNEL([splice.h], splice.h, , SKIP_SPLICE=yes, [struct splice_desc {])
fs/ocfs2/Makefile +4 -0
@@ -116,6 +116,10 @@ ifdef NO_CONFIRM_IN_PIPE_OPERATIONS EXTRA_CFLAGS += -DNO_CONFIRM_IN_PIPE_OPERATIONS endif +ifdef NO_INODE_DOUBLE_LOCK +EXTRA_CFLAGS += -DNO_INODE_DOUBLE_LOCK +endif + ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE endif
kapi-compat/include/inode_double_lock.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifndef KAPI_INODE_DOUBLE_LOCK_H +#define KAPI_INODE_DOUBLE_LOCK_H + +#ifdef NO_INODE_DOUBLE_LOCK +static inline void inode_double_lock (struct inode *inode1, +struct inode *inode2) +{ +if (inode1 ==NULL || inode2 ==NULL || inode1 == inode2) { +if (inode1) +mutex_lock (&inode1->i_mutex); +else if (inode2) +mutex_lock (&inode2->i_mutex); +return ; + } + +if (inode1 < inode2) { +mutex_lock_nested (&inode1->i_mutex,I_MUTEX_PARENT ); +mutex_lock_nested (&inode2->i_mutex,I_MUTEX_CHILD ); + }else { +mutex_lock_nested (&inode2->i_mutex,I_MUTEX_PARENT ); +mutex_lock_nested (&inode1->i_mutex,I_MUTEX_CHILD ); + } +} + +static inline void inode_double_unlock (struct inode *inode1, +struct inode *inode2) +{ +if (inode1) +mutex_unlock (&inode1->i_mutex); + +if (inode2 && inode2 != inode1) +mutex_unlock (&inode2->i_mutex); +} +#endif + +#endif
Signature · 1 line
1.5.2.3
PATCH 3/4 ocfs2-1.6: Add file_remove_suid()
In reply to Tiger Yangcommit 2f1936b87783a3a56c9441b27b9ba7a747f11e8e in mainline change remove_suid() to file_remove_suid() in vfs. This patch allows building ocfs2 with kernels having/not having this change.
--- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ kapi-compat/include/file_remove_suid.h | 8 ++++++++ 5 files changed, 21 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/file_remove_suid.h
Config.make.in +1 -0
@@ -80,6 +80,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ NO_CONFIRM_IN_PIPE_OPERATIONS = @NO_CONFIRM_IN_PIPE_OPERATIONS@ NO_INODE_DOUBLE_LOCK = @NO_INODE_DOUBLE_LOCK@ +NO_FILE_REMOVE_SUID = @NO_FILE_REMOVE_SUID@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@
Makefile +2 -1
@@ -44,7 +44,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/cancel_work_sync.h \ kapi-compat/include/fiemap_shared.h \ kapi-compat/include/pipe_buf_operations.h \ - kapi-compat/include/inode_double_lock.h + kapi-compat/include/inode_double_lock.h \ + kapi-compat/include/file_remove_suid.h PATCH_FILES =
configure.in +6 -0
@@ -426,6 +426,12 @@ OCFS2_CHECK_KERNEL([inode_double_lock() in fs.h], fs.h, AC_SUBST(NO_INODE_DOUBLE_LOCK) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_INODE_DOUBLE_LOCK" +NO_FILE_REMOVE_SUID= +OCFS2_CHECK_KERNEL([file_remove_suid() in fs.h], fs.h, + , NO_FILE_REMOVE_SUID=file_remove_suid.h, [^extern int file_remove_suid]) +AC_SUBST(NO_FILE_REMOVE_SUID) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_FILE_REMOVE_SUID" + SKIP_SPLICE= OCFS2_CHECK_KERNEL([splice.h], splice.h, , SKIP_SPLICE=yes, [struct splice_desc {])
fs/ocfs2/Makefile +4 -0
@@ -120,6 +120,10 @@ ifdef NO_INODE_DOUBLE_LOCK EXTRA_CFLAGS += -DNO_INODE_DOUBLE_LOCK endif +ifdef NO_FILE_REMOVE_SUID +EXTRA_CFLAGS += -DNO_FILE_REMOVE_SUID +endif + ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE endif
kapi-compat/include/file_remove_suid.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef KAPI_FILE_REMOVE_SUID_H +#define KAPI_FILE_REMOVE_SUID_H + +#ifdef NO_FILE_REMOVE_SUID +#define file_remove_suid (f) remove_suid(filp_dentry(f)) +#endif + +#endif
Signature · 1 line
1.5.2.3
PATCH 4/4 ocfs2-1.6: add splice read/write support
In reply to Tiger YangThis patch copied splice code in mainline 2.6.29
to allow support for splice io with enterprise
kernels based on 2.6.18.
--- Config.make.in | 1 + configure.in | 10 ++- fs/ocfs2/Makefile | 7 + fs/ocfs2/compat_splice.c | 251 ++++++++++++++++++++++++++++++++++++++++++ fs/ocfs2/file.c | 90 ++++----------- fs/ocfs2/xattr.c | 2 +- kapi-compat/include/splice.h | 21 ++++ 7 files changed, 314 insertions(+), 68 deletions(-) create mode 100644 fs/ocfs2/compat_splice.c create mode 100644 kapi-compat/include/splice.h
Config.make.in +1 -0
@@ -81,6 +81,7 @@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ NO_CONFIRM_IN_PIPE_OPERATIONS = @NO_CONFIRM_IN_PIPE_OPERATIONS@ NO_INODE_DOUBLE_LOCK = @NO_INODE_DOUBLE_LOCK@ NO_FILE_REMOVE_SUID = @NO_FILE_REMOVE_SUID@ +NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@
configure.in +8 -2
@@ -432,9 +432,15 @@ OCFS2_CHECK_KERNEL([file_remove_suid() in fs.h], fs.h, AC_SUBST(NO_FILE_REMOVE_SUID) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_FILE_REMOVE_SUID" +NO_SPLICE_HEADER= +OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h, + , NO_SPLICE_HEADER=splice.h, [^struct splice_desc ]) +AC_SUBST(NO_SPLICE_HEADER) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_SPLICE_HEADER" + SKIP_SPLICE= -OCFS2_CHECK_KERNEL([splice.h], splice.h, - , SKIP_SPLICE=yes, [struct splice_desc {]) +OCFS2_CHECK_KERNEL([splice_read() in fs.h], fs.h, + , SKIP_SPLICE=yes, [ssize_t (\*splice_read)]) AC_SUBST(SKIP_SPLICE) mnt_want_write=
fs/ocfs2/Makefile +7 -0
@@ -124,8 +124,15 @@ ifdef NO_FILE_REMOVE_SUID EXTRA_CFLAGS += -DNO_FILE_REMOVE_SUID endif +ifdef NO_SPLICE_HEADER +EXTRA_CFLAGS += -DNO_SPLICE_HEADER +endif + +COMPAT_SOURCES += compat_splice.c ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE +else +FS_SOURCES += compat_splice.c endif ifdef SKIP_BUFFER_TRIGGERS
fs/ocfs2/compat_splice.c new file +251 -0
251 lines not on this page · raw message
fs/ocfs2/file.c +25 -65
135 lines not on this page · raw message
fs/ocfs2/xattr.c +1 -1
@@ -27,7 +27,7 @@#include <linux/pagemap.h> #include <linux/uio.h> #include <linux/sched.h> -#ifndef SKIP_SPLICE +#ifndef NO_SPLICE_HEADER #include <linux/splice.h> #endif #include <linux/mount.h>
kapi-compat/include/splice.h new file +21 -0
@@ -0,0 +1,21 @@ +#ifndef KAPI_SPLICE_H +#define KAPI_SPLICE_H + +#ifndef SKIP_SPLICE +#include <linux/pipe_fs_i.h> +#include <linux/pagemap.h> +#include <linux/writeback.h> + +ssize_t generic_file_splice_write_nolock (struct pipe_inode_info *pipe, +struct file *out,loff_t *ppos, +size_t len,unsigned int flags); + +#ifdef NO_SPLICE_HEADER +# define sd_file (i) ((i)->file) +#else +# define sd_file (i) ((i)->u.file) +#endif + +#endif /* SKIP_SPLICE */ + +#endif
Signature · 1 line
1.5.2.3
PATCH 4/4 ocfs2-1.6: add splice read/write support
Hi tiger,
Quoted 23 lines · Tiger Yang
This patch copied splice code in mainline 2.6.29
to allow support for splice io with enterprise
kernels based on 2.6.18.Signed-off-by Tiger Yang <[email protected]>--- Config.make.in | 1 + configure.in | 10 ++- fs/ocfs2/Makefile | 7 + fs/ocfs2/compat_splice.c | 251 ++++++++++++++++++++++++++++++++++++++++++ fs/ocfs2/file.c | 90 ++++----------- fs/ocfs2/xattr.c | 2 +- kapi-compat/include/splice.h | 21 ++++ 7 files changed, 314 insertions(+), 68 deletions(-) create mode 100644 fs/ocfs2/compat_splice.c create mode 100644 kapi-compat/include/splice.hifdef
SKIP_BUFFER_TRIGGERSfs/ocfs2/compat_splice.c new file +0
-0
fs/ocfs2/compat_splice.c line 9
Quoted 9 lines
fs/ocfs2/compat_splice.c new file +9
-0@@ -0,0 +1,251 @@ +/* +* compat_splice.c +* +* This code has been copied from mainline linux kernel 2.6.29 +* to allow ocfs2 to build against older kernels. For license, +* refer to fs/splice.c in mainline linux kernel. +*/ + +void pipe_wait (struct pipe_inode_info *pipe)
I just see that el5 already has splice support, see
http://www.redhat.com/rhel/features/
So we still need to copy these functions back? At least in el5u2, I see these functions like pipe_wait, pipe_to_file etc.
Regards,
Tao
PATCH 4/4 ocfs2-1.6: add splice read/write support
Quoted 6 lines · Tao Ma
Quoted 1 line
+void
pipe_wait(struct pipe_inode_info *pipe)I just see that el5 already has splice support, see
http://www.redhat.com/rhel/features/So we still need to copy these functions back? At least in el5u2, I see these functions like
pipe_wait,pipe_to_fileetc.
Yes. We need copy these functions because they are not exported by the kernel of el5.
Because the struct splice_desc has been changed since 2.6.30, it it difficult to back port the latest code in mainline. So I chose the splice code in 2.6.29 for back porting. I hope the latest code before change are more stable and efficient.
thanks,
tiger
PATCH 4/4 ocfs2-1.6: add splice read/write support
Quoted 8 lines · Tiger Yang
Quoted 6 lines · Tao Ma
Quoted 1 line
+void
pipe_wait(struct pipe_inode_info *pipe)I just see that el5 already has splice support, see
http://www.redhat.com/rhel/features/So we still need to copy these functions back? At least in el5u2, I see these functions like
pipe_wait,pipe_to_fileetc.
Quoted 7 lines
Yes. We need copy these functions because they are not exported by the kernel of el5.
Because the struct
splice_deschas been changed since 2.6.30, it it difficult to back port the latest code in mainline. So I chose the splice code in 2.6.29 for back porting. I hope the latest code before change are more stable and efficient.
oh, I see. I just checked the source code in 1.4. Thanks for the explanation.
Regards,
Tao