All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21 15:12   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
                   ` (26 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit d6b29d7cee064f28ca097e906de7453541351095 in mainline moves the splice
structures from pipe_fs_i.h to splice.h. This patch allows one to build
ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |    2 ++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 3818cd5..788c156 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -66,6 +66,7 @@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
 SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
 STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
 FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
+SPLICE_HEADER = @SPLICE_HEADER@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 74337ee..931cf2c 100644
--- a/configure.in
+++ b/configure.in
@@ -247,6 +247,11 @@ OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h,
   FALLOCATE_DEFINED=yes, , [^.*long (\*fallocate)])
 AC_SUBST(FALLOCATE_DEFINED)
 
+SPLICE_HEADER=
+OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h,
+  SPLICE_HEADER=yes, , [^struct splice_desc ])
+AC_SUBST(SPLICE_HEADER)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 6f21960..3cc7c74 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -49,6 +49,10 @@ ifdef FALLOCATE_DEFINED
 EXTRA_CFLAGS += -DFALLOCATE_DEFINED
 endif
 
+ifdef SPLICE_HEADER
+EXTRA_CFLAGS += -DSPLICE_HEADER
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ce18447..1c179fc 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -31,7 +31,9 @@
 #include <linux/pagemap.h>
 #include <linux/uio.h>
 #include <linux/sched.h>
+#ifdef SPLICE_HEADER
 #include <linux/splice.h>
+#endif
 #include <linux/mount.h>
 #include <linux/writeback.h>
 #ifdef FALLOCATE_DEFINED
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21  1:09   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
                   ` (25 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 in mainline added
struct path in struct file. This patch allows one to build ocfs2 with
kernels having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in              |    1 +
 Makefile                    |    3 ++-
 configure.in                |    6 ++++++
 fs/ocfs2/Makefile           |    4 ++++
 fs/ocfs2/aops.c             |    4 ++--
 fs/ocfs2/dir.c              |    2 +-
 fs/ocfs2/dlm/dlmfs.c        |    4 ++--
 fs/ocfs2/file.c             |   38 +++++++++++++++++++-------------------
 fs/ocfs2/ioctl.c            |    2 +-
 fs/ocfs2/mmap.c             |    2 +-
 kapi-compat/include/fpath.h |   10 ++++++++++
 11 files changed, 49 insertions(+), 27 deletions(-)
 create mode 100644 kapi-compat/include/fpath.h

diff --git a/Config.make.in b/Config.make.in
index 1fe7ddc..4f42cca 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
 DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
 
 HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
+HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/Makefile b/Makefile
index b7b86db..b00a6c4 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES =
 KAPI_COMPAT_FILES = \
 	kapi-compat/include/workqueue.h \
 	kapi-compat/include/compiler.h \
-	kapi-compat/include/highmem.h
+	kapi-compat/include/highmem.h \
+	kapi-compat/include/fpath.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 603dc94..907c90f 100644
--- a/configure.in
+++ b/configure.in
@@ -177,6 +177,12 @@ OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
   HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
 AC_SUBST(HAS_SYNC_MAPPING_RANGE)
 
+HAS_F_PATH_DEFINED=
+OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
+  HAS_F_PATH_DEFINED=yes, , [f_path])
+AC_SUBST(HAS_F_PATH_DEFINED)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 3dc33a5..b6c8d03 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -33,6 +33,10 @@ ifdef HAS_SYNC_MAPPING_RANGE
 EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
 endif
 
+ifdef HAS_F_PATH_DEFINED
+EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 34d1045..96cb31b 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -584,7 +584,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
 			     ssize_t bytes,
 			     void *private)
 {
-	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+	struct inode *inode = iocb->ki_filp->f_path_dentry->d_inode;
 	int level;
 
 	/* this io's submitter should not have unlocked this before we could */
@@ -626,7 +626,7 @@ static ssize_t ocfs2_direct_IO(int rw,
 			       unsigned long nr_segs)
 {
 	struct file *file = iocb->ki_filp;
-	struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
+	struct inode *inode = file->f_path_dentry->d_inode->i_mapping->host;
 	int ret;
 
 	mlog_entry_void();
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 7453b70..0764a66 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -840,7 +840,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
 int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
 {
 	int error = 0;
-	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path_dentry->d_inode;
 	int lock_level = 0;
 
 	mlog_entry("dirino=%llu\n",
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 7418dc8..4ce2dea 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -175,7 +175,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
 	int bytes_left;
 	ssize_t readlen;
 	char *lvb_buf;
-	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path_dentry->d_inode;
 
 	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
 		inode->i_ino, count, *ppos);
@@ -219,7 +219,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
 	int bytes_left;
 	ssize_t writelen;
 	char *lvb_buf;
-	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path_dentry->d_inode;
 
 	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
 		inode->i_ino, count, *ppos);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index a62b14e..adb10b9 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -70,7 +70,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
 	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
-		   file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
+		   file->f_path_dentry->d_name.len, file->f_path_dentry->d_name.name);
 
 	spin_lock(&oi->ip_lock);
 
@@ -100,8 +100,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 
 	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
-		       file->f_path.dentry->d_name.len,
-		       file->f_path.dentry->d_name.name);
+		       file->f_path_dentry->d_name.len,
+		       file->f_path_dentry->d_name.name);
 
 	spin_lock(&oi->ip_lock);
 	if (!--oi->ip_open_count)
@@ -1663,7 +1663,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
 		}
 	}
 
-	if (file && should_remove_suid(file->f_path.dentry)) {
+	if (file && should_remove_suid(file->f_path_dentry)) {
 		ret = __ocfs2_write_remove_suid(inode, di_bh);
 		if (ret) {
 			mlog_errno(ret);
@@ -1730,7 +1730,7 @@ out:
 int ocfs2_change_file_space(struct file *file, unsigned int cmd,
 			    struct ocfs2_space_resv *sr)
 {
-	struct inode *inode = file->f_path.dentry->d_inode;
+	struct inode *inode = file->f_path_dentry->d_inode;
 	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);;
 
 	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
@@ -2023,12 +2023,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 	size_t count;		/* after file limit checks */
 	loff_t *ppos = &iocb->ki_pos;
 	struct file *file = iocb->ki_filp;
-	struct inode *inode = file->f_path.dentry->d_inode;
+	struct inode *inode = file->f_path_dentry->d_inode;
 
 	mlog_entry("(0x%p, %u, '%.*s')\n", file,
 		   (unsigned int)nr_segs,
-		   file->f_path.dentry->d_name.len,
-		   file->f_path.dentry->d_name.name);
+		   file->f_path_dentry->d_name.len,
+		   file->f_path_dentry->d_name.name);
 
 	if (iocb->ki_left == 0)
 		return 0;
@@ -2062,7 +2062,7 @@ relock:
 	}
 
 	can_do_direct = direct_io;
-	ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos,
+	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
 					    iocb->ki_left, appending,
 					    &can_do_direct);
 	if (ret < 0) {
@@ -2251,12 +2251,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
 				       unsigned int flags)
 {
 	int ret;
-	struct inode *inode = out->f_path.dentry->d_inode;
+	struct inode *inode = out->f_path_dentry->d_inode;
 
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
 		   (unsigned int)len,
-		   out->f_path.dentry->d_name.len,
-		   out->f_path.dentry->d_name.name);
+		   out->f_path_dentry->d_name.len,
+		   out->f_path_dentry->d_name.name);
 
 	inode_double_lock(inode, pipe->inode);
 
@@ -2266,7 +2266,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
 		goto out;
 	}
 
-	ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, ppos, len, 0,
+	ret = ocfs2_prepare_inode_for_write(out->f_path_dentry, ppos, len, 0,
 					    NULL);
 	if (ret < 0) {
 		mlog_errno(ret);
@@ -2292,12 +2292,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
 				      unsigned int flags)
 {
 	int ret = 0;
-	struct inode *inode = in->f_path.dentry->d_inode;
+	struct inode *inode = in->f_path_dentry->d_inode;
 
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
 		   (unsigned int)len,
-		   in->f_path.dentry->d_name.len,
-		   in->f_path.dentry->d_name.name);
+		   in->f_path_dentry->d_name.len,
+		   in->f_path_dentry->d_name.name);
 
 	/*
 	 * See the comment in ocfs2_file_aio_read()
@@ -2323,12 +2323,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 {
 	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
 	struct file *filp = iocb->ki_filp;
-	struct inode *inode = filp->f_path.dentry->d_inode;
+	struct inode *inode = filp->f_path_dentry->d_inode;
 
 	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
 		   (unsigned int)nr_segs,
-		   filp->f_path.dentry->d_name.len,
-		   filp->f_path.dentry->d_name.name);
+		   filp->f_path_dentry->d_name.len,
+		   filp->f_path_dentry->d_name.name);
 
 	if (!inode) {
 		ret = -EINVAL;
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 87dcece..929aeac 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -148,7 +148,7 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
 #ifdef CONFIG_COMPAT
 long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 {
-	struct inode *inode = file->f_path.dentry->d_inode;
+	struct inode *inode = file->f_path_dentry->d_inode;
 	int ret;
 
 	switch (cmd) {
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index 9875615..c0483c9 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -152,7 +152,7 @@ out:
 
 static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
 {
-	struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
+	struct inode *inode = vma->vm_file->f_path_dentry->d_inode;
 	struct buffer_head *di_bh = NULL;
 	sigset_t blocked, oldset;
 	int ret, ret2;
diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h
new file mode 100644
index 0000000..178d8e3
--- /dev/null
+++ b/kapi-compat/include/fpath.h
@@ -0,0 +1,10 @@
+#ifndef KAPI_FPATH_H
+#define KAPI_FPATH_H
+
+#ifdef HAS_F_PATH_DEFINED
+# define f_path_dentry	f_path.dentry
+#else
+# define f_path_dentry	f_dentry
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-24 13:32   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
                   ` (24 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit a569425512253992cc64ebf8b6d00a62f986db3e in mainline
moved struct export_operation from fs.h to exportfs.h. This
patch allows one to build ocfs2 with kernels having/not having
this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/export.h |    2 ++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index f22473c..90e4472 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -74,6 +74,7 @@ IOP_IS_CONST = @IOP_IS_CONST@
 VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
 SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
+EXPORTFS_HEADER = @EXPORTFS_HEADER@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 60fd68f..d4f3c97 100644
--- a/configure.in
+++ b/configure.in
@@ -297,6 +297,11 @@ OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
   OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
 AC_SUBST(OLD_BIO_END_IO)
 
+EXPORTFS_HEADER=
+OCFS2_CHECK_KERNEL([exportfs.h], exportfs.h,
+  EXPORTFS_HEADER=yes, , [^struct export_operations {])
+AC_SUBST(EXPORTFS_HEADER)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index e4296d3..8f8458e 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -81,6 +81,10 @@ ifdef SPLICE_FROM_PIPE
 EXTRA_CFLAGS += -DSPLICE_FROM_PIPE
 endif
 
+ifdef EXPORTFS_HEADER
+EXTRA_CFLAGS += -DEXPORTFS_HEADER
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/export.h b/fs/ocfs2/export.h
index e08bed9..f81edb5 100644
--- a/fs/ocfs2/export.h
+++ b/fs/ocfs2/export.h
@@ -26,7 +26,9 @@
 #ifndef OCFS2_EXPORT_H
 #define OCFS2_EXPORT_H
 
+#ifdef EXPORTFS_HEADER
 #include <linux/exportfs.h>
+#endif
 
 extern struct export_operations ocfs2_export_ops;
 
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (2 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21 11:39   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
                   ` (23 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit d8c76e6f45c111c32a4b3e50a2adc9210737b0d8 in mainline introduced
helper inc_nlink(). This patch allows one to build ocfs2 with kernels
having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                        |    3 ++-
 configure.in                    |    5 +++++
 kapi-compat/include/inc_nlink.h |   19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/inc_nlink.h

diff --git a/Makefile b/Makefile
index 088d0e1..1595b90 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/compiler.h \
 	kapi-compat/include/highmem.h \
 	kapi-compat/include/fpath.h \
-	kapi-compat/include/kmod.h
+	kapi-compat/include/kmod.h \
+	kapi-compat/include/inc_nlink.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 94937cd..554a0a4 100644
--- a/configure.in
+++ b/configure.in
@@ -188,6 +188,11 @@ OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h,
   , kmod_compat_header="kmod.h", [umh_wait])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header"
 
+inc_nlink_compat_header=""
+OCFS2_CHECK_KERNEL([inc_nlink() in fs.h], fs.h,
+  , inc_nlink_compat_header="inc_nlink.h", [^static inline void inc_nlink(])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inc_nlink_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/inc_nlink.h b/kapi-compat/include/inc_nlink.h
new file mode 100644
index 0000000..26ddaac
--- /dev/null
+++ b/kapi-compat/include/inc_nlink.h
@@ -0,0 +1,19 @@
+#ifndef KAPI_INC_NLINK_H
+#define KAPI_INC_NLINK_H
+
+#include <linux/fs.h>
+
+/*
+ * inc_nlink - directly increment an inode's link count
+ * @inode: inode
+ *
+ * This is a low-level filesystem helper to replace any
+ * direct filesystem manipulation of i_nlink.  Currently,
+ * it is only here for parity with dec_nlink().
+ */
+static inline void inc_nlink(struct inode *inode)
+{
+	inode->i_nlink++;
+}
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (3 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21  0:56   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
                   ` (22 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 9490991482a2091a828d997adbc088e24c310a4d in mainline introduced
macro uninitialized_var(). This patch allows one to build ocfs2 with
kernels having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                       |    3 ++-
 configure.in                   |    5 +++++
 kapi-compat/include/compiler.h |   10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/compiler.h

diff --git a/Makefile b/Makefile
index 4752593..21ff590 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,8 @@ SUBDIRS = fs vendor
 LINUX_INCLUDE_FILES =
 
 KAPI_COMPAT_FILES = \
-	kapi-compat/include/workqueue.h
+	kapi-compat/include/workqueue.h \
+	kapi-compat/include/compiler.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 72567b5..7faf363 100644
--- a/configure.in
+++ b/configure.in
@@ -162,6 +162,11 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h,
 AC_SUBST(DELAYED_WORK_DEFINED)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h"
 
+compiler_compat_header=""
+OCFS2_CHECK_KERNEL([uninitialized_var() in compiler-gcc4.h], compiler-gcc4.h,
+  , compiler_compat_header="compiler.h", [uninitialized_var])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $compiler_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/compiler.h b/kapi-compat/include/compiler.h
new file mode 100644
index 0000000..c104ed1
--- /dev/null
+++ b/kapi-compat/include/compiler.h
@@ -0,0 +1,10 @@
+#ifndef KAPI_COMPILER_H
+#define KAPI_COMPILER_H
+
+/*
+ * A trick to suppress uninitialized variable warning without generating any
+ * code
+ */
+#define uninitialized_var(x) x = x
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (4 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21  0:54   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
                   ` (21 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 introduced export symbol
do_sync_mapping_range(). This patch allows one to build ocfs2 with kernels
having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    2 +
 configure.in      |    5 +++
 fs/ocfs2/Makefile |    4 ++
 fs/ocfs2/alloc.c  |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index befeb79..1fe7ddc 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
 
 DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
 
+HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
+
 OCFS_DEBUG = @OCFS_DEBUG@
 
 ifneq ($(OCFS_DEBUG),)
diff --git a/configure.in b/configure.in
index 47b0da0..603dc94 100644
--- a/configure.in
+++ b/configure.in
@@ -172,6 +172,11 @@ OCFS2_CHECK_KERNEL([zero_user_page() in highmem.h], highmem.h,
   , highmem_compat_header="highmem.h", [zero_user_page])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $highmem_compat_header"
 
+HAS_SYNC_MAPPING_RANGE=
+OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
+  HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
+AC_SUBST(HAS_SYNC_MAPPING_RANGE)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 0edfed7..3dc33a5 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -29,6 +29,10 @@ ifdef DELAYED_WORK_DEFINED
 EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
 endif
 
+ifdef HAS_SYNC_MAPPING_RANGE
+EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 5a8a4f2..0cc4729 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -29,6 +29,11 @@
 #include <linux/highmem.h>
 #include <linux/swap.h>
 
+#ifndef HAS_SYNC_MAPPING_RANGE
+#include <linux/writeback.h>
+#include <linux/mpage.h>
+#endif
+
 #define MLOG_MASK_PREFIX ML_DISK_ALLOC
 #include <cluster/masklog.h>
 
@@ -5750,6 +5755,94 @@ out:
 	return ret;
 }
 
+#ifndef HAS_SYNC_MAPPING_RANGE
+int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
+{
+	int ret;
+
+	if (wbc->nr_to_write <= 0)
+		return 0;
+	wbc->for_writepages = 1;
+	if (mapping->a_ops->writepages)
+		ret = mapping->a_ops->writepages(mapping, wbc);
+	else
+		ret = generic_writepages(mapping, wbc);
+	wbc->for_writepages = 0;
+	return ret;
+}
+
+/**
+ * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range
+ * @mapping:	address space structure to write
+ * @start:	offset in bytes where the range starts
+ * @end:	offset in bytes where the range ends (inclusive)
+ * @sync_mode:	enable synchronous operation
+ *
+ * Start writeback against all of a mapping's dirty pages that lie
+ * within the byte offsets <start, end> inclusive.
+ *
+ * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
+ * opposed to a regular memory cleansing writeback.  The difference between
+ * these two operations is that if a dirty page/buffer is encountered, it must
+ * be waited upon, and not just skipped over.
+ */
+int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
+				loff_t end, int sync_mode)
+{
+	int ret;
+	struct writeback_control wbc = {
+		.sync_mode = sync_mode,
+		.nr_to_write = mapping->nrpages * 2,
+		.range_start = start,
+		.range_end = end,
+	};
+
+	if (!mapping_cap_writeback_dirty(mapping))
+		return 0;
+
+	ret = do_writepages(mapping, &wbc);
+	return ret;
+}
+
+/*
+ * `endbyte' is inclusive
+ */
+static int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
+				 loff_t endbyte, unsigned int flags)
+{
+	int ret;
+
+	if (!mapping) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = 0;
+	if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
+		ret = wait_on_page_writeback_range(mapping,
+					offset >> PAGE_CACHE_SHIFT,
+					endbyte >> PAGE_CACHE_SHIFT);
+		if (ret < 0)
+			goto out;
+	}
+
+	if (flags & SYNC_FILE_RANGE_WRITE) {
+		ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
+						WB_SYNC_NONE);
+		if (ret < 0)
+			goto out;
+	}
+
+	if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
+		ret = wait_on_page_writeback_range(mapping,
+					offset >> PAGE_CACHE_SHIFT,
+					endbyte >> PAGE_CACHE_SHIFT);
+	}
+out:
+	return ret;
+}
+#endif
+
 /*
  * Zero the area past i_size but still within an allocated
  * cluster. This avoids exposing nonzero data on subsequent file
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (6 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-24 13:30   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
                   ` (19 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 6712ecf8f648118c3363c142196418f89a510b90 in mainline
dropped 'size' argument from bi_end_io(). This patch allows
one to build ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in               |    1 +
 configure.in                 |    5 +++++
 fs/ocfs2/cluster/Makefile    |    4 ++++
 fs/ocfs2/cluster/heartbeat.c |    9 +++++++++
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 89c1e94..f22473c 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -73,6 +73,7 @@ SOP_IS_CONST = @SOP_IS_CONST@
 IOP_IS_CONST = @IOP_IS_CONST@
 VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
 SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
+OLD_BIO_END_IO = @OLD_BIO_END_IO@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 021b925..60fd68f 100644
--- a/configure.in
+++ b/configure.in
@@ -292,6 +292,11 @@ OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h,
   SPLICE_FROM_PIPE=yes, , [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*])
 AC_SUBST(SPLICE_FROM_PIPE)
 
+OLD_BIO_END_IO=
+OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
+  OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
+AC_SUBST(OLD_BIO_END_IO)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
index ff57486..ccbddd0 100644
--- a/fs/ocfs2/cluster/Makefile
+++ b/fs/ocfs2/cluster/Makefile
@@ -29,6 +29,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
 EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
 endif
 
+ifdef OLD_BIO_END_IO
+EXTRA_CFLAGS += -DOLD_BIO_END_IO
+endif
+
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index e610665..b41a7fb 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -216,8 +216,14 @@ static void o2hb_wait_on_io(struct o2hb_region *reg,
 	wait_for_completion(&wc->wc_io_complete);
 }
 
+#ifdef OLD_BIO_END_IO
+static int o2hb_bio_end_io(struct bio *bio,
+			   unsigned int bytes_done,
+			   int error)
+#else
 static void o2hb_bio_end_io(struct bio *bio,
 			   int error)
+#endif
 {
 	struct o2hb_bio_wait_ctxt *wc = bio->bi_private;
 
@@ -228,6 +234,9 @@ static void o2hb_bio_end_io(struct bio *bio,
 
 	o2hb_bio_wait_dec(wc, 1);
 	bio_put(bio);
+#ifdef OLD_BIO_END_IO
+	return 0;
+#endif
 }
 
 /* Setup a Bio to cover I/O against num_slots slots starting at
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (5 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-22  3:51   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
                   ` (20 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 0ceb331433e8aad9c5f441a965d7c681f8b9046f in mainline wraps
common segment checks in generic_segment_checks(). This patch allows
one to build ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |   40 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 788c156..c1ca1d9 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -67,6 +67,7 @@ SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
 STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
 FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
 SPLICE_HEADER = @SPLICE_HEADER@
+GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 472e01a..a311d3f 100644
--- a/configure.in
+++ b/configure.in
@@ -262,6 +262,11 @@ OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h,
   SHOULD_REMOVE_SUID=yes, , [should_remove_suid()])
 AC_SUBST(SHOULD_REMOVE_SUID)
 
+GENERIC_SEGMENT_CHECKS=
+OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h,
+  GENERIC_SEGMENT_CHECKS=yes, , [generic_segment_checks()])
+AC_SUBST(GENERIC_SEGMENT_CHECKS)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index a80a9fc..7434d6d 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -57,6 +57,10 @@ ifdef SHOULD_REMOVE_SUID
 EXTRA_CFLAGS += -DSHOULD_REMOVE_SUID
 endif
 
+ifdef GENERIC_SEGMENT_CHECKS
+EXTRA_CFLAGS += -DGENERIC_SEGMENT_CHECKS
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index cee10ae..dd074af 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1809,6 +1809,46 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
 }
 #endif
 
+#ifndef GENERIC_SEGMENT_CHECKS
+/*
+ * Performs necessary checks before doing a write
+ * @iov:	io vector request
+ * @nr_segs:	number of segments in the iovec
+ * @count:	number of bytes to write
+ * @access_flags: type of access: %VERIFY_READ or %VERIFY_WRITE
+ *
+ * Adjust number of segments and amount of bytes to write (nr_segs should be
+ * properly initialized first). Returns appropriate error code that caller
+ * should return or zero in case that write should be allowed.
+ */
+int generic_segment_checks(const struct iovec *iov,
+			unsigned long *nr_segs, size_t *count, int access_flags)
+{
+	unsigned long   seg;
+	size_t cnt = 0;
+	for (seg = 0; seg < *nr_segs; seg++) {
+		const struct iovec *iv = &iov[seg];
+
+		/*
+		 * If any segment has a negative length, or the cumulative
+		 * length ever wraps negative then return -EINVAL.
+		 */
+		cnt += iv->iov_len;
+		if (unlikely((ssize_t)(cnt|iv->iov_len) < 0))
+			return -EINVAL;
+		if (access_ok(access_flags, iv->iov_base, iv->iov_len))
+			continue;
+		if (seg == 0)
+			return -EFAULT;
+		*nr_segs = seg;
+		cnt -= iv->iov_len;	/* This segment is no good */
+		break;
+	}
+	*count = cnt;
+	return 0;
+}
+#endif
+
 static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
 					 loff_t *ppos,
 					 size_t count,
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (9 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-22  3:51   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
                   ` (16 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commits 01de85e057328ecbef36e108673b1e81059d54c1 and
d23a147bb6e8d467e8df73b6589888717da3b9ce in mainline added and exported
symbol should_remove_suid(). This patch allows one to build ocfs2 with
kernels having/not having these changes.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |   30 ++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index 39fb02b..472e01a 100644
--- a/configure.in
+++ b/configure.in
@@ -257,6 +257,11 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h,
   , relatime_compat_header="mount.h", [^#define MNT_RELATIME])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header"
 
+SHOULD_REMOVE_SUID=
+OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h,
+  SHOULD_REMOVE_SUID=yes, , [should_remove_suid()])
+AC_SUBST(SHOULD_REMOVE_SUID)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 3cc7c74..a80a9fc 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -53,6 +53,10 @@ ifdef SPLICE_HEADER
 EXTRA_CFLAGS += -DSPLICE_HEADER
 endif
 
+ifdef SHOULD_REMOVE_SUID
+EXTRA_CFLAGS += -DSHOULD_REMOVE_SUID
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 1c179fc..cee10ae 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1593,6 +1593,36 @@ out:
 	return ret;
 }
 
+#ifndef SHOULD_REMOVE_SUID
+/*
+ * The logic we want is
+ *
+ *	if suid or (sgid and xgrp)
+ *		remove privs
+ */
+int should_remove_suid(struct dentry *dentry)
+{
+	mode_t mode = dentry->d_inode->i_mode;
+	int kill = 0;
+
+	/* suid always must be killed */
+	if (unlikely(mode & S_ISUID))
+		kill = ATTR_KILL_SUID;
+
+	/*
+	 * sgid without any exec bits is just a mandatory locking mark; leave
+	 * it alone.  If some exec bits are set, it's a real sgid; kill it.
+	 */
+	if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
+		kill |= ATTR_KILL_SGID;
+
+	if (unlikely(kill && !capable(CAP_FSETID)))
+		return kill;
+
+	return 0;
+}
+#endif
+
 /*
  * Parts of this function taken from xfs_change_file_space()
  */
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (7 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21 11:59   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
                   ` (18 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 0b4d414714f0d2f922d39424b0c5c82ad900a381 in mainline removes the
insert_at_head argument from register_sysctl_table(). This patch allows
building ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in                        |    1 +
 Makefile                              |    3 ++-
 configure.in                          |    6 ++++++
 fs/ocfs2/cluster/Makefile             |    4 ++++
 fs/ocfs2/cluster/nodemanager.c        |    2 +-
 kapi-compat/include/register_sysctl.h |   10 ++++++++++
 6 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 kapi-compat/include/register_sysctl.h

diff --git a/Config.make.in b/Config.make.in
index 07c5a86..eb8671d 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -62,6 +62,7 @@ DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
 HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
 HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
+REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/Makefile b/Makefile
index 71cd3c7..a9bfccb 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/slab.h \
 	kapi-compat/include/fstype.h \
 	kapi-compat/include/sysctl.h \
-	kapi-compat/include/configfs.h
+	kapi-compat/include/configfs.h \
+	kapi-compat/include/register_sysctl.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 513585f..04db94f 100644
--- a/configure.in
+++ b/configure.in
@@ -219,6 +219,12 @@ OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
   , configfs_compat_header="configfs.h", [configfs_depend_item()])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
 
+REGISTER_SYSCTL_TWO_ARGS=
+OCFS2_CHECK_KERNEL([register_sysctl() with two args in sysctl.h], sysctl.h,
+  REGISTER_SYSCTL_TWO_ARGS=yes, , [^.*int insert_at_head);])
+AC_SUBST(REGISTER_SYSCTL_TWO_ARGS)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS register_sysctl.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
index a4251f5..6c2f11b 100644
--- a/fs/ocfs2/cluster/Makefile
+++ b/fs/ocfs2/cluster/Makefile
@@ -17,6 +17,10 @@ ifdef DELAYED_WORK_DEFINED
 EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
 endif
 
+ifdef REGISTER_SYSCTL_TWO_ARGS
+EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS
+endif
+
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index af2070d..9fff881 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -962,7 +962,7 @@ static int __init init_o2nm(void)
 	o2hb_init();
 	o2net_init();
 
-	ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
+	ocfs2_table_header = kapi_register_sysctl_table(ocfs2_root_table);
 	if (!ocfs2_table_header) {
 		printk(KERN_ERR "nodemanager: unable to register sysctl\n");
 		ret = -ENOMEM; /* or something. */
diff --git a/kapi-compat/include/register_sysctl.h b/kapi-compat/include/register_sysctl.h
new file mode 100644
index 0000000..94e8071
--- /dev/null
+++ b/kapi-compat/include/register_sysctl.h
@@ -0,0 +1,10 @@
+#ifndef KAPI_REGISTER_SYSCTL_H
+#define KAPI_REGISTER_SYSCTL_H
+
+#ifdef REGISTER_SYSCTL_TWO_ARGS
+#define kapi_register_sysctl_table(a)	register_sysctl_table(a, 0)
+#else
+#define kapi_register_sysctl_table(a)	register_sysctl_table(a)
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (8 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-21 15:10   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
                   ` (17 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 823bccfc4002296ba88c3ad0f049e1abd8108d30 in mainline removes struct
subsystem from kobject.h. This patch allows one to build ocfs2 with kernels
having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in                |    1 +
 Makefile                      |    3 ++-
 configure.in                  |    6 ++++++
 fs/ocfs2/Makefile             |    4 ++++
 fs/ocfs2/cluster/Makefile     |    4 ++++
 fs/ocfs2/cluster/masklog.c    |    2 +-
 fs/ocfs2/cluster/masklog.h    |    2 +-
 fs/ocfs2/cluster/sys.c        |    6 +++---
 fs/ocfs2/dlm/Makefile         |    4 ++++
 kapi-compat/include/kobject.h |   14 ++++++++++++++
 10 files changed, 40 insertions(+), 6 deletions(-)
 create mode 100644 kapi-compat/include/kobject.h

diff --git a/Config.make.in b/Config.make.in
index b7bd06b..a27e274 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -64,6 +64,7 @@ HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
 SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
+STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/Makefile b/Makefile
index 9848c47..a26e24f 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/sysctl.h \
 	kapi-compat/include/configfs.h \
 	kapi-compat/include/register_sysctl.h \
-	kapi-compat/include/su_mutex.h
+	kapi-compat/include/su_mutex.h \
+	kapi-compat/include/kobject.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 3d3c5da..83dcd37 100644
--- a/configure.in
+++ b/configure.in
@@ -231,6 +231,12 @@ OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], config
 AC_SUBST(SU_MUTEX_DEFINED)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS su_mutex.h"
 
+STRUCT_SUBSYSTEM_DEFINED=
+OCFS2_CHECK_KERNEL([struct subsystem in kobject.h], kobject.h,
+  STRUCT_SUBSYSTEM_DEFINED=yes, , [^struct subsystem {])
+AC_SUBST(STRUCT_SUBSYSTEM_DEFINED)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS kobject.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 403c1c6..5c290b7 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -41,6 +41,10 @@ ifdef KMEM_CACHE_CREATE_DTOR
 EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
 endif
 
+ifdef STRUCT_SUBSYSTEM_DEFINED
+EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
index 1e69fef..ff57486 100644
--- a/fs/ocfs2/cluster/Makefile
+++ b/fs/ocfs2/cluster/Makefile
@@ -25,6 +25,10 @@ ifdef SU_MUTEX_DEFINED
 EXTRA_CFLAGS += -DSU_MUTEX_DEFINED
 endif
 
+ifdef STRUCT_SUBSYSTEM_DEFINED
+EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
+endif
+
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index e9e042b..a1449df 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -146,7 +146,7 @@ static struct kset mlog_kset = {
 	.kobj   = {.name = "logmask", .ktype = &mlog_ktype},
 };
 
-int mlog_sys_init(struct kset *o2cb_subsys)
+int mlog_sys_init(struct kapi_kset *o2cb_subsys)
 {
 	int i = 0;
 
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 75cd877..2b78a1b 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -278,7 +278,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
 
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
-int mlog_sys_init(struct kset *o2cb_subsys);
+int mlog_sys_init(struct kapi_kset *o2cb_subsys);
 void mlog_sys_shutdown(void);
 
 #endif /* O2CLUSTER_MASKLOG_H */
diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c
index 64f6f37..c22c158 100644
--- a/fs/ocfs2/cluster/sys.c
+++ b/fs/ocfs2/cluster/sys.c
@@ -78,7 +78,7 @@ static ssize_t
 o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
 {
 	struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
-	struct kset *sbs = to_kset(kobj);
+	struct kapi_kset *sbs = to_kapi_kset(kobj);
 
 	BUG_ON(sbs != &o2cb_subsys);
 
@@ -92,7 +92,7 @@ o2cb_store(struct kobject * kobj, struct attribute * attr,
 	     const char * buffer, size_t count)
 {
 	struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
-	struct kset *sbs = to_kset(kobj);
+	struct kapi_kset *sbs = to_kapi_kset(kobj);
 
 	BUG_ON(sbs != &o2cb_subsys);
 
@@ -111,7 +111,7 @@ int o2cb_sys_init(void)
 {
 	int ret;
 
-	o2cb_subsys.kobj.ktype = &o2cb_subsys_type;
+	o2cb_subsys.kapi_kobj.ktype = &o2cb_subsys_type;
 	ret = subsystem_register(&o2cb_subsys);
 	if (ret)
 		return ret;
diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
index 628ab3d..5101f9c 100644
--- a/fs/ocfs2/dlm/Makefile
+++ b/fs/ocfs2/dlm/Makefile
@@ -24,6 +24,10 @@ ifdef KMEM_CACHE_CREATE_DTOR
 EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
 endif
 
+ifdef STRUCT_SUBSYSTEM_DEFINED
+EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
+endif
+
 DLM_SOURCES =			\
 	dlmast.c		\
 	dlmconvert.c		\
diff --git a/kapi-compat/include/kobject.h b/kapi-compat/include/kobject.h
new file mode 100644
index 0000000..4061901
--- /dev/null
+++ b/kapi-compat/include/kobject.h
@@ -0,0 +1,14 @@
+#ifndef KAPI_KOBJECT_H
+#define KAPI_KOBJECT_H
+
+#ifdef STRUCT_SUBSYSTEM_DEFINED
+# define kapi_kset		subsystem
+# define to_kapi_kset(k)	container_of(to_kset(k), struct subsystem, kset)
+# define kapi_kobj		kset.kobj
+#else
+# define kapi_kset		kset
+# define to_kapi_kset(k)	to_kset(k)
+# define kapi_kobj		kobj
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (11 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-24 13:30   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
                   ` (14 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit c66ab6fa705e1b2887a6d9246b798bdc526839e2 in mainline introduced
__splice_from_pipe(). This patch allows one to build ocfs2 with kernels
having/not having this change.

Note: This patch disables splice io for kernels not providing
__splice_from_pipe(). We will later add a patch to enable splice
io with such kernels too.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |    4 ++++
 4 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index f99b9f4..89c1e94 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -72,6 +72,7 @@ FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
 SOP_IS_CONST = @SOP_IS_CONST@
 IOP_IS_CONST = @IOP_IS_CONST@
 VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
+SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 741dfdb..021b925 100644
--- a/configure.in
+++ b/configure.in
@@ -287,6 +287,11 @@ OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], f
   VECTORED_FILE_AIO=yes, , [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
 AC_SUBST(VECTORED_FILE_AIO)
 
+SPLICE_FROM_PIPE=
+OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h,
+  SPLICE_FROM_PIPE=yes, , [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*])
+AC_SUBST(SPLICE_FROM_PIPE)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 80fd6c6..e4296d3 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -77,6 +77,10 @@ ifdef VECTORED_FILE_AIO
 EXTRA_CFLAGS += -DVECTORED_FILE_AIO
 endif
 
+ifdef SPLICE_FROM_PIPE
+EXTRA_CFLAGS += -DSPLICE_FROM_PIPE
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 1ee2a79..e022c97 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2258,6 +2258,7 @@ out_sems:
 	return written ? written : ret;
 }
 
+#ifdef SPLICE_FROM_PIPE
 static int ocfs2_splice_write_actor(struct pipe_inode_info *pipe,
 				    struct pipe_buffer *buf,
 				    struct splice_desc *sd)
@@ -2406,6 +2407,7 @@ bail:
 	mlog_exit(ret);
 	return ret;
 }
