OCFS2 1.4 Repository Base (3rd attempt)
This has all the changes requested by Joel. If you have been reviewing the patches in the last drop, note that only 5 patches have changed since that drop. The list of changed patches follows:
[PATCH 06/30] ocfs2: Include do_sync_mapping_range() from mainline Remove #ifdef from alloc.c
[PATCH 09/30] ocfs2: Define enum umh_wait
Rename kapi header
[PATCH 13/30] ocfs2: Define FS_RENAME_DOES_D_MOVE
Rename kapi header
[PATCH 18/30] ocfs2: Handle the removal of struct subsystem Reworked to reduce changes in fs code.
[PATCH 27/30] ocfs2: Handle missing vectorized fileops aio_read() and aio_write() Changes (from file.c) moved to a kapi header. Lot cleaner.
Sunil
PATCH 3/30 ocfs2: Handle workqueue changes
Commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c in mainline makes changes to workqueue.h. This patch allows one to build ocfs2 with kernels having/not having that change.
--- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/alloc.c | 11 +++--- fs/ocfs2/cluster/Makefile | 4 ++ fs/ocfs2/cluster/heartbeat.c | 9 ++--- fs/ocfs2/cluster/quorum.c | 4 +- fs/ocfs2/cluster/tcp.c | 66 +++++++++++++++++++------------------- 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 ++++++++++ 18 files changed, 94 insertions(+), 58 deletions(-) create mode 100644 kapi-compat/include/workqueue.h
Config.make.in +2 -0
@@ -57,6 +57,8 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ +NO_DELAYED_WORK = @NO_DELAYED_WORK@ + OCFS_DEBUG = @OCFS_DEBUG@ ifneq ($(OCFS_DEBUG),)
Makefile +2 -1
@@ -8,7 +8,8 @@ SUBDIRS = fs vendor LINUX_INCLUDE_FILES = -KAPI_COMPAT_FILES = +KAPI_COMPAT_FILES = \ + kapi-compat/include/workqueue.h PATCH_FILES =
configure.in +6 -0
@@ -156,6 +156,12 @@ case "$kversion" in ;; esac +NO_DELAYED_WORK= +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, + , NO_DELAYED_WORK=yes, [^struct delayed_work]) +AC_SUBST(NO_DELAYED_WORK) +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
fs/ocfs2/Makefile +4 -0
@@ -25,6 +25,10 @@ EXTRA_CFLAGS += -DOCFS2_CDSL EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK +EXTRA_CFLAGS += -DNO_DELAYED_WORK +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/alloc.c +5 -6
@@ -4752,12 +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, - osb_truncate_log_wq.work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + osb_truncate_log_wq.work);mlog_entry_void ();
@@ -4989,8 +4988,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;
fs/ocfs2/cluster/Makefile +4 -0
@@ -13,6 +13,10 @@ endif EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK +EXTRA_CFLAGS += -DNO_DELAYED_WORK +endif + SOURCES = \ heartbeat.c \ masklog.c \
fs/ocfs2/cluster/heartbeat.c +4 -5
@@ -156,11 +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, - hr_write_timeout_work.work); + struct o2hb_region *reg = work_to_object(work, struct o2hb_region, + hr_write_timeout_work.work); mlog(ML_ERROR, "Heartbeat write timeout to device %s after %u " "milliseconds\n", reg->hr_dev_name,
@@ -1306,7 +1305,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, goto out; } -INIT_DELAYED_WORK (®->hr_write_timeout_work, o2hb_write_timeout); +KAPI_INIT_DELAYED_WORK (®->hr_write_timeout_work, o2hb_write_timeout, reg);/* * A node is considered live after it has beat LIVE_THRESHOLD
fs/ocfs2/cluster/quorum.c +2 -2
@@ -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 )
fs/ocfs2/cluster/tcp.c +33 -33
151 lines not on this page · raw message
fs/ocfs2/dlm/Makefile +4 -0
@@ -16,6 +16,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK +EXTRA_CFLAGS += -DNO_DELAYED_WORK +endif + DLM_SOURCES = \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmcommon.h +1 -1
@@ -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 ;
fs/ocfs2/dlm/dlmdomain.c +1 -1
@@ -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 ;
fs/ocfs2/dlm/dlmrecovery.c +1 -1
@@ -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);
fs/ocfs2/dlm/userdlm.c +4 -4
@@ -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); + work_to_object(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,
fs/ocfs2/journal.c +2 -2
@@ -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); + work_to_object(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;
fs/ocfs2/journal.h +1 -1
@@ -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:
fs/ocfs2/super.c +1 -1
@@ -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 */
kapi-compat/include/workqueue.h new file +17 -0
@@ -0,0 +1,17 @@ +#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
Signature · 1 line
1.5.2.5
PATCH 3/30 ocfs2: Handle workqueue changes
Quoted 6 lines · Sunil Mushran
Commit
52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9cin mainline makes changes toworkqueue.h. This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
Though I'd have preferred a more descriptive name than "NO_DELAYED_WORK", which makes me think that we got rid of the entire delayed work mechanism. Maybe "NO_DELAYED_WORK_STRUCT"
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 4/30 ocfs2: Handle macro uninitialized_var
In reply to Sunil MushranCommit 9490991482a2091a828d997adbc088e24c310a4d in mainline introduced macro uninitialized_var(). This patch allows one to build ocfs2 with kernels having/not having that change.
--- 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
Makefile +2 -1
@@ -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 =
configure.in +5 -0
@@ -162,6 +162,11 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, AC_SUBST(NO_DELAYED_WORK) 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
kapi-compat/include/compiler.h new file +10 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 4/30 ocfs2: Handle macro uninitialized_var
Quoted 6 lines · Sunil Mushran
Commit
9490991482a2091a828d997adbc088e24c310a4din mainline introduced macrouninitialized_var(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 5/30 ocfs2: Handle macro zero_user_page()
In reply to Sunil MushranCommit 01f2705daf5a36208e69d7cf95db9c330f843af6 in mainline introduced macro zero_user_page(). This patch allows one to build ocfs2 with kernels having/not having that change.
--- 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
Makefile +2 -1
@@ -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 =
configure.in +5 -0
@@ -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
kapi-compat/include/highmem.h new file +22 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 5/30 ocfs2: Handle macro zero_user_page()
Quoted 6 lines · Sunil Mushran
Commit
01f2705daf5a36208e69d7cf95db9c330f843af6in mainline introduced macrozero_user_page(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 6/30 ocfs2: Include do_sync_mapping_range() from mainline
In reply to Sunil MushranCommit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 introduced export symbol do_sync_mapping_range(). This patch allows one to build ocfs2 with kernels having/not having that change.
--- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 ++ fs/ocfs2/Makefile | 4 + kapi-compat/include/sync_mapping_range.h | 103 ++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sync_mapping_range.h
Config.make.in +2 -0
@@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ +NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ + OCFS_DEBUG = @OCFS_DEBUG@ ifneq ($(OCFS_DEBUG),)
Makefile +2 -1
@@ -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/sync_mapping_range.h PATCH_FILES =
configure.in +6 -0
@@ -172,6 +172,12 @@ 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" +NO_SYNC_MAPPING_RANGE= +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, + , NO_SYNC_MAPPING_RANGE=yes, [do_sync_mapping_range(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping_range.h" +AC_SUBST(NO_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
fs/ocfs2/Makefile +4 -0
@@ -29,6 +29,10 @@ ifdef NO_DELAYED_WORK EXTRA_CFLAGS += -DNO_DELAYED_WORK endif +ifdef NO_SYNC_MAPPING_RANGE +CFLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
kapi-compat/include/sync_mapping_range.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 6/30 ocfs2: Include do_sync_mapping_range() from mainline
Quoted 170 lines · Sunil Mushran
Commit
5b04aa3a64f854244bc40a6f528176ed50b5c4f6introduced export symboldo_sync_mapping_range(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>--- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 ++ fs/ocfs2/Makefile | 4 + kapi-compat/include/sync_mapping_range.h | 103 ++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sync_mapping_range.hConfig.make.in +2
-0@@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ +NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ + OCFS_DEBUG = @OCFS_DEBUG@ ifneq ($(OCFS_DEBUG),)Makefile +2
-1@@ -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/sync_mapping_range.h PATCH_FILES =configure.in +6
-0@@ -172,6 +172,12 @@ 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" +NO_SYNC_MAPPING_RANGE= +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, + , NO_SYNC_MAPPING_RANGE=yes, [do_sync_mapping_range(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping_range.h" +AC_SUBST(NO_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 pathfs/ocfs2/Makefile +4
-0@@ -29,6 +29,10 @@ ifdef NO_DELAYED_WORK EXTRA_CFLAGS += -DNO_DELAYED_WORK endif +ifdef NO_SYNC_MAPPING_RANGE +CFLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.kapi-compat/include/sync_mapping_range.h new file +90
-0@@ -0,0 +1,103 @@ +#ifndef KAPI_SYNC_MAPPING_RANGE_H +#define KAPI_SYNC_MAPPING_RANGE_H + +#ifdef NO_SYNC_MAPPING_RANGE + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/slab.h> +#include <linux/highmem.h> +#include <linux/swap.h> +#include <linux/writeback.h> +#include <linux/mpage.h> +#include <linux/pagemap.h> + + +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;
kapi-compat/include/sync_mapping_range.h line 100
Quoted 10 lines
kapi-compat/include/sync_mapping_range.h new file +10
-0+ } + +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; +}
Shouldn't the function definitions be in a C file? It's pretty heavy for a header....
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 6/30 ocfs2: Include do_sync_mapping_range() from mainline
FLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE
It's only included with alloc.c.
Quoted 193 lines · Mark Fasheh
Quoted 171 lines · Sunil Mushran
Commit
5b04aa3a64f854244bc40a6f528176ed50b5c4f6introduced export symboldo_sync_mapping_range(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>--- Config.make.in | 2 + Makefile | 3 +- configure.in | 6 ++ fs/ocfs2/Makefile | 4 + kapi-compat/include/sync_mapping_range.h | 103 ++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sync_mapping_range.hConfig.make.in +2
-0@@ -59,6 +59,8 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ +NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ + OCFS_DEBUG = @OCFS_DEBUG@ ifneq ($(OCFS_DEBUG),)Makefile +2
-1@@ -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/sync_mapping_range.h PATCH_FILES =configure.in +6
-0@@ -172,6 +172,12 @@ 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" +NO_SYNC_MAPPING_RANGE= +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, + , NO_SYNC_MAPPING_RANGE=yes, [do_sync_mapping_range(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping_range.h" +AC_SUBST(NO_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 pathfs/ocfs2/Makefile +4
-0@@ -29,6 +29,10 @@ ifdef NO_DELAYED_WORK EXTRA_CFLAGS += -DNO_DELAYED_WORK endif +ifdef NO_SYNC_MAPPING_RANGE +CFLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.kapi-compat/include/sync_mapping_range.h new file +90
-0@@ -0,0 +1,103 @@ +#ifndef KAPI_SYNC_MAPPING_RANGE_H +#define KAPI_SYNC_MAPPING_RANGE_H + +#ifdef NO_SYNC_MAPPING_RANGE + +#include <linux/fs.h> +#include <linux/types.h> +#include <linux/slab.h> +#include <linux/highmem.h> +#include <linux/swap.h> +#include <linux/writeback.h> +#include <linux/mpage.h> +#include <linux/pagemap.h> + + +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;kapi-compat/include/sync_mapping_range.h line 100
Quoted 10 lines
kapi-compat/include/sync_mapping_range.h new file +10
-0+ } + +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; +}Shouldn't the function definitions be in a C file? It's pretty heavy for a header....
--Mark--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 6/30 ocfs2: Include do_sync_mapping_range() from mainline
Quoted 3 lines · Sunil Mushran
FLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE
It's only included with
alloc.c.
And if we ever need to call it from another file?
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 7/30 ocfs2: Handle missing vmops->fault()
In reply to Sunil MushranCommit 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.
--- Config.make.in | 1 + configure.in | 5 ++++ fs/ocfs2/Makefile | 4 +++ fs/ocfs2/mmap.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 61 insertions(+), 4 deletions(-)
Config.make.in +1 -0
@@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ +NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -178,6 +178,11 @@ OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping_range.h" AC_SUBST(NO_SYNC_MAPPING_RANGE) +NO_FAULT_IN_VMOPS= +OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h, + , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)]) +AC_SUBST(NO_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
fs/ocfs2/Makefile +4 -0
@@ -33,6 +33,10 @@ ifdef NO_SYNC_MAPPING_RANGE CFLAGS_alloc.o += -DNO_SYNC_MAPPING_RANGE endif +ifdef NO_FAULT_IN_VMOPS +EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/mmap.c +51 -4
108 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 7/30 ocfs2: Handle missing vmops->fault()
Quoted 7 lines · Sunil Mushran
Commit
54cb8821de07f2ffcd28c380ce9b93d5784b40d7in mainline introducesvmops->fault()which is used to replacevmops->populate()andvmops->nopage(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 8/30 ocfs2: Handle struct f_path in struct file
In reply to Sunil MushranCommit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 in mainline added struct path in struct file. This patch allows one to build ocfs2 with kernels having/not having that change.
--- 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/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 4 ++-- fs/ocfs2/file.c | 38 +++++++++++++++++++------------------- fs/ocfs2/ioctl.c | 2 +- fs/ocfs2/mmap.c | 10 +++++----- kapi-compat/include/fpath.h | 10 ++++++++++ 12 files changed, 57 insertions(+), 31 deletions(-) create mode 100644 kapi-compat/include/fpath.h
Config.make.in +1 -0
@@ -61,6 +61,7 @@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ +NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -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/sync_mapping_range.h + kapi-compat/include/sync_mapping_range.h \ + kapi-compat/include/fpath.h PATCH_FILES =
configure.in +6 -0
@@ -183,6 +183,12 @@ OCFS2_CHECK_KERNEL([fault() in struct vm_operations_struct in mm.h], mm.h, , NO_FAULT_IN_VMOPS=yes, [^.*int (\*fault)]) AC_SUBST(NO_FAULT_IN_VMOPS) +NO_F_PATH_IN_STRUCT_FILE= +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, + , NO_F_PATH_IN_STRUCT_FILE=yes, [f_path]) +AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) +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
fs/ocfs2/Makefile +4 -0
@@ -37,6 +37,10 @@ ifdef NO_FAULT_IN_VMOPS EXTRA_CFLAGS += -DNO_FAULT_IN_VMOPS endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/aops.c +2 -2
@@ -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 = filp_dentry(iocb->ki_filp)->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 =filp_dentry (file)->d_inode->i_mapping->host;int ret;mlog_entry_void ();
fs/ocfs2/dir.c +1 -1
@@ -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_dentry (filp)->d_inode;int lock_level =0 ; mlog_entry("dirino=%llu\n",
fs/ocfs2/dlm/Makefile +4 -0
@@ -20,6 +20,10 @@ ifdef NO_DELAYED_WORK EXTRA_CFLAGS += -DNO_DELAYED_WORK endif +ifdef NO_F_PATH_IN_STRUCT_FILE +EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE +endif + DLM_SOURCES = \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmfs.c +2 -2
@@ -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_dentry (filp)->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_dentry (filp)->d_inode;mlog (0 ,"inode %lu, count = %zu, *ppos = %llu\n" , inode->i_ino, count, *ppos);
fs/ocfs2/file.c +19 -19
@@ -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); +filp_dentry (file)->d_name.len,filp_dentry (file)->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); +filp_dentry (file)->d_name.len, +filp_dentry (file)->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 (filp_dentry (file))) { 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 =filp_dentry (file)->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 =filp_dentry (file)->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); +filp_dentry (file)->d_name.len, +filp_dentry (file)->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 (filp_dentry (file), 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 =filp_dentry (out)->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); +filp_dentry (out)->d_name.len, +filp_dentry (out)->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 (filp_dentry (out), 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 =filp_dentry (in)->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); +filp_dentry (in)->d_name.len, +filp_dentry (in)->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_dentry (filp)->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_dentry (filp)->d_name.len, +filp_dentry (filp)->d_name.name);if (!inode) { ret = -EINVAL ;
fs/ocfs2/ioctl.c +1 -1
@@ -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 =filp_dentry (file)->d_inode;int ret;switch (cmd) {
fs/ocfs2/mmap.c +5 -5
@@ -186,7 +186,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 =filp_dentry (vma->vm_file)->d_inode;struct buffer_head *di_bh =NULL ;sigset_t blocked, oldset;int ret, ret2;
@@ -256,16 +256,16 @@ 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); +filp_dentry (file)->d_name.len, +filp_dentry (file)->d_name.name); - ret =ocfs2_meta_lock_atime (file->f_path.dentry->d_inode, + ret =ocfs2_meta_lock_atime (filp_dentry (file)->d_inode, file->f_vfsmnt, &lock_level);if (ret <0 ) {mlog_errno (ret); goto out; } -ocfs2_meta_unlock (file->f_path.dentry->d_inode, lock_level); +ocfs2_meta_unlock (filp_dentry (file)->d_inode, lock_level); out: vma->vm_ops = &ocfs2_file_vm_ops;#ifndef NO_FAULT_IN_VMOPS
kapi-compat/include/fpath.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef KAPI_FPATH_H +#define KAPI_FPATH_H + +#ifdef NO_F_PATH_IN_STRUCT_FILE +# define filp_dentry (i) (i)->f_dentry +#else +# define filp_dentry (i) (i)->f_path.dentry +#endif + +#endif
Signature · 1 line
1.5.2.5
PATCH 8/30 ocfs2: Handle struct f_path in struct file
Quoted 6 lines · Sunil Mushran
Commit
0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05in 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 <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 9/30 ocfs2: Define enum umh_wait
In reply to Sunil MushranCommit 86313c488a6848b7ec2ba04e74f25f79dd32a0b7 in mainline introduced enum umh_wait. This patch allows one to build ocfs2 with kernels having/ not having that change.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/umh_wait.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/umh_wait.h
Makefile +2 -1
@@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/compiler.h \ kapi-compat/include/highmem.h \ kapi-compat/include/sync_mapping_range.h \ - kapi-compat/include/fpath.h + kapi-compat/include/fpath.h \ + kapi-compat/include/umh_wait.h PATCH_FILES =
configure.in +5 -0
@@ -189,6 +189,11 @@ OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) 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="umh_wait.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
kapi-compat/include/umh_wait.h new file +10 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 9/30 ocfs2: Define enum umh_wait
Quoted 6 lines · Sunil Mushran
Commit
86313c488a6848b7ec2ba04e74f25f79dd32a0b7in mainline introduced enumumh_wait. This patch allows one to build ocfs2 with kernels having/ not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 10/30 ocfs2: Add helper inc_nlink
In reply to Sunil MushranCommit d8c76e6f45c111c32a4b3e50a2adc9210737b0d8 in mainline introduced helper inc_nlink(). This patch allows one to build ocfs2 with kernels having/not having that change.
--- 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
Makefile +2 -1
@@ -14,7 +14,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/highmem.h \ kapi-compat/include/sync_mapping_range.h \ kapi-compat/include/fpath.h \ - kapi-compat/include/umh_wait.h + kapi-compat/include/umh_wait.h \ + kapi-compat/include/inc_nlink.h PATCH_FILES =
configure.in +5 -0
@@ -194,6 +194,11 @@ OCFS2_CHECK_KERNEL([enum umh_wait in kmod.h], kmod.h, , kmod_compat_header="umh_wait.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
kapi-compat/include/inc_nlink.h new file +19 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 10/30 ocfs2: Add helper inc_nlink
Quoted 6 lines · Sunil Mushran
Commit
d8c76e6f45c111c32a4b3e50a2adc9210737b0d8in mainline introduced helperinc_nlink(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 11/30 ocfs2: Add helper drop_nlink
In reply to Sunil MushranCommit 9a53c3a783c2fa9b969628e65695c11c3e51e673 in mainline added helper drop_nlink(). This patch allows one to build ocfs2 with kernels having/not having that change.
--- 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
Makefile +2 -1
@@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/sync_mapping_range.h \ kapi-compat/include/fpath.h \ kapi-compat/include/umh_wait.h \ - kapi-compat/include/inc_nlink.h + kapi-compat/include/inc_nlink.h \ + kapi-compat/include/drop_nlink.h PATCH_FILES =
configure.in +5 -0
@@ -199,6 +199,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
kapi-compat/include/drop_nlink.h new file +22 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 11/30 ocfs2: Add helper drop_nlink
Quoted 6 lines · Sunil Mushran
Commit
9a53c3a783c2fa9b969628e65695c11c3e51e673in mainline added helperdrop_nlink(). This patch allows one to build ocfs2 with kernels having/not having that change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 12/30 ocfs2: Handle missing dtors in kmem_cache_create()
In reply to Sunil MushranCommit 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac removed the dtor arg from kmem_cache_create(). This patch allows one to build ocfs2 with kernels having/not having this change.
--- 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
Config.make.in +1 -0
@@ -62,6 +62,7 @@ NO_DELAYED_WORK = @NO_DELAYED_WORK@ NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ +KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -16,7 +16,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fpath.h \ kapi-compat/include/umh_wait.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 =
configure.in +6 -0
@@ -204,6 +204,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
fs/ocfs2/Makefile +4 -0
@@ -41,6 +41,10 @@ ifdef NO_F_PATH_IN_STRUCT_FILE EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE 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.
fs/ocfs2/dlm/Makefile +4 -0
@@ -24,6 +24,10 @@ ifdef NO_F_PATH_IN_STRUCT_FILE EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE endif +ifdef KMEM_CACHE_CREATE_DTOR +EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR +endif + DLM_SOURCES = \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmfs.c +1 -1
@@ -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),
fs/ocfs2/dlm/dlmmaster.c +1 -1
@@ -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 );
fs/ocfs2/super.c +1 -1
@@ -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|
fs/ocfs2/uptodate.c +1 -1
@@ -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)
kapi-compat/include/slab.h new file +10 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 12/30 ocfs2: Handle missing dtors in kmem_cache_create()
Quoted 6 lines · Sunil Mushran
Commit
20c2df83d25c6a95affe6157a4c9cac4cf5ffaacremoved the dtor arg fromkmem_cache_create(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 13/30 ocfs2: Define FS_RENAME_DOES_D_MOVE
In reply to Sunil MushranCommit 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.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/fs_rename_does_d_move.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/fs_rename_does_d_move.h
Makefile +2 -1
@@ -17,7 +17,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/umh_wait.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/fs_rename_does_d_move.h PATCH_FILES =
configure.in +5 -0
@@ -210,6 +210,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="fs_rename_does_d_move.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
kapi-compat/include/fs_rename_does_d_move.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef KAPI_FSTYPE_H +#define KAPI_FSTYPE_H + +#define FS_RENAME_DOES_D_MOVE FS_ODD_RENAME + +#endif
Signature · 1 line
1.5.2.5
PATCH 14/30 ocfs2: Handle enum value FS_OCFS2
In reply to Sunil MushranCommit 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.
--- 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
Makefile +2 -1
@@ -18,7 +18,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/inc_nlink.h \ kapi-compat/include/drop_nlink.h \ kapi-compat/include/slab.h \ - kapi-compat/include/fs_rename_does_d_move.h + kapi-compat/include/fs_rename_does_d_move.h \ + kapi-compat/include/sysctl.h PATCH_FILES =
configure.in +5 -0
@@ -215,6 +215,11 @@ OCFS2_CHECK_KERNEL([flag FS_RENAME_DOES_D_MOVE in fs.h], fs.h, , fstype_compat_header="fs_rename_does_d_move.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
kapi-compat/include/sysctl.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef KAPI_SYSCTL_H +#define KAPI_SYSCTL_H + +/* CTL_FS names: */ +enum { +FS_OCFS2 =988 ,/* ocfs2 */ +}; + +#endif
Signature · 1 line
1.5.2.5
PATCH 14/30 ocfs2: Handle enum value FS_OCFS2
Quoted 6 lines · Sunil Mushran
Commit
0e03036c97b70b2602f7dedaa3a223ed7563c2c9in mainline registers ocfs2 sysctl (FS_OCFS2) number underCTL_FS. This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 15/30 ocfs2: Handles configfs_depend_item() and configfs_undepend_item()
In reply to Sunil MushranCommit 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.
--- 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
Makefile +2 -1
@@ -19,7 +19,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/drop_nlink.h \ kapi-compat/include/slab.h \ kapi-compat/include/fs_rename_does_d_move.h \ - kapi-compat/include/sysctl.h + kapi-compat/include/sysctl.h \ + kapi-compat/include/configfs.h PATCH_FILES =
configure.in +5 -0
@@ -220,6 +220,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
kapi-compat/include/configfs.h new file +7 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 15/30 ocfs2: Handles configfs_depend_item() and configfs_undepend_item()
Quoted 7 lines · Sunil Mushran
Commit
631d1febab8e546e3bb800bdfe2c212b8adf87dein mainline introduces two new calls in configfs,configfs_depend_item()andconfigfs_undepend_item(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 16/30 ocfs2: Handle different prototypes of register_sysctl_table()
In reply to Sunil MushranCommit 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.
--- 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
Config.make.in +1 -0
@@ -63,6 +63,7 @@ NO_SYNC_MAPPING_RANGE = @NO_SYNC_MAPPING_RANGE@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ +REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -20,7 +20,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/slab.h \ kapi-compat/include/fs_rename_does_d_move.h \ kapi-compat/include/sysctl.h \ - kapi-compat/include/configfs.h + kapi-compat/include/configfs.h \ + kapi-compat/include/register_sysctl.h PATCH_FILES =
configure.in +6 -0
@@ -225,6 +225,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
fs/ocfs2/cluster/Makefile +4 -0
@@ -17,6 +17,10 @@ ifdef NO_DELAYED_WORK EXTRA_CFLAGS += -DNO_DELAYED_WORK endif +ifdef REGISTER_SYSCTL_TWO_ARGS +EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS +endif + SOURCES = \ heartbeat.c \ masklog.c \
fs/ocfs2/cluster/nodemanager.c +1 -1
@@ -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. */
kapi-compat/include/register_sysctl.h new file +10 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 16/30 ocfs2: Handle different prototypes of register_sysctl_table()
Quoted 6 lines · Sunil Mushran
Commit
0b4d414714f0d2f922d39424b0c5c82ad900a381in mainline removes theinsert_at_headargument fromregister_sysctl_table(). This patch allows building ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 17/30 ocfs2: Handle su_mutex in struct configfs_subsystem
In reply to Sunil MushranCommit 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.
--- 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
Config.make.in +1 -0
@@ -64,6 +64,7 @@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@ +NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -21,7 +21,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/fs_rename_does_d_move.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 =
configure.in +6 -0
@@ -231,6 +231,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" +NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM= +OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], configfs.h, + , NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM=yes, [su_mutex]) +AC_SUBST(NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM) +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
fs/ocfs2/cluster/Makefile +4 -0
@@ -21,6 +21,10 @@ ifdef REGISTER_SYSCTL_TWO_ARGS EXTRA_CFLAGS += -DREGISTER_SYSCTL_TWO_ARGS endif +ifdef NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM +EXTRA_CFLAGS += -DNO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM +endif + SOURCES = \ heartbeat.c \ masklog.c \
fs/ocfs2/cluster/nodemanager.c +1 -1
@@ -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); +init_su_mutex (&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);
kapi-compat/include/su_mutex.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef KAPI_SUMUTEX_H +#define KAPI_SUMUTEX_H + +#ifdef NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM +# include "asm/semaphore.h" +# define init_su_mutex init_MUTEX +# define su_mutex su_sem +#else +# define init_su_mutex mutex_init +# define su_mutex su_mutex +#endif + +#endif
Signature · 1 line
1.5.2.5
PATCH 17/30 ocfs2: Handle su_mutex in struct configfs_subsystem
Quoted 6 lines · Sunil Mushran
Commit
e6bd07aee739566803425acdbf5cdb29919164e1in mainline changed a semaphore into a mutex in structconfigfs_subsystem. This patch allows building ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 18/30 ocfs2: Handle the removal of struct subsystem
In reply to Sunil MushranCommit 823bccfc4002296ba88c3ad0f049e1abd8108d30 in mainline removes struct subsystem from kobject.h. This patch allows one to build ocfs2 with kernels having/not having this change.
--- 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/sys.c | 8 ++++---- fs/ocfs2/dlm/Makefile | 4 ++++ kapi-compat/include/kobject.h | 12 ++++++++++++ 9 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 kapi-compat/include/kobject.h
Config.make.in +1 -0
@@ -65,6 +65,7 @@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@ NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM@ +STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -22,7 +22,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 =
configure.in +6 -0
@@ -237,6 +237,12 @@ OCFS2_CHECK_KERNEL([su_mutex in struct configfs_subsystem in configfs.h], config AC_SUBST(NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM) 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
fs/ocfs2/Makefile +4 -0
@@ -45,6 +45,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.
fs/ocfs2/cluster/Makefile +4 -0
@@ -25,6 +25,10 @@ ifdef NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM EXTRA_CFLAGS += -DNO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM endif +ifdef STRUCT_SUBSYSTEM_DEFINED +EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED +endif + SOURCES = \ heartbeat.c \ masklog.c \
fs/ocfs2/cluster/masklog.c +1 -1
@@ -156,7 +156,7 @@ int mlog_sys_init(struct kset *o2cb_subsys) } mlog_attr_ptrs[i] =NULL ; -kobj_set_kset_s (&mlog_kset, *o2cb_subsys); +kobj_set_kset_s (&mlog_kset,kapi_subsystem (o2cb_subsys));return kset_register (&mlog_kset); }
fs/ocfs2/cluster/sys.c +4 -4
@@ -80,7 +80,7 @@ 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); +BUG_ON (sbs !=kapi_subsystem_kset (&o2cb_subsys));if (o2cb_attr->show)return o2cb_attr->show (buffer);
@@ -94,7 +94,7 @@ o2cb_store(struct kobject * kobj, struct attribute * attr,struct o2cb_attribute *o2cb_attr =to_o2cb_attr (attr);struct kset *sbs =to_kset (kobj); -BUG_ON (sbs != &o2cb_subsys); +BUG_ON (sbs !=kapi_subsystem_kset (&o2cb_subsys));if (o2cb_attr->store)return o2cb_attr->store (buffer, count);
@@ -111,12 +111,12 @@ int o2cb_sys_init(void) {int ret; - o2cb_subsys.kobj.ktype = &o2cb_subsys_type; +kapi_subsystem_kset (&o2cb_subsys)->kobj.ktype = &o2cb_subsys_type; ret =subsystem_register (&o2cb_subsys);if (ret)return ret; - ret =mlog_sys_init (&o2cb_subsys); + ret =mlog_sys_init (kapi_subsystem_kset (&o2cb_subsys));if (ret)subsystem_unregister (&o2cb_subsys);return ret;
fs/ocfs2/dlm/Makefile +4 -0
@@ -28,6 +28,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 \
kapi-compat/include/kobject.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef KAPI_KOBJECT_H +#define KAPI_KOBJECT_H + +#ifdef STRUCT_SUBSYSTEM_DEFINED +# define kapi_subsystem_kset (_sub) (&((_sub)->kset)) +# define kapi_subsystem (_sub) *((struct subsystem *)(_sub)) +#else +# define kapi_subsystem_kset (_sub) (_sub) +# define kapi_subsystem (_sub) (_sub) +#endif + +#endif
Signature · 1 line
1.5.2.5
PATCH 19/30 ocfs2: Handle missing macro is_owner_or_cap()
In reply to Sunil MushranCommit 3bd858ab1c451725c07a805dcb315215dc85b86e in mainline introduces helper macro is_owner_or_cap(). This patch allows one to build ocfs2 with kernels having/not having this change.
--- 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
Makefile +2 -1
@@ -23,7 +23,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 =
configure.in +5 -0
@@ -243,6 +243,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
kapi-compat/include/cap.h new file +7 -0
@@ -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
Signature · 1 line
1.5.2.5
PATCH 19/30 ocfs2: Handle missing macro is_owner_or_cap()
Quoted 6 lines · Sunil Mushran
Commit
3bd858ab1c451725c07a805dcb315215dc85b86ein mainline introduces helper macrois_owner_or_cap(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 20/30 ocfs2: Handle missing iop->fallocate()
In reply to Sunil MushranCommit 97ac73506c0ba93f30239bb57b4cfc5d73e68a62 in mainline introduces a new iop, fallocate(). This patch allows one to build ocfs2 with kernels having/not having this change.
--- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 6 ++++++ 4 files changed, 16 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -66,6 +66,7 @@ KMEM_CACHE_CREATE_DTOR = @KMEM_CACHE_CREATE_DTOR@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@ NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM@ STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ +NO_FALLOCATE = @NO_FALLOCATE@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -248,6 +248,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" +NO_FALLOCATE= +OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h, + , NO_FALLOCATE=yes, [^.*long (\*fallocate)]) +AC_SUBST(NO_FALLOCATE) + # 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
fs/ocfs2/Makefile +4 -0
@@ -49,6 +49,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED endif +ifdef NO_FALLOCATE +EXTRA_CFLAGS += -DNO_FALLOCATE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +6 -0
@@ -34,7 +34,9 @@#include <linux/splice.h> #include <linux/mount.h> #include <linux/writeback.h> +#ifndef NO_FALLOCATE #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 ); } +#ifndef NO_FALLOCATE 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, +#ifndef NO_FALLOCATE .fallocate = ocfs2_fallocate, +#endif };const struct inode_operations ocfs2_special_file_iops = {
Signature · 1 line
1.5.2.5
PATCH 20/30 ocfs2: Handle missing iop->fallocate()
Quoted 6 lines · Sunil Mushran
Commit
97ac73506c0ba93f30239bb57b4cfc5d73e68a62in 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 <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 21/30 ocfs2: Handle splice.h
In reply to Sunil MushranCommit 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.
--- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 2 ++ 4 files changed, 12 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -67,6 +67,7 @@ REGISTER_SYSCTL_TWO_ARGS = @REGISTER_SYSCTL_TWO_ARGS@ NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM@ STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ NO_FALLOCATE = @NO_FALLOCATE@ +NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -253,6 +253,11 @@ OCFS2_CHECK_KERNEL([fallocate() in fs.h], fs.h, , NO_FALLOCATE=yes, [^.*long (\*fallocate)]) AC_SUBST(NO_FALLOCATE) +NO_SPLICE_HEADER= +OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h, + , NO_SPLICE_HEADER=yes, [^struct splice_desc ]) +AC_SUBST(NO_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
fs/ocfs2/Makefile +4 -0
@@ -53,6 +53,10 @@ ifdef NO_FALLOCATE EXTRA_CFLAGS += -DNO_FALLOCATE endif +ifdef NO_SPLICE_HEADER +EXTRA_CFLAGS += -DNO_SPLICE_HEADER +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +2 -0
@@ -31,7 +31,9 @@#include <linux/pagemap.h> #include <linux/uio.h> #include <linux/sched.h> +#ifndef NO_SPLICE_HEADER #include <linux/splice.h> +#endif #include <linux/mount.h> #include <linux/writeback.h> #ifndef NO_FALLOCATE
Signature · 1 line
1.5.2.5
PATCH 21/30 ocfs2: Handle splice.h
Quoted 6 lines · Sunil Mushran
Commit
d6b29d7cee064f28ca097e906de7453541351095in mainline moves the splice structures frompipe_fs_i.htosplice.h. This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 22/30 ocfs2: Handle missing macro MNT_RELATIME
In reply to Sunil MushranCommit 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/relatime.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/relatime.h
Makefile +2 -1
@@ -24,7 +24,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/relatime.h PATCH_FILES =
configure.in +5 -0
@@ -258,6 +258,11 @@ OCFS2_CHECK_KERNEL([struct splice_desc in splice.h], splice.h, , NO_SPLICE_HEADER=yes, [^struct splice_desc ]) AC_SUBST(NO_SPLICE_HEADER) +relatime_compat_header="" +OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, + , relatime_compat_header="relatime.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
kapi-compat/include/relatime.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef KAPI_RELATIME_H +#define KAPI_RELATIME_H + +#define MNT_RELATIME 0x20 + +#endif
Signature · 1 line
1.5.2.5
PATCH 22/30 ocfs2: Handle missing macro MNT_RELATIME
Quoted 7 lines · Sunil Mushran
Commit
47ae32d6a54955a041cdc30b06d0bb16e75f68d5in mainline introduced macroMNT_RELATIMEto 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.
I bet we can conditionally define our own relatime option in here though - Ocfs2 doesn't really make use of most of the vfs support, so it's not necessary.
By the way, relatime is the default on the latest fedora releases, so people _do_ want this feature.
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 23/30 ocfs2: Handles missing export should_remove_suid()
In reply to Sunil MushranCommits 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.
--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++++ fs/ocfs2/Makefile | 4 +++ kapi-compat/include/should_remove_suid.h | 37 ++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/should_remove_suid.h
Config.make.in +1 -0
@@ -68,6 +68,7 @@ NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSY STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ NO_FALLOCATE = @NO_FALLOCATE@ NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ +NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -25,7 +25,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/su_mutex.h \ kapi-compat/include/kobject.h \ kapi-compat/include/cap.h \ - kapi-compat/include/relatime.h + kapi-compat/include/relatime.h \ + kapi-compat/include/should_remove_suid.h PATCH_FILES =
configure.in +6 -0
@@ -263,6 +263,12 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, , relatime_compat_header="relatime.h", [^#define MNT_RELATIME]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" +NO_SHOULD_REMOVE_SUID= +OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h, + , NO_SHOULD_REMOVE_SUID=yes, [should_remove_suid()]) +AC_SUBST(NO_SHOULD_REMOVE_SUID) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS should_remove_suid.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
fs/ocfs2/Makefile +4 -0
@@ -57,6 +57,10 @@ ifdef NO_SPLICE_HEADER EXTRA_CFLAGS += -DNO_SPLICE_HEADER endif +ifdef NO_SHOULD_REMOVE_SUID +CFLAGS_file.o += -DNO_SHOULD_REMOVE_SUID +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
kapi-compat/include/should_remove_suid.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef KAP_SHOULD_REMOVE_SUID_H +#define KAP_SHOULD_REMOVE_SUID_H + +#ifdef NO_SHOULD_REMOVE_SUID + +#include <linux/fs.h> + +/* +* 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 + +#endif
Signature · 1 line
1.5.2.5
PATCH 23/30 ocfs2: Handles missing export should_remove_suid()
Quoted 84 lines · Sunil Mushran
Commits
01de85e057328ecbef36e108673b1e81059d54c1andd23a147bb6e8d467e8df73b6589888717da3b9cein mainline added and exported symbolshould_remove_suid(). This patch allows one to build ocfs2 with kernels having/not having these changes.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++++ fs/ocfs2/Makefile | 4 +++ kapi-compat/include/should_remove_suid.h | 37 ++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/should_remove_suid.hConfig.make.in +1
-0@@ -68,6 +68,7 @@ NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSYSTEM = @NO_SU_MUTEX_IN_STRUCT_CONFIGFS_SUBSY STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ NO_FALLOCATE = @NO_FALLOCATE@ NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ +NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ OCFS_DEBUG = @OCFS_DEBUG@Makefile +2
-1@@ -25,7 +25,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/su_mutex.h \ kapi-compat/include/kobject.h \ kapi-compat/include/cap.h \ - kapi-compat/include/relatime.h + kapi-compat/include/relatime.h \ + kapi-compat/include/should_remove_suid.h PATCH_FILES =configure.in +6
-0@@ -263,6 +263,12 @@ OCFS2_CHECK_KERNEL([MNT_RELATIME in mount.h], mount.h, , relatime_compat_header="relatime.h", [^#define MNT_RELATIME]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $relatime_compat_header" +NO_SHOULD_REMOVE_SUID= +OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h, + , NO_SHOULD_REMOVE_SUID=yes, [should_remove_suid()]) +AC_SUBST(NO_SHOULD_REMOVE_SUID) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS should_remove_suid.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 pathfs/ocfs2/Makefile +4
-0@@ -57,6 +57,10 @@ ifdef NO_SPLICE_HEADER EXTRA_CFLAGS += -DNO_SPLICE_HEADER endif +ifdef NO_SHOULD_REMOVE_SUID +CFLAGS_file.o += -DNO_SHOULD_REMOVE_SUID +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.kapi-compat/include/should_remove_suid.h new file +4
-0@@ -0,0 +1,37 @@ +#ifndef KAP_SHOULD_REMOVE_SUID_H +#define KAP_SHOULD_REMOVE_SUID_H + +#ifdef NO_SHOULD_REMOVE_SUID
kapi-compat/include/should_remove_suid.h line 14
Quoted 10 lines
kapi-compat/include/should_remove_suid.h new file +10
-0+ +#include <linux/fs.h> + +/* +* The logic we want is +* +* if suid or (sgid and xgrp) +* remove privs +*/ +int should_remove_suid (struct dentry *dentry)
Why not just make this should be static inline and include it if generally needed?
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 24/30 ocfs2: Handle missing export generic_segment_checks()
In reply to Sunil MushranCommit 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.
--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ kapi-compat/include/generic_segment_checks.h | 49 ++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/generic_segment_checks.h
Config.make.in +1 -0
@@ -69,6 +69,7 @@ STRUCT_SUBSYSTEM_DEFINED = @STRUCT_SUBSYSTEM_DEFINED@ NO_FALLOCATE = @NO_FALLOCATE@ NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ +NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -26,7 +26,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/kobject.h \ kapi-compat/include/cap.h \ kapi-compat/include/relatime.h \ - kapi-compat/include/should_remove_suid.h + kapi-compat/include/should_remove_suid.h \ + kapi-compat/include/generic_segment_checks.h PATCH_FILES =
configure.in +6 -0
@@ -269,6 +269,12 @@ OCFS2_CHECK_KERNEL([should_remove_suid() in fs.h], fs.h, AC_SUBST(NO_SHOULD_REMOVE_SUID) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS should_remove_suid.h" +NO_GENERIC_SEGMENT_CHECKS= +OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h, + , NO_GENERIC_SEGMENT_CHECKS=yes, [generic_segment_checks()]) +AC_SUBST(NO_GENERIC_SEGMENT_CHECKS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS generic_segment_checks.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
fs/ocfs2/Makefile +4 -0
@@ -61,6 +61,10 @@ ifdef NO_SHOULD_REMOVE_SUID CFLAGS_file.o += -DNO_SHOULD_REMOVE_SUID endif +ifdef NO_GENERIC_SEGMENT_CHECKS +CFLAGS_file.o += -DNO_GENERIC_SEGMENT_CHECKS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
kapi-compat/include/generic_segment_checks.h new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 25/30 ocfs2: Handle missing const s_op in struct super_block
In reply to Sunil MushranCommit 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.
--- 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(-)
Config.make.in +1 -0
@@ -70,6 +70,7 @@ NO_FALLOCATE = @NO_FALLOCATE@ NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ +SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -275,6 +275,11 @@ OCFS2_CHECK_KERNEL([generic_segment_checks() in fs.h], fs.h, AC_SUBST(NO_GENERIC_SEGMENT_CHECKS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS generic_segment_checks.h" +SOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h, + , SOP_IS_NOT_CONST=yes, [^.*const struct super_operations.*\*s_op;]) +AC_SUBST(SOP_IS_NOT_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
fs/ocfs2/Makefile +4 -0
@@ -65,6 +65,10 @@ ifdef NO_GENERIC_SEGMENT_CHECKS CFLAGS_file.o += -DNO_GENERIC_SEGMENT_CHECKS endif +ifdef SOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/dlm/Makefile +4 -0
@@ -32,6 +32,10 @@ ifdef STRUCT_SUBSYSTEM_DEFINED EXTRA_CFLAGS += -DSTRUCT_SUBSYSTEM_DEFINED endif +ifdef SOP_IS_NOT_CONST +EXTRA_CFLAGS += -DSOP_IS_NOT_CONST +endif + DLM_SOURCES = \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmfs.c +8 -0
@@ -60,7 +60,11 @@#define MLOG_MASK_PREFIX ML_DLMFS#include "cluster/masklog.h" +#ifdef SOP_IS_NOT_CONST +static struct super_operations dlmfs_ops; +#else static const 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_NOT_CONST +static struct super_operations dlmfs_ops = { +#else static const struct super_operations dlmfs_ops = { +#endif .statfs = simple_statfs, .alloc_inode = dlmfs_alloc_inode, .destroy_inode = dlmfs_destroy_inode,
fs/ocfs2/super.c +4 -0
@@ -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_NOT_CONST +static struct super_operations ocfs2_sops = { +#else static const struct super_operations ocfs2_sops = { +#endif .statfs = ocfs2_statfs, .alloc_inode = ocfs2_alloc_inode, .destroy_inode = ocfs2_destroy_inode,
Signature · 1 line
1.5.2.5
PATCH 25/30 ocfs2: Handle missing const s_op in struct super_block
Quoted 6 lines · Sunil Mushran
Commit
ee9b6d61a2a43c5952eb43283f8db284a4e70b8ain mainline marks structsuper_operationsas a const in structsuper_block. This patch allows one to build with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 26/30 ocfs2: Handle missing const struct inode_operations in struct inode
In reply to Sunil MushranCommit 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.
--- 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(-)
Config.make.in +1 -0
@@ -71,6 +71,7 @@ NO_SPLICE_HEADER = @NO_SPLICE_HEADER@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ +IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -280,6 +280,11 @@ OCFS2_CHECK_KERNEL([s_op declared as const in struct super_block in fs.h], fs.h, , SOP_IS_NOT_CONST=yes, [^.*const struct super_operations.*\*s_op;]) AC_SUBST(SOP_IS_NOT_CONST) +IOP_IS_NOT_CONST= +OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h, + , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;]) +AC_SUBST(IOP_IS_NOT_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
fs/ocfs2/Makefile +4 -0
@@ -69,6 +69,10 @@ ifdef SOP_IS_NOT_CONST EXTRA_CFLAGS += -DSOP_IS_NOT_CONST endif +ifdef IOP_IS_NOT_CONST +EXTRA_CFLAGS += -DIOP_IS_NOT_CONST +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/dlm/Makefile +4 -0
@@ -36,6 +36,10 @@ ifdef SOP_IS_NOT_CONST EXTRA_CFLAGS += -DSOP_IS_NOT_CONST endif +ifdef IOP_IS_NOT_CONST +EXTRA_CFLAGS += -DIOP_IS_NOT_CONST +endif + DLM_SOURCES = \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmfs.c +18 -0
@@ -66,9 +66,15 @@ static struct super_operations dlmfs_ops;static const struct super_operations dlmfs_ops;#endif static const struct file_operations dlmfs_file_operations; +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_dir_inode_operations; +static struct inode_operations dlmfs_root_inode_operations; +static struct inode_operations dlmfs_file_inode_operations; +#else 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; +#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_NOT_CONST +static struct inode_operations dlmfs_dir_inode_operations = { +#else static const 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_NOT_CONST +static struct inode_operations dlmfs_root_inode_operations = { +#else static const struct inode_operations dlmfs_root_inode_operations = { +#endif .lookup = simple_lookup, .mkdir = dlmfs_mkdir, .rmdir = simple_rmdir,
@@ -572,7 +586,11 @@ static const struct super_operations dlmfs_ops = { .drop_inode = generic_delete_inode, }; +#ifdef IOP_IS_NOT_CONST +static struct inode_operations dlmfs_file_inode_operations = { +#else static const struct inode_operations dlmfs_file_inode_operations = { +#endif .getattr = simple_getattr, };
fs/ocfs2/file.c +8 -0
@@ -2399,7 +2399,11 @@ bail:return ret; } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_file_iops = { +#else const struct inode_operations ocfs2_file_iops = { +#endif .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission,
@@ -2408,7 +2412,11 @@ const struct inode_operations ocfs2_file_iops = {#endif }; +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_special_file_iops = { +#else const struct inode_operations ocfs2_special_file_iops = { +#endif .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission,
fs/ocfs2/file.h +5 -0
@@ -28,8 +28,13 @@extern const struct file_operations ocfs2_fops;extern const struct file_operations ocfs2_dops; +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_file_iops; +extern struct inode_operations ocfs2_special_file_iops; +#else extern const struct inode_operations ocfs2_file_iops;extern const struct inode_operations ocfs2_special_file_iops; +#endif struct ocfs2_alloc_context ;enum ocfs2_alloc_restarted {
fs/ocfs2/namei.c +4 -0
@@ -1898,7 +1898,11 @@ leave:return status; } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_dir_iops = { +#else const struct inode_operations ocfs2_dir_iops = { +#endif .create = ocfs2_create, .lookup = ocfs2_lookup, .link = ocfs2_link,
fs/ocfs2/namei.h +4 -0
@@ -26,7 +26,11 @@#ifndef OCFS2_NAMEI_H #define OCFS2_NAMEI_H +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_dir_iops; +#else extern const struct inode_operations ocfs2_dir_iops; +#endif struct dentry *ocfs2_get_parent (struct dentry *child);
fs/ocfs2/symlink.c +8 -0
@@ -163,12 +163,20 @@ bail:return ERR_PTR (status); } +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_symlink_inode_operations = { +#else const struct inode_operations ocfs2_symlink_inode_operations = { +#endif .readlink = page_readlink, .follow_link = ocfs2_follow_link, .getattr = ocfs2_getattr, }; +#ifdef IOP_IS_NOT_CONST +struct inode_operations ocfs2_fast_symlink_inode_operations = { +#else const struct inode_operations ocfs2_fast_symlink_inode_operations = { +#endif .readlink = ocfs2_readlink, .follow_link = ocfs2_follow_link, .getattr = ocfs2_getattr,
fs/ocfs2/symlink.h +5 -0
@@ -26,8 +26,13 @@#ifndef OCFS2_SYMLINK_H #define OCFS2_SYMLINK_H +#ifdef IOP_IS_NOT_CONST +extern struct inode_operations ocfs2_symlink_inode_operations; +extern struct inode_operations ocfs2_fast_symlink_inode_operations; +#else extern const struct inode_operations ocfs2_symlink_inode_operations;extern const struct inode_operations ocfs2_fast_symlink_inode_operations; +#endif /* * Test whether an inode is a fast symlink.
Signature · 1 line
1.5.2.5
PATCH 26/30 ocfs2: Handle missing const struct inode_operations in struct inode
Quoted 6 lines · Sunil Mushran
Commit
c5ef1c42c51b1b5b4a401a6517bdda30933ddbafin mainline marks structinode_operationsin struct inode as a const. This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 27/30 ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
In reply to Sunil MushranCommit 027445c37282bc1ed26add45e573ad2d3e4860a5 in mainline vectorized fileops aio_read() and aio_write(). This patch allows one to build ocfs2 with kernels having/not having this change.
--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/file.c | 6 ++-- kapi-compat/include/aiovec.h | 68 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 kapi-compat/include/aiovec.h
Config.make.in +1 -0
@@ -72,6 +72,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ +NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -27,7 +27,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/cap.h \ kapi-compat/include/relatime.h \ kapi-compat/include/should_remove_suid.h \ - kapi-compat/include/generic_segment_checks.h + kapi-compat/include/generic_segment_checks.h \ + kapi-compat/include/aiovec.h PATCH_FILES =
configure.in +6 -0
@@ -285,6 +285,12 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h, , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;]) AC_SUBST(IOP_IS_NOT_CONST) +NO_VECTORIZED_AIO= +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h, + , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);]) +AC_SUBST(NO_VECTORIZED_AIO) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS aiovec.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
fs/ocfs2/Makefile +4 -0
@@ -73,6 +73,10 @@ ifdef IOP_IS_NOT_CONST EXTRA_CFLAGS += -DIOP_IS_NOT_CONST endif +ifdef NO_VECTORIZED_AIO +CFLAGS_file.o += -DNO_VECTORIZED_AIO +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +3 -3
@@ -2017,7 +2017,7 @@ out:return total ? total : ret; } -static ssize_t ocfs2_file_aio_write (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)
@@ -2322,7 +2322,7 @@ bail:return ret; } -static ssize_t ocfs2_file_aio_read (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)
@@ -2376,7 +2376,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, }ocfs2_meta_unlock (inode, lock_level); - ret =generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos); + ret =kapi_generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos);if (ret == -EINVAL )mlog (ML_ERROR ,"generic_file_aio_read returned -EINVAL\n" );
kapi-compat/include/aiovec.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 27/30 ocfs2: Handle missing vectorized fileops aio_read() and aio_write()
Quoted 165 lines · Sunil Mushran
Commit
027445c37282bc1ed26add45e573ad2d3e4860a5in mainline vectorized fileopsaio_read()andaio_write(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>--- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/file.c | 6 ++-- kapi-compat/include/aiovec.h | 68 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 kapi-compat/include/aiovec.hConfig.make.in +1
-0@@ -72,6 +72,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ +NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ OCFS_DEBUG = @OCFS_DEBUG@Makefile +2
-1@@ -27,7 +27,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/cap.h \ kapi-compat/include/relatime.h \ kapi-compat/include/should_remove_suid.h \ - kapi-compat/include/generic_segment_checks.h + kapi-compat/include/generic_segment_checks.h \ + kapi-compat/include/aiovec.h PATCH_FILES =configure.in +6
-0@@ -285,6 +285,12 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h, , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;]) AC_SUBST(IOP_IS_NOT_CONST) +NO_VECTORIZED_AIO= +OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h, + , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);]) +AC_SUBST(NO_VECTORIZED_AIO) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS aiovec.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 pathfs/ocfs2/Makefile +4
-0@@ -73,6 +73,10 @@ ifdef IOP_IS_NOT_CONST EXTRA_CFLAGS += -DIOP_IS_NOT_CONST endif +ifdef NO_VECTORIZED_AIO +CFLAGS_file.o += -DNO_VECTORIZED_AIO +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.fs/ocfs2/file.c +3
-3@@ -2017,7 +2017,7 @@ out:return total ? total : ret; } -static ssize_t ocfs2_file_aio_write (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)@@ -2322,7 +2322,7 @@ bail:return ret; } -static ssize_t ocfs2_file_aio_read (struct kiocb *iocb, +static ssize_t __ocfs2_file_aio_read (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos)@@ -2376,7 +2376,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, }ocfs2_meta_unlock (inode, lock_level); - ret =generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos); + ret =kapi_generic_file_aio_read (iocb, iov, nr_segs, iocb->ki_pos);if (ret == -EINVAL )mlog (ML_ERROR ,"generic_file_aio_read returned -EINVAL\n" );kapi-compat/include/aiovec.h new file +54
-0@@ -0,0 +1,68 @@ +#ifndef KAPI_AIOVEC_H +#define KAPI_AIOVEC_H + +#ifdef NO_VECTORIZED_AIO + +#include <linux/fs.h> +#include <linux/uio.h> + +static ssize_t kapi_generic_file_aio_read (struct kiocb *iocb, +const struct iovec *iov, +unsigned long nr_segs, +loff_t pos) +{ +BUG_ON (nr_segs !=1 ); +return generic_file_aio_read (iocb, iov->iov_base, iov->iov_len, pos); +} + +static ssize_t __ocfs2_file_aio_read (struct kiocb *iocb, +const struct iovec *iov, +unsigned long nr_segs, +loff_t pos); + +static ssize_t ocfs2_file_aio_read (struct kiocb *iocb, +char __user *buf, +size_t buflen, +loff_t pos) +{ +struct iovec iov_local = { .iov_base = (void __user *)buf, + .iov_len = buflen }; +const struct iovec *iov = &iov_local; +unsigned long nr_segs =1 ; + +return __ocfs2_file_aio_read (iocb, iov, nr_segs, pos); +} + +static ssize_t __ocfs2_file_aio_write (struct kiocb *iocb, +const struct iovec *iov, +unsigned long nr_segs, +loff_t pos); + +static ssize_t ocfs2_file_aio_write (struct kiocb *iocb, +const char __user *buf, +size_t buflen, +loff_t pos) +{ +struct iovec iov_local = { .iov_base = (void __user *)buf, + .iov_len = buflen }; +const struct iovec *iov = &iov_local; +unsigned long nr_segs =1 ; + + iocb->ki_left = buflen; +return __ocfs2_file_aio_write (iocb, iov, nr_segs, pos); +} +
kapi-compat/include/aiovec.h line 64
Quoted 10 lines
kapi-compat/include/aiovec.h new file +10
-0+#else /* ! NO_VECTORIZED_AIO */ + +#define kapi_generic_file_aio_read (a, b, c, d) \ + generic_file_aio_read(a, b, c, d) + +#define ocfs2_file_aio_read (a, b, c, d) \ + __ocfs2_file_aio_read(a, b, c, d) + +#define ocfs2_file_aio_write (a, b, c, d) \ + __ocfs2_file_aio_write(a, b, c, d)
ocfs2_file_aio_read and ocfs2_file_aio_write are pointed to by the operations struct. Does this still compile and work against a 2.6.24 kernel?
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 28/30 ocfs2: Handle missing __splice_from_pipe()
In reply to Sunil MushranCommit 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.
--- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 4 ++++ 4 files changed, 14 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -73,6 +73,7 @@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ +NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -291,6 +291,11 @@ OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], f AC_SUBST(NO_VECTORIZED_AIO) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS aiovec.h" +NO_SPLICE_FROM_PIPE= +OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h, + , NO_SPLICE_FROM_PIPE=yes, [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*]) +AC_SUBST(NO_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
fs/ocfs2/Makefile +4 -0
@@ -77,6 +77,10 @@ ifdef NO_VECTORIZED_AIO CFLAGS_file.o += -DNO_VECTORIZED_AIO endif +ifdef NO_SPLICE_FROM_PIPE +EXTRA_CFLAGS += -DNO_SPLICE_FROM_PIPE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/file.c +4 -0
@@ -2173,6 +2173,7 @@ out_sems:return written ? written : ret; } +#ifndef NO_SPLICE_FROM_PIPE static int ocfs2_splice_write_actor (struct pipe_inode_info *pipe,struct pipe_buffer *buf,struct splice_desc *sd)
@@ -2321,6 +2322,7 @@ bail:mlog_exit (ret);return ret; } +#endif static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
@@ -2435,8 +2437,10 @@ const struct file_operations ocfs2_fops = {#ifdef CONFIG_COMPAT .compat_ioctl = ocfs2_compat_ioctl,#endif +#ifndef NO_SPLICE_FROM_PIPE .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#endif };const struct file_operations ocfs2_dops = {
Signature · 1 line
1.5.2.5
PATCH 28/30 ocfs2: Handle missing __splice_from_pipe()
Quoted 10 lines · Sunil Mushran
Commit
c66ab6fa705e1b2887a6d9246b798bdc526839e2in 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 <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 29/30 ocfs2: Handle older prototype of bi_end_io_t
In reply to Sunil MushranCommit 6712ecf8f648118c3363c142196418f89a510b90 in mainline dropped 'size' argument from bi_end_io(). This patch allows one to build ocfs2 with kernels having/not having this change.
--- 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(-)
Config.make.in +1 -0
@@ -74,6 +74,7 @@ SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@ +OLD_BIO_END_IO = @OLD_BIO_END_IO@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -296,6 +296,11 @@ OCFS2_CHECK_KERNEL([__splice_from_pipe() in splice.h], splice.h, , NO_SPLICE_FROM_PIPE=yes, [^extern ssize_t __splice_from_pipe(struct pipe_inode_info \*]) AC_SUBST(NO_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
fs/ocfs2/cluster/Makefile +4 -0
@@ -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 \
fs/ocfs2/cluster/heartbeat.c +9 -0
@@ -215,8 +215,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;
@@ -227,6 +233,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
Signature · 1 line
1.5.2.5
PATCH 29/30 ocfs2: Handle older prototype of bi_end_io_t
Quoted 6 lines · Sunil Mushran
Commit
6712ecf8f648118c3363c142196418f89a510b90in mainline dropped 'size' argument frombi_end_io(). This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]
PATCH 30/30 ocfs2: Handle missing exportfs.h
In reply to Sunil MushranCommit 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.
--- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/export.h | 2 ++ 4 files changed, 12 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -75,6 +75,7 @@ IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@ NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@ NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@ OLD_BIO_END_IO = @OLD_BIO_END_IO@ +NO_EXPORTFS_HEADER = @NO_EXPORTFS_HEADER@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +5 -0
@@ -301,6 +301,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) +NO_EXPORTFS_HEADER= +OCFS2_CHECK_KERNEL([exportfs.h], exportfs.h, + , NO_EXPORTFS_HEADER=yes, [^struct export_operations {]) +AC_SUBST(NO_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
fs/ocfs2/Makefile +4 -0
@@ -81,6 +81,10 @@ ifdef NO_SPLICE_FROM_PIPE EXTRA_CFLAGS += -DNO_SPLICE_FROM_PIPE endif +ifdef NO_EXPORTFS_HEADER +EXTRA_CFLAGS += -DNO_EXPORTFS_HEADER +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/export.h +2 -0
@@ -26,7 +26,9 @@#ifndef OCFS2_EXPORT_H #define OCFS2_EXPORT_H +#ifndef NO_EXPORTFS_HEADER #include <linux/exportfs.h> +#endif extern struct export_operations ocfs2_export_ops;
Signature · 1 line
1.5.2.5
PATCH 30/30 ocfs2: Handle missing exportfs.h
Quoted 7 lines · Sunil Mushran
Commit
a569425512253992cc64ebf8b6d00a62f986db3ein mainline moved structexport_operationfromfs.htoexportfs.h. This patch allows one to build ocfs2 with kernels having/not having this change.Signed-off-by Sunil Mushran <[email protected]>Signed-off-by Joel Becker <[email protected]>
--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]