+#endif
 
 #ifdef VECTORED_FILE_AIO
 static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
@@ -2530,8 +2532,10 @@ const struct file_operations ocfs2_fops = {
 #ifdef CONFIG_COMPAT
 	.compat_ioctl   = ocfs2_compat_ioctl,
 #endif
+#ifdef SPLICE_FROM_PIPE
 	.splice_read	= ocfs2_file_splice_read,
 	.splice_write	= ocfs2_file_splice_write,
+#endif
 };
 
 const struct file_operations ocfs2_dops = {
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (10 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
@ 2007-12-20 15:29 ` Sunil Mushran
  2007-12-24 13:21   ` Joel Becker
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
                   ` (15 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:29 UTC (permalink / raw)
  To: ocfs2-devel

Commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7 in mainline introduces
vmops->fault() which is used to replace vmops->populate() and vmops->nopage().
This patch allows one to build ocfs2 with kernels having/not having this
change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/mmap.c   |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index c1ca1d9..96dbb7a 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -68,6 +68,7 @@ STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
 FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
 SPLICE_HEADER = @SPLICE_HEADER@
 GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
+FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index a311d3f..b8b8001 100644
--- a/configure.in
+++ b/configure.in
@@ -267,6 +267,11 @@ OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h,
   GENERIC_SEGMENT_CHECKS=yes, , [generic_segment_checks()])
 AC_SUBST(GENERIC_SEGMENT_CHECKS)
 
+FAULT_IN_VMOPS=
+OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
+  FAULT_IN_VMOPS=yes, , [^.*int (\*fault)])
+AC_SUBST(FAULT_IN_VMOPS)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 7434d6d..521888b 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -61,6 +61,10 @@ ifdef GENERIC_SEGMENT_CHECKS
 EXTRA_CFLAGS += -DGENERIC_SEGMENT_CHECKS
 endif
 
+ifdef FAULT_IN_VMOPS
+EXTRA_CFLAGS += -DFAULT_IN_VMOPS
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index c0483c9..58c67ea 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -60,6 +60,7 @@ static inline int ocfs2_vm_op_unblock_sigs(sigset_t *oldset)
 	return sigprocmask(SIG_SETMASK, oldset, NULL);
 }
 
+#ifdef FAULT_IN_VMOPS
 static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf)
 {
 	sigset_t blocked, oldset;
@@ -83,6 +84,35 @@ out:
 	mlog_exit_ptr(vmf->page);
 	return ret;
 }
+#else
+static struct page *ocfs2_nopage(struct vm_area_struct * area,
+				 unsigned long address,
+				 int *type)
+{
+	struct page *page = NOPAGE_SIGBUS;
+	sigset_t blocked, oldset;
+	int error, ret;
+
+	mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address,
+		   type);
+
+	error = ocfs2_vm_op_block_sigs(&blocked, &oldset);
+	if (error < 0) {
+		mlog_errno(error);
+		ret = VM_FAULT_SIGBUS;
+		goto out;
+	}
+
+	page = filemap_nopage(area, address, type);
+
+	error = ocfs2_vm_op_unblock_sigs(&oldset);
+	if (error < 0)
+		mlog_errno(error);
+out:
+	mlog_exit_ptr(page);
+	return page;
+}
+#endif
 
 static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
 				struct page *page)
@@ -96,6 +126,9 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
 	void *fsdata;
 	loff_t size = i_size_read(inode);
 
+	mlog_entry("(inode=0x%p, i_ino=%lu, page=0x%p)\n", inode, inode->i_ino,
+		   page);
+
 	/*
 	 * Another node might have truncated while we were waiting on
 	 * cluster locks.
@@ -147,6 +180,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
 	BUG_ON(ret != len);
 	ret = 0;
 out:
+	mlog_exit(ret);
 	return ret;
 }
 
@@ -157,6 +191,8 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
 	sigset_t blocked, oldset;
 	int ret, ret2;
 
+	mlog_entry("(vma=0x%p, page=0x%p)\n", vma, page);
+
 	ret = ocfs2_vm_op_block_sigs(&blocked, &oldset);
 	if (ret < 0) {
 		mlog_errno(ret);
@@ -202,11 +238,16 @@ out:
 	if (ret2 < 0)
 		mlog_errno(ret2);
 
+	mlog_exit(ret);
 	return ret;
 }
 
 static struct vm_operations_struct ocfs2_file_vm_ops = {
+#ifdef FAULT_IN_VMOPS
 	.fault		= ocfs2_fault,
+#else
+	.nopage		= ocfs2_nopage,
+#endif
 	.page_mkwrite	= ocfs2_page_mkwrite,
 };
 
@@ -214,6 +255,10 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	int ret = 0, lock_level = 0;
 
+	mlog_entry("(file=0x%p, vma=%p, '%.*s')\n", file, vma,
+		   file->f_path_dentry->d_name.len,
+		   file->f_path_dentry->d_name.name);
+
 	ret = ocfs2_meta_lock_atime(file->f_dentry->d_inode,
 				    file->f_vfsmnt, &lock_level);
 	if (ret < 0) {
@@ -223,7 +268,9 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
 	ocfs2_meta_unlock(file->f_dentry->d_inode, lock_level);
 out:
 	vma->vm_ops = &ocfs2_file_vm_ops;
+#ifdef FAULT_IN_VMOPS
 	vma->vm_flags |= VM_CAN_NONLINEAR;
-	return 0;
+#endif
+	mlog_exit(ret);
+	return ret;
 }
-
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (12 preceding siblings ...)
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 15:10   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
                   ` (13 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 3bd858ab1c451725c07a805dcb315215dc85b86e in mainline introduces
helper macro is_owner_or_cap(). This patch allows one to build ocfs2 with
kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                  |    3 ++-
 configure.in              |    5 +++++
 kapi-compat/include/cap.h |    7 +++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/cap.h

diff --git a/Makefile b/Makefile
index a26e24f..eafeb2f 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/configfs.h \
 	kapi-compat/include/register_sysctl.h \
 	kapi-compat/include/su_mutex.h \
-	kapi-compat/include/kobject.h
+	kapi-compat/include/kobject.h \
+	kapi-compat/include/cap.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 83dcd37..f8b5f20 100644
--- a/configure.in
+++ b/configure.in
@@ -237,6 +237,11 @@ OCFS2_CHECK_KERNEL([struct subsystem in kobject.h], kobject.h,
 AC_SUBST(STRUCT_SUBSYSTEM_DEFINED)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS kobject.h"
 
+cap_compat_header=""
+OCFS2_CHECK_KERNEL([is_owner_or_cap() in fs.h], fs.h,
+  , cap_compat_header="cap.h", [^#define is_owner_or_cap])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cap_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/cap.h b/kapi-compat/include/cap.h
new file mode 100644
index 0000000..a10a12f
--- /dev/null
+++ b/kapi-compat/include/cap.h
@@ -0,0 +1,7 @@
+#ifndef KAPI_CAP_H
+#define KAPI_CAP_H
+
+#define is_owner_or_cap(inode)  \
+	        ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (13 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:47   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
                   ` (12 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg
from kmem_cache_create(). This patch allows one to build ocfs2 with
kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in             |    1 +
 Makefile                   |    3 ++-
 configure.in               |    6 ++++++
 fs/ocfs2/Makefile          |    4 ++++
 fs/ocfs2/dlm/Makefile      |    4 ++++
 fs/ocfs2/dlm/dlmfs.c       |    2 +-
 fs/ocfs2/dlm/dlmmaster.c   |    2 +-
 fs/ocfs2/super.c           |    2 +-
 fs/ocfs2/uptodate.c        |    2 +-
 kapi-compat/include/slab.h |   10 ++++++++++
 10 files changed, 31 insertions(+), 5 deletions(-)
 create mode 100644 kapi-compat/include/slab.h

diff --git a/Config.make.in b/Config.make.in
index 4f42cca..07c5a86 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -61,6 +61,7 @@ DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
 
 HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
 HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
+KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/Makefile b/Makefile
index 2a97e00..ae5947b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/fpath.h \
 	kapi-compat/include/kmod.h \
 	kapi-compat/include/inc_nlink.h \
-	kapi-compat/include/drop_nlink.h
+	kapi-compat/include/drop_nlink.h \
+	kapi-compat/include/slab.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 81041fb..cb91de1 100644
--- a/configure.in
+++ b/configure.in
@@ -198,6 +198,12 @@ OCFS2_CHECK_KERNEL([drop_nlink() in fs.h], fs.h,
   , drop_nlink_compat_header="drop_nlink.h", [^static inline void drop_nlink(])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $drop_nlink_compat_header"
 
+KMEM_CACHE_CREATE_DTOR=
+OCFS2_CHECK_KERNEL([kmem_cache_create() with dtor arg in slab.h], slab.h,
+  KMEM_CACHE_CREATE_DTOR=yes, , [^.*void (\*)(void \*, kmem_cache_t \*, unsigned long),])
+AC_SUBST(KMEM_CACHE_CREATE_DTOR)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS slab.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index b6c8d03..403c1c6 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -37,6 +37,10 @@ ifdef HAS_F_PATH_DEFINED
 EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
 endif
 
+ifdef KMEM_CACHE_CREATE_DTOR
+EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
index b4fb8e3..628ab3d 100644
--- a/fs/ocfs2/dlm/Makefile
+++ b/fs/ocfs2/dlm/Makefile
@@ -20,6 +20,10 @@ ifdef DELAYED_WORK_DEFINED
 EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
 endif
 
+ifdef KMEM_CACHE_CREATE_DTOR
+EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
+endif
+
 DLM_SOURCES =			\
 	dlmast.c		\
 	dlmconvert.c		\
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 4ce2dea..dc43923 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -588,7 +588,7 @@ static int __init init_dlmfs_fs(void)
 
 	dlmfs_print_version();
 
-	dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
+	dlmfs_inode_cache = kapi_kmem_cache_create("dlmfs_inode_cache",
 				sizeof(struct dlmfs_inode_private),
 				0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
 					SLAB_MEM_SPREAD),
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 62e4a7d..a668840 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -507,7 +507,7 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm,
 
 int dlm_init_mle_cache(void)
 {
-	dlm_mle_cache = kmem_cache_create("dlm_mle_cache",
+	dlm_mle_cache = kapi_kmem_cache_create("dlm_mle_cache",
 					  sizeof(struct dlm_master_list_entry),
 					  0, SLAB_HWCACHE_ALIGN,
 					  NULL);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index a8f90a2..f5c424d 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1033,7 +1033,7 @@ static void ocfs2_inode_init_once(void *data,
 
 static int ocfs2_initialize_mem_caches(void)
 {
-	ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
+	ocfs2_inode_cachep = kapi_kmem_cache_create("ocfs2_inode_cache",
 				       sizeof(struct ocfs2_inode_info),
 				       0,
 				       (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index 4da8851..6248308 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -546,7 +546,7 @@ void ocfs2_remove_from_cache(struct inode *inode,
 
 int __init init_ocfs2_uptodate_cache(void)
 {
-	ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate",
+	ocfs2_uptodate_cachep = kapi_kmem_cache_create("ocfs2_uptodate",
 				  sizeof(struct ocfs2_meta_cache_item),
 				  0, SLAB_HWCACHE_ALIGN, NULL);
 	if (!ocfs2_uptodate_cachep)
diff --git a/kapi-compat/include/slab.h b/kapi-compat/include/slab.h
new file mode 100644
index 0000000..239763f
--- /dev/null
+++ b/kapi-compat/include/slab.h
@@ -0,0 +1,10 @@
+#ifndef KAPI_SLAB_H
+#define KAPI_SLAB_H
+
+#ifdef KMEM_CACHE_CREATE_DTOR
+#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e, NULL)
+#else
+#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (15 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21  0:56   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
                   ` (10 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 01f2705daf5a36208e69d7cf95db9c330f843af6 in mainline introduced
macro zero_user_page(). This patch allows one to build ocfs2 with
kernels having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                      |    3 ++-
 configure.in                  |    5 +++++
 kapi-compat/include/highmem.h |   22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/highmem.h

diff --git a/Makefile b/Makefile
index 21ff590..b7b86db 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,8 @@ LINUX_INCLUDE_FILES =
 
 KAPI_COMPAT_FILES = \
 	kapi-compat/include/workqueue.h \
-	kapi-compat/include/compiler.h
+	kapi-compat/include/compiler.h \
+	kapi-compat/include/highmem.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 7faf363..47b0da0 100644
--- a/configure.in
+++ b/configure.in
@@ -167,6 +167,11 @@ OCFS2_CHECK_KERNEL([uninitialized_var() in compiler-gcc4.h], compiler-gcc4.h,
   , compiler_compat_header="compiler.h", [uninitialized_var])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $compiler_compat_header"
 
+highmem_compat_header=""
+OCFS2_CHECK_KERNEL([zero_user_page() in highmem.h], highmem.h,
+  , highmem_compat_header="highmem.h", [zero_user_page])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $highmem_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/highmem.h b/kapi-compat/include/highmem.h
new file mode 100644
index 0000000..a8c7e11
--- /dev/null
+++ b/kapi-compat/include/highmem.h
@@ -0,0 +1,22 @@
+#ifndef KAPI_HIGHMEM_H
+#define KAPI_HIGHMEM_H
+
+/*
+ * Same but also flushes aliased cache contents to RAM.
+ *
+ * This must be a macro because KM_USER0 and friends aren't defined if
+ * !CONFIG_HIGHMEM
+ */
+#define zero_user_page(page, offset, size, km_type)		\
+	do {							\
+		void *kaddr;					\
+								\
+		BUG_ON((offset) + (size) > PAGE_SIZE);		\
+								\
+		kaddr = kmap_atomic(page, km_type);		\
+		memset((char *)kaddr + (offset), 0, (size));	\
+		flush_dcache_page(page);			\
+		kunmap_atomic(kaddr, (km_type));		\
+	} while (0)
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (14 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-24 13:23   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
                   ` (11 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit c5ef1c42c51b1b5b4a401a6517bdda30933ddbaf in mainline marks struct
inode_operations in struct inode as a const. This patch allows one to build
ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in        |    1 +
 configure.in          |    5 +++++
 fs/ocfs2/Makefile     |    4 ++++
 fs/ocfs2/dlm/Makefile |    4 ++++
 fs/ocfs2/dlm/dlmfs.c  |   18 ++++++++++++++++++
 fs/ocfs2/file.c       |    8 ++++++++
 fs/ocfs2/file.h       |    5 +++++
 fs/ocfs2/namei.c      |    4 ++++
 fs/ocfs2/namei.h      |    4 ++++
 fs/ocfs2/symlink.c    |    8 ++++++++
 fs/ocfs2/symlink.h    |    5 +++++
 11 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 938ac53..d4cd518 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -70,6 +70,7 @@ SPLICE_HEADER = @SPLICE_HEADER@
 GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
 FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
 SOP_IS_CONST = @SOP_IS_CONST@
+IOP_IS_CONST = @IOP_IS_CONST@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 3093542..8a23983 100644
--- a/configure.in
+++ b/configure.in
@@ -277,6 +277,11 @@ OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h,
   SOP_IS_CONST=yes, , [^.*const struct super_operations.*\*s_op;])
 AC_SUBST(SOP_IS_CONST)
 
+IOP_IS_CONST=
+OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
+  IOP_IS_CONST=yes, , [^.*const struct inode_operations.*\*i_op;])
+AC_SUBST(IOP_IS_CONST)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 4ce2431..97912fd 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -69,6 +69,10 @@ ifdef SOPS_IS_CONST
 EXTRA_CFLAGS += -DSOPS_IS_CONST
 endif
 
+ifdef IOP_IS_CONST
+EXTRA_CFLAGS += -DIOP_IS_CONST
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
index 2df255e..c7edb07 100644
--- a/fs/ocfs2/dlm/Makefile
+++ b/fs/ocfs2/dlm/Makefile
@@ -32,6 +32,10 @@ ifdef SOP_IS_CONST
 EXTRA_CFLAGS += -DSOP_IS_CONST
 endif
 
+ifdef IOP_IS_CONST
+EXTRA_CFLAGS += -DIOP_IS_CONST
+endif
+
 DLM_SOURCES =			\
 	dlmast.c		\
 	dlmconvert.c		\
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index dc5b5a5..9ff18be 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -66,9 +66,15 @@ static const struct super_operations dlmfs_ops;
 static struct super_operations dlmfs_ops;
 #endif
 static const struct file_operations dlmfs_file_operations;
+#ifdef IOP_IS_CONST
 static const struct inode_operations dlmfs_dir_inode_operations;
 static const struct inode_operations dlmfs_root_inode_operations;
 static const struct inode_operations dlmfs_file_inode_operations;
+#else
+static struct inode_operations dlmfs_dir_inode_operations;
+static struct inode_operations dlmfs_root_inode_operations;
+static struct inode_operations dlmfs_file_inode_operations;
+#endif
 static struct kmem_cache *dlmfs_inode_cache;
 
 struct workqueue_struct *user_dlm_worker;
@@ -547,14 +553,22 @@ static const struct file_operations dlmfs_file_operations = {
 	.write		= dlmfs_file_write,
 };
 
+#ifdef IOP_IS_CONST
 static const struct inode_operations dlmfs_dir_inode_operations = {
+#else
+static struct inode_operations dlmfs_dir_inode_operations = {
+#endif
 	.create		= dlmfs_create,
 	.lookup		= simple_lookup,
 	.unlink		= dlmfs_unlink,
 };
 
 /* this way we can restrict mkdir to only the toplevel of the fs. */
+#ifdef IOP_IS_CONST
 static const struct inode_operations dlmfs_root_inode_operations = {
+#else
+static struct inode_operations dlmfs_root_inode_operations = {
+#endif
 	.lookup		= simple_lookup,
 	.mkdir		= dlmfs_mkdir,
 	.rmdir		= simple_rmdir,
@@ -572,7 +586,11 @@ static struct super_operations dlmfs_ops = {
 	.drop_inode	= generic_delete_inode,
 };
 
+#ifdef IOP_IS_CONST
 static const struct inode_operations dlmfs_file_inode_operations = {
+#else
+static struct inode_operations dlmfs_file_inode_operations = {
+#endif
 	.getattr	= simple_getattr,
 };
 
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index dd074af..e74730d 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2469,7 +2469,11 @@ bail:
 	return ret;
 }
 
+#ifdef IOP_IS_CONST
 const struct inode_operations ocfs2_file_iops = {
+#else
+struct inode_operations ocfs2_file_iops = {
+#endif
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
@@ -2478,7 +2482,11 @@ const struct inode_operations ocfs2_file_iops = {
 #endif
 };
 
+#ifdef IOP_IS_CONST
 const struct inode_operations ocfs2_special_file_iops = {
+#else
+struct inode_operations ocfs2_special_file_iops = {
+#endif
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index 066f14a..7bf6f9d 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -28,8 +28,13 @@
 
 extern const struct file_operations ocfs2_fops;
 extern const struct file_operations ocfs2_dops;
+#ifdef IOP_IS_CONST
 extern const struct inode_operations ocfs2_file_iops;
 extern const struct inode_operations ocfs2_special_file_iops;
+#else
+extern struct inode_operations ocfs2_file_iops;
+extern struct inode_operations ocfs2_special_file_iops;
+#endif
 struct ocfs2_alloc_context;
 
 enum ocfs2_alloc_restarted {
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 7292590..5ddcc23 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1898,7 +1898,11 @@ leave:
 	return status;
 }
 
+#ifdef IOP_IS_CONST
 const struct inode_operations ocfs2_dir_iops = {
+#else
+struct inode_operations ocfs2_dir_iops = {
+#endif
 	.create		= ocfs2_create,
 	.lookup		= ocfs2_lookup,
 	.link		= ocfs2_link,
diff --git a/fs/ocfs2/namei.h b/fs/ocfs2/namei.h
index 688aef6..66e1dee 100644
--- a/fs/ocfs2/namei.h
+++ b/fs/ocfs2/namei.h
@@ -26,7 +26,11 @@
 #ifndef OCFS2_NAMEI_H
 #define OCFS2_NAMEI_H
 
+#ifdef IOP_IS_CONST
 extern const struct inode_operations ocfs2_dir_iops;
+#else
+extern struct inode_operations ocfs2_dir_iops;
+#endif
 
 struct dentry *ocfs2_get_parent(struct dentry *child);
 
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 7134007..d77c1d4 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -163,12 +163,20 @@ bail:
 	return ERR_PTR(status);
 }
 
+#ifdef IOP_IS_CONST
 const struct inode_operations ocfs2_symlink_inode_operations = {
+#else
+struct inode_operations ocfs2_symlink_inode_operations = {
+#endif
 	.readlink	= page_readlink,
 	.follow_link	= ocfs2_follow_link,
 	.getattr	= ocfs2_getattr,
 };
+#ifdef IOP_IS_CONST
 const struct inode_operations ocfs2_fast_symlink_inode_operations = {
+#else
+struct inode_operations ocfs2_fast_symlink_inode_operations = {
+#endif
 	.readlink	= ocfs2_readlink,
 	.follow_link	= ocfs2_follow_link,
 	.getattr	= ocfs2_getattr,
diff --git a/fs/ocfs2/symlink.h b/fs/ocfs2/symlink.h
index 65a6c9c..fd0ed70 100644
--- a/fs/ocfs2/symlink.h
+++ b/fs/ocfs2/symlink.h
@@ -26,8 +26,13 @@
 #ifndef OCFS2_SYMLINK_H
 #define OCFS2_SYMLINK_H
 
+#ifdef IOP_IS_CONST
 extern const struct inode_operations ocfs2_symlink_inode_operations;
 extern const struct inode_operations ocfs2_fast_symlink_inode_operations;
+#else
+extern struct inode_operations ocfs2_symlink_inode_operations;
+extern struct inode_operations ocfs2_fast_symlink_inode_operations;
+#endif
 
 /*
  * Test whether an inode is a fast symlink.
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] ocfs2 1.4: A new beginning
@ 2007-12-20 15:30 Sunil Mushran
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
                   ` (27 more replies)
  0 siblings, 28 replies; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

These patches allow ocfs2 pulled from mainline commit
e7b34019606ab1dd06196635e931b0c302799228 to build on 2.6.18.
I am not emailing the first set of patches that essentially copy
the source from the mainline and copy the build infrastructure files
from ocfs2-1.2.

The rationale behind this series of patches is not only to allow
it to build with el5 (2.6.18) but to do so with minimal code changes.
The latter will help us later when we have to backport new patches
from mainline.

Please review the patches concentrating on the tricks played to
allow one to build the same tree against both 2.6.18 and mainline.

Sunil

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (17 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:57   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
                   ` (8 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 0e03036c97b70b2602f7dedaa3a223ed7563c2c9 in mainline registers
ocfs2 sysctl (FS_OCFS2) number under CTL_FS. This patch allows one to
build ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                     |    3 ++-
 configure.in                 |    5 +++++
 kapi-compat/include/sysctl.h |    9 +++++++++
 3 files changed, 16 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/sysctl.h

diff --git a/Makefile b/Makefile
index 5c22979..6377ff9 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/inc_nlink.h \
 	kapi-compat/include/drop_nlink.h \
 	kapi-compat/include/slab.h \
-	kapi-compat/include/fstype.h
+	kapi-compat/include/fstype.h \
+	kapi-compat/include/sysctl.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index f1ca3e3..fdb188c 100644
--- a/configure.in
+++ b/configure.in
@@ -209,6 +209,11 @@ OCFS2_CHECK_KERNEL([flag FS_RENAME_DOES_D_MOVE in fs.h], fs.h,
   , fstype_compat_header="fstype.h", [FS_RENAME_DOES_D_MOVE])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fstype_compat_header"
 
+sysctl_compat_header=""
+OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h,
+  , sysctl_compat_header="sysctl.h", [FS_OCFS2])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/sysctl.h b/kapi-compat/include/sysctl.h
new file mode 100644
index 0000000..73ed0a7
--- /dev/null
+++ b/kapi-compat/include/sysctl.h
@@ -0,0 +1,9 @@
+#ifndef KAPI_SYSCTL_H
+#define KAPI_SYSCTL_H
+
+/* CTL_FS names: */
+enum {
+	FS_OCFS2=988,   /* ocfs2 */
+};
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (16 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:57   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
                   ` (9 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 631d1febab8e546e3bb800bdfe2c212b8adf87de in mainline introduces
two new calls in configfs, configfs_depend_item() and configfs_undepend_item().
This patch allows one to build ocfs2 with kernels having/not having
this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                       |    3 ++-
 configure.in                   |    5 +++++
 kapi-compat/include/configfs.h |    7 +++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/configfs.h

diff --git a/Makefile b/Makefile
index 6377ff9..71cd3c7 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/drop_nlink.h \
 	kapi-compat/include/slab.h \
 	kapi-compat/include/fstype.h \
-	kapi-compat/include/sysctl.h
+	kapi-compat/include/sysctl.h \
+	kapi-compat/include/configfs.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index fdb188c..513585f 100644
--- a/configure.in
+++ b/configure.in
@@ -214,6 +214,11 @@ OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h,
   , sysctl_compat_header="sysctl.h", [FS_OCFS2])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header"
 
+configfs_compat_header=""
+OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
+  , configfs_compat_header="configfs.h", [configfs_depend_item()])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/configfs.h b/kapi-compat/include/configfs.h
new file mode 100644
index 0000000..ff68e58
--- /dev/null
+++ b/kapi-compat/include/configfs.h
@@ -0,0 +1,7 @@
+#ifndef KAPI_CONFIGFS_H
+#define KAPI_CONFIGFS_H
+
+#define configfs_depend_item(a, b)	0
+#define configfs_undepend_item(a, b)
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (18 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:37   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
                   ` (7 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 86313c488a6848b7ec2ba04e74f25f79dd32a0b7 in mainline introduced
enum umh_wait. This patch allows one to build ocfs2 with kernels having/
not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                   |    3 ++-
 configure.in               |    5 +++++
 kapi-compat/include/kmod.h |   10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/kmod.h

diff --git a/Makefile b/Makefile
index b00a6c4..088d0e1 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/workqueue.h \
 	kapi-compat/include/compiler.h \
 	kapi-compat/include/highmem.h \
-	kapi-compat/include/fpath.h
+	kapi-compat/include/fpath.h \
+	kapi-compat/include/kmod.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 907c90f..94937cd 100644
--- a/configure.in
+++ b/configure.in
@@ -183,6 +183,11 @@ OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
 AC_SUBST(HAS_F_PATH_DEFINED)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
 
+kmod_compat_header=""
+OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h,
+  , kmod_compat_header="kmod.h", [umh_wait])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/kmod.h b/kapi-compat/include/kmod.h
new file mode 100644
index 0000000..42a082b
--- /dev/null
+++ b/kapi-compat/include/kmod.h
@@ -0,0 +1,10 @@
+#ifndef KAPI_KMOD_H
+#define KAPI_KMOD_H
+
+enum umh_wait {
+	UMH_NO_WAIT = -1,	/* don't wait at all */
+	UMH_WAIT_EXEC = 0,	/* wait for the exec, but not the process */
+	UMH_WAIT_PROC = 1,	/* wait for the process to complete */
+};
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (19 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21  0:54   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
                   ` (6 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c in mainline makes
changes to workqueue.h. This patch allows one to build ocfs2 with
kernels having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in                  |    2 +
 Makefile                        |    3 +-
 configure.in                    |    6 ++++
 fs/Makefile                     |   64 +++++++++++++++++++++++++++++++++++++++
 fs/ocfs2/Makefile               |    4 ++
 fs/ocfs2/alloc.c                |    8 ++--
 fs/ocfs2/cluster/Makefile       |    4 ++
 fs/ocfs2/cluster/heartbeat.c    |    6 ++--
 fs/ocfs2/cluster/quorum.c       |    4 +-
 fs/ocfs2/cluster/tcp.c          |   56 +++++++++++++++++-----------------
 fs/ocfs2/dlm/Makefile           |    4 ++
 fs/ocfs2/dlm/dlmcommon.h        |    2 +-
 fs/ocfs2/dlm/dlmdomain.c        |    2 +-
 fs/ocfs2/dlm/dlmrecovery.c      |    2 +-
 fs/ocfs2/dlm/userdlm.c          |    8 ++--
 fs/ocfs2/journal.c              |    4 +-
 fs/ocfs2/journal.h              |    2 +-
 fs/ocfs2/super.c                |    2 +-
 kapi-compat/include/workqueue.h |   17 ++++++++++
 19 files changed, 151 insertions(+), 49 deletions(-)
 create mode 100644 fs/Makefile
 create mode 100644 kapi-compat/include/workqueue.h

diff --git a/Config.make.in b/Config.make.in
index c9e0132..befeb79 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@
 
 EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
 
+DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
+
 OCFS_DEBUG = @OCFS_DEBUG@
 
 ifneq ($(OCFS_DEBUG),)
diff --git a/Makefile b/Makefile
index 227ab23..4752593 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,8 @@ SUBDIRS = fs vendor
 
 LINUX_INCLUDE_FILES =
 
-KAPI_COMPAT_FILES =
+KAPI_COMPAT_FILES = \
+	kapi-compat/include/workqueue.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 1af47fc..72567b5 100644
--- a/configure.in
+++ b/configure.in
@@ -156,6 +156,12 @@ case "$kversion" in
     ;;
 esac
 
+DELAYED_WORK_DEFINED=
+OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h,
+  DELAYED_WORK_DEFINED=yes, , [^struct delayed_work])
+AC_SUBST(DELAYED_WORK_DEFINED)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/Makefile b/fs/Makefile
new file mode 100644
index 0000000..d7f3aec
--- /dev/null
+++ b/fs/Makefile
@@ -0,0 +1,64 @@
+
+ifeq ($(KERNELRELEASE),)
+TOPDIR = ..
+
+include $(TOPDIR)/Preamble.make
+else
+# We are included by kbuild.
+
+OUR_TOPDIR	:= $(M)/..
+
+include $(OUR_TOPDIR)/Config.make
+
+endif
+
+#
+# As 2.6 kbuild is unhappy seeing SUBDIRS, this is a safe one to
+# set globally.  Do not include trailing slashes.
+#
+SAFE_SUBDIRS :=
+
+SAFE_SUBDIRS += ocfs2
+
+ifneq ($(KERNELRELEASE),)
+#
+# Called under kbuild 2.6
+#
+
+obj-m	+= $(addsuffix /,$(SAFE_SUBDIRS))
+INSTALL_MOD_DIR := fs/ocfs2
+
+else
+#
+# Called from a regular "make". Just forward to kbuild.
+#
+
+ALL_RULES = build-modules
+
+CLEAN_RULES = clean-modules
+
+INSTALL_RULES = install-modules
+
+# Traverse subdirs via Makebo for "make dist"
+ifeq ($(MAKECMDGOALS),dist-all)
+SUBDIRS = $(SAFE_SUBDIRS)
+endif
+
+build-modules:
+	$(MAKE) -C ocfs2 stamp-md5
+	$(MAKE) -C ocfs2/cluster stamp-md5
+	$(MAKE) -C ocfs2/dlm stamp-md5
+	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules
+
+install-modules:
+	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install
+
+clean-modules:
+	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) clean
+	-rm ocfs2/stamp-md5
+	-rm ocfs2/cluster/stamp-md5
+	-rm ocfs2/dlm/stamp-md5
+
+include $(TOPDIR)/Postamble.make
+
+endif
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index dce2a62..0edfed7 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -25,6 +25,10 @@ EXTRA_CFLAGS += -DOCFS2_CDSL
 
 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
 
+ifdef DELAYED_WORK_DEFINED
+EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 4ba7f0b..5a8a4f2 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -4752,11 +4752,11 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb)
 	return status;
 }
 
-static void ocfs2_truncate_log_worker(struct work_struct *work)
+static void ocfs2_truncate_log_worker(kapi_work_struct_t *work)
 {
 	int status;
 	struct ocfs2_super *osb =
-		container_of(work, struct ocfs2_super,
+		kapi_container_of(work, struct ocfs2_super,
 			     osb_truncate_log_wq.work);
 
 	mlog_entry_void();
@@ -4989,8 +4989,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
 	/* ocfs2_truncate_log_shutdown keys on the existence of
 	 * osb->osb_tl_inode so we don't set any of the osb variables
 	 * until we're sure all is well. */
-	INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
-			  ocfs2_truncate_log_worker);
+	KAPI_INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
+			  ocfs2_truncate_log_worker, osb);
 	osb->osb_tl_bh    = tl_bh;
 	osb->osb_tl_inode = tl_inode;
 
diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
index c9c2e9b..a4251f5 100644
--- a/fs/ocfs2/cluster/Makefile
+++ b/fs/ocfs2/cluster/Makefile
@@ -13,6 +13,10 @@ endif
 
 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
 
+ifdef DELAYED_WORK_DEFINED
+EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
+endif
+
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index f14b541..e610665 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -156,10 +156,10 @@ struct o2hb_bio_wait_ctxt {
 	int               wc_error;
 };
 
-static void o2hb_write_timeout(struct work_struct *work)
+static void o2hb_write_timeout(kapi_work_struct_t *work)
 {
 	struct o2hb_region *reg =
-		container_of(work, struct o2hb_region,
+		kapi_container_of(work, struct o2hb_region,
 			     hr_write_timeout_work.work);
 
 	mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
@@ -1306,7 +1306,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
 		goto out;
 	}
 
-	INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
+	KAPI_INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout, reg);
 
 	/*
 	 * A node is considered live after it has beat LIVE_THRESHOLD
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
index bbacf7d..df9b74a 100644
--- a/fs/ocfs2/cluster/quorum.c
+++ b/fs/ocfs2/cluster/quorum.c
@@ -91,7 +91,7 @@ void o2quo_disk_timeout(void)
 	o2quo_fence_self();
 }
 
-static void o2quo_make_decision(struct work_struct *work)
+static void o2quo_make_decision(kapi_work_struct_t *work)
 {
 	int quorum;
 	int lowest_hb, lowest_reachable = 0, fence = 0;
@@ -309,7 +309,7 @@ void o2quo_init(void)
 	struct o2quo_state *qs = &o2quo_state;
 
 	spin_lock_init(&qs->qs_lock);
-	INIT_WORK(&qs->qs_work, o2quo_make_decision);
+	KAPI_INIT_WORK(&qs->qs_work, o2quo_make_decision, NULL);
 }
 
 void o2quo_exit(void)
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 685c180..c4a0c73 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -140,11 +140,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] =
 		 [O2NET_ERR_DIED]	= -EHOSTDOWN,};
 
 /* can't quite avoid *all* internal declarations :/ */
-static void o2net_sc_connect_completed(struct work_struct *work);
-static void o2net_rx_until_empty(struct work_struct *work);
-static void o2net_shutdown_sc(struct work_struct *work);
+static void o2net_sc_connect_completed(kapi_work_struct_t *work);
+static void o2net_rx_until_empty(kapi_work_struct_t *work);
+static void o2net_shutdown_sc(kapi_work_struct_t *work);
 static void o2net_listen_data_ready(struct sock *sk, int bytes);
-static void o2net_sc_send_keep_req(struct work_struct *work);
+static void o2net_sc_send_keep_req(kapi_work_struct_t *work);
 static void o2net_idle_timer(unsigned long data);
 static void o2net_sc_postpone_idle(struct o2net_sock_container *sc);
 static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc);
@@ -330,10 +330,10 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node)
 	o2nm_node_get(node);
 	sc->sc_node = node;
 
-	INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed);
-	INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty);
-	INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc);
-	INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req);
+	KAPI_INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc);
+	KAPI_INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc);
+	KAPI_INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc);
+	KAPI_INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, sc);
 
 	init_timer(&sc->sc_idle_timeout);
 	sc->sc_idle_timeout.function = o2net_idle_timer;
@@ -600,10 +600,10 @@ static void o2net_ensure_shutdown(struct o2net_node *nn,
  * ourselves as state_change couldn't get the nn_lock and call set_nn_state
  * itself.
  */
-static void o2net_shutdown_sc(struct work_struct *work)
+static void o2net_shutdown_sc(kapi_work_struct_t *work)
 {
 	struct o2net_sock_container *sc =
-		container_of(work, struct o2net_sock_container,
+		kapi_container_of(work, struct o2net_sock_container,
 			     sc_shutdown_work);
 	struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
 
@@ -1306,10 +1306,10 @@ out:
 /* this work func is triggerd by data ready.  it reads until it can read no
  * more.  it interprets 0, eof, as fatal.  if data_ready hits while we're doing
  * our work the work struct will be marked and we'll be called again. */
-static void o2net_rx_until_empty(struct work_struct *work)
+static void o2net_rx_until_empty(kapi_work_struct_t *work)
 {
 	struct o2net_sock_container *sc =
-		container_of(work, struct o2net_sock_container, sc_rx_work);
+		kapi_container_of(work, struct o2net_sock_container, sc_rx_work);
 	int ret;
 
 	do {
@@ -1367,10 +1367,10 @@ static void o2net_initialize_handshake(void)
 
 /* called when a connect completes and after a sock is accepted.  the
  * rx path will see the response and mark the sc valid */
-static void o2net_sc_connect_completed(struct work_struct *work)
+static void o2net_sc_connect_completed(kapi_work_struct_t *work)
 {
 	struct o2net_sock_container *sc =
-		container_of(work, struct o2net_sock_container,
+		kapi_container_of(work, struct o2net_sock_container,
 			     sc_connect_work);
 
 	mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n",
@@ -1383,10 +1383,10 @@ static void o2net_sc_connect_completed(struct work_struct *work)
 }
 
 /* this is called as a work_struct func. */
-static void o2net_sc_send_keep_req(struct work_struct *work)
+static void o2net_sc_send_keep_req(kapi_work_struct_t *work)
 {
 	struct o2net_sock_container *sc =
-		container_of(work, struct o2net_sock_container,
+		kapi_container_of(work, struct o2net_sock_container,
 			     sc_keepalive_work.work);
 
 	o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req));
@@ -1446,10 +1446,10 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc)
  * having a connect attempt fail, etc. This centralizes the logic which decides
  * if a connect attempt should be made or if we should give up and all future
  * transmit attempts should fail */
-static void o2net_start_connect(struct work_struct *work)
+static void o2net_start_connect(kapi_work_struct_t *work)
 {
 	struct o2net_node *nn =
-		container_of(work, struct o2net_node, nn_connect_work.work);
+		kapi_container_of(work, struct o2net_node, nn_connect_work.work);
 	struct o2net_sock_container *sc = NULL;
 	struct o2nm_node *node = NULL, *mynode = NULL;
 	struct socket *sock = NULL;
@@ -1553,10 +1553,10 @@ out:
 	return;
 }
 
-static void o2net_connect_expired(struct work_struct *work)
+static void o2net_connect_expired(kapi_work_struct_t *work)
 {
 	struct o2net_node *nn =
-		container_of(work, struct o2net_node, nn_connect_expired.work);
+		kapi_container_of(work, struct o2net_node, nn_connect_expired.work);
 
 	spin_lock(&nn->nn_lock);
 	if (!nn->nn_sc_valid) {
@@ -1572,10 +1572,10 @@ static void o2net_connect_expired(struct work_struct *work)
 	spin_unlock(&nn->nn_lock);
 }
 
-static void o2net_still_up(struct work_struct *work)
+static void o2net_still_up(kapi_work_struct_t *work)
 {
 	struct o2net_node *nn =
-		container_of(work, struct o2net_node, nn_still_up.work);
+		kapi_container_of(work, struct o2net_node, nn_still_up.work);
 
 	o2quo_hb_still_up(o2net_num_from_nn(nn));
 }
@@ -1775,7 +1775,7 @@ out:
 	return ret;
 }
 
-static void o2net_accept_many(struct work_struct *work)
+static void o2net_accept_many(kapi_work_struct_t *work)
 {
 	struct socket *sock = o2net_listen_sock;
 	while (o2net_accept_one(sock) == 0)
@@ -1831,7 +1831,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
 	write_unlock_bh(&sock->sk->sk_callback_lock);
 
 	o2net_listen_sock = sock;
-	INIT_WORK(&o2net_listen_work, o2net_accept_many);
+	KAPI_INIT_WORK(&o2net_listen_work, o2net_accept_many, sock);
 
 	sock->sk->sk_reuse = 1;
 	ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
@@ -1951,10 +1951,10 @@ int o2net_init(void)
 		struct o2net_node *nn = o2net_nn_from_num(i);
 
 		spin_lock_init(&nn->nn_lock);
-		INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect);
-		INIT_DELAYED_WORK(&nn->nn_connect_expired,
-				  o2net_connect_expired);
-		INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up);
+		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect, nn);
+		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_expired,
+				  o2net_connect_expired, nn);
+		KAPI_INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up, nn);
 		/* until we see hb from a node we'll return einval */
 		nn->nn_persistent_error = -ENOTCONN;
 		init_waitqueue_head(&nn->nn_sc_wq);
diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
index 7e1031e..b4fb8e3 100644
--- a/fs/ocfs2/dlm/Makefile
+++ b/fs/ocfs2/dlm/Makefile
@@ -16,6 +16,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2
 
 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
 
+ifdef DELAYED_WORK_DEFINED
+EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
+endif
+
 DLM_SOURCES =			\
 	dlmast.c		\
 	dlmconvert.c		\
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index e90b92f..cddf85a 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -153,7 +153,7 @@ static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned
  * called functions that cannot be directly called from the
  * net message handlers for some reason, usually because
  * they need to send net messages of their own. */
-void dlm_dispatch_work(struct work_struct *work);
+void dlm_dispatch_work(kapi_work_struct_t *work);
 
 struct dlm_lock_resource;
 struct dlm_work_item;
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 6954565..10b3e60 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -1435,7 +1435,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
 
 	spin_lock_init(&dlm->work_lock);
 	INIT_LIST_HEAD(&dlm->work_list);
-	INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work);
+	KAPI_INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work, dlm);
 
 	kref_init(&dlm->dlm_refs);
 	dlm->dlm_state = DLM_CTXT_NEW;
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index a2c3316..3cf4f49 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -153,7 +153,7 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm)
 }
 
 /* Worker function used during recovery. */
-void dlm_dispatch_work(struct work_struct *work)
+void dlm_dispatch_work(kapi_work_struct_t *work)
 {
 	struct dlm_ctxt *dlm =
 		container_of(work, struct dlm_ctxt, dispatched_work);
diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c
index 7d2f578..2f6deb1 100644
--- a/fs/ocfs2/dlm/userdlm.c
+++ b/fs/ocfs2/dlm/userdlm.c
@@ -171,14 +171,14 @@ static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres)
 		BUG();
 }
 
-static void user_dlm_unblock_lock(struct work_struct *work);
+static void user_dlm_unblock_lock(kapi_work_struct_t *work);
 
 static void __user_dlm_queue_lockres(struct user_lock_res *lockres)
 {
 	if (!(lockres->l_flags & USER_LOCK_QUEUED)) {
 		user_dlm_grab_inode_ref(lockres);
 
-		INIT_WORK(&lockres->l_work, user_dlm_unblock_lock);
+		KAPI_INIT_WORK(&lockres->l_work, user_dlm_unblock_lock, lockres);
 
 		queue_work(user_dlm_worker, &lockres->l_work);
 		lockres->l_flags |= USER_LOCK_QUEUED;
@@ -278,11 +278,11 @@ static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres)
 	iput(inode);
 }
 
-static void user_dlm_unblock_lock(struct work_struct *work)
+static void user_dlm_unblock_lock(kapi_work_struct_t *work)
 {
 	int new_level, status;
 	struct user_lock_res *lockres =
-		container_of(work, struct user_lock_res, l_work);
+		kapi_container_of(work, struct user_lock_res, l_work);
 	struct dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres);
 
 	mlog(0, "processing lockres %.*s\n", lockres->l_namelen,
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index f9d01e2..b94208f 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -715,11 +715,11 @@ struct ocfs2_la_recovery_item {
  * NOTE: This function can and will sleep on recovery of other nodes
  * during cluster locking, just like any other ocfs2 process.
  */
-void ocfs2_complete_recovery(struct work_struct *work)
+void ocfs2_complete_recovery(kapi_work_struct_t *work)
 {
 	int ret;
 	struct ocfs2_journal *journal =
-		container_of(work, struct ocfs2_journal, j_recovery_work);
+		kapi_container_of(work, struct ocfs2_journal, j_recovery_work);
 	struct ocfs2_super *osb = journal->j_osb;
 	struct ocfs2_dinode *la_dinode, *tl_dinode;
 	struct ocfs2_la_recovery_item *item, *n;
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 4b32e09..548d6af 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -133,7 +133,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb,
 }
 
 /* Exported only for the journal struct init code in super.c. Do not call. */
-void ocfs2_complete_recovery(struct work_struct *work);
+void ocfs2_complete_recovery(kapi_work_struct_t *work);
 
 /*
  *  Journal Control:
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 0e2a1b4..a8f90a2 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1465,7 +1465,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	spin_lock_init(&journal->j_lock);
 	journal->j_trans_id = (unsigned long) 1;
 	INIT_LIST_HEAD(&journal->j_la_cleanups);
-	INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
+	KAPI_INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, journal);
 	journal->j_state = OCFS2_JOURNAL_FREE;
 
 	/* get some pseudo constants for clustersize bits */
diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h
new file mode 100644
index 0000000..26dfbdf
--- /dev/null
+++ b/kapi-compat/include/workqueue.h
@@ -0,0 +1,17 @@
+#ifndef KAPI_WORKQUEUE_H
+#define KAPI_WORKQUEUE_H
+
+#ifndef DELAYED_WORK_DEFINED
+# define delayed_work				work_struct
+typedef void kapi_work_struct_t;
+# define kapi_container_of(a, b, c)		(a)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b, c)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_WORK(a, b, c)
+#else
+typedef struct work_struct kapi_work_struct_t;
+# define kapi_container_of(a, b, c)		container_of(a, b, c)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (21 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:39   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
                   ` (4 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 9a53c3a783c2fa9b969628e65695c11c3e51e673 in mainline added
helper drop_nlink(). This patch allows one to build ocfs2 with kernels
having/not having that change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                         |    3 ++-
 configure.in                     |    5 +++++
 kapi-compat/include/drop_nlink.h |   22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/drop_nlink.h

diff --git a/Makefile b/Makefile
index 1595b90..2a97e00 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/highmem.h \
 	kapi-compat/include/fpath.h \
 	kapi-compat/include/kmod.h \
-	kapi-compat/include/inc_nlink.h
+	kapi-compat/include/inc_nlink.h \
+	kapi-compat/include/drop_nlink.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 554a0a4..81041fb 100644
--- a/configure.in
+++ b/configure.in
@@ -193,6 +193,11 @@ OCFS2_CHECK_KERNEL([inc_nlink() in fs.h], fs.h,
   , inc_nlink_compat_header="inc_nlink.h", [^static inline void inc_nlink(])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inc_nlink_compat_header"
 
+drop_nlink_compat_header=""
+OCFS2_CHECK_KERNEL([drop_nlink() in fs.h], fs.h,
+  , drop_nlink_compat_header="drop_nlink.h", [^static inline void drop_nlink(])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $drop_nlink_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/drop_nlink.h b/kapi-compat/include/drop_nlink.h
new file mode 100644
index 0000000..d54973b
--- /dev/null
+++ b/kapi-compat/include/drop_nlink.h
@@ -0,0 +1,22 @@
+#ifndef KAPI_DROP_NLINK_H
+#define KAPI_DROP_NLINK_H
+
+#include <linux/fs.h>
+
+/*
+ * drop_nlink - directly drop an inode's link count
+ * @inode: inode
+ *
+ * This is a low-level filesystem helper to replace any
+ * direct filesystem manipulation of i_nlink.  In cases
+ * where we are attempting to track writes to the
+ * filesystem, a decrement to zero means an imminent
+ * write when the file is truncated and actually unlinked
+ * on the filesystem.
+ */
+static inline void drop_nlink(struct inode *inode)
+{
+	inode->i_nlink--;
+}
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (20 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-24 13:23   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
                   ` (5 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit ee9b6d61a2a43c5952eb43283f8db284a4e70b8a in mainline marks
struct super_operations as a const in struct super_block. This patch
allows one to build with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in        |    1 +
 configure.in          |    5 +++++
 fs/ocfs2/Makefile     |    4 ++++
 fs/ocfs2/dlm/Makefile |    4 ++++
 fs/ocfs2/dlm/dlmfs.c  |    8 ++++++++
 fs/ocfs2/super.c      |    4 ++++
 6 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index 96dbb7a..938ac53 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -69,6 +69,7 @@ FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
 SPLICE_HEADER = @SPLICE_HEADER@
 GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
 FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
+SOP_IS_CONST = @SOP_IS_CONST@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index b8b8001..3093542 100644
--- a/configure.in
+++ b/configure.in
@@ -272,6 +272,11 @@ OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
   FAULT_IN_VMOPS=yes, , [^.*int (\*fault)])
 AC_SUBST(FAULT_IN_VMOPS)
 
+SOP_IS_CONST=
+OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h,
+  SOP_IS_CONST=yes, , [^.*const struct super_operations.*\*s_op;])
+AC_SUBST(SOP_IS_CONST)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 521888b..4ce2431 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -65,6 +65,10 @@ ifdef FAULT_IN_VMOPS
 EXTRA_CFLAGS += -DFAULT_IN_VMOPS
 endif
 
+ifdef SOPS_IS_CONST
+EXTRA_CFLAGS += -DSOPS_IS_CONST
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
index 5101f9c..2df255e 100644
--- a/fs/ocfs2/dlm/Makefile
+++ b/fs/ocfs2/dlm/Makefile
@@ -28,6 +28,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
 EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
 endif
 
+ifdef SOP_IS_CONST
+EXTRA_CFLAGS += -DSOP_IS_CONST
+endif
+
 DLM_SOURCES =			\
 	dlmast.c		\
 	dlmconvert.c		\
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index dc43923..dc5b5a5 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -60,7 +60,11 @@
 #define MLOG_MASK_PREFIX ML_DLMFS
 #include "cluster/masklog.h"
 
+#ifdef SOP_IS_CONST
 static const struct super_operations dlmfs_ops;
+#else
+static struct super_operations dlmfs_ops;
+#endif
 static const struct file_operations dlmfs_file_operations;
 static const struct inode_operations dlmfs_dir_inode_operations;
 static const struct inode_operations dlmfs_root_inode_operations;
@@ -556,7 +560,11 @@ static const struct inode_operations dlmfs_root_inode_operations = {
 	.rmdir		= simple_rmdir,
 };
 
+#ifdef SOP_IS_CONST
 static const struct super_operations dlmfs_ops = {
+#else
+static struct super_operations dlmfs_ops = {
+#endif
 	.statfs		= simple_statfs,
 	.alloc_inode	= dlmfs_alloc_inode,
 	.destroy_inode	= dlmfs_destroy_inode,
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index f5c424d..176ae35 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -124,7 +124,11 @@ static void ocfs2_write_super(struct super_block *sb);
 static struct inode *ocfs2_alloc_inode(struct super_block *sb);
 static void ocfs2_destroy_inode(struct inode *inode);
 
+#ifdef SOP_IS_CONST
 static const struct super_operations ocfs2_sops = {
+#else
+static struct super_operations ocfs2_sops = {
+#endif
 	.statfs		= ocfs2_statfs,
 	.alloc_inode	= ocfs2_alloc_inode,
 	.destroy_inode	= ocfs2_destroy_inode,
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (23 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 15:14   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
                   ` (2 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 47ae32d6a54955a041cdc30b06d0bb16e75f68d5 in mainline introduced
macro MNT_RELATIME to limit atime updates to frequency specified in the
mount option. This patch allows one to build ocfs2 with kernels having/not
having this change.

It should be noted that the functionality will not be available on kernels
not having the macro as the vfs support will be missing.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                    |    3 ++-
 configure.in                |    5 +++++
 kapi-compat/include/mount.h |    6 ++++++
 3 files changed, 13 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/mount.h

diff --git a/Makefile b/Makefile
index eafeb2f..3b2acf2 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/register_sysctl.h \
 	kapi-compat/include/su_mutex.h \
 	kapi-compat/include/kobject.h \
-	kapi-compat/include/cap.h
+	kapi-compat/include/cap.h \
+	kapi-compat/include/mount.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 931cf2c..39fb02b 100644
--- a/configure.in
+++ b/configure.in
@@ -252,6 +252,11 @@ OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h,
   SPLICE_HEADER=yes, , [^struct splice_desc ])
 AC_SUBST(SPLICE_HEADER)
 
+relatime_compat_header=""
+OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h,
+  , relatime_compat_header="mount.h", [^#define MNT_RELATIME])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/mount.h b/kapi-compat/include/mount.h
new file mode 100644
index 0000000..f515b64
--- /dev/null
+++ b/kapi-compat/include/mount.h
@@ -0,0 +1,6 @@
+#ifndef KAPI_MOUNT_H
+#define KAPI_MOUNT_H
+
+#define MNT_RELATIME    0x20
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (22 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 15:12   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
                   ` (3 subsequent siblings)
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 97ac73506c0ba93f30239bb57b4cfc5d73e68a62 in mainline introduces a
new iop, fallocate(). This patch allows one to build ocfs2 with kernels
having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |    6 ++++++
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index a27e274..3818cd5 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -65,6 +65,7 @@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
 SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
 STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
+FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index f8b5f20..74337ee 100644
--- a/configure.in
+++ b/configure.in
@@ -242,6 +242,11 @@ OCFS2_CHECK_KERNEL([is_owner_or_cap() in fs.h], fs.h,
   , cap_compat_header="cap.h", [^#define is_owner_or_cap])
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cap_compat_header"
 
+FALLOCATE_DEFINED=
+OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h,
+  FALLOCATE_DEFINED=yes, , [^.*long (\*fallocate)])
+AC_SUBST(FALLOCATE_DEFINED)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 5c290b7..6f21960 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -45,6 +45,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
 EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
 endif
 
+ifdef FALLOCATE_DEFINED
+EXTRA_CFLAGS += -DFALLOCATE_DEFINED
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index adb10b9..ce18447 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -34,7 +34,9 @@
 #include <linux/splice.h>
 #include <linux/mount.h>
 #include <linux/writeback.h>
+#ifdef FALLOCATE_DEFINED
 #include <linux/falloc.h>
+#endif
 
 #define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
@@ -1749,6 +1751,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd,
 	return __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0);
 }
 
+#ifdef FALLOCATE_DEFINED
 static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
 			    loff_t len)
 {
@@ -1772,6 +1775,7 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
 	return __ocfs2_change_file_space(NULL, inode, offset,
 					 OCFS2_IOC_RESVSP64, &sr, change_size);
 }
+#endif
 
 static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
 					 loff_t *ppos,
@@ -2397,7 +2401,9 @@ const struct inode_operations ocfs2_file_iops = {
 	.setattr	= ocfs2_setattr,
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
+#ifdef FALLOCATE_DEFINED
 	.fallocate	= ocfs2_fallocate,
+#endif
 };
 
 const struct inode_operations ocfs2_special_file_iops = {
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (24 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 12:00   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit e6bd07aee739566803425acdbf5cdb29919164e1 in mainline changed a
semaphore into a mutex in struct configfs_subsystem. This patch allows
building ocfs2 with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in                 |    1 +
 Makefile                       |    3 ++-
 configure.in                   |    6 ++++++
 fs/ocfs2/cluster/Makefile      |    4 ++++
 fs/ocfs2/cluster/nodemanager.c |    2 +-
 kapi-compat/include/su_mutex.h |   13 +++++++++++++
 6 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 kapi-compat/include/su_mutex.h

diff --git a/Config.make.in b/Config.make.in
index eb8671d..b7bd06b 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -63,6 +63,7 @@ HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
 HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
 KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
 REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
+SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/Makefile b/Makefile
index a9bfccb..9848c47 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/fstype.h \
 	kapi-compat/include/sysctl.h \
 	kapi-compat/include/configfs.h \
-	kapi-compat/include/register_sysctl.h
+	kapi-compat/include/register_sysctl.h \
+	kapi-compat/include/su_mutex.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index 04db94f..3d3c5da 100644
--- a/configure.in
+++ b/configure.in
@@ -225,6 +225,12 @@ OCFS2_CHECK_KERNEL([register_sysctl() with two args in sysctl.h], sysctl.h,
 AC_SUBST(REGISTER_SYSCTL_TWO_ARGS)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS register_sysctl.h"
 
+SU_MUTEX_DEFINED=
+OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], configfs.h,
+  SU_MUTEX_DEFINED=yes, , [su_mutex])
+AC_SUBST(SU_MUTEX_DEFINED)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS su_mutex.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
index 6c2f11b..1e69fef 100644
--- a/fs/ocfs2/cluster/Makefile
+++ b/fs/ocfs2/cluster/Makefile
@@ -21,6 +21,10 @@ ifdef REGISTER_SYSCTL_TWO_ARGS
 EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS
 endif
 
+ifdef SU_MUTEX_DEFINED
+EXTRA_CFLAGS += -DSU_MUTEX_DEFINED
+endif
+
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index 9fff881..ca142d0 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -974,7 +974,7 @@ static int __init init_o2nm(void)
 		goto out_sysctl;
 
 	config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
-	mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
+	kapi_mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
 	ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys);
 	if (ret) {
 		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
diff --git a/kapi-compat/include/su_mutex.h b/kapi-compat/include/su_mutex.h
new file mode 100644
index 0000000..1e633ed
--- /dev/null
+++ b/kapi-compat/include/su_mutex.h
@@ -0,0 +1,13 @@
+#ifndef KAPI_SUMUTEX_H
+#define KAPI_SUMUTEX_H
+
+#ifdef SU_MUTEX_DEFINED
+# define kapi_mutex_init	mutex_init
+# define su_mutex		su_mutex
+#else
+# include "asm/semaphore.h"
+# define kapi_mutex_init	init_MUTEX
+# define su_mutex		su_sem
+#endif
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (25 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-24 13:28   ` Joel Becker
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 027445c37282bc1ed26add45e573ad2d3e4860a5 in mainline vectorized
fileops aio_read() and aio_write(). This patch allows one to build ocfs2
with kernels having/not having this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/file.c   |   33 +++++++++++++++++++++++++++++----
 4 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/Config.make.in b/Config.make.in
index d4cd518..f99b9f4 100644
--- a/Config.make.in
+++ b/Config.make.in
@@ -71,6 +71,7 @@ GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
 FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
 SOP_IS_CONST = @SOP_IS_CONST@
 IOP_IS_CONST = @IOP_IS_CONST@
+VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
diff --git a/configure.in b/configure.in
index 8a23983..741dfdb 100644
--- a/configure.in
+++ b/configure.in
@@ -282,6 +282,11 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
   IOP_IS_CONST=yes, , [^.*const struct inode_operations.*\*i_op;])
 AC_SUBST(IOP_IS_CONST)
 
+VECTORED_FILE_AIO=
+OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
+  VECTORED_FILE_AIO=yes, , [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
+AC_SUBST(VECTORED_FILE_AIO)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 97912fd..80fd6c6 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -73,6 +73,10 @@ ifdef IOP_IS_CONST
 EXTRA_CFLAGS += -DIOP_IS_CONST
 endif
 
+ifdef VECTORED_FILE_AIO
+EXTRA_CFLAGS += -DVECTORED_FILE_AIO
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index e74730d..1ee2a79 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2087,10 +2087,19 @@ out:
 	return total ? total : ret;
 }
 
+#ifdef VECTORED_FILE_AIO
+#define iocb_ki_left	iocb->ki_left
 static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 				    const struct iovec *iov,
 				    unsigned long nr_segs,
 				    loff_t pos)
+#else
+#define iocb_ki_left	buflen
+static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
+				    const char __user *buf,
+				    size_t buflen,
+				    loff_t pos)
+#endif
 {
 	int ret, direct_io, appending, rw_level, have_alloc_sem  = 0;
 	int can_do_direct, sync = 0;
@@ -2100,13 +2109,19 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 	loff_t *ppos = &iocb->ki_pos;
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_path_dentry->d_inode;
+#ifndef VECTORED_FILE_AIO
+	struct iovec iov_local = { .iov_base = (void __user *)buf,
+				   .iov_len  = buflen };
+	const struct iovec *iov = &iov_local;
+	unsigned long nr_segs = 1;
+#endif
 
 	mlog_entry("(0x%p, %u, '%.*s')\n", file,
 		   (unsigned int)nr_segs,
 		   file->f_path_dentry->d_name.len,
 		   file->f_path_dentry->d_name.name);
 
-	if (iocb->ki_left == 0)
+	if (iocb_ki_left == 0)
 		return 0;
 
 	ret = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
@@ -2139,7 +2154,7 @@ relock:
 
 	can_do_direct = direct_io;
 	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
-					    iocb->ki_left, appending,
+					    iocb_ki_left, appending,
 					    &can_do_direct);
 	if (ret < 0) {
 		mlog_errno(ret);
@@ -2392,17 +2407,23 @@ bail:
 	return ret;
 }
 
+#ifdef VECTORED_FILE_AIO
 static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 				   const struct iovec *iov,
 				   unsigned long nr_segs,
 				   loff_t pos)
+#else
+static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
+				   char __user *buf,
+				   size_t buflen,
+				   loff_t pos)
+#endif
 {
 	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
 	struct file *filp = iocb->ki_filp;
 	struct inode *inode = filp->f_path_dentry->d_inode;
 
-	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
-		   (unsigned int)nr_segs,
+	mlog_entry("(0x%p, '%.*s')\n", filp,
 		   filp->f_path_dentry->d_name.len,
 		   filp->f_path_dentry->d_name.name);
 
@@ -2446,7 +2467,11 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 	}
 	ocfs2_meta_unlock(inode, lock_level);
 
+#ifdef VECTORED_FILE_AIO
 	ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
+#else
+	ret = generic_file_aio_read(iocb, buf, buflen, iocb->ki_pos);
+#endif
 	if (ret == -EINVAL)
 		mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
 
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE
  2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
                   ` (26 preceding siblings ...)
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
@ 2007-12-20 15:30 ` Sunil Mushran
  2007-12-21 11:55   ` Joel Becker
  27 siblings, 1 reply; 60+ messages in thread
From: Sunil Mushran @ 2007-12-20 15:30 UTC (permalink / raw)
  To: ocfs2-devel

Commit 349457ccf2592c14bdf13b6706170ae2e94931b1 in mainline defines macro
FS_RENAME_DOES_D_MOVE to allow fs to call d_move() during rename().
This patch allows one to build ocfs2 with kernels having/not having
this change.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
---
 Makefile                     |    3 ++-
 configure.in                 |    5 +++++
 kapi-compat/include/fstype.h |    6 ++++++
 3 files changed, 13 insertions(+), 1 deletions(-)
 create mode 100644 kapi-compat/include/fstype.h

diff --git a/Makefile b/Makefile
index ae5947b..5c22979 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,8 @@ KAPI_COMPAT_FILES = \
 	kapi-compat/include/kmod.h \
 	kapi-compat/include/inc_nlink.h \
 	kapi-compat/include/drop_nlink.h \
-	kapi-compat/include/slab.h
+	kapi-compat/include/slab.h \
+	kapi-compat/include/fstype.h
 
 PATCH_FILES =
 
diff --git a/configure.in b/configure.in
index cb91de1..f1ca3e3 100644
--- a/configure.in
+++ b/configure.in
@@ -204,6 +204,11 @@ OCFS2_CHECK_KERNEL([kmem_cache_create() with dtor arg in slab.h], slab.h,
 AC_SUBST(KMEM_CACHE_CREATE_DTOR)
 KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS slab.h"
 
+fstype_compat_header=""
+OCFS2_CHECK_KERNEL([flag FS_RENAME_DOES_D_MOVE in fs.h], fs.h,
+  , fstype_compat_header="fstype.h", [FS_RENAME_DOES_D_MOVE])
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fstype_compat_header"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
diff --git a/kapi-compat/include/fstype.h b/kapi-compat/include/fstype.h
new file mode 100644
index 0000000..895ea86
--- /dev/null
+++ b/kapi-compat/include/fstype.h
@@ -0,0 +1,6 @@
+#ifndef KAPI_FSTYPE_H
+#define KAPI_FSTYPE_H
+
+#define FS_RENAME_DOES_D_MOVE	FS_ODD_RENAME
+
+#endif
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
@ 2007-12-21  0:54   ` Joel Becker
  2007-12-21 11:51     ` Joel Becker
  0 siblings, 1 reply; 60+ messages in thread
From: Joel Becker @ 2007-12-21  0:54 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:20PM -0800, Sunil Mushran wrote:
> Commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c in mainline makes
> changes to workqueue.h. This patch allows one to build ocfs2 with
> kernels having/not having that change.
> 

Here the check is reversed.  Without running configure, the tree expects
an old kernel (it will behave as if delayed_work does not exist).

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in                  |    2 +
>  Makefile                        |    3 +-
>  configure.in                    |    6 ++++
>  fs/Makefile                     |   64 +++++++++++++++++++++++++++++++++++++++
>  fs/ocfs2/Makefile               |    4 ++
>  fs/ocfs2/alloc.c                |    8 ++--
>  fs/ocfs2/cluster/Makefile       |    4 ++
>  fs/ocfs2/cluster/heartbeat.c    |    6 ++--
>  fs/ocfs2/cluster/quorum.c       |    4 +-
>  fs/ocfs2/cluster/tcp.c          |   56 +++++++++++++++++-----------------
>  fs/ocfs2/dlm/Makefile           |    4 ++
>  fs/ocfs2/dlm/dlmcommon.h        |    2 +-
>  fs/ocfs2/dlm/dlmdomain.c        |    2 +-
>  fs/ocfs2/dlm/dlmrecovery.c      |    2 +-
>  fs/ocfs2/dlm/userdlm.c          |    8 ++--
>  fs/ocfs2/journal.c              |    4 +-
>  fs/ocfs2/journal.h              |    2 +-
>  fs/ocfs2/super.c                |    2 +-
>  kapi-compat/include/workqueue.h |   17 ++++++++++
>  19 files changed, 151 insertions(+), 49 deletions(-)
>  create mode 100644 fs/Makefile
>  create mode 100644 kapi-compat/include/workqueue.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index c9e0132..befeb79 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@
>  
>  EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>  
> +DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
> +
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
>  ifneq ($(OCFS_DEBUG),)
> diff --git a/Makefile b/Makefile
> index 227ab23..4752593 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -8,7 +8,8 @@ SUBDIRS = fs vendor
>  
>  LINUX_INCLUDE_FILES =
>  
> -KAPI_COMPAT_FILES =
> +KAPI_COMPAT_FILES = \
> +	kapi-compat/include/workqueue.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 1af47fc..72567b5 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -156,6 +156,12 @@ case "$kversion" in
>      ;;
>  esac
>  
> +DELAYED_WORK_DEFINED=
> +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h,
> +  DELAYED_WORK_DEFINED=yes, , [^struct delayed_work])
> +AC_SUBST(DELAYED_WORK_DEFINED)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/Makefile b/fs/Makefile
> new file mode 100644
> index 0000000..d7f3aec
> --- /dev/null
> +++ b/fs/Makefile
> @@ -0,0 +1,64 @@
> +
> +ifeq ($(KERNELRELEASE),)
> +TOPDIR = ..
> +
> +include $(TOPDIR)/Preamble.make
> +else
> +# We are included by kbuild.
> +
> +OUR_TOPDIR	:= $(M)/..
> +
> +include $(OUR_TOPDIR)/Config.make
> +
> +endif
> +
> +#
> +# As 2.6 kbuild is unhappy seeing SUBDIRS, this is a safe one to
> +# set globally.  Do not include trailing slashes.
> +#
> +SAFE_SUBDIRS :=
> +
> +SAFE_SUBDIRS += ocfs2
> +
> +ifneq ($(KERNELRELEASE),)
> +#
> +# Called under kbuild 2.6
> +#
> +
> +obj-m	+= $(addsuffix /,$(SAFE_SUBDIRS))
> +INSTALL_MOD_DIR := fs/ocfs2
> +
> +else
> +#
> +# Called from a regular "make". Just forward to kbuild.
> +#
> +
> +ALL_RULES = build-modules
> +
> +CLEAN_RULES = clean-modules
> +
> +INSTALL_RULES = install-modules
> +
> +# Traverse subdirs via Makebo for "make dist"
> +ifeq ($(MAKECMDGOALS),dist-all)
> +SUBDIRS = $(SAFE_SUBDIRS)
> +endif
> +
> +build-modules:
> +	$(MAKE) -C ocfs2 stamp-md5
> +	$(MAKE) -C ocfs2/cluster stamp-md5
> +	$(MAKE) -C ocfs2/dlm stamp-md5
> +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules
> +
> +install-modules:
> +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install
> +
> +clean-modules:
> +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) clean
> +	-rm ocfs2/stamp-md5
> +	-rm ocfs2/cluster/stamp-md5
> +	-rm ocfs2/dlm/stamp-md5
> +
> +include $(TOPDIR)/Postamble.make
> +
> +endif
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index dce2a62..0edfed7 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -25,6 +25,10 @@ EXTRA_CFLAGS += -DOCFS2_CDSL
>  
>  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
>  
> +ifdef DELAYED_WORK_DEFINED
> +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 4ba7f0b..5a8a4f2 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -4752,11 +4752,11 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb)
>  	return status;
>  }
>  
> -static void ocfs2_truncate_log_worker(struct work_struct *work)
> +static void ocfs2_truncate_log_worker(kapi_work_struct_t *work)
>  {
>  	int status;
>  	struct ocfs2_super *osb =
> -		container_of(work, struct ocfs2_super,
> +		kapi_container_of(work, struct ocfs2_super,
>  			     osb_truncate_log_wq.work);
>  
>  	mlog_entry_void();
> @@ -4989,8 +4989,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
>  	/* ocfs2_truncate_log_shutdown keys on the existence of
>  	 * osb->osb_tl_inode so we don't set any of the osb variables
>  	 * until we're sure all is well. */
> -	INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
> -			  ocfs2_truncate_log_worker);
> +	KAPI_INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
> +			  ocfs2_truncate_log_worker, osb);
>  	osb->osb_tl_bh    = tl_bh;
>  	osb->osb_tl_inode = tl_inode;
>  
> diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
> index c9c2e9b..a4251f5 100644
> --- a/fs/ocfs2/cluster/Makefile
> +++ b/fs/ocfs2/cluster/Makefile
> @@ -13,6 +13,10 @@ endif
>  
>  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
>  
> +ifdef DELAYED_WORK_DEFINED
> +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> +endif
> +
>  SOURCES =			\
>  	heartbeat.c		\
>  	masklog.c		\
> diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> index f14b541..e610665 100644
> --- a/fs/ocfs2/cluster/heartbeat.c
> +++ b/fs/ocfs2/cluster/heartbeat.c
> @@ -156,10 +156,10 @@ struct o2hb_bio_wait_ctxt {
>  	int               wc_error;
>  };
>  
> -static void o2hb_write_timeout(struct work_struct *work)
> +static void o2hb_write_timeout(kapi_work_struct_t *work)
>  {
>  	struct o2hb_region *reg =
> -		container_of(work, struct o2hb_region,
> +		kapi_container_of(work, struct o2hb_region,
>  			     hr_write_timeout_work.work);
>  
>  	mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
> @@ -1306,7 +1306,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
>  		goto out;
>  	}
>  
> -	INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
> +	KAPI_INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout, reg);
>  
>  	/*
>  	 * A node is considered live after it has beat LIVE_THRESHOLD
> diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
> index bbacf7d..df9b74a 100644
> --- a/fs/ocfs2/cluster/quorum.c
> +++ b/fs/ocfs2/cluster/quorum.c
> @@ -91,7 +91,7 @@ void o2quo_disk_timeout(void)
>  	o2quo_fence_self();
>  }
>  
> -static void o2quo_make_decision(struct work_struct *work)
> +static void o2quo_make_decision(kapi_work_struct_t *work)
>  {
>  	int quorum;
>  	int lowest_hb, lowest_reachable = 0, fence = 0;
> @@ -309,7 +309,7 @@ void o2quo_init(void)
>  	struct o2quo_state *qs = &o2quo_state;
>  
>  	spin_lock_init(&qs->qs_lock);
> -	INIT_WORK(&qs->qs_work, o2quo_make_decision);
> +	KAPI_INIT_WORK(&qs->qs_work, o2quo_make_decision, NULL);
>  }
>  
>  void o2quo_exit(void)
> diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
> index 685c180..c4a0c73 100644
> --- a/fs/ocfs2/cluster/tcp.c
> +++ b/fs/ocfs2/cluster/tcp.c
> @@ -140,11 +140,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] =
>  		 [O2NET_ERR_DIED]	= -EHOSTDOWN,};
>  
>  /* can't quite avoid *all* internal declarations :/ */
> -static void o2net_sc_connect_completed(struct work_struct *work);
> -static void o2net_rx_until_empty(struct work_struct *work);
> -static void o2net_shutdown_sc(struct work_struct *work);
> +static void o2net_sc_connect_completed(kapi_work_struct_t *work);
> +static void o2net_rx_until_empty(kapi_work_struct_t *work);
> +static void o2net_shutdown_sc(kapi_work_struct_t *work);
>  static void o2net_listen_data_ready(struct sock *sk, int bytes);
> -static void o2net_sc_send_keep_req(struct work_struct *work);
> +static void o2net_sc_send_keep_req(kapi_work_struct_t *work);
>  static void o2net_idle_timer(unsigned long data);
>  static void o2net_sc_postpone_idle(struct o2net_sock_container *sc);
>  static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc);
> @@ -330,10 +330,10 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node)
>  	o2nm_node_get(node);
>  	sc->sc_node = node;
>  
> -	INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed);
> -	INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty);
> -	INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc);
> -	INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req);
> +	KAPI_INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc);
> +	KAPI_INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc);
> +	KAPI_INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc);
> +	KAPI_INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, sc);
>  
>  	init_timer(&sc->sc_idle_timeout);
>  	sc->sc_idle_timeout.function = o2net_idle_timer;
> @@ -600,10 +600,10 @@ static void o2net_ensure_shutdown(struct o2net_node *nn,
>   * ourselves as state_change couldn't get the nn_lock and call set_nn_state
>   * itself.
>   */
> -static void o2net_shutdown_sc(struct work_struct *work)
> +static void o2net_shutdown_sc(kapi_work_struct_t *work)
>  {
>  	struct o2net_sock_container *sc =
> -		container_of(work, struct o2net_sock_container,
> +		kapi_container_of(work, struct o2net_sock_container,
>  			     sc_shutdown_work);
>  	struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
>  
> @@ -1306,10 +1306,10 @@ out:
>  /* this work func is triggerd by data ready.  it reads until it can read no
>   * more.  it interprets 0, eof, as fatal.  if data_ready hits while we're doing
>   * our work the work struct will be marked and we'll be called again. */
> -static void o2net_rx_until_empty(struct work_struct *work)
> +static void o2net_rx_until_empty(kapi_work_struct_t *work)
>  {
>  	struct o2net_sock_container *sc =
> -		container_of(work, struct o2net_sock_container, sc_rx_work);
> +		kapi_container_of(work, struct o2net_sock_container, sc_rx_work);
>  	int ret;
>  
>  	do {
> @@ -1367,10 +1367,10 @@ static void o2net_initialize_handshake(void)
>  
>  /* called when a connect completes and after a sock is accepted.  the
>   * rx path will see the response and mark the sc valid */
> -static void o2net_sc_connect_completed(struct work_struct *work)
> +static void o2net_sc_connect_completed(kapi_work_struct_t *work)
>  {
>  	struct o2net_sock_container *sc =
> -		container_of(work, struct o2net_sock_container,
> +		kapi_container_of(work, struct o2net_sock_container,
>  			     sc_connect_work);
>  
>  	mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n",
> @@ -1383,10 +1383,10 @@ static void o2net_sc_connect_completed(struct work_struct *work)
>  }
>  
>  /* this is called as a work_struct func. */
> -static void o2net_sc_send_keep_req(struct work_struct *work)
> +static void o2net_sc_send_keep_req(kapi_work_struct_t *work)
>  {
>  	struct o2net_sock_container *sc =
> -		container_of(work, struct o2net_sock_container,
> +		kapi_container_of(work, struct o2net_sock_container,
>  			     sc_keepalive_work.work);
>  
>  	o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req));
> @@ -1446,10 +1446,10 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc)
>   * having a connect attempt fail, etc. This centralizes the logic which decides
>   * if a connect attempt should be made or if we should give up and all future
>   * transmit attempts should fail */
> -static void o2net_start_connect(struct work_struct *work)
> +static void o2net_start_connect(kapi_work_struct_t *work)
>  {
>  	struct o2net_node *nn =
> -		container_of(work, struct o2net_node, nn_connect_work.work);
> +		kapi_container_of(work, struct o2net_node, nn_connect_work.work);
>  	struct o2net_sock_container *sc = NULL;
>  	struct o2nm_node *node = NULL, *mynode = NULL;
>  	struct socket *sock = NULL;
> @@ -1553,10 +1553,10 @@ out:
>  	return;
>  }
>  
> -static void o2net_connect_expired(struct work_struct *work)
> +static void o2net_connect_expired(kapi_work_struct_t *work)
>  {
>  	struct o2net_node *nn =
> -		container_of(work, struct o2net_node, nn_connect_expired.work);
> +		kapi_container_of(work, struct o2net_node, nn_connect_expired.work);
>  
>  	spin_lock(&nn->nn_lock);
>  	if (!nn->nn_sc_valid) {
> @@ -1572,10 +1572,10 @@ static void o2net_connect_expired(struct work_struct *work)
>  	spin_unlock(&nn->nn_lock);
>  }
>  
> -static void o2net_still_up(struct work_struct *work)
> +static void o2net_still_up(kapi_work_struct_t *work)
>  {
>  	struct o2net_node *nn =
> -		container_of(work, struct o2net_node, nn_still_up.work);
> +		kapi_container_of(work, struct o2net_node, nn_still_up.work);
>  
>  	o2quo_hb_still_up(o2net_num_from_nn(nn));
>  }
> @@ -1775,7 +1775,7 @@ out:
>  	return ret;
>  }
>  
> -static void o2net_accept_many(struct work_struct *work)
> +static void o2net_accept_many(kapi_work_struct_t *work)
>  {
>  	struct socket *sock = o2net_listen_sock;
>  	while (o2net_accept_one(sock) == 0)
> @@ -1831,7 +1831,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
>  	write_unlock_bh(&sock->sk->sk_callback_lock);
>  
>  	o2net_listen_sock = sock;
> -	INIT_WORK(&o2net_listen_work, o2net_accept_many);
> +	KAPI_INIT_WORK(&o2net_listen_work, o2net_accept_many, sock);
>  
>  	sock->sk->sk_reuse = 1;
>  	ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
> @@ -1951,10 +1951,10 @@ int o2net_init(void)
>  		struct o2net_node *nn = o2net_nn_from_num(i);
>  
>  		spin_lock_init(&nn->nn_lock);
> -		INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect);
> -		INIT_DELAYED_WORK(&nn->nn_connect_expired,
> -				  o2net_connect_expired);
> -		INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up);
> +		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect, nn);
> +		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_expired,
> +				  o2net_connect_expired, nn);
> +		KAPI_INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up, nn);
>  		/* until we see hb from a node we'll return einval */
>  		nn->nn_persistent_error = -ENOTCONN;
>  		init_waitqueue_head(&nn->nn_sc_wq);
> diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> index 7e1031e..b4fb8e3 100644
> --- a/fs/ocfs2/dlm/Makefile
> +++ b/fs/ocfs2/dlm/Makefile
> @@ -16,6 +16,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2
>  
>  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
>  
> +ifdef DELAYED_WORK_DEFINED
> +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> +endif
> +
>  DLM_SOURCES =			\
>  	dlmast.c		\
>  	dlmconvert.c		\
> diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> index e90b92f..cddf85a 100644
> --- a/fs/ocfs2/dlm/dlmcommon.h
> +++ b/fs/ocfs2/dlm/dlmcommon.h
> @@ -153,7 +153,7 @@ static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned
>   * called functions that cannot be directly called from the
>   * net message handlers for some reason, usually because
>   * they need to send net messages of their own. */
> -void dlm_dispatch_work(struct work_struct *work);
> +void dlm_dispatch_work(kapi_work_struct_t *work);
>  
>  struct dlm_lock_resource;
>  struct dlm_work_item;
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 6954565..10b3e60 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -1435,7 +1435,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
>  
>  	spin_lock_init(&dlm->work_lock);
>  	INIT_LIST_HEAD(&dlm->work_list);
> -	INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work);
> +	KAPI_INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work, dlm);
>  
>  	kref_init(&dlm->dlm_refs);
>  	dlm->dlm_state = DLM_CTXT_NEW;
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index a2c3316..3cf4f49 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -153,7 +153,7 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm)
>  }
>  
>  /* Worker function used during recovery. */
> -void dlm_dispatch_work(struct work_struct *work)
> +void dlm_dispatch_work(kapi_work_struct_t *work)
>  {
>  	struct dlm_ctxt *dlm =
>  		container_of(work, struct dlm_ctxt, dispatched_work);
> diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c
> index 7d2f578..2f6deb1 100644
> --- a/fs/ocfs2/dlm/userdlm.c
> +++ b/fs/ocfs2/dlm/userdlm.c
> @@ -171,14 +171,14 @@ static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres)
>  		BUG();
>  }
>  
> -static void user_dlm_unblock_lock(struct work_struct *work);
> +static void user_dlm_unblock_lock(kapi_work_struct_t *work);
>  
>  static void __user_dlm_queue_lockres(struct user_lock_res *lockres)
>  {
>  	if (!(lockres->l_flags & USER_LOCK_QUEUED)) {
>  		user_dlm_grab_inode_ref(lockres);
>  
> -		INIT_WORK(&lockres->l_work, user_dlm_unblock_lock);
> +		KAPI_INIT_WORK(&lockres->l_work, user_dlm_unblock_lock, lockres);
>  
>  		queue_work(user_dlm_worker, &lockres->l_work);
>  		lockres->l_flags |= USER_LOCK_QUEUED;
> @@ -278,11 +278,11 @@ static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres)
>  	iput(inode);
>  }
>  
> -static void user_dlm_unblock_lock(struct work_struct *work)
> +static void user_dlm_unblock_lock(kapi_work_struct_t *work)
>  {
>  	int new_level, status;
>  	struct user_lock_res *lockres =
> -		container_of(work, struct user_lock_res, l_work);
> +		kapi_container_of(work, struct user_lock_res, l_work);
>  	struct dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres);
>  
>  	mlog(0, "processing lockres %.*s\n", lockres->l_namelen,
> diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> index f9d01e2..b94208f 100644
> --- a/fs/ocfs2/journal.c
> +++ b/fs/ocfs2/journal.c
> @@ -715,11 +715,11 @@ struct ocfs2_la_recovery_item {
>   * NOTE: This function can and will sleep on recovery of other nodes
>   * during cluster locking, just like any other ocfs2 process.
>   */
> -void ocfs2_complete_recovery(struct work_struct *work)
> +void ocfs2_complete_recovery(kapi_work_struct_t *work)
>  {
>  	int ret;
>  	struct ocfs2_journal *journal =
> -		container_of(work, struct ocfs2_journal, j_recovery_work);
> +		kapi_container_of(work, struct ocfs2_journal, j_recovery_work);
>  	struct ocfs2_super *osb = journal->j_osb;
>  	struct ocfs2_dinode *la_dinode, *tl_dinode;
>  	struct ocfs2_la_recovery_item *item, *n;
> diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
> index 4b32e09..548d6af 100644
> --- a/fs/ocfs2/journal.h
> +++ b/fs/ocfs2/journal.h
> @@ -133,7 +133,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb,
>  }
>  
>  /* Exported only for the journal struct init code in super.c. Do not call. */
> -void ocfs2_complete_recovery(struct work_struct *work);
> +void ocfs2_complete_recovery(kapi_work_struct_t *work);
>  
>  /*
>   *  Journal Control:
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index 0e2a1b4..a8f90a2 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -1465,7 +1465,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
>  	spin_lock_init(&journal->j_lock);
>  	journal->j_trans_id = (unsigned long) 1;
>  	INIT_LIST_HEAD(&journal->j_la_cleanups);
> -	INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
> +	KAPI_INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, journal);
>  	journal->j_state = OCFS2_JOURNAL_FREE;
>  
>  	/* get some pseudo constants for clustersize bits */
> diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h
> new file mode 100644
> index 0000000..26dfbdf
> --- /dev/null
> +++ b/kapi-compat/include/workqueue.h
> @@ -0,0 +1,17 @@
> +#ifndef KAPI_WORKQUEUE_H
> +#define KAPI_WORKQUEUE_H
> +
> +#ifndef DELAYED_WORK_DEFINED
> +# define delayed_work				work_struct
> +typedef void kapi_work_struct_t;
> +# define kapi_container_of(a, b, c)		(a)
> +# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b, c)
> +# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_WORK(a, b, c)
> +#else
> +typedef struct work_struct kapi_work_struct_t;
> +# define kapi_container_of(a, b, c)		container_of(a, b, c)
> +# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
> +# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Only a life lived for others is a life worth while."
							-Albert Einstein  

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
@ 2007-12-21  0:54   ` Joel Becker
  2007-12-21  9:39     ` Sunil Mushran
  0 siblings, 1 reply; 60+ messages in thread
From: Joel Becker @ 2007-12-21  0:54 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:23PM -0800, Sunil Mushran wrote:
> Commit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 introduced export symbol
> do_sync_mapping_range(). This patch allows one to build ocfs2 with kernels
> having/not having that change.

	Rather than putting this in alloc.c, I'd put it in
kapi-include/sync_mapping_range.h, wrapped in the
!HAVE_SYNC_MAPPING_RANGE check:

    #ifndef KAPI_SYNC_MAPPING_RANGE_H
    #define KAPI_SYNC_MAPPING_RANGE_H

    #ifndef HAVE_SYNC_MAPPING_RANGE
    int do_writepages...
    {
    }
    int sync_mapping..
    {
    }
    #endif
    #endif

then, in fs/ocfs2/Makefile, I'd do:

ifdef HAS_SYNC_MAPPING_RANGE
CPPFLAGS_alloc.o += -DHAS_SYNC_MAPPING_RANGE
endif

This applys the define to alloc.c only.  Thus, while all files would get
-include kapi-compat/sync_mapping_range.h, every file except alloc.c
would see it as empty.
	The other thing I would do would be to reverse the check.  Right
now, you set HAS_SYNC_MAPPING_RANGE for new kernels.  If I ran "make -C
/usr/src/linux M=`pwd`/fs/ocfs2" without running configure, it would
fail against a recent kernel.

Joel

> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    2 +
>  configure.in      |    5 +++
>  fs/ocfs2/Makefile |    4 ++
>  fs/ocfs2/alloc.c  |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 104 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index befeb79..1fe7ddc 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>  
>  DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  
> +HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
> +
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
>  ifneq ($(OCFS_DEBUG),)
> diff --git a/configure.in b/configure.in
> index 47b0da0..603dc94 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -172,6 +172,11 @@ OCFS2_CHECK_KERNEL([zero_user_page() in highmem.h], highmem.h,
>    , highmem_compat_header="highmem.h", [zero_user_page])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $highmem_compat_header"
>  
> +HAS_SYNC_MAPPING_RANGE=
> +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
> +  HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
> +AC_SUBST(HAS_SYNC_MAPPING_RANGE)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 0edfed7..3dc33a5 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -29,6 +29,10 @@ ifdef DELAYED_WORK_DEFINED
>  EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
>  endif
>  
> +ifdef HAS_SYNC_MAPPING_RANGE
> +EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 5a8a4f2..0cc4729 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -29,6 +29,11 @@
>  #include <linux/highmem.h>
>  #include <linux/swap.h>
>  
> +#ifndef HAS_SYNC_MAPPING_RANGE
> +#include <linux/writeback.h>
> +#include <linux/mpage.h>
> +#endif
> +
>  #define MLOG_MASK_PREFIX ML_DISK_ALLOC
>  #include <cluster/masklog.h>
>  
> @@ -5750,6 +5755,94 @@ out:
>  	return ret;
>  }
>  
> +#ifndef HAS_SYNC_MAPPING_RANGE
> +int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
> +{
> +	int ret;
> +
> +	if (wbc->nr_to_write <= 0)
> +		return 0;
> +	wbc->for_writepages = 1;
> +	if (mapping->a_ops->writepages)
> +		ret = mapping->a_ops->writepages(mapping, wbc);
> +	else
> +		ret = generic_writepages(mapping, wbc);
> +	wbc->for_writepages = 0;
> +	return ret;
> +}
> +
> +/**
> + * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range
> + * @mapping:	address space structure to write
> + * @start:	offset in bytes where the range starts
> + * @end:	offset in bytes where the range ends (inclusive)
> + * @sync_mode:	enable synchronous operation
> + *
> + * Start writeback against all of a mapping's dirty pages that lie
> + * within the byte offsets <start, end> inclusive.
> + *
> + * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
> + * opposed to a regular memory cleansing writeback.  The difference between
> + * these two operations is that if a dirty page/buffer is encountered, it must
> + * be waited upon, and not just skipped over.
> + */
> +int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
> +				loff_t end, int sync_mode)
> +{
> +	int ret;
> +	struct writeback_control wbc = {
> +		.sync_mode = sync_mode,
> +		.nr_to_write = mapping->nrpages * 2,
> +		.range_start = start,
> +		.range_end = end,
> +	};
> +
> +	if (!mapping_cap_writeback_dirty(mapping))
> +		return 0;
> +
> +	ret = do_writepages(mapping, &wbc);
> +	return ret;
> +}
> +
> +/*
> + * `endbyte' is inclusive
> + */
> +static int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
> +				 loff_t endbyte, unsigned int flags)
> +{
> +	int ret;
> +
> +	if (!mapping) {
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	ret = 0;
> +	if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
> +		ret = wait_on_page_writeback_range(mapping,
> +					offset >> PAGE_CACHE_SHIFT,
> +					endbyte >> PAGE_CACHE_SHIFT);
> +		if (ret < 0)
> +			goto out;
> +	}
> +
> +	if (flags & SYNC_FILE_RANGE_WRITE) {
> +		ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
> +						WB_SYNC_NONE);
> +		if (ret < 0)
> +			goto out;
> +	}
> +
> +	if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
> +		ret = wait_on_page_writeback_range(mapping,
> +					offset >> PAGE_CACHE_SHIFT,
> +					endbyte >> PAGE_CACHE_SHIFT);
> +	}
> +out:
> +	return ret;
> +}
> +#endif
> +
>  /*
>   * Zero the area past i_size but still within an allocated
>   * cluster. This avoids exposing nonzero data on subsequent file
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"And yet I fight,
 And yet I fight this battle all alone.
 No one to cry to;
 No place to call home."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
@ 2007-12-21  0:56   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21  0:56 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:21PM -0800, Sunil Mushran wrote:
> Commit 9490991482a2091a828d997adbc088e24c310a4d in mainline introduced
> macro uninitialized_var(). This patch allows one to build ocfs2 with
> kernels having/not having that change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                       |    3 ++-
>  configure.in                   |    5 +++++
>  kapi-compat/include/compiler.h |   10 ++++++++++
>  3 files changed, 17 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/compiler.h
> 
> diff --git a/Makefile b/Makefile
> index 4752593..21ff590 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -9,7 +9,8 @@ SUBDIRS = fs vendor
>  LINUX_INCLUDE_FILES =
>  
>  KAPI_COMPAT_FILES = \
> -	kapi-compat/include/workqueue.h
> +	kapi-compat/include/workqueue.h \
> +	kapi-compat/include/compiler.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 72567b5..7faf363 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -162,6 +162,11 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h,
>  AC_SUBST(DELAYED_WORK_DEFINED)
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h"
>  
> +compiler_compat_header=""
> +OCFS2_CHECK_KERNEL([uninitialized_var() in compiler-gcc4.h], compiler-gcc4.h,
> +  , compiler_compat_header="compiler.h", [uninitialized_var])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $compiler_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/compiler.h b/kapi-compat/include/compiler.h
> new file mode 100644
> index 0000000..c104ed1
> --- /dev/null
> +++ b/kapi-compat/include/compiler.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_COMPILER_H
> +#define KAPI_COMPILER_H
> +
> +/*
> + * A trick to suppress uninitialized variable warning without generating any
> + * code
> + */
> +#define uninitialized_var(x) x = x
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"The opposite of a correct statement is a false statement. The
 opposite of a profound truth may well be another profound truth."
         - Niels Bohr 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
@ 2007-12-21  0:56   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21  0:56 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:22PM -0800, Sunil Mushran wrote:
> Commit 01f2705daf5a36208e69d7cf95db9c330f843af6 in mainline introduced
> macro zero_user_page(). This patch allows one to build ocfs2 with
> kernels having/not having that change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                      |    3 ++-
>  configure.in                  |    5 +++++
>  kapi-compat/include/highmem.h |   22 ++++++++++++++++++++++
>  3 files changed, 29 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/highmem.h
> 
> diff --git a/Makefile b/Makefile
> index 21ff590..b7b86db 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -10,7 +10,8 @@ LINUX_INCLUDE_FILES =
>  
>  KAPI_COMPAT_FILES = \
>  	kapi-compat/include/workqueue.h \
> -	kapi-compat/include/compiler.h
> +	kapi-compat/include/compiler.h \
> +	kapi-compat/include/highmem.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 7faf363..47b0da0 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -167,6 +167,11 @@ OCFS2_CHECK_KERNEL([uninitialized_var() in compiler-gcc4.h], compiler-gcc4.h,
>    , compiler_compat_header="compiler.h", [uninitialized_var])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $compiler_compat_header"
>  
> +highmem_compat_header=""
> +OCFS2_CHECK_KERNEL([zero_user_page() in highmem.h], highmem.h,
> +  , highmem_compat_header="highmem.h", [zero_user_page])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $highmem_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/highmem.h b/kapi-compat/include/highmem.h
> new file mode 100644
> index 0000000..a8c7e11
> --- /dev/null
> +++ b/kapi-compat/include/highmem.h
> @@ -0,0 +1,22 @@
> +#ifndef KAPI_HIGHMEM_H
> +#define KAPI_HIGHMEM_H
> +
> +/*
> + * Same but also flushes aliased cache contents to RAM.
> + *
> + * This must be a macro because KM_USER0 and friends aren't defined if
> + * !CONFIG_HIGHMEM
> + */
> +#define zero_user_page(page, offset, size, km_type)		\
> +	do {							\
> +		void *kaddr;					\
> +								\
> +		BUG_ON((offset) + (size) > PAGE_SIZE);		\
> +								\
> +		kaddr = kmap_atomic(page, km_type);		\
> +		memset((char *)kaddr + (offset), 0, (size));	\
> +		flush_dcache_page(page);			\
> +		kunmap_atomic(kaddr, (km_type));		\
> +	} while (0)
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Friends may come and go, but enemies accumulate." 
        - Thomas Jones

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
@ 2007-12-21  1:09   ` Joel Becker
  2007-12-21  9:41     ` Sunil Mushran
  0 siblings, 1 reply; 60+ messages in thread
From: Joel Becker @ 2007-12-21  1:09 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:24PM -0800, Sunil Mushran wrote:
> Commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 in mainline added
> struct path in struct file. This patch allows one to build ocfs2 with
> kernels having/not having that change.
> 

Here again the define is reversed.

Thinking about the compat trick you did, I'm wondering if something like
this isn't a better idea:

#ifdef NO_F_PATH
# define filp_dentry(i) (i)->f_dentry
#else
# define filp_dentry(i) (i)->f_path.dentry
#endif
...
-	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
+	struct inode *inode = filp_dentry(iocb->ki_filp)->d_inode;

Thoughs?  I'm not sold on it, just throwing it out there.

Joel

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in              |    1 +
>  Makefile                    |    3 ++-
>  configure.in                |    6 ++++++
>  fs/ocfs2/Makefile           |    4 ++++
>  fs/ocfs2/aops.c             |    4 ++--
>  fs/ocfs2/dir.c              |    2 +-
>  fs/ocfs2/dlm/dlmfs.c        |    4 ++--
>  fs/ocfs2/file.c             |   38 +++++++++++++++++++-------------------
>  fs/ocfs2/ioctl.c            |    2 +-
>  fs/ocfs2/mmap.c             |    2 +-
>  kapi-compat/include/fpath.h |   10 ++++++++++
>  11 files changed, 49 insertions(+), 27 deletions(-)
>  create mode 100644 kapi-compat/include/fpath.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 1fe7ddc..4f42cca 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>  DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  
>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
> +HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index b7b86db..b00a6c4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES =
>  KAPI_COMPAT_FILES = \
>  	kapi-compat/include/workqueue.h \
>  	kapi-compat/include/compiler.h \
> -	kapi-compat/include/highmem.h
> +	kapi-compat/include/highmem.h \
> +	kapi-compat/include/fpath.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 603dc94..907c90f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -177,6 +177,12 @@ OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
>    HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
>  AC_SUBST(HAS_SYNC_MAPPING_RANGE)
>  
> +HAS_F_PATH_DEFINED=
> +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
> +  HAS_F_PATH_DEFINED=yes, , [f_path])
> +AC_SUBST(HAS_F_PATH_DEFINED)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 3dc33a5..b6c8d03 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -33,6 +33,10 @@ ifdef HAS_SYNC_MAPPING_RANGE
>  EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
>  endif
>  
> +ifdef HAS_F_PATH_DEFINED
> +EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index 34d1045..96cb31b 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -584,7 +584,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
>  			     ssize_t bytes,
>  			     void *private)
>  {
> -	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
> +	struct inode *inode = iocb->ki_filp->f_path_dentry->d_inode;
>  	int level;
>  
>  	/* this io's submitter should not have unlocked this before we could */
> @@ -626,7 +626,7 @@ static ssize_t ocfs2_direct_IO(int rw,
>  			       unsigned long nr_segs)
>  {
>  	struct file *file = iocb->ki_filp;
> -	struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
> +	struct inode *inode = file->f_path_dentry->d_inode->i_mapping->host;
>  	int ret;
>  
>  	mlog_entry_void();
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index 7453b70..0764a66 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -840,7 +840,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
>  int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
>  {
>  	int error = 0;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  	int lock_level = 0;
>  
>  	mlog_entry("dirino=%llu\n",
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index 7418dc8..4ce2dea 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -175,7 +175,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
>  	int bytes_left;
>  	ssize_t readlen;
>  	char *lvb_buf;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>  		inode->i_ino, count, *ppos);
> @@ -219,7 +219,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
>  	int bytes_left;
>  	ssize_t writelen;
>  	char *lvb_buf;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>  		inode->i_ino, count, *ppos);
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index a62b14e..adb10b9 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -70,7 +70,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>  
>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
> -		   file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
> +		   file->f_path_dentry->d_name.len, file->f_path_dentry->d_name.name);
>  
>  	spin_lock(&oi->ip_lock);
>  
> @@ -100,8 +100,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>  
>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
> -		       file->f_path.dentry->d_name.len,
> -		       file->f_path.dentry->d_name.name);
> +		       file->f_path_dentry->d_name.len,
> +		       file->f_path_dentry->d_name.name);
>  
>  	spin_lock(&oi->ip_lock);
>  	if (!--oi->ip_open_count)
> @@ -1663,7 +1663,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>  		}
>  	}
>  
> -	if (file && should_remove_suid(file->f_path.dentry)) {
> +	if (file && should_remove_suid(file->f_path_dentry)) {
>  		ret = __ocfs2_write_remove_suid(inode, di_bh);
>  		if (ret) {
>  			mlog_errno(ret);
> @@ -1730,7 +1730,7 @@ out:
>  int ocfs2_change_file_space(struct file *file, unsigned int cmd,
>  			    struct ocfs2_space_resv *sr)
>  {
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);;
>  
>  	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
> @@ -2023,12 +2023,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
>  	size_t count;		/* after file limit checks */
>  	loff_t *ppos = &iocb->ki_pos;
>  	struct file *file = iocb->ki_filp;
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, %u, '%.*s')\n", file,
>  		   (unsigned int)nr_segs,
> -		   file->f_path.dentry->d_name.len,
> -		   file->f_path.dentry->d_name.name);
> +		   file->f_path_dentry->d_name.len,
> +		   file->f_path_dentry->d_name.name);
>  
>  	if (iocb->ki_left == 0)
>  		return 0;
> @@ -2062,7 +2062,7 @@ relock:
>  	}
>  
>  	can_do_direct = direct_io;
> -	ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos,
> +	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
>  					    iocb->ki_left, appending,
>  					    &can_do_direct);
>  	if (ret < 0) {
> @@ -2251,12 +2251,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>  				       unsigned int flags)
>  {
>  	int ret;
> -	struct inode *inode = out->f_path.dentry->d_inode;
> +	struct inode *inode = out->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
>  		   (unsigned int)len,
> -		   out->f_path.dentry->d_name.len,
> -		   out->f_path.dentry->d_name.name);
> +		   out->f_path_dentry->d_name.len,
> +		   out->f_path_dentry->d_name.name);
>  
>  	inode_double_lock(inode, pipe->inode);
>  
> @@ -2266,7 +2266,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>  		goto out;
>  	}
>  
> -	ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, ppos, len, 0,
> +	ret = ocfs2_prepare_inode_for_write(out->f_path_dentry, ppos, len, 0,
>  					    NULL);
>  	if (ret < 0) {
>  		mlog_errno(ret);
> @@ -2292,12 +2292,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
>  				      unsigned int flags)
>  {
>  	int ret = 0;
> -	struct inode *inode = in->f_path.dentry->d_inode;
> +	struct inode *inode = in->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
>  		   (unsigned int)len,
> -		   in->f_path.dentry->d_name.len,
> -		   in->f_path.dentry->d_name.name);
> +		   in->f_path_dentry->d_name.len,
> +		   in->f_path_dentry->d_name.name);
>  
>  	/*
>  	 * See the comment in ocfs2_file_aio_read()
> @@ -2323,12 +2323,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>  {
>  	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
>  	struct file *filp = iocb->ki_filp;
> -	struct inode *inode = filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp->f_path_dentry->d_inode;
>  
>  	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
>  		   (unsigned int)nr_segs,
> -		   filp->f_path.dentry->d_name.len,
> -		   filp->f_path.dentry->d_name.name);
> +		   filp->f_path_dentry->d_name.len,
> +		   filp->f_path_dentry->d_name.name);
>  
>  	if (!inode) {
>  		ret = -EINVAL;
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index 87dcece..929aeac 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -148,7 +148,7 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
>  #ifdef CONFIG_COMPAT
>  long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
>  {
> -	struct inode *inode = file->f_path.dentry->d_inode;
> +	struct inode *inode = file->f_path_dentry->d_inode;
>  	int ret;
>  
>  	switch (cmd) {
> diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
> index 9875615..c0483c9 100644
> --- a/fs/ocfs2/mmap.c
> +++ b/fs/ocfs2/mmap.c
> @@ -152,7 +152,7 @@ out:
>  
>  static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
>  {
> -	struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
> +	struct inode *inode = vma->vm_file->f_path_dentry->d_inode;
>  	struct buffer_head *di_bh = NULL;
>  	sigset_t blocked, oldset;
>  	int ret, ret2;
> diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h
> new file mode 100644
> index 0000000..178d8e3
> --- /dev/null
> +++ b/kapi-compat/include/fpath.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_FPATH_H
> +#define KAPI_FPATH_H
> +
> +#ifdef HAS_F_PATH_DEFINED
> +# define f_path_dentry	f_path.dentry
> +#else
> +# define f_path_dentry	f_dentry
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #3

	"Watch a sunrise at least once a year."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline
  2007-12-21  0:54   ` Joel Becker
@ 2007-12-21  9:39     ` Sunil Mushran
  0 siblings, 0 replies; 60+ messages in thread
From: Sunil Mushran @ 2007-12-21  9:39 UTC (permalink / raw)
  To: ocfs2-devel

Yes, this is better.

Joel Becker wrote:
> On Thu, Dec 20, 2007 at 03:29:23PM -0800, Sunil Mushran wrote:
>   
>> Commit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 introduced export symbol
>> do_sync_mapping_range(). This patch allows one to build ocfs2 with kernels
>> having/not having that change.
>>     
>
> 	Rather than putting this in alloc.c, I'd put it in
> kapi-include/sync_mapping_range.h, wrapped in the
> !HAVE_SYNC_MAPPING_RANGE check:
>
>     #ifndef KAPI_SYNC_MAPPING_RANGE_H
>     #define KAPI_SYNC_MAPPING_RANGE_H
>
>     #ifndef HAVE_SYNC_MAPPING_RANGE
>     int do_writepages...
>     {
>     }
>     int sync_mapping..
>     {
>     }
>     #endif
>     #endif
>
> then, in fs/ocfs2/Makefile, I'd do:
>
> ifdef HAS_SYNC_MAPPING_RANGE
> CPPFLAGS_alloc.o += -DHAS_SYNC_MAPPING_RANGE
> endif
>
> This applys the define to alloc.c only.  Thus, while all files would get
> -include kapi-compat/sync_mapping_range.h, every file except alloc.c
> would see it as empty.
> 	The other thing I would do would be to reverse the check.  Right
> now, you set HAS_SYNC_MAPPING_RANGE for new kernels.  If I ran "make -C
> /usr/src/linux M=`pwd`/fs/ocfs2" without running configure, it would
> fail against a recent kernel.
>
> Joel
>
>   
>> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
>> ---
>>  Config.make.in    |    2 +
>>  configure.in      |    5 +++
>>  fs/ocfs2/Makefile |    4 ++
>>  fs/ocfs2/alloc.c  |   93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 104 insertions(+), 0 deletions(-)
>>
>> diff --git a/Config.make.in b/Config.make.in
>> index befeb79..1fe7ddc 100644
>> --- a/Config.make.in
>> +++ b/Config.make.in
>> @@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>>  
>>  DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>>  
>> +HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>> +
>>  OCFS_DEBUG = @OCFS_DEBUG@
>>  
>>  ifneq ($(OCFS_DEBUG),)
>> diff --git a/configure.in b/configure.in
>> index 47b0da0..603dc94 100644
>> --- a/configure.in
>> +++ b/configure.in
>> @@ -172,6 +172,11 @@ OCFS2_CHECK_KERNEL([zero_user_page() in highmem.h], highmem.h,
>>    , highmem_compat_header="highmem.h", [zero_user_page])
>>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $highmem_compat_header"
>>  
>> +HAS_SYNC_MAPPING_RANGE=
>> +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
>> +  HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
>> +AC_SUBST(HAS_SYNC_MAPPING_RANGE)
>> +
>>  # using -include has two advantages:
>>  #  the source doesn't need to know to include compat headers
>>  #  the compat header file names don't go through the search path
>> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
>> index 0edfed7..3dc33a5 100644
>> --- a/fs/ocfs2/Makefile
>> +++ b/fs/ocfs2/Makefile
>> @@ -29,6 +29,10 @@ ifdef DELAYED_WORK_DEFINED
>>  EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
>>  endif
>>  
>> +ifdef HAS_SYNC_MAPPING_RANGE
>> +EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
>> +endif
>> +
>>  #
>>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>>  # include trailing slashes.
>> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
>> index 5a8a4f2..0cc4729 100644
>> --- a/fs/ocfs2/alloc.c
>> +++ b/fs/ocfs2/alloc.c
>> @@ -29,6 +29,11 @@
>>  #include <linux/highmem.h>
>>  #include <linux/swap.h>
>>  
>> +#ifndef HAS_SYNC_MAPPING_RANGE
>> +#include <linux/writeback.h>
>> +#include <linux/mpage.h>
>> +#endif
>> +
>>  #define MLOG_MASK_PREFIX ML_DISK_ALLOC
>>  #include <cluster/masklog.h>
>>  
>> @@ -5750,6 +5755,94 @@ out:
>>  	return ret;
>>  }
>>  
>> +#ifndef HAS_SYNC_MAPPING_RANGE
>> +int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
>> +{
>> +	int ret;
>> +
>> +	if (wbc->nr_to_write <= 0)
>> +		return 0;
>> +	wbc->for_writepages = 1;
>> +	if (mapping->a_ops->writepages)
>> +		ret = mapping->a_ops->writepages(mapping, wbc);
>> +	else
>> +		ret = generic_writepages(mapping, wbc);
>> +	wbc->for_writepages = 0;
>> +	return ret;
>> +}
>> +
>> +/**
>> + * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range
>> + * @mapping:	address space structure to write
>> + * @start:	offset in bytes where the range starts
>> + * @end:	offset in bytes where the range ends (inclusive)
>> + * @sync_mode:	enable synchronous operation
>> + *
>> + * Start writeback against all of a mapping's dirty pages that lie
>> + * within the byte offsets <start, end> inclusive.
>> + *
>> + * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
>> + * opposed to a regular memory cleansing writeback.  The difference between
>> + * these two operations is that if a dirty page/buffer is encountered, it must
>> + * be waited upon, and not just skipped over.
>> + */
>> +int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
>> +				loff_t end, int sync_mode)
>> +{
>> +	int ret;
>> +	struct writeback_control wbc = {
>> +		.sync_mode = sync_mode,
>> +		.nr_to_write = mapping->nrpages * 2,
>> +		.range_start = start,
>> +		.range_end = end,
>> +	};
>> +
>> +	if (!mapping_cap_writeback_dirty(mapping))
>> +		return 0;
>> +
>> +	ret = do_writepages(mapping, &wbc);
>> +	return ret;
>> +}
>> +
>> +/*
>> + * `endbyte' is inclusive
>> + */
>> +static int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
>> +				 loff_t endbyte, unsigned int flags)
>> +{
>> +	int ret;
>> +
>> +	if (!mapping) {
>> +		ret = -EINVAL;
>> +		goto out;
>> +	}
>> +
>> +	ret = 0;
>> +	if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
>> +		ret = wait_on_page_writeback_range(mapping,
>> +					offset >> PAGE_CACHE_SHIFT,
>> +					endbyte >> PAGE_CACHE_SHIFT);
>> +		if (ret < 0)
>> +			goto out;
>> +	}
>> +
>> +	if (flags & SYNC_FILE_RANGE_WRITE) {
>> +		ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
>> +						WB_SYNC_NONE);
>> +		if (ret < 0)
>> +			goto out;
>> +	}
>> +
>> +	if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
>> +		ret = wait_on_page_writeback_range(mapping,
>> +					offset >> PAGE_CACHE_SHIFT,
>> +					endbyte >> PAGE_CACHE_SHIFT);
>> +	}
>> +out:
>> +	return ret;
>> +}
>> +#endif
>> +
>>  /*
>>   * Zero the area past i_size but still within an allocated
>>   * cluster. This avoids exposing nonzero data on subsequent file
>> -- 
>> 1.5.2.5
>>
>>
>> _______________________________________________
>> Ocfs2-devel mailing list
>> Ocfs2-devel@oss.oracle.com
>> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
>>     
>
>   

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file
  2007-12-21  1:09   ` Joel Becker
@ 2007-12-21  9:41     ` Sunil Mushran
  0 siblings, 0 replies; 60+ messages in thread
From: Sunil Mushran @ 2007-12-21  9:41 UTC (permalink / raw)
  To: ocfs2-devel

I think this is better. Will do.

Joel Becker wrote:
> On Thu, Dec 20, 2007 at 03:29:24PM -0800, Sunil Mushran wrote:
>   
>> Commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 in mainline added
>> struct path in struct file. This patch allows one to build ocfs2 with
>> kernels having/not having that change.
>>
>>     
>
> Here again the define is reversed.
>
> Thinking about the compat trick you did, I'm wondering if something like
> this isn't a better idea:
>
> #ifdef NO_F_PATH
> # define filp_dentry(i) (i)->f_dentry
> #else
> # define filp_dentry(i) (i)->f_path.dentry
> #endif
> ...
> -	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
> +	struct inode *inode = filp_dentry(iocb->ki_filp)->d_inode;
>
> Thoughs?  I'm not sold on it, just throwing it out there.
>
> Joel
>
>   
>> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
>> ---
>>  Config.make.in              |    1 +
>>  Makefile                    |    3 ++-
>>  configure.in                |    6 ++++++
>>  fs/ocfs2/Makefile           |    4 ++++
>>  fs/ocfs2/aops.c             |    4 ++--
>>  fs/ocfs2/dir.c              |    2 +-
>>  fs/ocfs2/dlm/dlmfs.c        |    4 ++--
>>  fs/ocfs2/file.c             |   38 +++++++++++++++++++-------------------
>>  fs/ocfs2/ioctl.c            |    2 +-
>>  fs/ocfs2/mmap.c             |    2 +-
>>  kapi-compat/include/fpath.h |   10 ++++++++++
>>  11 files changed, 49 insertions(+), 27 deletions(-)
>>  create mode 100644 kapi-compat/include/fpath.h
>>
>> diff --git a/Config.make.in b/Config.make.in
>> index 1fe7ddc..4f42cca 100644
>> --- a/Config.make.in
>> +++ b/Config.make.in
>> @@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
>>  DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>>  
>>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>> +HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
>>  
>>  OCFS_DEBUG = @OCFS_DEBUG@
>>  
>> diff --git a/Makefile b/Makefile
>> index b7b86db..b00a6c4 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES =
>>  KAPI_COMPAT_FILES = \
>>  	kapi-compat/include/workqueue.h \
>>  	kapi-compat/include/compiler.h \
>> -	kapi-compat/include/highmem.h
>> +	kapi-compat/include/highmem.h \
>> +	kapi-compat/include/fpath.h
>>  
>>  PATCH_FILES =
>>  
>> diff --git a/configure.in b/configure.in
>> index 603dc94..907c90f 100644
>> --- a/configure.in
>> +++ b/configure.in
>> @@ -177,6 +177,12 @@ OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h,
>>    HAS_SYNC_MAPPING_RANGE=yes, , [do_sync_mapping_range(])
>>  AC_SUBST(HAS_SYNC_MAPPING_RANGE)
>>  
>> +HAS_F_PATH_DEFINED=
>> +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
>> +  HAS_F_PATH_DEFINED=yes, , [f_path])
>> +AC_SUBST(HAS_F_PATH_DEFINED)
>> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
>> +
>>  # using -include has two advantages:
>>  #  the source doesn't need to know to include compat headers
>>  #  the compat header file names don't go through the search path
>> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
>> index 3dc33a5..b6c8d03 100644
>> --- a/fs/ocfs2/Makefile
>> +++ b/fs/ocfs2/Makefile
>> @@ -33,6 +33,10 @@ ifdef HAS_SYNC_MAPPING_RANGE
>>  EXTRA_CFLAGS += -DHAS_SYNC_MAPPING_RANGE
>>  endif
>>  
>> +ifdef HAS_F_PATH_DEFINED
>> +EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
>> +endif
>> +
>>  #
>>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>>  # include trailing slashes.
>> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
>> index 34d1045..96cb31b 100644
>> --- a/fs/ocfs2/aops.c
>> +++ b/fs/ocfs2/aops.c
>> @@ -584,7 +584,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
>>  			     ssize_t bytes,
>>  			     void *private)
>>  {
>> -	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
>> +	struct inode *inode = iocb->ki_filp->f_path_dentry->d_inode;
>>  	int level;
>>  
>>  	/* this io's submitter should not have unlocked this before we could */
>> @@ -626,7 +626,7 @@ static ssize_t ocfs2_direct_IO(int rw,
>>  			       unsigned long nr_segs)
>>  {
>>  	struct file *file = iocb->ki_filp;
>> -	struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
>> +	struct inode *inode = file->f_path_dentry->d_inode->i_mapping->host;
>>  	int ret;
>>  
>>  	mlog_entry_void();
>> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
>> index 7453b70..0764a66 100644
>> --- a/fs/ocfs2/dir.c
>> +++ b/fs/ocfs2/dir.c
>> @@ -840,7 +840,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
>>  int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir)
>>  {
>>  	int error = 0;
>> -	struct inode *inode = filp->f_path.dentry->d_inode;
>> +	struct inode *inode = filp->f_path_dentry->d_inode;
>>  	int lock_level = 0;
>>  
>>  	mlog_entry("dirino=%llu\n",
>> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
>> index 7418dc8..4ce2dea 100644
>> --- a/fs/ocfs2/dlm/dlmfs.c
>> +++ b/fs/ocfs2/dlm/dlmfs.c
>> @@ -175,7 +175,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
>>  	int bytes_left;
>>  	ssize_t readlen;
>>  	char *lvb_buf;
>> -	struct inode *inode = filp->f_path.dentry->d_inode;
>> +	struct inode *inode = filp->f_path_dentry->d_inode;
>>  
>>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>>  		inode->i_ino, count, *ppos);
>> @@ -219,7 +219,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
>>  	int bytes_left;
>>  	ssize_t writelen;
>>  	char *lvb_buf;
>> -	struct inode *inode = filp->f_path.dentry->d_inode;
>> +	struct inode *inode = filp->f_path_dentry->d_inode;
>>  
>>  	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
>>  		inode->i_ino, count, *ppos);
>> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
>> index a62b14e..adb10b9 100644
>> --- a/fs/ocfs2/file.c
>> +++ b/fs/ocfs2/file.c
>> @@ -70,7 +70,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
>>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>>  
>>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
>> -		   file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
>> +		   file->f_path_dentry->d_name.len, file->f_path_dentry->d_name.name);
>>  
>>  	spin_lock(&oi->ip_lock);
>>  
>> @@ -100,8 +100,8 @@ static int ocfs2_file_release(struct inode *inode, struct file *file)
>>  	struct ocfs2_inode_info *oi = OCFS2_I(inode);
>>  
>>  	mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file,
>> -		       file->f_path.dentry->d_name.len,
>> -		       file->f_path.dentry->d_name.name);
>> +		       file->f_path_dentry->d_name.len,
>> +		       file->f_path_dentry->d_name.name);
>>  
>>  	spin_lock(&oi->ip_lock);
>>  	if (!--oi->ip_open_count)
>> @@ -1663,7 +1663,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
>>  		}
>>  	}
>>  
>> -	if (file && should_remove_suid(file->f_path.dentry)) {
>> +	if (file && should_remove_suid(file->f_path_dentry)) {
>>  		ret = __ocfs2_write_remove_suid(inode, di_bh);
>>  		if (ret) {
>>  			mlog_errno(ret);
>> @@ -1730,7 +1730,7 @@ out:
>>  int ocfs2_change_file_space(struct file *file, unsigned int cmd,
>>  			    struct ocfs2_space_resv *sr)
>>  {
>> -	struct inode *inode = file->f_path.dentry->d_inode;
>> +	struct inode *inode = file->f_path_dentry->d_inode;
>>  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);;
>>  
>>  	if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
>> @@ -2023,12 +2023,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
>>  	size_t count;		/* after file limit checks */
>>  	loff_t *ppos = &iocb->ki_pos;
>>  	struct file *file = iocb->ki_filp;
>> -	struct inode *inode = file->f_path.dentry->d_inode;
>> +	struct inode *inode = file->f_path_dentry->d_inode;
>>  
>>  	mlog_entry("(0x%p, %u, '%.*s')\n", file,
>>  		   (unsigned int)nr_segs,
>> -		   file->f_path.dentry->d_name.len,
>> -		   file->f_path.dentry->d_name.name);
>> +		   file->f_path_dentry->d_name.len,
>> +		   file->f_path_dentry->d_name.name);
>>  
>>  	if (iocb->ki_left == 0)
>>  		return 0;
>> @@ -2062,7 +2062,7 @@ relock:
>>  	}
>>  
>>  	can_do_direct = direct_io;
>> -	ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos,
>> +	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
>>  					    iocb->ki_left, appending,
>>  					    &can_do_direct);
>>  	if (ret < 0) {
>> @@ -2251,12 +2251,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>>  				       unsigned int flags)
>>  {
>>  	int ret;
>> -	struct inode *inode = out->f_path.dentry->d_inode;
>> +	struct inode *inode = out->f_path_dentry->d_inode;
>>  
>>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
>>  		   (unsigned int)len,
>> -		   out->f_path.dentry->d_name.len,
>> -		   out->f_path.dentry->d_name.name);
>> +		   out->f_path_dentry->d_name.len,
>> +		   out->f_path_dentry->d_name.name);
>>  
>>  	inode_double_lock(inode, pipe->inode);
>>  
>> @@ -2266,7 +2266,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
>>  		goto out;
>>  	}
>>  
>> -	ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, ppos, len, 0,
>> +	ret = ocfs2_prepare_inode_for_write(out->f_path_dentry, ppos, len, 0,
>>  					    NULL);
>>  	if (ret < 0) {
>>  		mlog_errno(ret);
>> @@ -2292,12 +2292,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in,
>>  				      unsigned int flags)
>>  {
>>  	int ret = 0;
>> -	struct inode *inode = in->f_path.dentry->d_inode;
>> +	struct inode *inode = in->f_path_dentry->d_inode;
>>  
>>  	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe,
>>  		   (unsigned int)len,
>> -		   in->f_path.dentry->d_name.len,
>> -		   in->f_path.dentry->d_name.name);
>> +		   in->f_path_dentry->d_name.len,
>> +		   in->f_path_dentry->d_name.name);
>>  
>>  	/*
>>  	 * See the comment in ocfs2_file_aio_read()
>> @@ -2323,12 +2323,12 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>>  {
>>  	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
>>  	struct file *filp = iocb->ki_filp;
>> -	struct inode *inode = filp->f_path.dentry->d_inode;
>> +	struct inode *inode = filp->f_path_dentry->d_inode;
>>  
>>  	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
>>  		   (unsigned int)nr_segs,
>> -		   filp->f_path.dentry->d_name.len,
>> -		   filp->f_path.dentry->d_name.name);
>> +		   filp->f_path_dentry->d_name.len,
>> +		   filp->f_path_dentry->d_name.name);
>>  
>>  	if (!inode) {
>>  		ret = -EINVAL;
>> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
>> index 87dcece..929aeac 100644
>> --- a/fs/ocfs2/ioctl.c
>> +++ b/fs/ocfs2/ioctl.c
>> @@ -148,7 +148,7 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
>>  #ifdef CONFIG_COMPAT
>>  long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
>>  {
>> -	struct inode *inode = file->f_path.dentry->d_inode;
>> +	struct inode *inode = file->f_path_dentry->d_inode;
>>  	int ret;
>>  
>>  	switch (cmd) {
>> diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
>> index 9875615..c0483c9 100644
>> --- a/fs/ocfs2/mmap.c
>> +++ b/fs/ocfs2/mmap.c
>> @@ -152,7 +152,7 @@ out:
>>  
>>  static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
>>  {
>> -	struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
>> +	struct inode *inode = vma->vm_file->f_path_dentry->d_inode;
>>  	struct buffer_head *di_bh = NULL;
>>  	sigset_t blocked, oldset;
>>  	int ret, ret2;
>> diff --git a/kapi-compat/include/fpath.h b/kapi-compat/include/fpath.h
>> new file mode 100644
>> index 0000000..178d8e3
>> --- /dev/null
>> +++ b/kapi-compat/include/fpath.h
>> @@ -0,0 +1,10 @@
>> +#ifndef KAPI_FPATH_H
>> +#define KAPI_FPATH_H
>> +
>> +#ifdef HAS_F_PATH_DEFINED
>> +# define f_path_dentry	f_path.dentry
>> +#else
>> +# define f_path_dentry	f_dentry
>> +#endif
>> +
>> +#endif
>> -- 
>> 1.5.2.5
>>
>>
>> _______________________________________________
>> Ocfs2-devel mailing list
>> Ocfs2-devel@oss.oracle.com
>> http://oss.oracle.com/mailman/listinfo/ocfs2-devel
>>     
>
>   

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
@ 2007-12-21 11:37   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:37 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:25PM -0800, Sunil Mushran wrote:
> Commit 86313c488a6848b7ec2ba04e74f25f79dd32a0b7 in mainline introduced
> enum umh_wait. This patch allows one to build ocfs2 with kernels having/
> not having that change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                   |    3 ++-
>  configure.in               |    5 +++++
>  kapi-compat/include/kmod.h |   10 ++++++++++
>  3 files changed, 17 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/kmod.h
> 
> diff --git a/Makefile b/Makefile
> index b00a6c4..088d0e1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -12,7 +12,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/workqueue.h \
>  	kapi-compat/include/compiler.h \
>  	kapi-compat/include/highmem.h \
> -	kapi-compat/include/fpath.h
> +	kapi-compat/include/fpath.h \
> +	kapi-compat/include/kmod.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 907c90f..94937cd 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -183,6 +183,11 @@ OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h,
>  AC_SUBST(HAS_F_PATH_DEFINED)
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h"
>  
> +kmod_compat_header=""
> +OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h,
> +  , kmod_compat_header="kmod.h", [umh_wait])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/kmod.h b/kapi-compat/include/kmod.h
> new file mode 100644
> index 0000000..42a082b
> --- /dev/null
> +++ b/kapi-compat/include/kmod.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_KMOD_H
> +#define KAPI_KMOD_H
> +
> +enum umh_wait {
> +	UMH_NO_WAIT = -1,	/* don't wait at all */
> +	UMH_WAIT_EXEC = 0,	/* wait for the exec, but not the process */
> +	UMH_WAIT_PROC = 1,	/* wait for the process to complete */
> +};
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #232

	"Keep your promises."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
@ 2007-12-21 11:39   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:39 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:27PM -0800, Sunil Mushran wrote:
> Commit 9a53c3a783c2fa9b969628e65695c11c3e51e673 in mainline added
> helper drop_nlink(). This patch allows one to build ocfs2 with kernels
> having/not having that change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>

Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                         |    3 ++-
>  configure.in                     |    5 +++++
>  kapi-compat/include/drop_nlink.h |   22 ++++++++++++++++++++++
>  3 files changed, 29 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/drop_nlink.h
> 
> diff --git a/Makefile b/Makefile
> index 1595b90..2a97e00 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -14,7 +14,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/highmem.h \
>  	kapi-compat/include/fpath.h \
>  	kapi-compat/include/kmod.h \
> -	kapi-compat/include/inc_nlink.h
> +	kapi-compat/include/inc_nlink.h \
> +	kapi-compat/include/drop_nlink.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 554a0a4..81041fb 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -193,6 +193,11 @@ OCFS2_CHECK_KERNEL([inc_nlink() in fs.h], fs.h,
>    , inc_nlink_compat_header="inc_nlink.h", [^static inline void inc_nlink(])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inc_nlink_compat_header"
>  
> +drop_nlink_compat_header=""
> +OCFS2_CHECK_KERNEL([drop_nlink() in fs.h], fs.h,
> +  , drop_nlink_compat_header="drop_nlink.h", [^static inline void drop_nlink(])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $drop_nlink_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/drop_nlink.h b/kapi-compat/include/drop_nlink.h
> new file mode 100644
> index 0000000..d54973b
> --- /dev/null
> +++ b/kapi-compat/include/drop_nlink.h
> @@ -0,0 +1,22 @@
> +#ifndef KAPI_DROP_NLINK_H
> +#define KAPI_DROP_NLINK_H
> +
> +#include <linux/fs.h>
> +
> +/*
> + * drop_nlink - directly drop an inode's link count
> + * @inode: inode
> + *
> + * This is a low-level filesystem helper to replace any
> + * direct filesystem manipulation of i_nlink.  In cases
> + * where we are attempting to track writes to the
> + * filesystem, a decrement to zero means an imminent
> + * write when the file is truncated and actually unlinked
> + * on the filesystem.
> + */
> +static inline void drop_nlink(struct inode *inode)
> +{
> +	inode->i_nlink--;
> +}
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

 print STDOUT q
 Just another Perl hacker,
 unless $spring
	- Larry Wall

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
@ 2007-12-21 11:39   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:39 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:26PM -0800, Sunil Mushran wrote:
> Commit d8c76e6f45c111c32a4b3e50a2adc9210737b0d8 in mainline introduced
> helper inc_nlink(). This patch allows one to build ocfs2 with kernels
> having/not having that change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                        |    3 ++-
>  configure.in                    |    5 +++++
>  kapi-compat/include/inc_nlink.h |   19 +++++++++++++++++++
>  3 files changed, 26 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/inc_nlink.h
> 
> diff --git a/Makefile b/Makefile
> index 088d0e1..1595b90 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/compiler.h \
>  	kapi-compat/include/highmem.h \
>  	kapi-compat/include/fpath.h \
> -	kapi-compat/include/kmod.h
> +	kapi-compat/include/kmod.h \
> +	kapi-compat/include/inc_nlink.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 94937cd..554a0a4 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -188,6 +188,11 @@ OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h,
>    , kmod_compat_header="kmod.h", [umh_wait])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $kmod_compat_header"
>  
> +inc_nlink_compat_header=""
> +OCFS2_CHECK_KERNEL([inc_nlink() in fs.h], fs.h,
> +  , inc_nlink_compat_header="inc_nlink.h", [^static inline void inc_nlink(])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $inc_nlink_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/inc_nlink.h b/kapi-compat/include/inc_nlink.h
> new file mode 100644
> index 0000000..26ddaac
> --- /dev/null
> +++ b/kapi-compat/include/inc_nlink.h
> @@ -0,0 +1,19 @@
> +#ifndef KAPI_INC_NLINK_H
> +#define KAPI_INC_NLINK_H
> +
> +#include <linux/fs.h>
> +
> +/*
> + * inc_nlink - directly increment an inode's link count
> + * @inode: inode
> + *
> + * This is a low-level filesystem helper to replace any
> + * direct filesystem manipulation of i_nlink.  Currently,
> + * it is only here for parity with dec_nlink().
> + */
> +static inline void inc_nlink(struct inode *inode)
> +{
> +	inode->i_nlink++;
> +}
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #407

	"Every once in a while, take the scenic route."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
@ 2007-12-21 11:47   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:47 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:28PM -0800, Sunil Mushran wrote:
> Commit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg
> from kmem_cache_create(). This patch allows one to build ocfs2 with
> kernels having/not having this change.

	I desperately want to come up with a trick here that will leave
"kmem_cache_create()" in the source, but I can't think of one.  This is
probably as good as we're going to get.

Joel
 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in             |    1 +
>  Makefile                   |    3 ++-
>  configure.in               |    6 ++++++
>  fs/ocfs2/Makefile          |    4 ++++
>  fs/ocfs2/dlm/Makefile      |    4 ++++
>  fs/ocfs2/dlm/dlmfs.c       |    2 +-
>  fs/ocfs2/dlm/dlmmaster.c   |    2 +-
>  fs/ocfs2/super.c           |    2 +-
>  fs/ocfs2/uptodate.c        |    2 +-
>  kapi-compat/include/slab.h |   10 ++++++++++
>  10 files changed, 31 insertions(+), 5 deletions(-)
>  create mode 100644 kapi-compat/include/slab.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 4f42cca..07c5a86 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -61,6 +61,7 @@ DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  
>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>  HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
> +KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index 2a97e00..ae5947b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/fpath.h \
>  	kapi-compat/include/kmod.h \
>  	kapi-compat/include/inc_nlink.h \
> -	kapi-compat/include/drop_nlink.h
> +	kapi-compat/include/drop_nlink.h \
> +	kapi-compat/include/slab.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 81041fb..cb91de1 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -198,6 +198,12 @@ OCFS2_CHECK_KERNEL([drop_nlink() in fs.h], fs.h,
>    , drop_nlink_compat_header="drop_nlink.h", [^static inline void drop_nlink(])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $drop_nlink_compat_header"
>  
> +KMEM_CACHE_CREATE_DTOR=
> +OCFS2_CHECK_KERNEL([kmem_cache_create() with dtor arg in slab.h], slab.h,
> +  KMEM_CACHE_CREATE_DTOR=yes, , [^.*void (\*)(void \*, kmem_cache_t \*, unsigned long),])
> +AC_SUBST(KMEM_CACHE_CREATE_DTOR)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS slab.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index b6c8d03..403c1c6 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -37,6 +37,10 @@ ifdef HAS_F_PATH_DEFINED
>  EXTRA_CFLAGS += -DHAS_F_PATH_DEFINED
>  endif
>  
> +ifdef KMEM_CACHE_CREATE_DTOR
> +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> index b4fb8e3..628ab3d 100644
> --- a/fs/ocfs2/dlm/Makefile
> +++ b/fs/ocfs2/dlm/Makefile
> @@ -20,6 +20,10 @@ ifdef DELAYED_WORK_DEFINED
>  EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
>  endif
>  
> +ifdef KMEM_CACHE_CREATE_DTOR
> +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR
> +endif
> +
>  DLM_SOURCES =			\
>  	dlmast.c		\
>  	dlmconvert.c		\
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index 4ce2dea..dc43923 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -588,7 +588,7 @@ static int __init init_dlmfs_fs(void)
>  
>  	dlmfs_print_version();
>  
> -	dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
> +	dlmfs_inode_cache = kapi_kmem_cache_create("dlmfs_inode_cache",
>  				sizeof(struct dlmfs_inode_private),
>  				0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
>  					SLAB_MEM_SPREAD),
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 62e4a7d..a668840 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -507,7 +507,7 @@ static void dlm_mle_node_up(struct dlm_ctxt *dlm,
>  
>  int dlm_init_mle_cache(void)
>  {
> -	dlm_mle_cache = kmem_cache_create("dlm_mle_cache",
> +	dlm_mle_cache = kapi_kmem_cache_create("dlm_mle_cache",
>  					  sizeof(struct dlm_master_list_entry),
>  					  0, SLAB_HWCACHE_ALIGN,
>  					  NULL);
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index a8f90a2..f5c424d 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -1033,7 +1033,7 @@ static void ocfs2_inode_init_once(void *data,
>  
>  static int ocfs2_initialize_mem_caches(void)
>  {
> -	ocfs2_inode_cachep = kmem_cache_create("ocfs2_inode_cache",
> +	ocfs2_inode_cachep = kapi_kmem_cache_create("ocfs2_inode_cache",
>  				       sizeof(struct ocfs2_inode_info),
>  				       0,
>  				       (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
> diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
> index 4da8851..6248308 100644
> --- a/fs/ocfs2/uptodate.c
> +++ b/fs/ocfs2/uptodate.c
> @@ -546,7 +546,7 @@ void ocfs2_remove_from_cache(struct inode *inode,
>  
>  int __init init_ocfs2_uptodate_cache(void)
>  {
> -	ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate",
> +	ocfs2_uptodate_cachep = kapi_kmem_cache_create("ocfs2_uptodate",
>  				  sizeof(struct ocfs2_meta_cache_item),
>  				  0, SLAB_HWCACHE_ALIGN, NULL);
>  	if (!ocfs2_uptodate_cachep)
> diff --git a/kapi-compat/include/slab.h b/kapi-compat/include/slab.h
> new file mode 100644
> index 0000000..239763f
> --- /dev/null
> +++ b/kapi-compat/include/slab.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_SLAB_H
> +#define KAPI_SLAB_H
> +
> +#ifdef KMEM_CACHE_CREATE_DTOR
> +#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e, NULL)
> +#else
> +#define kapi_kmem_cache_create(a, b, c, d, e)	kmem_cache_create(a, b, c, d, e)
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Any man who is under 30, and is not a liberal, has not heart;
 and any man who is over 30, and is not a conservative, has no brains."
         - Sir Winston Churchill 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes
  2007-12-21  0:54   ` Joel Becker
@ 2007-12-21 11:51     ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:51 UTC (permalink / raw)
  To: ocfs2-devel

On Fri, Dec 21, 2007 at 12:53:39AM -0800, Joel Becker wrote:
> On Thu, Dec 20, 2007 at 03:29:20PM -0800, Sunil Mushran wrote:
> > Commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c in mainline makes
> > changes to workqueue.h. This patch allows one to build ocfs2 with
> > kernels having/not having that change.
> > 
> 
> Here the check is reversed.  Without running configure, the tree expects
> an old kernel (it will behave as if delayed_work does not exist).
> 

	Looking at it, rather than spoil the meaning of container_of()
(the second usage isn't a container_of() at all), what about calling it
"work_to_object()"?

+#ifndef KAPI_WORKQUEUE_H
+#define KAPI_WORKQUEUE_H
+
+#ifdef NO_DELAYED_WORK
+# define delayed_work				work_struct
+typedef void kapi_work_struct_t;
+# define work_to_object(a, b, c)		(a)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b, c)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_WORK(a, b, c)
+#else
+typedef struct work_struct kapi_work_struct_t;
+# define work_to_object(a, b, c)		container_of(a, b, c)
+# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
+# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
+#endif
+
+#endif

	I don't have any way to make KAPI_INIT_WORK(), etc, any better,
though.

Joel

> > Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> > ---
> >  Config.make.in                  |    2 +
> >  Makefile                        |    3 +-
> >  configure.in                    |    6 ++++
> >  fs/Makefile                     |   64 +++++++++++++++++++++++++++++++++++++++
> >  fs/ocfs2/Makefile               |    4 ++
> >  fs/ocfs2/alloc.c                |    8 ++--
> >  fs/ocfs2/cluster/Makefile       |    4 ++
> >  fs/ocfs2/cluster/heartbeat.c    |    6 ++--
> >  fs/ocfs2/cluster/quorum.c       |    4 +-
> >  fs/ocfs2/cluster/tcp.c          |   56 +++++++++++++++++-----------------
> >  fs/ocfs2/dlm/Makefile           |    4 ++
> >  fs/ocfs2/dlm/dlmcommon.h        |    2 +-
> >  fs/ocfs2/dlm/dlmdomain.c        |    2 +-
> >  fs/ocfs2/dlm/dlmrecovery.c      |    2 +-
> >  fs/ocfs2/dlm/userdlm.c          |    8 ++--
> >  fs/ocfs2/journal.c              |    4 +-
> >  fs/ocfs2/journal.h              |    2 +-
> >  fs/ocfs2/super.c                |    2 +-
> >  kapi-compat/include/workqueue.h |   17 ++++++++++
> >  19 files changed, 151 insertions(+), 49 deletions(-)
> >  create mode 100644 fs/Makefile
> >  create mode 100644 kapi-compat/include/workqueue.h
> > 
> > diff --git a/Config.make.in b/Config.make.in
> > index c9e0132..befeb79 100644
> > --- a/Config.make.in
> > +++ b/Config.make.in
> > @@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@
> >  
> >  EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@
> >  
> > +DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
> > +
> >  OCFS_DEBUG = @OCFS_DEBUG@
> >  
> >  ifneq ($(OCFS_DEBUG),)
> > diff --git a/Makefile b/Makefile
> > index 227ab23..4752593 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -8,7 +8,8 @@ SUBDIRS = fs vendor
> >  
> >  LINUX_INCLUDE_FILES =
> >  
> > -KAPI_COMPAT_FILES =
> > +KAPI_COMPAT_FILES = \
> > +	kapi-compat/include/workqueue.h
> >  
> >  PATCH_FILES =
> >  
> > diff --git a/configure.in b/configure.in
> > index 1af47fc..72567b5 100644
> > --- a/configure.in
> > +++ b/configure.in
> > @@ -156,6 +156,12 @@ case "$kversion" in
> >      ;;
> >  esac
> >  
> > +DELAYED_WORK_DEFINED=
> > +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h,
> > +  DELAYED_WORK_DEFINED=yes, , [^struct delayed_work])
> > +AC_SUBST(DELAYED_WORK_DEFINED)
> > +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h"
> > +
> >  # using -include has two advantages:
> >  #  the source doesn't need to know to include compat headers
> >  #  the compat header file names don't go through the search path
> > diff --git a/fs/Makefile b/fs/Makefile
> > new file mode 100644
> > index 0000000..d7f3aec
> > --- /dev/null
> > +++ b/fs/Makefile
> > @@ -0,0 +1,64 @@
> > +
> > +ifeq ($(KERNELRELEASE),)
> > +TOPDIR = ..
> > +
> > +include $(TOPDIR)/Preamble.make
> > +else
> > +# We are included by kbuild.
> > +
> > +OUR_TOPDIR	:= $(M)/..
> > +
> > +include $(OUR_TOPDIR)/Config.make
> > +
> > +endif
> > +
> > +#
> > +# As 2.6 kbuild is unhappy seeing SUBDIRS, this is a safe one to
> > +# set globally.  Do not include trailing slashes.
> > +#
> > +SAFE_SUBDIRS :=
> > +
> > +SAFE_SUBDIRS += ocfs2
> > +
> > +ifneq ($(KERNELRELEASE),)
> > +#
> > +# Called under kbuild 2.6
> > +#
> > +
> > +obj-m	+= $(addsuffix /,$(SAFE_SUBDIRS))
> > +INSTALL_MOD_DIR := fs/ocfs2
> > +
> > +else
> > +#
> > +# Called from a regular "make". Just forward to kbuild.
> > +#
> > +
> > +ALL_RULES = build-modules
> > +
> > +CLEAN_RULES = clean-modules
> > +
> > +INSTALL_RULES = install-modules
> > +
> > +# Traverse subdirs via Makebo for "make dist"
> > +ifeq ($(MAKECMDGOALS),dist-all)
> > +SUBDIRS = $(SAFE_SUBDIRS)
> > +endif
> > +
> > +build-modules:
> > +	$(MAKE) -C ocfs2 stamp-md5
> > +	$(MAKE) -C ocfs2/cluster stamp-md5
> > +	$(MAKE) -C ocfs2/dlm stamp-md5
> > +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules
> > +
> > +install-modules:
> > +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install
> > +
> > +clean-modules:
> > +	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) clean
> > +	-rm ocfs2/stamp-md5
> > +	-rm ocfs2/cluster/stamp-md5
> > +	-rm ocfs2/dlm/stamp-md5
> > +
> > +include $(TOPDIR)/Postamble.make
> > +
> > +endif
> > diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> > index dce2a62..0edfed7 100644
> > --- a/fs/ocfs2/Makefile
> > +++ b/fs/ocfs2/Makefile
> > @@ -25,6 +25,10 @@ EXTRA_CFLAGS += -DOCFS2_CDSL
> >  
> >  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
> >  
> > +ifdef DELAYED_WORK_DEFINED
> > +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> > +endif
> > +
> >  #
> >  # Since SUBDIRS means something to kbuild, define them safely.  Do not
> >  # include trailing slashes.
> > diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> > index 4ba7f0b..5a8a4f2 100644
> > --- a/fs/ocfs2/alloc.c
> > +++ b/fs/ocfs2/alloc.c
> > @@ -4752,11 +4752,11 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb)
> >  	return status;
> >  }
> >  
> > -static void ocfs2_truncate_log_worker(struct work_struct *work)
> > +static void ocfs2_truncate_log_worker(kapi_work_struct_t *work)
> >  {
> >  	int status;
> >  	struct ocfs2_super *osb =
> > -		container_of(work, struct ocfs2_super,
> > +		kapi_container_of(work, struct ocfs2_super,
> >  			     osb_truncate_log_wq.work);
> >  
> >  	mlog_entry_void();
> > @@ -4989,8 +4989,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
> >  	/* ocfs2_truncate_log_shutdown keys on the existence of
> >  	 * osb->osb_tl_inode so we don't set any of the osb variables
> >  	 * until we're sure all is well. */
> > -	INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
> > -			  ocfs2_truncate_log_worker);
> > +	KAPI_INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
> > +			  ocfs2_truncate_log_worker, osb);
> >  	osb->osb_tl_bh    = tl_bh;
> >  	osb->osb_tl_inode = tl_inode;
> >  
> > diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
> > index c9c2e9b..a4251f5 100644
> > --- a/fs/ocfs2/cluster/Makefile
> > +++ b/fs/ocfs2/cluster/Makefile
> > @@ -13,6 +13,10 @@ endif
> >  
> >  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
> >  
> > +ifdef DELAYED_WORK_DEFINED
> > +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> > +endif
> > +
> >  SOURCES =			\
> >  	heartbeat.c		\
> >  	masklog.c		\
> > diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> > index f14b541..e610665 100644
> > --- a/fs/ocfs2/cluster/heartbeat.c
> > +++ b/fs/ocfs2/cluster/heartbeat.c
> > @@ -156,10 +156,10 @@ struct o2hb_bio_wait_ctxt {
> >  	int               wc_error;
> >  };
> >  
> > -static void o2hb_write_timeout(struct work_struct *work)
> > +static void o2hb_write_timeout(kapi_work_struct_t *work)
> >  {
> >  	struct o2hb_region *reg =
> > -		container_of(work, struct o2hb_region,
> > +		kapi_container_of(work, struct o2hb_region,
> >  			     hr_write_timeout_work.work);
> >  
> >  	mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u "
> > @@ -1306,7 +1306,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
> >  		goto out;
> >  	}
> >  
> > -	INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout);
> > +	KAPI_INIT_DELAYED_WORK(&reg->hr_write_timeout_work, o2hb_write_timeout, reg);
> >  
> >  	/*
> >  	 * A node is considered live after it has beat LIVE_THRESHOLD
> > diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
> > index bbacf7d..df9b74a 100644
> > --- a/fs/ocfs2/cluster/quorum.c
> > +++ b/fs/ocfs2/cluster/quorum.c
> > @@ -91,7 +91,7 @@ void o2quo_disk_timeout(void)
> >  	o2quo_fence_self();
> >  }
> >  
> > -static void o2quo_make_decision(struct work_struct *work)
> > +static void o2quo_make_decision(kapi_work_struct_t *work)
> >  {
> >  	int quorum;
> >  	int lowest_hb, lowest_reachable = 0, fence = 0;
> > @@ -309,7 +309,7 @@ void o2quo_init(void)
> >  	struct o2quo_state *qs = &o2quo_state;
> >  
> >  	spin_lock_init(&qs->qs_lock);
> > -	INIT_WORK(&qs->qs_work, o2quo_make_decision);
> > +	KAPI_INIT_WORK(&qs->qs_work, o2quo_make_decision, NULL);
> >  }
> >  
> >  void o2quo_exit(void)
> > diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
> > index 685c180..c4a0c73 100644
> > --- a/fs/ocfs2/cluster/tcp.c
> > +++ b/fs/ocfs2/cluster/tcp.c
> > @@ -140,11 +140,11 @@ static int o2net_sys_err_translations[O2NET_ERR_MAX] =
> >  		 [O2NET_ERR_DIED]	= -EHOSTDOWN,};
> >  
> >  /* can't quite avoid *all* internal declarations :/ */
> > -static void o2net_sc_connect_completed(struct work_struct *work);
> > -static void o2net_rx_until_empty(struct work_struct *work);
> > -static void o2net_shutdown_sc(struct work_struct *work);
> > +static void o2net_sc_connect_completed(kapi_work_struct_t *work);
> > +static void o2net_rx_until_empty(kapi_work_struct_t *work);
> > +static void o2net_shutdown_sc(kapi_work_struct_t *work);
> >  static void o2net_listen_data_ready(struct sock *sk, int bytes);
> > -static void o2net_sc_send_keep_req(struct work_struct *work);
> > +static void o2net_sc_send_keep_req(kapi_work_struct_t *work);
> >  static void o2net_idle_timer(unsigned long data);
> >  static void o2net_sc_postpone_idle(struct o2net_sock_container *sc);
> >  static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc);
> > @@ -330,10 +330,10 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node)
> >  	o2nm_node_get(node);
> >  	sc->sc_node = node;
> >  
> > -	INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed);
> > -	INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty);
> > -	INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc);
> > -	INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req);
> > +	KAPI_INIT_WORK(&sc->sc_connect_work, o2net_sc_connect_completed, sc);
> > +	KAPI_INIT_WORK(&sc->sc_rx_work, o2net_rx_until_empty, sc);
> > +	KAPI_INIT_WORK(&sc->sc_shutdown_work, o2net_shutdown_sc, sc);
> > +	KAPI_INIT_DELAYED_WORK(&sc->sc_keepalive_work, o2net_sc_send_keep_req, sc);
> >  
> >  	init_timer(&sc->sc_idle_timeout);
> >  	sc->sc_idle_timeout.function = o2net_idle_timer;
> > @@ -600,10 +600,10 @@ static void o2net_ensure_shutdown(struct o2net_node *nn,
> >   * ourselves as state_change couldn't get the nn_lock and call set_nn_state
> >   * itself.
> >   */
> > -static void o2net_shutdown_sc(struct work_struct *work)
> > +static void o2net_shutdown_sc(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_sock_container *sc =
> > -		container_of(work, struct o2net_sock_container,
> > +		kapi_container_of(work, struct o2net_sock_container,
> >  			     sc_shutdown_work);
> >  	struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
> >  
> > @@ -1306,10 +1306,10 @@ out:
> >  /* this work func is triggerd by data ready.  it reads until it can read no
> >   * more.  it interprets 0, eof, as fatal.  if data_ready hits while we're doing
> >   * our work the work struct will be marked and we'll be called again. */
> > -static void o2net_rx_until_empty(struct work_struct *work)
> > +static void o2net_rx_until_empty(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_sock_container *sc =
> > -		container_of(work, struct o2net_sock_container, sc_rx_work);
> > +		kapi_container_of(work, struct o2net_sock_container, sc_rx_work);
> >  	int ret;
> >  
> >  	do {
> > @@ -1367,10 +1367,10 @@ static void o2net_initialize_handshake(void)
> >  
> >  /* called when a connect completes and after a sock is accepted.  the
> >   * rx path will see the response and mark the sc valid */
> > -static void o2net_sc_connect_completed(struct work_struct *work)
> > +static void o2net_sc_connect_completed(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_sock_container *sc =
> > -		container_of(work, struct o2net_sock_container,
> > +		kapi_container_of(work, struct o2net_sock_container,
> >  			     sc_connect_work);
> >  
> >  	mlog(ML_MSG, "sc sending handshake with ver %llu id %llx\n",
> > @@ -1383,10 +1383,10 @@ static void o2net_sc_connect_completed(struct work_struct *work)
> >  }
> >  
> >  /* this is called as a work_struct func. */
> > -static void o2net_sc_send_keep_req(struct work_struct *work)
> > +static void o2net_sc_send_keep_req(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_sock_container *sc =
> > -		container_of(work, struct o2net_sock_container,
> > +		kapi_container_of(work, struct o2net_sock_container,
> >  			     sc_keepalive_work.work);
> >  
> >  	o2net_sendpage(sc, o2net_keep_req, sizeof(*o2net_keep_req));
> > @@ -1446,10 +1446,10 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc)
> >   * having a connect attempt fail, etc. This centralizes the logic which decides
> >   * if a connect attempt should be made or if we should give up and all future
> >   * transmit attempts should fail */
> > -static void o2net_start_connect(struct work_struct *work)
> > +static void o2net_start_connect(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_node *nn =
> > -		container_of(work, struct o2net_node, nn_connect_work.work);
> > +		kapi_container_of(work, struct o2net_node, nn_connect_work.work);
> >  	struct o2net_sock_container *sc = NULL;
> >  	struct o2nm_node *node = NULL, *mynode = NULL;
> >  	struct socket *sock = NULL;
> > @@ -1553,10 +1553,10 @@ out:
> >  	return;
> >  }
> >  
> > -static void o2net_connect_expired(struct work_struct *work)
> > +static void o2net_connect_expired(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_node *nn =
> > -		container_of(work, struct o2net_node, nn_connect_expired.work);
> > +		kapi_container_of(work, struct o2net_node, nn_connect_expired.work);
> >  
> >  	spin_lock(&nn->nn_lock);
> >  	if (!nn->nn_sc_valid) {
> > @@ -1572,10 +1572,10 @@ static void o2net_connect_expired(struct work_struct *work)
> >  	spin_unlock(&nn->nn_lock);
> >  }
> >  
> > -static void o2net_still_up(struct work_struct *work)
> > +static void o2net_still_up(kapi_work_struct_t *work)
> >  {
> >  	struct o2net_node *nn =
> > -		container_of(work, struct o2net_node, nn_still_up.work);
> > +		kapi_container_of(work, struct o2net_node, nn_still_up.work);
> >  
> >  	o2quo_hb_still_up(o2net_num_from_nn(nn));
> >  }
> > @@ -1775,7 +1775,7 @@ out:
> >  	return ret;
> >  }
> >  
> > -static void o2net_accept_many(struct work_struct *work)
> > +static void o2net_accept_many(kapi_work_struct_t *work)
> >  {
> >  	struct socket *sock = o2net_listen_sock;
> >  	while (o2net_accept_one(sock) == 0)
> > @@ -1831,7 +1831,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
> >  	write_unlock_bh(&sock->sk->sk_callback_lock);
> >  
> >  	o2net_listen_sock = sock;
> > -	INIT_WORK(&o2net_listen_work, o2net_accept_many);
> > +	KAPI_INIT_WORK(&o2net_listen_work, o2net_accept_many, sock);
> >  
> >  	sock->sk->sk_reuse = 1;
> >  	ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
> > @@ -1951,10 +1951,10 @@ int o2net_init(void)
> >  		struct o2net_node *nn = o2net_nn_from_num(i);
> >  
> >  		spin_lock_init(&nn->nn_lock);
> > -		INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect);
> > -		INIT_DELAYED_WORK(&nn->nn_connect_expired,
> > -				  o2net_connect_expired);
> > -		INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up);
> > +		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_work, o2net_start_connect, nn);
> > +		KAPI_INIT_DELAYED_WORK(&nn->nn_connect_expired,
> > +				  o2net_connect_expired, nn);
> > +		KAPI_INIT_DELAYED_WORK(&nn->nn_still_up, o2net_still_up, nn);
> >  		/* until we see hb from a node we'll return einval */
> >  		nn->nn_persistent_error = -ENOTCONN;
> >  		init_waitqueue_head(&nn->nn_sc_wq);
> > diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> > index 7e1031e..b4fb8e3 100644
> > --- a/fs/ocfs2/dlm/Makefile
> > +++ b/fs/ocfs2/dlm/Makefile
> > @@ -16,6 +16,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2
> >  
> >  EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG
> >  
> > +ifdef DELAYED_WORK_DEFINED
> > +EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
> > +endif
> > +
> >  DLM_SOURCES =			\
> >  	dlmast.c		\
> >  	dlmconvert.c		\
> > diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> > index e90b92f..cddf85a 100644
> > --- a/fs/ocfs2/dlm/dlmcommon.h
> > +++ b/fs/ocfs2/dlm/dlmcommon.h
> > @@ -153,7 +153,7 @@ static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned
> >   * called functions that cannot be directly called from the
> >   * net message handlers for some reason, usually because
> >   * they need to send net messages of their own. */
> > -void dlm_dispatch_work(struct work_struct *work);
> > +void dlm_dispatch_work(kapi_work_struct_t *work);
> >  
> >  struct dlm_lock_resource;
> >  struct dlm_work_item;
> > diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> > index 6954565..10b3e60 100644
> > --- a/fs/ocfs2/dlm/dlmdomain.c
> > +++ b/fs/ocfs2/dlm/dlmdomain.c
> > @@ -1435,7 +1435,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
> >  
> >  	spin_lock_init(&dlm->work_lock);
> >  	INIT_LIST_HEAD(&dlm->work_list);
> > -	INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work);
> > +	KAPI_INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work, dlm);
> >  
> >  	kref_init(&dlm->dlm_refs);
> >  	dlm->dlm_state = DLM_CTXT_NEW;
> > diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> > index a2c3316..3cf4f49 100644
> > --- a/fs/ocfs2/dlm/dlmrecovery.c
> > +++ b/fs/ocfs2/dlm/dlmrecovery.c
> > @@ -153,7 +153,7 @@ static inline void dlm_reset_recovery(struct dlm_ctxt *dlm)
> >  }
> >  
> >  /* Worker function used during recovery. */
> > -void dlm_dispatch_work(struct work_struct *work)
> > +void dlm_dispatch_work(kapi_work_struct_t *work)
> >  {
> >  	struct dlm_ctxt *dlm =
> >  		container_of(work, struct dlm_ctxt, dispatched_work);
> > diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c
> > index 7d2f578..2f6deb1 100644
> > --- a/fs/ocfs2/dlm/userdlm.c
> > +++ b/fs/ocfs2/dlm/userdlm.c
> > @@ -171,14 +171,14 @@ static inline void user_dlm_grab_inode_ref(struct user_lock_res *lockres)
> >  		BUG();
> >  }
> >  
> > -static void user_dlm_unblock_lock(struct work_struct *work);
> > +static void user_dlm_unblock_lock(kapi_work_struct_t *work);
> >  
> >  static void __user_dlm_queue_lockres(struct user_lock_res *lockres)
> >  {
> >  	if (!(lockres->l_flags & USER_LOCK_QUEUED)) {
> >  		user_dlm_grab_inode_ref(lockres);
> >  
> > -		INIT_WORK(&lockres->l_work, user_dlm_unblock_lock);
> > +		KAPI_INIT_WORK(&lockres->l_work, user_dlm_unblock_lock, lockres);
> >  
> >  		queue_work(user_dlm_worker, &lockres->l_work);
> >  		lockres->l_flags |= USER_LOCK_QUEUED;
> > @@ -278,11 +278,11 @@ static inline void user_dlm_drop_inode_ref(struct user_lock_res *lockres)
> >  	iput(inode);
> >  }
> >  
> > -static void user_dlm_unblock_lock(struct work_struct *work)
> > +static void user_dlm_unblock_lock(kapi_work_struct_t *work)
> >  {
> >  	int new_level, status;
> >  	struct user_lock_res *lockres =
> > -		container_of(work, struct user_lock_res, l_work);
> > +		kapi_container_of(work, struct user_lock_res, l_work);
> >  	struct dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres);
> >  
> >  	mlog(0, "processing lockres %.*s\n", lockres->l_namelen,
> > diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
> > index f9d01e2..b94208f 100644
> > --- a/fs/ocfs2/journal.c
> > +++ b/fs/ocfs2/journal.c
> > @@ -715,11 +715,11 @@ struct ocfs2_la_recovery_item {
> >   * NOTE: This function can and will sleep on recovery of other nodes
> >   * during cluster locking, just like any other ocfs2 process.
> >   */
> > -void ocfs2_complete_recovery(struct work_struct *work)
> > +void ocfs2_complete_recovery(kapi_work_struct_t *work)
> >  {
> >  	int ret;
> >  	struct ocfs2_journal *journal =
> > -		container_of(work, struct ocfs2_journal, j_recovery_work);
> > +		kapi_container_of(work, struct ocfs2_journal, j_recovery_work);
> >  	struct ocfs2_super *osb = journal->j_osb;
> >  	struct ocfs2_dinode *la_dinode, *tl_dinode;
> >  	struct ocfs2_la_recovery_item *item, *n;
> > diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
> > index 4b32e09..548d6af 100644
> > --- a/fs/ocfs2/journal.h
> > +++ b/fs/ocfs2/journal.h
> > @@ -133,7 +133,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb,
> >  }
> >  
> >  /* Exported only for the journal struct init code in super.c. Do not call. */
> > -void ocfs2_complete_recovery(struct work_struct *work);
> > +void ocfs2_complete_recovery(kapi_work_struct_t *work);
> >  
> >  /*
> >   *  Journal Control:
> > diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> > index 0e2a1b4..a8f90a2 100644
> > --- a/fs/ocfs2/super.c
> > +++ b/fs/ocfs2/super.c
> > @@ -1465,7 +1465,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
> >  	spin_lock_init(&journal->j_lock);
> >  	journal->j_trans_id = (unsigned long) 1;
> >  	INIT_LIST_HEAD(&journal->j_la_cleanups);
> > -	INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
> > +	KAPI_INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, journal);
> >  	journal->j_state = OCFS2_JOURNAL_FREE;
> >  
> >  	/* get some pseudo constants for clustersize bits */
> > diff --git a/kapi-compat/include/workqueue.h b/kapi-compat/include/workqueue.h
> > new file mode 100644
> > index 0000000..26dfbdf
> > --- /dev/null
> > +++ b/kapi-compat/include/workqueue.h
> > @@ -0,0 +1,17 @@
> > +#ifndef KAPI_WORKQUEUE_H
> > +#define KAPI_WORKQUEUE_H
> > +
> > +#ifndef DELAYED_WORK_DEFINED
> > +# define delayed_work				work_struct
> > +typedef void kapi_work_struct_t;
> > +# define kapi_container_of(a, b, c)		(a)
> > +# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b, c)
> > +# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_WORK(a, b, c)
> > +#else
> > +typedef struct work_struct kapi_work_struct_t;
> > +# define kapi_container_of(a, b, c)		container_of(a, b, c)
> > +# define KAPI_INIT_WORK(a, b, c)		INIT_WORK(a, b)
> > +# define KAPI_INIT_DELAYED_WORK(a, b, c)	INIT_DELAYED_WORK(a, b)
> > +#endif
> > +
> > +#endif
> > -- 
> > 1.5.2.5
> > 
> > 
> > _______________________________________________
> > Ocfs2-devel mailing list
> > Ocfs2-devel@oss.oracle.com
> > http://oss.oracle.com/mailman/listinfo/ocfs2-devel
> 
> -- 
> 
> "Only a life lived for others is a life worth while."
> 							-Albert Einstein  
> 
> Joel Becker
> Principal Software Developer
> Oracle
> E-mail: joel.becker@oracle.com
> Phone: (650) 506-8127
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"When I am working on a problem I never think about beauty. I
 only think about how to solve the problem. But when I have finished, if
 the solution is not beautiful, I know it is wrong."
         - Buckminster Fuller

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
@ 2007-12-21 11:55   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:55 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:29PM -0800, Sunil Mushran wrote:
> Commit 349457ccf2592c14bdf13b6706170ae2e94931b1 in mainline defines macro
> FS_RENAME_DOES_D_MOVE to allow fs to call d_move() during rename().
> This patch allows one to build ocfs2 with kernels having/not having
> this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                     |    3 ++-
>  configure.in                 |    5 +++++
>  kapi-compat/include/fstype.h |    6 ++++++
>  3 files changed, 13 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/fstype.h
> 
> diff --git a/Makefile b/Makefile
> index ae5947b..5c22979 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -16,7 +16,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/kmod.h \
>  	kapi-compat/include/inc_nlink.h \
>  	kapi-compat/include/drop_nlink.h \
> -	kapi-compat/include/slab.h
> +	kapi-compat/include/slab.h \
> +	kapi-compat/include/fstype.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index cb91de1..f1ca3e3 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -204,6 +204,11 @@ OCFS2_CHECK_KERNEL([kmem_cache_create() with dtor arg in slab.h], slab.h,
>  AC_SUBST(KMEM_CACHE_CREATE_DTOR)
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS slab.h"
>  
> +fstype_compat_header=""
> +OCFS2_CHECK_KERNEL([flag FS_RENAME_DOES_D_MOVE in fs.h], fs.h,
> +  , fstype_compat_header="fstype.h", [FS_RENAME_DOES_D_MOVE])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fstype_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/fstype.h b/kapi-compat/include/fstype.h
> new file mode 100644
> index 0000000..895ea86
> --- /dev/null
> +++ b/kapi-compat/include/fstype.h
> @@ -0,0 +1,6 @@
> +#ifndef KAPI_FSTYPE_H
> +#define KAPI_FSTYPE_H
> +
> +#define FS_RENAME_DOES_D_MOVE	FS_ODD_RENAME
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #407

	"Every once in a while, take the scenic route."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
@ 2007-12-21 11:57   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:57 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:30PM -0800, Sunil Mushran wrote:
> Commit 0e03036c97b70b2602f7dedaa3a223ed7563c2c9 in mainline registers
> ocfs2 sysctl (FS_OCFS2) number under CTL_FS. This patch allows one to
> build ocfs2 with kernels having/not having this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                     |    3 ++-
>  configure.in                 |    5 +++++
>  kapi-compat/include/sysctl.h |    9 +++++++++
>  3 files changed, 16 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/sysctl.h
> 
> diff --git a/Makefile b/Makefile
> index 5c22979..6377ff9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -17,7 +17,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/inc_nlink.h \
>  	kapi-compat/include/drop_nlink.h \
>  	kapi-compat/include/slab.h \
> -	kapi-compat/include/fstype.h
> +	kapi-compat/include/fstype.h \
> +	kapi-compat/include/sysctl.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index f1ca3e3..fdb188c 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -209,6 +209,11 @@ OCFS2_CHECK_KERNEL([flag FS_RENAME_DOES_D_MOVE in fs.h], fs.h,
>    , fstype_compat_header="fstype.h", [FS_RENAME_DOES_D_MOVE])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $fstype_compat_header"
>  
> +sysctl_compat_header=""
> +OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h,
> +  , sysctl_compat_header="sysctl.h", [FS_OCFS2])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/sysctl.h b/kapi-compat/include/sysctl.h
> new file mode 100644
> index 0000000..73ed0a7
> --- /dev/null
> +++ b/kapi-compat/include/sysctl.h
> @@ -0,0 +1,9 @@
> +#ifndef KAPI_SYSCTL_H
> +#define KAPI_SYSCTL_H
> +
> +/* CTL_FS names: */
> +enum {
> +	FS_OCFS2=988,   /* ocfs2 */
> +};
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

 Joel's Second Law:

	If a code change requires additional user setup, it is wrong.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
@ 2007-12-21 11:57   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:57 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:31PM -0800, Sunil Mushran wrote:
> Commit 631d1febab8e546e3bb800bdfe2c212b8adf87de in mainline introduces
> two new calls in configfs, configfs_depend_item() and configfs_undepend_item().
> This patch allows one to build ocfs2 with kernels having/not having
> this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Makefile                       |    3 ++-
>  configure.in                   |    5 +++++
>  kapi-compat/include/configfs.h |    7 +++++++
>  3 files changed, 14 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/configfs.h
> 
> diff --git a/Makefile b/Makefile
> index 6377ff9..71cd3c7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -18,7 +18,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/drop_nlink.h \
>  	kapi-compat/include/slab.h \
>  	kapi-compat/include/fstype.h \
> -	kapi-compat/include/sysctl.h
> +	kapi-compat/include/sysctl.h \
> +	kapi-compat/include/configfs.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index fdb188c..513585f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -214,6 +214,11 @@ OCFS2_CHECK_KERNEL([enum FS_OCFS2 in sysctl.h], sysctl.h,
>    , sysctl_compat_header="sysctl.h", [FS_OCFS2])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $sysctl_compat_header"
>  
> +configfs_compat_header=""
> +OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
> +  , configfs_compat_header="configfs.h", [configfs_depend_item()])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/configfs.h b/kapi-compat/include/configfs.h
> new file mode 100644
> index 0000000..ff68e58
> --- /dev/null
> +++ b/kapi-compat/include/configfs.h
> @@ -0,0 +1,7 @@
> +#ifndef KAPI_CONFIGFS_H
> +#define KAPI_CONFIGFS_H
> +
> +#define configfs_depend_item(a, b)	0

	It's trivial, I know, but can we wrap that '0' in ()?

Joel

> +#define configfs_undepend_item(a, b)
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"I think it would be a good idea."  
        - Mahatma Ghandi, when asked what he thought of Western
          civilization

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table()
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
@ 2007-12-21 11:59   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 11:59 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:32PM -0800, Sunil Mushran wrote:
> Commit 0b4d414714f0d2f922d39424b0c5c82ad900a381 in mainline removes the
> insert_at_head argument from register_sysctl_table(). This patch allows
> building ocfs2 with kernels having/not having this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>

Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Config.make.in                        |    1 +
>  Makefile                              |    3 ++-
>  configure.in                          |    6 ++++++
>  fs/ocfs2/cluster/Makefile             |    4 ++++
>  fs/ocfs2/cluster/nodemanager.c        |    2 +-
>  kapi-compat/include/register_sysctl.h |   10 ++++++++++
>  6 files changed, 24 insertions(+), 2 deletions(-)
>  create mode 100644 kapi-compat/include/register_sysctl.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index 07c5a86..eb8671d 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -62,6 +62,7 @@ DELAYED_WORK_DEFINED = @DELAYED_WORK_DEFINED@
>  HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>  HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
>  KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
> +REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index 71cd3c7..a9bfccb 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -19,7 +19,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/slab.h \
>  	kapi-compat/include/fstype.h \
>  	kapi-compat/include/sysctl.h \
> -	kapi-compat/include/configfs.h
> +	kapi-compat/include/configfs.h \
> +	kapi-compat/include/register_sysctl.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 513585f..04db94f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -219,6 +219,12 @@ OCFS2_CHECK_KERNEL([configfs_depend_item() in configfs.h], configfs.h,
>    , configfs_compat_header="configfs.h", [configfs_depend_item()])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $configfs_compat_header"
>  
> +REGISTER_SYSCTL_TWO_ARGS=
> +OCFS2_CHECK_KERNEL([register_sysctl() with two args in sysctl.h], sysctl.h,
> +  REGISTER_SYSCTL_TWO_ARGS=yes, , [^.*int insert_at_head);])
> +AC_SUBST(REGISTER_SYSCTL_TWO_ARGS)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS register_sysctl.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
> index a4251f5..6c2f11b 100644
> --- a/fs/ocfs2/cluster/Makefile
> +++ b/fs/ocfs2/cluster/Makefile
> @@ -17,6 +17,10 @@ ifdef DELAYED_WORK_DEFINED
>  EXTRA_CFLAGS += -DDELAYED_WORK_DEFINED
>  endif
>  
> +ifdef REGISTER_SYSCTL_TWO_ARGS
> +EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS
> +endif
> +
>  SOURCES =			\
>  	heartbeat.c		\
>  	masklog.c		\
> diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
> index af2070d..9fff881 100644
> --- a/fs/ocfs2/cluster/nodemanager.c
> +++ b/fs/ocfs2/cluster/nodemanager.c
> @@ -962,7 +962,7 @@ static int __init init_o2nm(void)
>  	o2hb_init();
>  	o2net_init();
>  
> -	ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
> +	ocfs2_table_header = kapi_register_sysctl_table(ocfs2_root_table);
>  	if (!ocfs2_table_header) {
>  		printk(KERN_ERR "nodemanager: unable to register sysctl\n");
>  		ret = -ENOMEM; /* or something. */
> diff --git a/kapi-compat/include/register_sysctl.h b/kapi-compat/include/register_sysctl.h
> new file mode 100644
> index 0000000..94e8071
> --- /dev/null
> +++ b/kapi-compat/include/register_sysctl.h
> @@ -0,0 +1,10 @@
> +#ifndef KAPI_REGISTER_SYSCTL_H
> +#define KAPI_REGISTER_SYSCTL_H
> +
> +#ifdef REGISTER_SYSCTL_TWO_ARGS
> +#define kapi_register_sysctl_table(a)	register_sysctl_table(a, 0)
> +#else
> +#define kapi_register_sysctl_table(a)	register_sysctl_table(a)
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"I'm drifting and drifting
 Just like a ship out on the sea.
 Cause I ain't got nobody, baby,
 In this world to care for me."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
@ 2007-12-21 12:00   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 12:00 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:33PM -0800, Sunil Mushran wrote:
> Commit e6bd07aee739566803425acdbf5cdb29919164e1 in mainline changed a
> semaphore into a mutex in struct configfs_subsystem. This patch allows
> building ocfs2 with kernels having/not having this change.

	The define is reversed.  Also, since this is specific to this
particular place, maybe we call it "init_su_mutex()" instead of
"kapi_init_mutex()"?

Joel

> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in                 |    1 +
>  Makefile                       |    3 ++-
>  configure.in                   |    6 ++++++
>  fs/ocfs2/cluster/Makefile      |    4 ++++
>  fs/ocfs2/cluster/nodemanager.c |    2 +-
>  kapi-compat/include/su_mutex.h |   13 +++++++++++++
>  6 files changed, 27 insertions(+), 2 deletions(-)
>  create mode 100644 kapi-compat/include/su_mutex.h
> 
> diff --git a/Config.make.in b/Config.make.in
> index eb8671d..b7bd06b 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -63,6 +63,7 @@ HAS_SYNC_MAPPING_RANGE  = @HAS_SYNC_MAPPING_RANGE@
>  HAS_F_PATH_DEFINED = @HAS_F_PATH_DEFINED@
>  KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
>  REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
> +SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/Makefile b/Makefile
> index a9bfccb..9848c47 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -20,7 +20,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/fstype.h \
>  	kapi-compat/include/sysctl.h \
>  	kapi-compat/include/configfs.h \
> -	kapi-compat/include/register_sysctl.h
> +	kapi-compat/include/register_sysctl.h \
> +	kapi-compat/include/su_mutex.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 04db94f..3d3c5da 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -225,6 +225,12 @@ OCFS2_CHECK_KERNEL([register_sysctl() with two args in sysctl.h], sysctl.h,
>  AC_SUBST(REGISTER_SYSCTL_TWO_ARGS)
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS register_sysctl.h"
>  
> +SU_MUTEX_DEFINED=
> +OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], configfs.h,
> +  SU_MUTEX_DEFINED=yes, , [su_mutex])
> +AC_SUBST(SU_MUTEX_DEFINED)
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS su_mutex.h"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
> index 6c2f11b..1e69fef 100644
> --- a/fs/ocfs2/cluster/Makefile
> +++ b/fs/ocfs2/cluster/Makefile
> @@ -21,6 +21,10 @@ ifdef REGISTER_SYSCTL_TWO_ARGS
>  EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS
>  endif
>  
> +ifdef SU_MUTEX_DEFINED
> +EXTRA_CFLAGS += -DSU_MUTEX_DEFINED
> +endif
> +
>  SOURCES =			\
>  	heartbeat.c		\
>  	masklog.c		\
> diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
> index 9fff881..ca142d0 100644
> --- a/fs/ocfs2/cluster/nodemanager.c
> +++ b/fs/ocfs2/cluster/nodemanager.c
> @@ -974,7 +974,7 @@ static int __init init_o2nm(void)
>  		goto out_sysctl;
>  
>  	config_group_init(&o2nm_cluster_group.cs_subsys.su_group);
> -	mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
> +	kapi_mutex_init(&o2nm_cluster_group.cs_subsys.su_mutex);
>  	ret = configfs_register_subsystem(&o2nm_cluster_group.cs_subsys);
>  	if (ret) {
>  		printk(KERN_ERR "nodemanager: Registration returned %d\n", ret);
> diff --git a/kapi-compat/include/su_mutex.h b/kapi-compat/include/su_mutex.h
> new file mode 100644
> index 0000000..1e633ed
> --- /dev/null
> +++ b/kapi-compat/include/su_mutex.h
> @@ -0,0 +1,13 @@
> +#ifndef KAPI_SUMUTEX_H
> +#define KAPI_SUMUTEX_H
> +
> +#ifdef SU_MUTEX_DEFINED
> +# define kapi_mutex_init	mutex_init
> +# define su_mutex		su_mutex
> +#else
> +# include "asm/semaphore.h"
> +# define kapi_mutex_init	init_MUTEX
> +# define su_mutex		su_sem
> +#endif
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Well-timed silence hath more eloquence than speech."  
         - Martin Fraquhar Tupper

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
@ 2007-12-21 15:10   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 15:10 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:35PM -0800, Sunil Mushran wrote:
> Commit 3bd858ab1c451725c07a805dcb315215dc85b86e in mainline introduces
> helper macro is_owner_or_cap(). This patch allows one to build ocfs2 with
> kernels having/not having this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Makefile                  |    3 ++-
>  configure.in              |    5 +++++
>  kapi-compat/include/cap.h |    7 +++++++
>  3 files changed, 14 insertions(+), 1 deletions(-)
>  create mode 100644 kapi-compat/include/cap.h
> 
> diff --git a/Makefile b/Makefile
> index a26e24f..eafeb2f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -22,7 +22,8 @@ KAPI_COMPAT_FILES = \
>  	kapi-compat/include/configfs.h \
>  	kapi-compat/include/register_sysctl.h \
>  	kapi-compat/include/su_mutex.h \
> -	kapi-compat/include/kobject.h
> +	kapi-compat/include/kobject.h \
> +	kapi-compat/include/cap.h
>  
>  PATCH_FILES =
>  
> diff --git a/configure.in b/configure.in
> index 83dcd37..f8b5f20 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -237,6 +237,11 @@ OCFS2_CHECK_KERNEL([struct subsystem in kobject.h], kobject.h,
>  AC_SUBST(STRUCT_SUBSYSTEM_DEFINED)
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS kobject.h"
>  
> +cap_compat_header=""
> +OCFS2_CHECK_KERNEL([is_owner_or_cap() in fs.h], fs.h,
> +  , cap_compat_header="cap.h", [^#define is_owner_or_cap])
> +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cap_compat_header"
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/kapi-compat/include/cap.h b/kapi-compat/include/cap.h
> new file mode 100644
> index 0000000..a10a12f
> --- /dev/null
> +++ b/kapi-compat/include/cap.h
> @@ -0,0 +1,7 @@
> +#ifndef KAPI_CAP_H
> +#define KAPI_CAP_H
> +
> +#define is_owner_or_cap(inode)  \
> +	        ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
> +
> +#endif
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"The suffering man ought really to consume his own smoke; there is no 
 good in emitting smoke till you have made it into fire."
			- thomas carlyle

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
@ 2007-12-21 15:10   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 15:10 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:34PM -0800, Sunil Mushran wrote:
> Commit 823bccfc4002296ba88c3ad0f049e1abd8108d30 in mainline removes struct
> subsystem from kobject.h. This patch allows one to build ocfs2 with kernels
> having/not having this change.

	A subsystem is just a {kset, ...}, so the pointers are actually
still equal.  I wouldn't introduce "struct kapi_kset".  We don't need
it.  You can just pass the kset on to mlog_sys_init().  See below.

>  
> -int mlog_sys_init(struct kset *o2cb_subsys)

Just keep this as struct kset...

> +int mlog_sys_init(struct kapi_kset *o2cb_subsys)
>  {
>  	int i = 0;
>  
> diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
> index 75cd877..2b78a1b 100644
> --- a/fs/ocfs2/cluster/masklog.h
> +++ b/fs/ocfs2/cluster/masklog.h
> @@ -278,7 +278,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
>  
>  #include <linux/kobject.h>
>  #include <linux/sysfs.h>
> -int mlog_sys_init(struct kset *o2cb_subsys);

Same here.  The better way is to introduce "kapi_subsystem_kset()":

+#ifdef STRUCT_SUBSYSTEM_DEFINED
+# define kapi_subsystem_kset(_sub) &((_sub)->kset)
+#else
+# define kapi_subsystem_kset(_sub) (_sub)
+#endif

Then you can call "int mlog_sys_init(struct kset *kset)" like so:

  mlog_sys_init(kapi_subsystem_kset(&o2cb_subsys));

> @@ -111,7 +111,7 @@ int o2cb_sys_init(void)
>  {
>  	int ret;
>  
> -	o2cb_subsys.kobj.ktype = &o2cb_subsys_type;
> +	o2cb_subsys.kapi_kobj.ktype = &o2cb_subsys_type;
>  	ret = subsystem_register(&o2cb_subsys);

becomes:

  kapi_subsystem_kset(&o2cb_subsys)->kobj.ktype = &o2cb_subsys_type;
  ret = subsystem_register(&o2cb_subsys);

and this: 

>  o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
>  {
>  	struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
> -	struct kset *sbs = to_kset(kobj);
> +	struct kapi_kset *sbs = to_kapi_kset(kobj);
>  
>  	BUG_ON(sbs != &o2cb_subsys);

becomes this:

  o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
  {
  	struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
	struct kset *sbs = to_kset(kobj);

        BUG_ON(sbs != &o2cb_subsys);

because the kset and subsystem pointers are identical.  If gcc warns
about the types, you can say:

        BUG_ON(sbs != kapi_subsystem_kset(&o2cb_subsys));

instead.  Thoughts?

Joel

-- 

"And yet I fight,
 And yet I fight this battle all alone.
 No one to cry to;
 No place to call home."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
@ 2007-12-21 15:12   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 15:12 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:36PM -0800, Sunil Mushran wrote:
> Commit 97ac73506c0ba93f30239bb57b4cfc5d73e68a62 in mainline introduces a
> new iop, fallocate(). This patch allows one to build ocfs2 with kernels
> having/not having this change.

Test is reversed (should be #ifndef NO_FALLOCATE).  I'm trying to think
how we could move the #ifdef to a kapi-compat file, but I'm not coming
up with anything.

Joel
 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |    6 ++++++
>  4 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index a27e274..3818cd5 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -65,6 +65,7 @@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@
>  REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
>  SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
>  STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
> +FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index f8b5f20..74337ee 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -242,6 +242,11 @@ OCFS2_CHECK_KERNEL([is_owner_or_cap() in fs.h], fs.h,
>    , cap_compat_header="cap.h", [^#define is_owner_or_cap])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cap_compat_header"
>  
> +FALLOCATE_DEFINED=
> +OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h,
> +  FALLOCATE_DEFINED=yes, , [^.*long (\*fallocate)])
> +AC_SUBST(FALLOCATE_DEFINED)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 5c290b7..6f21960 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -45,6 +45,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
>  EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
>  endif
>  
> +ifdef FALLOCATE_DEFINED
> +EXTRA_CFLAGS += -DFALLOCATE_DEFINED
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index adb10b9..ce18447 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -34,7 +34,9 @@
>  #include <linux/splice.h>
>  #include <linux/mount.h>
>  #include <linux/writeback.h>
> +#ifdef FALLOCATE_DEFINED
>  #include <linux/falloc.h>
> +#endif
>  
>  #define MLOG_MASK_PREFIX ML_INODE
>  #include <cluster/masklog.h>
> @@ -1749,6 +1751,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd,
>  	return __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0);
>  }
>  
> +#ifdef FALLOCATE_DEFINED
>  static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
>  			    loff_t len)
>  {
> @@ -1772,6 +1775,7 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
>  	return __ocfs2_change_file_space(NULL, inode, offset,
>  					 OCFS2_IOC_RESVSP64, &sr, change_size);
>  }
> +#endif
>  
>  static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
>  					 loff_t *ppos,
> @@ -2397,7 +2401,9 @@ const struct inode_operations ocfs2_file_iops = {
>  	.setattr	= ocfs2_setattr,
>  	.getattr	= ocfs2_getattr,
>  	.permission	= ocfs2_permission,
> +#ifdef FALLOCATE_DEFINED
>  	.fallocate	= ocfs2_fallocate,
> +#endif
>  };
>  
>  const struct inode_operations ocfs2_special_file_iops = {
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #80

	"Slow dance"

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
@ 2007-12-21 15:12   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 15:12 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:37PM -0800, Sunil Mushran wrote:
> Commit d6b29d7cee064f28ca097e906de7453541351095 in mainline moves the splice
> structures from pipe_fs_i.h to splice.h. This patch allows one to build
> ocfs2 with kernels having/not having this change.

Test is reversed.

Joel

> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |    2 ++
>  4 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index 3818cd5..788c156 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -66,6 +66,7 @@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@
>  SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
>  STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
>  FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
> +SPLICE_HEADER = @SPLICE_HEADER@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 74337ee..931cf2c 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -247,6 +247,11 @@ OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h,
>    FALLOCATE_DEFINED=yes, , [^.*long (\*fallocate)])
>  AC_SUBST(FALLOCATE_DEFINED)
>  
> +SPLICE_HEADER=
> +OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h,
> +  SPLICE_HEADER=yes, , [^struct splice_desc ])
> +AC_SUBST(SPLICE_HEADER)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 6f21960..3cc7c74 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -49,6 +49,10 @@ ifdef FALLOCATE_DEFINED
>  EXTRA_CFLAGS += -DFALLOCATE_DEFINED
>  endif
>  
> +ifdef SPLICE_HEADER
> +EXTRA_CFLAGS += -DSPLICE_HEADER
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index ce18447..1c179fc 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -31,7 +31,9 @@
>  #include <linux/pagemap.h>
>  #include <linux/uio.h>
>  #include <linux/sched.h>
> +#ifdef SPLICE_HEADER
>  #include <linux/splice.h>
> +#endif
>  #include <linux/mount.h>
>  #include <linux/writeback.h>
>  #ifdef FALLOCATE_DEFINED
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Here's something to think about:  How come you never see a headline
 like ``Psychic Wins Lottery''?"
	- Jay Leno

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
@ 2007-12-21 15:14   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-21 15:14 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:38PM -0800, Sunil Mushran wrote:
> Commit 47ae32d6a54955a041cdc30b06d0bb16e75f68d5 in mainline introduced
> macro MNT_RELATIME to limit atime updates to frequency specified in the
> mount option. This patch allows one to build ocfs2 with kernels having/not
> having this change.
> 
> It should be noted that the functionality will not be available on kernels
> not having the macro as the vfs support will be missing.

> ---
>  Makefile                    |    3 ++-
>  configure.in                |    5 +++++
>  kapi-compat/include/mount.h |    6 ++++++

	Why not relatime.h?

Joel

-- 

"Up and down that road in our worn out shoes,
 Talking bout good things and singing the blues."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks()
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
@ 2007-12-22  3:51   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-22  3:51 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:40PM -0800, Sunil Mushran wrote:
> Commit 0ceb331433e8aad9c5f441a965d7c681f8b9046f in mainline wraps
> common segment checks in generic_segment_checks(). This patch allows
> one to build ocfs2 with kernels having/not having this change.

Let's move this to kapi-compat/include/generic-segment-checks.h and do

ifdef NO_GENERIC_SEGMENT_CHECKS
CPPFLAGS_file.o += -DNO_GENERIC_SEGMENT_CHECKS
endif

like the previous patch.

Joel
 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |   40 ++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 50 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index 788c156..c1ca1d9 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -67,6 +67,7 @@ SU_MUTEX_DEFINED = @SU_MUTEX_DEFINED@
>  STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
>  FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
>  SPLICE_HEADER = @SPLICE_HEADER@
> +GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 472e01a..a311d3f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -262,6 +262,11 @@ OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h,
>    SHOULD_REMOVE_SUID=yes, , [should_remove_suid()])
>  AC_SUBST(SHOULD_REMOVE_SUID)
>  
> +GENERIC_SEGMENT_CHECKS=
> +OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h,
> +  GENERIC_SEGMENT_CHECKS=yes, , [generic_segment_checks()])
> +AC_SUBST(GENERIC_SEGMENT_CHECKS)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index a80a9fc..7434d6d 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -57,6 +57,10 @@ ifdef SHOULD_REMOVE_SUID
>  EXTRA_CFLAGS += -DSHOULD_REMOVE_SUID
>  endif
>  
> +ifdef GENERIC_SEGMENT_CHECKS
> +EXTRA_CFLAGS += -DGENERIC_SEGMENT_CHECKS
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index cee10ae..dd074af 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1809,6 +1809,46 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset,
>  }
>  #endif
>  
> +#ifndef GENERIC_SEGMENT_CHECKS
> +/*
> + * Performs necessary checks before doing a write
> + * @iov:	io vector request
> + * @nr_segs:	number of segments in the iovec
> + * @count:	number of bytes to write
> + * @access_flags: type of access: %VERIFY_READ or %VERIFY_WRITE
> + *
> + * Adjust number of segments and amount of bytes to write (nr_segs should be
> + * properly initialized first). Returns appropriate error code that caller
> + * should return or zero in case that write should be allowed.
> + */
> +int generic_segment_checks(const struct iovec *iov,
> +			unsigned long *nr_segs, size_t *count, int access_flags)
> +{
> +	unsigned long   seg;
> +	size_t cnt = 0;
> +	for (seg = 0; seg < *nr_segs; seg++) {
> +		const struct iovec *iv = &iov[seg];
> +
> +		/*
> +		 * If any segment has a negative length, or the cumulative
> +		 * length ever wraps negative then return -EINVAL.
> +		 */
> +		cnt += iv->iov_len;
> +		if (unlikely((ssize_t)(cnt|iv->iov_len) < 0))
> +			return -EINVAL;
> +		if (access_ok(access_flags, iv->iov_base, iv->iov_len))
> +			continue;
> +		if (seg == 0)
> +			return -EFAULT;
> +		*nr_segs = seg;
> +		cnt -= iv->iov_len;	/* This segment is no good */
> +		break;
> +	}
> +	*count = cnt;
> +	return 0;
> +}
> +#endif
> +
>  static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
>  					 loff_t *ppos,
>  					 size_t count,
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #20

	"Be forgiving of yourself and others."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid()
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
@ 2007-12-22  3:51   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-22  3:51 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:39PM -0800, Sunil Mushran wrote:
> Commits 01de85e057328ecbef36e108673b1e81059d54c1 and
> d23a147bb6e8d467e8df73b6589888717da3b9ce in mainline added and exported
> symbol should_remove_suid(). This patch allows one to build ocfs2 with
> kernels having/not having these changes.
> 

This should go in kapi-compat/include/should-remove-suid.h and play the
same tricks as we did above.

[should-remove-suid.h]
#ifdef NO_SHOULD_REMOVE_SUID
int should_remove_suid()
{
...
}
#endif

[Makefile]
ifdef NO_SHOULD_REMOVE_SUID
CPPFLAGS_file.o += -DNO_SHOULD_REMOVE_SUID
endif

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |   30 ++++++++++++++++++++++++++++++
>  3 files changed, 39 insertions(+), 0 deletions(-)
> 
> diff --git a/configure.in b/configure.in
> index 39fb02b..472e01a 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -257,6 +257,11 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h,
>    , relatime_compat_header="mount.h", [^#define MNT_RELATIME])
>  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header"
>  
> +SHOULD_REMOVE_SUID=
> +OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h,
> +  SHOULD_REMOVE_SUID=yes, , [should_remove_suid()])
> +AC_SUBST(SHOULD_REMOVE_SUID)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 3cc7c74..a80a9fc 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -53,6 +53,10 @@ ifdef SPLICE_HEADER
>  EXTRA_CFLAGS += -DSPLICE_HEADER
>  endif
>  
> +ifdef SHOULD_REMOVE_SUID
> +EXTRA_CFLAGS += -DSHOULD_REMOVE_SUID
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 1c179fc..cee10ae 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -1593,6 +1593,36 @@ out:
>  	return ret;
>  }
>  
> +#ifndef SHOULD_REMOVE_SUID
> +/*
> + * The logic we want is
> + *
> + *	if suid or (sgid and xgrp)
> + *		remove privs
> + */
> +int should_remove_suid(struct dentry *dentry)
> +{
> +	mode_t mode = dentry->d_inode->i_mode;
> +	int kill = 0;
> +
> +	/* suid always must be killed */
> +	if (unlikely(mode & S_ISUID))
> +		kill = ATTR_KILL_SUID;
> +
> +	/*
> +	 * sgid without any exec bits is just a mandatory locking mark; leave
> +	 * it alone.  If some exec bits are set, it's a real sgid; kill it.
> +	 */
> +	if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
> +		kill |= ATTR_KILL_SGID;
> +
> +	if (unlikely(kill && !capable(CAP_FSETID)))
> +		return kill;
> +
> +	return 0;
> +}
> +#endif
> +
>  /*
>   * Parts of this function taken from xfs_change_file_space()
>   */
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"In the beginning, the universe was created. This has made a lot 
 of people very angry, and is generally considered to have been a 
 bad move."
        - Douglas Adams

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault()
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
@ 2007-12-24 13:21   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:21 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:41PM -0800, Sunil Mushran wrote:
> Commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7 in mainline introduces
> vmops->fault() which is used to replace vmops->populate() and vmops->nopage().
> This patch allows one to build ocfs2 with kernels having/not having this
> change.

	While I hate the naked ifdef'd code, I'm not sure what else to
do.  In asmlib, I solve this with a function
"init_asmfs_dir_operations()", called from the __init func.  We could do
that, placing the _populate() and _nopage() functions in kapi-compat,
then providing the init_fault_ops() function...but frankly, I'm not sure
that's a big win.
	I would, however, reverse the test so that it's

+#ifndef NO_FAULT_IN_VMOPS
 	.fault		= ocfs2_fault,
+#else
+	.nopage		= ocfs2_nopage,
+#endif

Joel


> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/mmap.c   |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  4 files changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index c1ca1d9..96dbb7a 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -68,6 +68,7 @@ STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@
>  FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
>  SPLICE_HEADER = @SPLICE_HEADER@
>  GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
> +FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index a311d3f..b8b8001 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -267,6 +267,11 @@ OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h,
>    GENERIC_SEGMENT_CHECKS=yes, , [generic_segment_checks()])
>  AC_SUBST(GENERIC_SEGMENT_CHECKS)
>  
> +FAULT_IN_VMOPS=
> +OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
> +  FAULT_IN_VMOPS=yes, , [^.*int (\*fault)])
> +AC_SUBST(FAULT_IN_VMOPS)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 7434d6d..521888b 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -61,6 +61,10 @@ ifdef GENERIC_SEGMENT_CHECKS
>  EXTRA_CFLAGS += -DGENERIC_SEGMENT_CHECKS
>  endif
>  
> +ifdef FAULT_IN_VMOPS
> +EXTRA_CFLAGS += -DFAULT_IN_VMOPS
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
> index c0483c9..58c67ea 100644
> --- a/fs/ocfs2/mmap.c
> +++ b/fs/ocfs2/mmap.c
> @@ -60,6 +60,7 @@ static inline int ocfs2_vm_op_unblock_sigs(sigset_t *oldset)
>  	return sigprocmask(SIG_SETMASK, oldset, NULL);
>  }
>  
> +#ifdef FAULT_IN_VMOPS
>  static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf)
>  {
>  	sigset_t blocked, oldset;
> @@ -83,6 +84,35 @@ out:
>  	mlog_exit_ptr(vmf->page);
>  	return ret;
>  }
> +#else
> +static struct page *ocfs2_nopage(struct vm_area_struct * area,
> +				 unsigned long address,
> +				 int *type)
> +{
> +	struct page *page = NOPAGE_SIGBUS;
> +	sigset_t blocked, oldset;
> +	int error, ret;
> +
> +	mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address,
> +		   type);
> +
> +	error = ocfs2_vm_op_block_sigs(&blocked, &oldset);
> +	if (error < 0) {
> +		mlog_errno(error);
> +		ret = VM_FAULT_SIGBUS;
> +		goto out;
> +	}
> +
> +	page = filemap_nopage(area, address, type);
> +
> +	error = ocfs2_vm_op_unblock_sigs(&oldset);
> +	if (error < 0)
> +		mlog_errno(error);
> +out:
> +	mlog_exit_ptr(page);
> +	return page;
> +}
> +#endif
>  
>  static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
>  				struct page *page)
> @@ -96,6 +126,9 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
>  	void *fsdata;
>  	loff_t size = i_size_read(inode);
>  
> +	mlog_entry("(inode=0x%p, i_ino=%lu, page=0x%p)\n", inode, inode->i_ino,
> +		   page);
> +
>  	/*
>  	 * Another node might have truncated while we were waiting on
>  	 * cluster locks.
> @@ -147,6 +180,7 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
>  	BUG_ON(ret != len);
>  	ret = 0;
>  out:
> +	mlog_exit(ret);
>  	return ret;
>  }
>  
> @@ -157,6 +191,8 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
>  	sigset_t blocked, oldset;
>  	int ret, ret2;
>  
> +	mlog_entry("(vma=0x%p, page=0x%p)\n", vma, page);
> +
>  	ret = ocfs2_vm_op_block_sigs(&blocked, &oldset);
>  	if (ret < 0) {
>  		mlog_errno(ret);
> @@ -202,11 +238,16 @@ out:
>  	if (ret2 < 0)
>  		mlog_errno(ret2);
>  
> +	mlog_exit(ret);
>  	return ret;
>  }
>  
>  static struct vm_operations_struct ocfs2_file_vm_ops = {
> +#ifdef FAULT_IN_VMOPS
>  	.fault		= ocfs2_fault,
> +#else
> +	.nopage		= ocfs2_nopage,
> +#endif
>  	.page_mkwrite	= ocfs2_page_mkwrite,
>  };
>  
> @@ -214,6 +255,10 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
>  {
>  	int ret = 0, lock_level = 0;
>  
> +	mlog_entry("(file=0x%p, vma=%p, '%.*s')\n", file, vma,
> +		   file->f_path_dentry->d_name.len,
> +		   file->f_path_dentry->d_name.name);
> +
>  	ret = ocfs2_meta_lock_atime(file->f_dentry->d_inode,
>  				    file->f_vfsmnt, &lock_level);
>  	if (ret < 0) {
> @@ -223,7 +268,9 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma)
>  	ocfs2_meta_unlock(file->f_dentry->d_inode, lock_level);
>  out:
>  	vma->vm_ops = &ocfs2_file_vm_ops;
> +#ifdef FAULT_IN_VMOPS
>  	vma->vm_flags |= VM_CAN_NONLINEAR;
> -	return 0;
> +#endif
> +	mlog_exit(ret);
> +	return ret;
>  }
> -
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #20

	"Be forgiving of yourself and others."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
@ 2007-12-24 13:23   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:23 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:43PM -0800, Sunil Mushran wrote:
> Commit c5ef1c42c51b1b5b4a401a6517bdda30933ddbaf in mainline marks struct
> inode_operations in struct inode as a const. This patch allows one to build
> ocfs2 with kernels having/not having this change.

	Please reverse the test.

Joel
 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in        |    1 +
>  configure.in          |    5 +++++
>  fs/ocfs2/Makefile     |    4 ++++
>  fs/ocfs2/dlm/Makefile |    4 ++++
>  fs/ocfs2/dlm/dlmfs.c  |   18 ++++++++++++++++++
>  fs/ocfs2/file.c       |    8 ++++++++
>  fs/ocfs2/file.h       |    5 +++++
>  fs/ocfs2/namei.c      |    4 ++++
>  fs/ocfs2/namei.h      |    4 ++++
>  fs/ocfs2/symlink.c    |    8 ++++++++
>  fs/ocfs2/symlink.h    |    5 +++++
>  11 files changed, 66 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index 938ac53..d4cd518 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -70,6 +70,7 @@ SPLICE_HEADER = @SPLICE_HEADER@
>  GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
>  FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
>  SOP_IS_CONST = @SOP_IS_CONST@
> +IOP_IS_CONST = @IOP_IS_CONST@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 3093542..8a23983 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -277,6 +277,11 @@ OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h,
>    SOP_IS_CONST=yes, , [^.*const struct super_operations.*\*s_op;])
>  AC_SUBST(SOP_IS_CONST)
>  
> +IOP_IS_CONST=
> +OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
> +  IOP_IS_CONST=yes, , [^.*const struct inode_operations.*\*i_op;])
> +AC_SUBST(IOP_IS_CONST)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 4ce2431..97912fd 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -69,6 +69,10 @@ ifdef SOPS_IS_CONST
>  EXTRA_CFLAGS += -DSOPS_IS_CONST
>  endif
>  
> +ifdef IOP_IS_CONST
> +EXTRA_CFLAGS += -DIOP_IS_CONST
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> index 2df255e..c7edb07 100644
> --- a/fs/ocfs2/dlm/Makefile
> +++ b/fs/ocfs2/dlm/Makefile
> @@ -32,6 +32,10 @@ ifdef SOP_IS_CONST
>  EXTRA_CFLAGS += -DSOP_IS_CONST
>  endif
>  
> +ifdef IOP_IS_CONST
> +EXTRA_CFLAGS += -DIOP_IS_CONST
> +endif
> +
>  DLM_SOURCES =			\
>  	dlmast.c		\
>  	dlmconvert.c		\
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index dc5b5a5..9ff18be 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -66,9 +66,15 @@ static const struct super_operations dlmfs_ops;
>  static struct super_operations dlmfs_ops;
>  #endif
>  static const struct file_operations dlmfs_file_operations;
> +#ifdef IOP_IS_CONST
>  static const struct inode_operations dlmfs_dir_inode_operations;
>  static const struct inode_operations dlmfs_root_inode_operations;
>  static const struct inode_operations dlmfs_file_inode_operations;
> +#else
> +static struct inode_operations dlmfs_dir_inode_operations;
> +static struct inode_operations dlmfs_root_inode_operations;
> +static struct inode_operations dlmfs_file_inode_operations;
> +#endif
>  static struct kmem_cache *dlmfs_inode_cache;
>  
>  struct workqueue_struct *user_dlm_worker;
> @@ -547,14 +553,22 @@ static const struct file_operations dlmfs_file_operations = {
>  	.write		= dlmfs_file_write,
>  };
>  
> +#ifdef IOP_IS_CONST
>  static const struct inode_operations dlmfs_dir_inode_operations = {
> +#else
> +static struct inode_operations dlmfs_dir_inode_operations = {
> +#endif
>  	.create		= dlmfs_create,
>  	.lookup		= simple_lookup,
>  	.unlink		= dlmfs_unlink,
>  };
>  
>  /* this way we can restrict mkdir to only the toplevel of the fs. */
> +#ifdef IOP_IS_CONST
>  static const struct inode_operations dlmfs_root_inode_operations = {
> +#else
> +static struct inode_operations dlmfs_root_inode_operations = {
> +#endif
>  	.lookup		= simple_lookup,
>  	.mkdir		= dlmfs_mkdir,
>  	.rmdir		= simple_rmdir,
> @@ -572,7 +586,11 @@ static struct super_operations dlmfs_ops = {
>  	.drop_inode	= generic_delete_inode,
>  };
>  
> +#ifdef IOP_IS_CONST
>  static const struct inode_operations dlmfs_file_inode_operations = {
> +#else
> +static struct inode_operations dlmfs_file_inode_operations = {
> +#endif
>  	.getattr	= simple_getattr,
>  };
>  
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index dd074af..e74730d 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2469,7 +2469,11 @@ bail:
>  	return ret;
>  }
>  
> +#ifdef IOP_IS_CONST
>  const struct inode_operations ocfs2_file_iops = {
> +#else
> +struct inode_operations ocfs2_file_iops = {
> +#endif
>  	.setattr	= ocfs2_setattr,
>  	.getattr	= ocfs2_getattr,
>  	.permission	= ocfs2_permission,
> @@ -2478,7 +2482,11 @@ const struct inode_operations ocfs2_file_iops = {
>  #endif
>  };
>  
> +#ifdef IOP_IS_CONST
>  const struct inode_operations ocfs2_special_file_iops = {
> +#else
> +struct inode_operations ocfs2_special_file_iops = {
> +#endif
>  	.setattr	= ocfs2_setattr,
>  	.getattr	= ocfs2_getattr,
>  	.permission	= ocfs2_permission,
> diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
> index 066f14a..7bf6f9d 100644
> --- a/fs/ocfs2/file.h
> +++ b/fs/ocfs2/file.h
> @@ -28,8 +28,13 @@
>  
>  extern const struct file_operations ocfs2_fops;
>  extern const struct file_operations ocfs2_dops;
> +#ifdef IOP_IS_CONST
>  extern const struct inode_operations ocfs2_file_iops;
>  extern const struct inode_operations ocfs2_special_file_iops;
> +#else
> +extern struct inode_operations ocfs2_file_iops;
> +extern struct inode_operations ocfs2_special_file_iops;
> +#endif
>  struct ocfs2_alloc_context;
>  
>  enum ocfs2_alloc_restarted {
> diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
> index 7292590..5ddcc23 100644
> --- a/fs/ocfs2/namei.c
> +++ b/fs/ocfs2/namei.c
> @@ -1898,7 +1898,11 @@ leave:
>  	return status;
>  }
>  
> +#ifdef IOP_IS_CONST
>  const struct inode_operations ocfs2_dir_iops = {
> +#else
> +struct inode_operations ocfs2_dir_iops = {
> +#endif
>  	.create		= ocfs2_create,
>  	.lookup		= ocfs2_lookup,
>  	.link		= ocfs2_link,
> diff --git a/fs/ocfs2/namei.h b/fs/ocfs2/namei.h
> index 688aef6..66e1dee 100644
> --- a/fs/ocfs2/namei.h
> +++ b/fs/ocfs2/namei.h
> @@ -26,7 +26,11 @@
>  #ifndef OCFS2_NAMEI_H
>  #define OCFS2_NAMEI_H
>  
> +#ifdef IOP_IS_CONST
>  extern const struct inode_operations ocfs2_dir_iops;
> +#else
> +extern struct inode_operations ocfs2_dir_iops;
> +#endif
>  
>  struct dentry *ocfs2_get_parent(struct dentry *child);
>  
> diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
> index 7134007..d77c1d4 100644
> --- a/fs/ocfs2/symlink.c
> +++ b/fs/ocfs2/symlink.c
> @@ -163,12 +163,20 @@ bail:
>  	return ERR_PTR(status);
>  }
>  
> +#ifdef IOP_IS_CONST
>  const struct inode_operations ocfs2_symlink_inode_operations = {
> +#else
> +struct inode_operations ocfs2_symlink_inode_operations = {
> +#endif
>  	.readlink	= page_readlink,
>  	.follow_link	= ocfs2_follow_link,
>  	.getattr	= ocfs2_getattr,
>  };
> +#ifdef IOP_IS_CONST
>  const struct inode_operations ocfs2_fast_symlink_inode_operations = {
> +#else
> +struct inode_operations ocfs2_fast_symlink_inode_operations = {
> +#endif
>  	.readlink	= ocfs2_readlink,
>  	.follow_link	= ocfs2_follow_link,
>  	.getattr	= ocfs2_getattr,
> diff --git a/fs/ocfs2/symlink.h b/fs/ocfs2/symlink.h
> index 65a6c9c..fd0ed70 100644
> --- a/fs/ocfs2/symlink.h
> +++ b/fs/ocfs2/symlink.h
> @@ -26,8 +26,13 @@
>  #ifndef OCFS2_SYMLINK_H
>  #define OCFS2_SYMLINK_H
>  
> +#ifdef IOP_IS_CONST
>  extern const struct inode_operations ocfs2_symlink_inode_operations;
>  extern const struct inode_operations ocfs2_fast_symlink_inode_operations;
> +#else
> +extern struct inode_operations ocfs2_symlink_inode_operations;
> +extern struct inode_operations ocfs2_fast_symlink_inode_operations;
> +#endif
>  
>  /*
>   * Test whether an inode is a fast symlink.
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Life's Little Instruction Book #226

	"When someone hugs you, let them be the first to let go."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
@ 2007-12-24 13:23   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:23 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:42PM -0800, Sunil Mushran wrote:
> Commit ee9b6d61a2a43c5952eb43283f8db284a4e70b8a in mainline marks
> struct super_operations as a const in struct super_block. This patch
> allows one to build with kernels having/not having this change.

	Can we reverse this test as well?

Joel

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in        |    1 +
>  configure.in          |    5 +++++
>  fs/ocfs2/Makefile     |    4 ++++
>  fs/ocfs2/dlm/Makefile |    4 ++++
>  fs/ocfs2/dlm/dlmfs.c  |    8 ++++++++
>  fs/ocfs2/super.c      |    4 ++++
>  6 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index 96dbb7a..938ac53 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -69,6 +69,7 @@ FALLOCATE_DEFINED = @FALLOCATE_DEFINED@
>  SPLICE_HEADER = @SPLICE_HEADER@
>  GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
>  FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
> +SOP_IS_CONST = @SOP_IS_CONST@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index b8b8001..3093542 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -272,6 +272,11 @@ OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h,
>    FAULT_IN_VMOPS=yes, , [^.*int (\*fault)])
>  AC_SUBST(FAULT_IN_VMOPS)
>  
> +SOP_IS_CONST=
> +OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h,
> +  SOP_IS_CONST=yes, , [^.*const struct super_operations.*\*s_op;])
> +AC_SUBST(SOP_IS_CONST)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 521888b..4ce2431 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -65,6 +65,10 @@ ifdef FAULT_IN_VMOPS
>  EXTRA_CFLAGS += -DFAULT_IN_VMOPS
>  endif
>  
> +ifdef SOPS_IS_CONST
> +EXTRA_CFLAGS += -DSOPS_IS_CONST
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile
> index 5101f9c..2df255e 100644
> --- a/fs/ocfs2/dlm/Makefile
> +++ b/fs/ocfs2/dlm/Makefile
> @@ -28,6 +28,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
>  EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
>  endif
>  
> +ifdef SOP_IS_CONST
> +EXTRA_CFLAGS += -DSOP_IS_CONST
> +endif
> +
>  DLM_SOURCES =			\
>  	dlmast.c		\
>  	dlmconvert.c		\
> diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
> index dc43923..dc5b5a5 100644
> --- a/fs/ocfs2/dlm/dlmfs.c
> +++ b/fs/ocfs2/dlm/dlmfs.c
> @@ -60,7 +60,11 @@
>  #define MLOG_MASK_PREFIX ML_DLMFS
>  #include "cluster/masklog.h"
>  
> +#ifdef SOP_IS_CONST
>  static const struct super_operations dlmfs_ops;
> +#else
> +static struct super_operations dlmfs_ops;
> +#endif
>  static const struct file_operations dlmfs_file_operations;
>  static const struct inode_operations dlmfs_dir_inode_operations;
>  static const struct inode_operations dlmfs_root_inode_operations;
> @@ -556,7 +560,11 @@ static const struct inode_operations dlmfs_root_inode_operations = {
>  	.rmdir		= simple_rmdir,
>  };
>  
> +#ifdef SOP_IS_CONST
>  static const struct super_operations dlmfs_ops = {
> +#else
> +static struct super_operations dlmfs_ops = {
> +#endif
>  	.statfs		= simple_statfs,
>  	.alloc_inode	= dlmfs_alloc_inode,
>  	.destroy_inode	= dlmfs_destroy_inode,
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index f5c424d..176ae35 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -124,7 +124,11 @@ static void ocfs2_write_super(struct super_block *sb);
>  static struct inode *ocfs2_alloc_inode(struct super_block *sb);
>  static void ocfs2_destroy_inode(struct inode *inode);
>  
> +#ifdef SOP_IS_CONST
>  static const struct super_operations ocfs2_sops = {
> +#else
> +static struct super_operations ocfs2_sops = {
> +#endif
>  	.statfs		= ocfs2_statfs,
>  	.alloc_inode	= ocfs2_alloc_inode,
>  	.destroy_inode	= ocfs2_destroy_inode,
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"The question of whether computers can think is just like the question
 of whether submarines can swim."
	- Edsger W. Dijkstra

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
  2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
@ 2007-12-24 13:28   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:28 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:44PM -0800, Sunil Mushran wrote:
> Commit 027445c37282bc1ed26add45e573ad2d3e4860a5 in mainline vectorized
> fileops aio_read() and aio_write(). This patch allows one to build ocfs2
> with kernels having/not having this change.

	I can't help but wonder if we couldn't write this as a wrapper
over the vectorized version.  That is, rather than defining two
different ocfs2_aio_read() prototypes, just do

#ifdef NO_VECTORIZED_AIO
static ocfs2_aio_read_novec(...)
{
    struct iovec { ... };
    return ocfs2_aio_read(..., &iovec, ...);
}
#endif

Something like that.
	Also, please reverse the test.

Joel

> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |   33 +++++++++++++++++++++++++++++----
>  4 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index d4cd518..f99b9f4 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -71,6 +71,7 @@ GENERIC_SEGMENT_CHECKS = @GENERIC_SEGMENT_CHECKS@
>  FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
>  SOP_IS_CONST = @SOP_IS_CONST@
>  IOP_IS_CONST = @IOP_IS_CONST@
> +VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 8a23983..741dfdb 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -282,6 +282,11 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
>    IOP_IS_CONST=yes, , [^.*const struct inode_operations.*\*i_op;])
>  AC_SUBST(IOP_IS_CONST)
>  
> +VECTORED_FILE_AIO=
> +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
> +  VECTORED_FILE_AIO=yes, , [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
> +AC_SUBST(VECTORED_FILE_AIO)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 97912fd..80fd6c6 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -73,6 +73,10 @@ ifdef IOP_IS_CONST
>  EXTRA_CFLAGS += -DIOP_IS_CONST
>  endif
>  
> +ifdef VECTORED_FILE_AIO
> +EXTRA_CFLAGS += -DVECTORED_FILE_AIO
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index e74730d..1ee2a79 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2087,10 +2087,19 @@ out:
>  	return total ? total : ret;
>  }
>  
> +#ifdef VECTORED_FILE_AIO
> +#define iocb_ki_left	iocb->ki_left
>  static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
>  				    const struct iovec *iov,
>  				    unsigned long nr_segs,
>  				    loff_t pos)
> +#else
> +#define iocb_ki_left	buflen
> +static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
> +				    const char __user *buf,
> +				    size_t buflen,
> +				    loff_t pos)
> +#endif
>  {
>  	int ret, direct_io, appending, rw_level, have_alloc_sem  = 0;
>  	int can_do_direct, sync = 0;
> @@ -2100,13 +2109,19 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
>  	loff_t *ppos = &iocb->ki_pos;
>  	struct file *file = iocb->ki_filp;
>  	struct inode *inode = file->f_path_dentry->d_inode;
> +#ifndef VECTORED_FILE_AIO
> +	struct iovec iov_local = { .iov_base = (void __user *)buf,
> +				   .iov_len  = buflen };
> +	const struct iovec *iov = &iov_local;
> +	unsigned long nr_segs = 1;
> +#endif
>  
>  	mlog_entry("(0x%p, %u, '%.*s')\n", file,
>  		   (unsigned int)nr_segs,
>  		   file->f_path_dentry->d_name.len,
>  		   file->f_path_dentry->d_name.name);
>  
> -	if (iocb->ki_left == 0)
> +	if (iocb_ki_left == 0)
>  		return 0;
>  
>  	ret = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
> @@ -2139,7 +2154,7 @@ relock:
>  
>  	can_do_direct = direct_io;
>  	ret = ocfs2_prepare_inode_for_write(file->f_path_dentry, ppos,
> -					    iocb->ki_left, appending,
> +					    iocb_ki_left, appending,
>  					    &can_do_direct);
>  	if (ret < 0) {
>  		mlog_errno(ret);
> @@ -2392,17 +2407,23 @@ bail:
>  	return ret;
>  }
>  
> +#ifdef VECTORED_FILE_AIO
>  static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>  				   const struct iovec *iov,
>  				   unsigned long nr_segs,
>  				   loff_t pos)
> +#else
> +static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> +				   char __user *buf,
> +				   size_t buflen,
> +				   loff_t pos)
> +#endif
>  {
>  	int ret = 0, rw_level = -1, have_alloc_sem = 0, lock_level = 0;
>  	struct file *filp = iocb->ki_filp;
>  	struct inode *inode = filp->f_path_dentry->d_inode;
>  
> -	mlog_entry("(0x%p, %u, '%.*s')\n", filp,
> -		   (unsigned int)nr_segs,
> +	mlog_entry("(0x%p, '%.*s')\n", filp,
>  		   filp->f_path_dentry->d_name.len,
>  		   filp->f_path_dentry->d_name.name);
>  
> @@ -2446,7 +2467,11 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
>  	}
>  	ocfs2_meta_unlock(inode, lock_level);
>  
> +#ifdef VECTORED_FILE_AIO
>  	ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos);
> +#else
> +	ret = generic_file_aio_read(iocb, buf, buflen, iocb->ki_pos);
> +#endif
>  	if (ret == -EINVAL)
>  		mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
>  
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"There is no sincerer love than the love of food."  
         - George Bernard Shaw 

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe()
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
@ 2007-12-24 13:30   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:30 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:45PM -0800, Sunil Mushran wrote:
> Commit c66ab6fa705e1b2887a6d9246b798bdc526839e2 in mainline introduced
> __splice_from_pipe(). This patch allows one to build ocfs2 with kernels
> having/not having this change.

	Can we reverse the test?

Joel

> Note: This patch disables splice io for kernels not providing
> __splice_from_pipe(). We will later add a patch to enable splice
> io with such kernels too.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/file.c   |    4 ++++
>  4 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index f99b9f4..89c1e94 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -72,6 +72,7 @@ FAULT_IN_VMOPS = @FAULT_IN_VMOPS@
>  SOP_IS_CONST = @SOP_IS_CONST@
>  IOP_IS_CONST = @IOP_IS_CONST@
>  VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
> +SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 741dfdb..021b925 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -287,6 +287,11 @@ OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], f
>    VECTORED_FILE_AIO=yes, , [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
>  AC_SUBST(VECTORED_FILE_AIO)
>  
> +SPLICE_FROM_PIPE=
> +OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h,
> +  SPLICE_FROM_PIPE=yes, , [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*])
> +AC_SUBST(SPLICE_FROM_PIPE)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index 80fd6c6..e4296d3 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -77,6 +77,10 @@ ifdef VECTORED_FILE_AIO
>  EXTRA_CFLAGS += -DVECTORED_FILE_AIO
>  endif
>  
> +ifdef SPLICE_FROM_PIPE
> +EXTRA_CFLAGS += -DSPLICE_FROM_PIPE
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index 1ee2a79..e022c97 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -2258,6 +2258,7 @@ out_sems:
>  	return written ? written : ret;
>  }
>  
> +#ifdef SPLICE_FROM_PIPE
>  static int ocfs2_splice_write_actor(struct pipe_inode_info *pipe,
>  				    struct pipe_buffer *buf,
>  				    struct splice_desc *sd)
> @@ -2406,6 +2407,7 @@ bail:
>  	mlog_exit(ret);
>  	return ret;
>  }
> +#endif
>  
>  #ifdef VECTORED_FILE_AIO
>  static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
> @@ -2530,8 +2532,10 @@ const struct file_operations ocfs2_fops = {
>  #ifdef CONFIG_COMPAT
>  	.compat_ioctl   = ocfs2_compat_ioctl,
>  #endif
> +#ifdef SPLICE_FROM_PIPE
>  	.splice_read	= ocfs2_file_splice_read,
>  	.splice_write	= ocfs2_file_splice_write,
> +#endif
>  };
>  
>  const struct file_operations ocfs2_dops = {
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

"Maybe the time has drawn the faces I recall.
 But things in this life change very slowly,
 If they ever change at all."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
@ 2007-12-24 13:30   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:30 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:46PM -0800, Sunil Mushran wrote:
> Commit 6712ecf8f648118c3363c142196418f89a510b90 in mainline
> dropped 'size' argument from bi_end_io(). This patch allows
> one to build ocfs2 with kernels having/not having this change.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>

Signed-off-by: Joel Becker <joel.becker@oracle.com>

> ---
>  Config.make.in               |    1 +
>  configure.in                 |    5 +++++
>  fs/ocfs2/cluster/Makefile    |    4 ++++
>  fs/ocfs2/cluster/heartbeat.c |    9 +++++++++
>  4 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index 89c1e94..f22473c 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -73,6 +73,7 @@ SOP_IS_CONST = @SOP_IS_CONST@
>  IOP_IS_CONST = @IOP_IS_CONST@
>  VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
>  SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
> +OLD_BIO_END_IO = @OLD_BIO_END_IO@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 021b925..60fd68f 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -292,6 +292,11 @@ OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h,
>    SPLICE_FROM_PIPE=yes, , [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*])
>  AC_SUBST(SPLICE_FROM_PIPE)
>  
> +OLD_BIO_END_IO=
> +OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
> +  OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
> +AC_SUBST(OLD_BIO_END_IO)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile
> index ff57486..ccbddd0 100644
> --- a/fs/ocfs2/cluster/Makefile
> +++ b/fs/ocfs2/cluster/Makefile
> @@ -29,6 +29,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED
>  EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED
>  endif
>  
> +ifdef OLD_BIO_END_IO
> +EXTRA_CFLAGS += -DOLD_BIO_END_IO
> +endif
> +
>  SOURCES =			\
>  	heartbeat.c		\
>  	masklog.c		\
> diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> index e610665..b41a7fb 100644
> --- a/fs/ocfs2/cluster/heartbeat.c
> +++ b/fs/ocfs2/cluster/heartbeat.c
> @@ -216,8 +216,14 @@ static void o2hb_wait_on_io(struct o2hb_region *reg,
>  	wait_for_completion(&wc->wc_io_complete);
>  }
>  
> +#ifdef OLD_BIO_END_IO
> +static int o2hb_bio_end_io(struct bio *bio,
> +			   unsigned int bytes_done,
> +			   int error)
> +#else
>  static void o2hb_bio_end_io(struct bio *bio,
>  			   int error)
> +#endif
>  {
>  	struct o2hb_bio_wait_ctxt *wc = bio->bi_private;
>  
> @@ -228,6 +234,9 @@ static void o2hb_bio_end_io(struct bio *bio,
>  
>  	o2hb_bio_wait_dec(wc, 1);
>  	bio_put(bio);
> +#ifdef OLD_BIO_END_IO
> +	return 0;
> +#endif
>  }
>  
>  /* Setup a Bio to cover I/O against num_slots slots starting at
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

Viro's Razor:
	Any race condition, no matter how unlikely, will occur just
	often enough to bite you.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h
  2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
@ 2007-12-24 13:32   ` Joel Becker
  0 siblings, 0 replies; 60+ messages in thread
From: Joel Becker @ 2007-12-24 13:32 UTC (permalink / raw)
  To: ocfs2-devel

On Thu, Dec 20, 2007 at 03:29:47PM -0800, Sunil Mushran wrote:
> Commit a569425512253992cc64ebf8b6d00a62f986db3e in mainline
> moved struct export_operation from fs.h to exportfs.h. This
> patch allows one to build ocfs2 with kernels having/not having
> this change.

	Please reverse the test.

Joel

> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  Config.make.in    |    1 +
>  configure.in      |    5 +++++
>  fs/ocfs2/Makefile |    4 ++++
>  fs/ocfs2/export.h |    2 ++
>  4 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/Config.make.in b/Config.make.in
> index f22473c..90e4472 100644
> --- a/Config.make.in
> +++ b/Config.make.in
> @@ -74,6 +74,7 @@ IOP_IS_CONST = @IOP_IS_CONST@
>  VECTORED_FILE_AIO = @VECTORED_FILE_AIO@
>  SPLICE_FROM_PIPE = @SPLICE_FROM_PIPE@
>  OLD_BIO_END_IO = @OLD_BIO_END_IO@
> +EXPORTFS_HEADER = @EXPORTFS_HEADER@
>  
>  OCFS_DEBUG = @OCFS_DEBUG@
>  
> diff --git a/configure.in b/configure.in
> index 60fd68f..d4f3c97 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -297,6 +297,11 @@ OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
>    OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
>  AC_SUBST(OLD_BIO_END_IO)
>  
> +EXPORTFS_HEADER=
> +OCFS2_CHECK_KERNEL([exportfs.h], exportfs.h,
> +  EXPORTFS_HEADER=yes, , [^struct export_operations {])
> +AC_SUBST(EXPORTFS_HEADER)
> +
>  # using -include has two advantages:
>  #  the source doesn't need to know to include compat headers
>  #  the compat header file names don't go through the search path
> diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
> index e4296d3..8f8458e 100644
> --- a/fs/ocfs2/Makefile
> +++ b/fs/ocfs2/Makefile
> @@ -81,6 +81,10 @@ ifdef SPLICE_FROM_PIPE
>  EXTRA_CFLAGS += -DSPLICE_FROM_PIPE
>  endif
>  
> +ifdef EXPORTFS_HEADER
> +EXTRA_CFLAGS += -DEXPORTFS_HEADER
> +endif
> +
>  #
>  # Since SUBDIRS means something to kbuild, define them safely.  Do not
>  # include trailing slashes.
> diff --git a/fs/ocfs2/export.h b/fs/ocfs2/export.h
> index e08bed9..f81edb5 100644
> --- a/fs/ocfs2/export.h
> +++ b/fs/ocfs2/export.h
> @@ -26,7 +26,9 @@
>  #ifndef OCFS2_EXPORT_H
>  #define OCFS2_EXPORT_H
>  
> +#ifdef EXPORTFS_HEADER
>  #include <linux/exportfs.h>
> +#endif
>  
>  extern struct export_operations ocfs2_export_ops;
>  
> -- 
> 1.5.2.5
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

 print STDOUT q
 Just another Perl hacker,
 unless $spring
	- Larry Wall

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2007-12-24 13:32 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-20 15:30 [Ocfs2-devel] ocfs2 1.4: A new beginning Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 20/30] ocfs2: Handle splice.h Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 07/30] ocfs2: Handle struct f_path in struct file Sunil Mushran
2007-12-21  1:09   ` Joel Becker
2007-12-21  9:41     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 30/30] ocfs2: Handle missing exportfs.h Sunil Mushran
2007-12-24 13:32   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 09/30] ocfs2: Add helper inc_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 04/30] ocfs2: Handle macro uninitialized_var Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21  9:39     ` Sunil Mushran
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 23/30] ocfs2: Handle missing export generic_segment_checks() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 29/30] ocfs2: Handle older prototype of bi_end_io_t Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 15/30] ocfs2: Handle different prototypes of register_sysctl_table() Sunil Mushran
2007-12-21 11:59   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 17/30] ocfs2: Handle the removal of struct subsystem Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 22/30] ocfs2: Handles missing export should_remove_suid() Sunil Mushran
2007-12-22  3:51   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 24/30] ocfs2: Handle missing vmops->fault() Sunil Mushran
2007-12-24 13:21   ` Joel Becker
2007-12-20 15:29 ` [Ocfs2-devel] [PATCH 28/30] ocfs2: Handle missing __splice_from_pipe() Sunil Mushran
2007-12-24 13:30   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 18/30] ocfs2: Handle missing macro is_owner_or_cap() Sunil Mushran
2007-12-21 15:10   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 11/30] ocfs2: Handle missing dtors in kmem_cache_create() Sunil Mushran
2007-12-21 11:47   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 26/30] ocfs2: Handle missing const struct inode_operations in struct inode Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 05/30] ocfs2: Handle macro zero_user_page() Sunil Mushran
2007-12-21  0:56   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 14/30] ocfs2: Handles configfs_depend_item() and configfs_undepend_item() Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 13/30] ocfs2: Handle enum value FS_OCFS2 Sunil Mushran
2007-12-21 11:57   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 08/30] ocfs2: Define enum umh_wait Sunil Mushran
2007-12-21 11:37   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 03/30] ocfs2: Handle workqueue changes Sunil Mushran
2007-12-21  0:54   ` Joel Becker
2007-12-21 11:51     ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 25/30] ocfs2: Handle missing const s_op in struct super_block Sunil Mushran
2007-12-24 13:23   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 10/30] ocfs2: Add helper drop_nlink Sunil Mushran
2007-12-21 11:39   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 19/30] ocfs2: Handle missing iop->fallocate() Sunil Mushran
2007-12-21 15:12   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 21/30] ocfs2: Handle missing macro MNT_RELATIME Sunil Mushran
2007-12-21 15:14   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 16/30] ocfs2: Handle su_mutex in struct configfs_subsystem Sunil Mushran
2007-12-21 12:00   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Sunil Mushran
2007-12-24 13:28   ` Joel Becker
2007-12-20 15:30 ` [Ocfs2-devel] [PATCH 12/30] ocfs2: Define FS_RENAME_DOES_D_MOVE Sunil Mushran
2007-12-21 11:55   ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.