ocfs2 1.6 - second set of patches
The second set of patches.
PATCH 1/10 ocfs2: Handle workqueue changes
Mainline commit 52bad64d95bd89e08c49ec5a071fa6dcbe5a1a9c introduced struct delayed_work to separate delayable and non-delayable work.
--- 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 | 10 +++--- fs/ocfs2/cluster/quorum.c | 4 +- fs/ocfs2/cluster/tcp.c | 65 ++++++++++++++++++++------------------ fs/ocfs2/dcache.c | 6 ++-- fs/ocfs2/dcache.h | 2 +- fs/ocfs2/dlm/Makefile | 4 ++ fs/ocfs2/dlm/dlmcommon.h | 2 +- fs/ocfs2/dlm/dlmdomain.c | 2 +- fs/ocfs2/dlm/dlmrecovery.c | 4 +- fs/ocfs2/dlm/userdlm.c | 9 +++-- fs/ocfs2/journal.c | 12 +++--- fs/ocfs2/journal.h | 2 +- fs/ocfs2/localalloc.c | 6 ++-- fs/ocfs2/localalloc.h | 2 +- fs/ocfs2/quota_global.c | 12 +++--- fs/ocfs2/super.c | 6 ++-- kapi-compat/include/workqueue.h | 17 ++++++++++ 23 files changed, 118 insertions(+), 77 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_STRUCT = @NO_DELAYED_WORK_STRUCT@ + OCFS_DEBUG = @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
@@ -158,6 +158,12 @@ esac # Begin kapi_compat checks +NO_DELAYED_WORK_STRUCT= +OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, + , NO_DELAYED_WORK_STRUCT=yes, [^struct delayed_work]) +AC_SUBST(NO_DELAYED_WORK_STRUCT) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h" + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -34,6 +34,10 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/alloc.c +5 -6
@@ -6024,12 +6024,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 ();
@@ -6262,8 +6261,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
@@ -18,6 +18,10 @@ HEADERS = EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + SOURCES += \ heartbeat.c \ masklog.c \
fs/ocfs2/cluster/heartbeat.c +5 -5
@@ -162,11 +162,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,
@@ -1400,7 +1399,8 @@ 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, qs); }void o2quo_exit (void )
fs/ocfs2/cluster/tcp.c +34 -31
152 lines not on this page · raw message
fs/ocfs2/dcache.c +3 -3
@@ -344,10 +344,10 @@ static void __ocfs2_drop_dl_inodes(struct ocfs2_super *osb, int drop_count)spin_unlock (&dentry_list_lock); } -void ocfs2_drop_dl_inodes (struct work_struct *work) +void ocfs2_drop_dl_inodes (kapi_work_struct_t *work) { - struct ocfs2_super *osb = container_of(work, struct ocfs2_super, - dentry_lock_work); + struct ocfs2_super *osb = work_to_object(work, struct ocfs2_super, + dentry_lock_work);__ocfs2_drop_dl_inodes (osb,DL_INODE_DROP_COUNT );/*
fs/ocfs2/dcache.h +1 -1
@@ -54,7 +54,7 @@ extern spinlock_t dentry_list_lock;void ocfs2_dentry_lock_put (struct ocfs2_super *osb,struct ocfs2_dentry_lock *dl); -void ocfs2_drop_dl_inodes (struct work_struct *work); +void ocfs2_drop_dl_inodes (kapi_work_struct_t *work);void ocfs2_drop_all_dl_inodes (struct ocfs2_super *osb); struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno,
fs/ocfs2/dlm/Makefile +4 -0
@@ -22,6 +22,10 @@ EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/ocfs2 EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG +ifdef NO_DELAYED_WORK_STRUCT +EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \
fs/ocfs2/dlm/dlmcommon.h +1 -1
@@ -203,7 +203,7 @@ static inline struct hlist_head *dlm_master_hash(struct dlm_ctxt *dlm,* 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
@@ -1613,7 +1613,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 +2 -2
@@ -152,10 +152,10 @@ 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); + work_to_object(work, struct dlm_ctxt, dispatched_work);LIST_HEAD (tmp_list);struct dlm_work_item *item, *next;dlm_workfunc_t *workfunc;
fs/ocfs2/dlm/userdlm.c +5 -4
@@ -171,14 +171,15 @@ 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 +279,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 +6 -6
@@ -1189,11 +1189,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;
@@ -1926,13 +1926,13 @@ out: }/* Worker task that gets fired every ORPHAN_SCAN_SCHEDULE_TIMEOUT millsec */ -void ocfs2_orphan_scan_work (struct work_struct *work) +void ocfs2_orphan_scan_work (kapi_work_struct_t *work) {struct ocfs2_orphan_scan *os;struct ocfs2_super *osb; - os = container_of(work, struct ocfs2_orphan_scan, - os_orphan_scan_work.work); + os = work_to_object(work, struct ocfs2_orphan_scan, + os_orphan_scan_work.work); osb = os->os_osb;mutex_lock (&os->os_lock);
@@ -1965,7 +1965,7 @@ void ocfs2_orphan_scan_init(struct ocfs2_super *osb) os->os_count =0 ; os->os_seqno =0 ;mutex_init (&os->os_lock); -INIT_DELAYED_WORK (&os->os_orphan_scan_work, ocfs2_orphan_scan_work); +KAPI_INIT_DELAYED_WORK (&os->os_orphan_scan_work, ocfs2_orphan_scan_work, os); }void ocfs2_orphan_scan_start (struct ocfs2_super *osb)
fs/ocfs2/journal.h +1 -1
@@ -159,7 +159,7 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb);void ocfs2_orphan_scan_stop (struct ocfs2_super *osb);void ocfs2_orphan_scan_exit (struct ocfs2_super *osb); -void ocfs2_complete_recovery (struct work_struct *work); +void ocfs2_complete_recovery (kapi_work_struct_t *work);void ocfs2_wait_for_recovery (struct ocfs2_super *osb);int ocfs2_recovery_init (struct ocfs2_super *osb);
fs/ocfs2/localalloc.c +3 -3
@@ -93,11 +93,11 @@ void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb,spin_unlock (&osb->osb_lock); } -void ocfs2_la_enable_worker (struct work_struct *work) +void ocfs2_la_enable_worker (kapi_work_struct_t *work) {struct ocfs2_super *osb = - container_of(work, struct ocfs2_super, - la_enable_wq.work); + work_to_object(work, struct ocfs2_super, + la_enable_wq.work);spin_lock (&osb->osb_lock); osb->local_alloc_state =OCFS2_LA_ENABLED ;spin_unlock (&osb->osb_lock);
fs/ocfs2/localalloc.h +1 -1
@@ -54,6 +54,6 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,void ocfs2_local_alloc_seen_free_bits (struct ocfs2_super *osb,unsigned int num_clusters); -void ocfs2_la_enable_worker (struct work_struct *work); +void ocfs2_la_enable_worker (kapi_work_struct_t *work);#endif /* OCFS2_LOCALALLOC_H */
fs/ocfs2/quota_global.c +6 -6
@@ -28,7 +28,7 @@static struct workqueue_struct *ocfs2_quota_wq =NULL ; -static void qsync_work_fn (struct work_struct *work); +static void qsync_work_fn (kapi_work_struct_t *work);static void ocfs2_global_disk2memdqb (struct dquot *dquot,void *dp) {
@@ -360,7 +360,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) oinfo->dqi_gi.dqi_usable_bs = sb->s_blocksize -OCFS2_QBLK_RESERVED_SPACE ; oinfo->dqi_gi.dqi_qtree_depth =qtree_depth (&oinfo->dqi_gi); -INIT_DELAYED_WORK (&oinfo->dqi_sync_work, qsync_work_fn); +KAPI_INIT_DELAYED_WORK (&oinfo->dqi_sync_work, qsync_work_fn, oinfo);queue_delayed_work (ocfs2_quota_wq, &oinfo->dqi_sync_work,msecs_to_jiffies (oinfo->dqi_syncms));
@@ -653,11 +653,11 @@ out:return status; } -static void qsync_work_fn (struct work_struct *work) +static void qsync_work_fn (kapi_work_struct_t *work) { -struct ocfs2_mem_dqinfo *oinfo =container_of (work, - struct ocfs2_mem_dqinfo, - dqi_sync_work.work); +struct ocfs2_mem_dqinfo *oinfo = + work_to_object(work, struct ocfs2_mem_dqinfo, + dqi_sync_work.work);struct super_block *sb = oinfo->dqi_gqinode->i_sb;dquot_scan_active (sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
fs/ocfs2/super.c +3 -3
@@ -2027,7 +2027,7 @@ static int ocfs2_initialize_super(struct super_block *sb, osb->local_alloc_state =OCFS2_LA_UNUSED ; osb->local_alloc_bh =NULL ; -INIT_DELAYED_WORK (&osb->la_enable_wq, ocfs2_la_enable_worker); +KAPI_INIT_DELAYED_WORK (&osb->la_enable_wq, ocfs2_la_enable_worker, osb);init_waitqueue_head (&osb->osb_mount_event);
@@ -2134,10 +2134,10 @@ 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 ; -INIT_WORK (&osb->dentry_lock_work, ocfs2_drop_dl_inodes); +KAPI_INIT_WORK (&osb->dentry_lock_work, ocfs2_drop_dl_inodes, osb); osb->dentry_lock_list =NULL ;/* 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_STRUCT +# 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.6.5
PATCH 1/10 ocfs2: Handle workqueue changes
Quoted 13 lines · Sunil Mushran
kapi-compat/include/workqueue.h new file +7
-0@@ -0,0 +1,17 @@ +#ifndef KAPI_WORKQUEUE_H +#define KAPI_WORKQUEUE_H + +#ifdef NO_DELAYED_WORK_STRUCT +# define delayed_work work_struct +typedef void kapi_work_struct_t ; +# define work_to_object (a, b, c) (a)
kapi-compat/include/workqueue.h line 17
Quoted 10 lines
kapi-compat/include/workqueue.h new file +10
-0+# 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
Rather than include kapi-compat/include/workqueue.h at all
times, I'd really like to only include it when necessary. That way you can build the driver against mainline even when there is no kapi-compat directory.
Can't we have an fs/ocfs2/kapi-default.h that has defines for
when we're against mainline? Include it from fs/ocfs2/ocfs2.h. For this patch, it would include:
#ifndef KAPI_INIT_WORK
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
Joel
Signature · 9 lines
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127PATCH 1/10 ocfs2: Handle workqueue changes
Quoted 8 lines · Joel Becker
Rather than include
kapi-compat/include/workqueue.hat all
times, I'd really like to only include it when necessary. That way you can build the driver against mainline even when there is no kapi-compat directory.
Can't we have anfs/ocfs2/kapi-default.hthat has defines for
when we're against mainline? Include it fromfs/ocfs2/ocfs2.h. For this patch, it would include:
Quoted 7 lines
#ifndef
KAPI_INIT_WORK
typedef structwork_structkapi_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
Yeah, that's a good idea.
PATCH 2/10 ocfs2: Handle missing dlmconstants.h
In reply to Sunil MushranMainline commit d69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34 split lock mode and flag constants from dlm.h into a sharable header, dlmconstants.h.
This patch adds a header with the same name that merely includes dlm.h.
--- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/stackglue.h | 2 ++ kapi-compat/include/dlmconstants.h | 9 +++++++++ 6 files changed, 24 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/dlmconstants.h
Config.make.in +1 -0
@@ -58,6 +58,7 @@ MAKEBO_VERSION = @VERSION@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ +NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ OCFS_DEBUG = @OCFS_DEBUG@
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/dlmconstants.h PATCH_FILES =
configure.in +6 -0
@@ -164,6 +164,12 @@ OCFS2_CHECK_KERNEL([struct delayed_work in workqueue.h], workqueue.h, AC_SUBST(NO_DELAYED_WORK_STRUCT) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS workqueue.h" +NO_DLMCONSTANTS_HEADER= +OCFS2_CHECK_KERNEL([dlmconstants.h], dlmconstants.h, + , NO_DLMCONSTANTS_HEADER=yes, [__DLMCONSTANTS_DOT_H__]) +AC_SUBST(NO_DLMCONSTANTS_HEADER) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS dlmconstants.h" + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -38,6 +38,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif +ifdef NO_DLMCONSTANTS_HEADER +EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/stackglue.h +2 -0
@@ -23,7 +23,9 @@#include <linux/types.h> #include <linux/list.h> +#ifndef NO_DLMCONSTANTS_HEADER #include <linux/dlmconstants.h> +#endif #include "dlm/dlmapi.h" #include <linux/dlm.h>
kapi-compat/include/dlmconstants.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef KAPI_DLMCONSTANTS_H +#define KAPI_DLMCONSTANTS_H + +#ifdef NO_DLMCONSTANTS_HEADER +#include <linux/types.h> +#include <linux/dlm.h> +#endif + +#endif
Signature · 1 line
1.5.6.5
PATCH 2/10 ocfs2: Handle missing dlmconstants.h
Quoted 6 lines · Sunil Mushran
Mainline commit
d69a3ad6a0e47b2aa9b2b2ddfd385752132a4d34split lock mode and flag constants fromdlm.hinto a sharable header,dlmconstants.h.This patch adds a header with the same name that merely includes
dlm.h.
Again you're including the kapi-compat header unconditionally.
Only include it when it is necessary.
kapi-compat/include/dlmconstants.h line 6
Quoted 3 lines
kapi-compat/include/dlmconstants.h new file +3
-0+#ifdef NO_DLMCONSTANTS_HEADER +#include <linux/types.h> +#include <linux/dlm.h>
Then maybe change this to
#ifndef DLM_LOCK_NL
# include <linux/dlmconstants.h> #endif
Joel
Signature · 10 lines
"In the arms of the angel, fly away from here, From this dark, cold hotel room and the endlessness that you fear. You are pulled from the wreckage of your silent reverie. In the arms of the angel, may you find some comfort here." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
PATCH 2/10 ocfs2: Handle missing dlmconstants.h
Quoted 3 lines · Joel Becker
Again you're including the kapi-compat header unconditionally.
Only include it when it is necessary.
Ok.
Quoted 8 lines
kapi-compat/include/dlmconstants.h line 6
Quoted 5 lines
kapi-compat/include/dlmconstants.h new file +3
-0+#ifdef NO_DLMCONSTANTS_HEADER +#include <linux/types.h> +#include <linux/dlm.h> Then maybe change this to
Quoted 4 lines
#ifndef
DLM_LOCK_NL# include <linux/dlmconstants.h> #endif
Not sure why we need to do this.
PATCH 2/10 ocfs2: Handle missing dlmconstants.h
Quoted 9 lines · Sunil Mushran
Quoted 6 lines · Joel Becker
Then maybe change this to
#ifndef
DLM_LOCK_NL# include <linux/dlmconstants.h> #endifNot sure why we need to do this.
Because if we are against mainline, we will not include the
kapi-compat header. Then we have to include linux/dlmconstants.h. Or are you asking why do this instead of checking the NO_DLMCONSTANTS define? That works too. -EDONTCARE
Joel
Signature · 8 lines
"Sometimes one pays most for the things one gets for nothing."
- Albert Einstein
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127PATCH 3/10 ocfs2: Add helper task_pid_nr()
In reply to Sunil MushranMainline commit 7af5729474b5b8ad385adadab78d6e723e7655a3 added a helper to obtain the pid number.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/task_pid_nr.h | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/task_pid_nr.h
Makefile +2 -1
@@ -10,7 +10,8 @@ LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ - kapi-compat/include/dlmconstants.h + kapi-compat/include/dlmconstants.h \ + kapi-compat/include/task_pid_nr.h PATCH_FILES =
configure.in +5 -0
@@ -170,6 +170,11 @@ OCFS2_CHECK_KERNEL([dlmconstants.h], dlmconstants.h, AC_SUBST(NO_DLMCONSTANTS_HEADER) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS dlmconstants.h" +task_pid_nr_compat_header= +OCFS2_CHECK_KERNEL([task_pid_nr() in sched.h], sched.h, + , task_pid_nr_compat_header="task_pid_nr.h", [^static inline pid_t task_pid_nr(struct]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $task_pid_nr_compat_header" + # End kapi_compat checks
kapi-compat/include/task_pid_nr.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef KAPI_TASK_PID_NR_H +#define KAPI_TASK_PID_NR_H + +#include <linux/types.h> +#include <linux/sched.h> + +static inline pid_t task_pid_nr (struct task_struct *tsk) +{ +return tsk->pid; +} + +#endif
Signature · 1 line
1.5.6.5
PATCH 4/10 ocfs2: Enable CONFIG_OCFS2_FS_POSIX_ACL
In reply to Sunil Mushran--- fs/ocfs2/Makefile | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ocfs2/Makefile +2 -0
@@ -34,6 +34,8 @@ EXTRA_CFLAGS += -DCONFIG_OCFS2_DEBUG_MASKLOG EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_STATS +EXTRA_CFLAGS += -DCONFIG_OCFS2_FS_POSIX_ACL + ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT endif
Signature · 1 line
1.5.6.5
PATCH 5/10 ocfs2: Add helper current_umask()
In reply to Sunil MushranMainline commit ce3b0f8d5c2203301fc87f3aaaed73e5819e2a48 adde helper current_umask().
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/current_umask.h | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/current_umask.h
Makefile +2 -1
@@ -11,7 +11,8 @@ LINUX_INCLUDE_FILES = KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ kapi-compat/include/dlmconstants.h \ - kapi-compat/include/task_pid_nr.h + kapi-compat/include/task_pid_nr.h \ + kapi-compat/include/current_umask.h PATCH_FILES =
configure.in +5 -0
@@ -175,6 +175,11 @@ OCFS2_CHECK_KERNEL([task_pid_nr() in sched.h], sched.h, , task_pid_nr_compat_header="task_pid_nr.h", [^static inline pid_t task_pid_nr(struct]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $task_pid_nr_compat_header" +current_umask_compat_header= +OCFS2_CHECK_KERNEL([current_umask() in fs.h], fs.h, + , current_umask_compat_header="current_umask.h", [^extern int current_umask(void)]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $current_umask_compat_header" + # End kapi_compat checks
kapi-compat/include/current_umask.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef KAPI_CURRENT_UMASK_H +#define KAPI_CURRENT_UMASK_H + +static inline int current_umask (void ) +{ +return current->fs->umask; +} + +#endif
Signature · 1 line
1.5.6.5
PATCH 6/10 ocfs2: Handle missing do_sync_mapping_range()
In reply to Sunil MushranMainline commit 5b04aa3a64f854244bc40a6f528176ed50b5c4f6 added do_sync_mapping_range(). EL5 has do_sync_file_range(). This patch wires do_sync_mapping_range() into do_sync_file_range().
Build fails if both symbols are not found.
--- Makefile | 3 ++- configure.in | 13 +++++++++++++ kapi-compat/include/sync_mapping.h | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/sync_mapping.h
Makefile +2 -1
@@ -12,7 +12,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/workqueue.h \ kapi-compat/include/dlmconstants.h \ kapi-compat/include/task_pid_nr.h \ - kapi-compat/include/current_umask.h + kapi-compat/include/current_umask.h \ + kapi-compat/include/sync_mapping.h PATCH_FILES =
configure.in +13 -0
@@ -180,6 +180,19 @@ OCFS2_CHECK_KERNEL([current_umask() in fs.h], fs.h, , current_umask_compat_header="current_umask.h", [^extern int current_umask(void)]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $current_umask_compat_header" +do_sync_mapping_range= +OCFS2_CHECK_KERNEL([do_sync_mapping_range() in fs.h], fs.h, +do_sync_mapping_range="yes", , [int do_sync_mapping_range(struct address_space \*mapping]) +if test "x$do_sync_mapping_range" = "x" ; then + do_sync_file_range= + OCFS2_CHECK_KERNEL([ do_sync_file_range() in fs.h], fs.h, + do_sync_file_range="yes", , [int do_sync_file_range(struct file \*file]) + if test "x$do_sync_file_range" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that is missing both do_sync_mapping_range() and do_sync_file_range()) + fi + KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping.h" +fi + # End kapi_compat checks
kapi-compat/include/sync_mapping.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef KAPI_SYNC_MAPPING_H +#define KAPI_SYNC_MAPPING_H + +#include <linux/fs.h> +static inline int do_sync_mapping_range (struct address_space *mapping, +loff_t offset,loff_t endbyte, +unsigned int flags) +{ +struct file fake = { .f_mapping = mapping, }; +return do_sync_file_range (&fake, offset, endbyte, flags); +} + +#endif
Signature · 1 line
1.5.6.5
PATCH 7/10 ocfs2: Handle struct f_path in struct file
In reply to Sunil MushranMainline commit 0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05 added struct path into struct file.
--- 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 | 36 ++++++++++++++++++------------------ fs/ocfs2/ioctl.c | 6 +++--- fs/ocfs2/mmap.c | 8 ++++---- kapi-compat/include/fpath.h | 12 ++++++++++++ 12 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 kapi-compat/include/fpath.h
Config.make.in +1 -0
@@ -59,6 +59,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ +NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -13,7 +13,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/dlmconstants.h \ kapi-compat/include/task_pid_nr.h \ kapi-compat/include/current_umask.h \ - kapi-compat/include/sync_mapping.h + kapi-compat/include/sync_mapping.h \ + kapi-compat/include/fpath.h PATCH_FILES =
configure.in +6 -0
@@ -193,6 +193,12 @@ if test "x$do_sync_mapping_range" = "x" ; then KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS sync_mapping.h" fi +NO_F_PATH_IN_STRUCT_FILE= +OCFS2_CHECK_KERNEL([f_path in fs.h], fs.h, + , NO_F_PATH_IN_STRUCT_FILE=yes, [struct path.*f_path]) +AC_SUBST(NO_F_PATH_IN_STRUCT_FILE) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fpath.h" + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -44,6 +44,10 @@ ifdef NO_DLMCONSTANTS_HEADER EXTRA_CFLAGS += -DNO_DLMCONSTANTS_HEADER 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
@@ -636,7 +636,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 */
@@ -678,7 +678,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
@@ -2025,7 +2025,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
@@ -26,6 +26,10 @@ ifdef NO_DELAYED_WORK_STRUCT EXTRA_CFLAGS += -DNO_DELAYED_WORK_STRUCT 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
@@ -187,7 +187,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);
@@ -231,7 +231,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 +18 -18
@@ -105,7 +105,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);
@@ -146,8 +146,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)
@@ -1593,7 +1593,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);
@@ -1660,7 +1660,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) &&
@@ -1905,13 +1905,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,loff_t old_size, *ppos = &iocb->ki_pos;u32 old_clusters;struct file *file = iocb->ki_filp; -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);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 ;
@@ -1939,7 +1939,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 ) {
@@ -2060,7 +2060,7 @@ static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, {int ret; - ret =ocfs2_prepare_inode_for_write (out->f_path.dentry, &sd->pos, + ret =ocfs2_prepare_inode_for_write (filp_dentry (out), &sd->pos, sd->total_len,0 ,NULL );if (ret <0 ) {mlog_errno (ret);
@@ -2088,8 +2088,8 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,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);if (pipe->inode)mutex_lock_nested (&pipe->inode->i_mutex,I_MUTEX_PARENT );
@@ -2144,12 +2144,12 @@ static ssize_t ocfs2_file_splice_read(struct file *in, unsigned int flags) {int ret =0 , lock_level =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()
@@ -2175,12 +2175,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 +3 -3
@@ -110,7 +110,7 @@ bail:long ocfs2_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) { -struct inode *inode = filp->f_path.dentry->d_inode; +struct inode *inode =filp_dentry (filp)->d_inode;unsigned int flags;int new_clusters;int status;
@@ -132,12 +132,12 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)if (get_user (flags, (int __user *) arg))return -EFAULT ; - status =mnt_want_write (filp->f_path.mnt); + status =mnt_want_write (filp_mnt (filp));if (status)return status; status =ocfs2_set_inode_attr (inode, flags,OCFS2_FL_MODIFIABLE ); -mnt_drop_write (filp->f_path.mnt); +mnt_drop_write (filp_mnt (filp));return status;case OCFS2_IOC_RESVSP :case OCFS2_IOC_RESVSP64 :
fs/ocfs2/mmap.c +4 -4
@@ -157,7 +157,7 @@ out:static int ocfs2_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf) {struct page *page = vmf->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;
@@ -211,13 +211,13 @@ int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) {int ret =0 , lock_level =0 ; - ret =ocfs2_inode_lock_atime (file->f_dentry->d_inode, - file->f_vfsmnt, &lock_level); + ret =ocfs2_inode_lock_atime (filp_dentry (file)->d_inode, +filp_mnt (file), &lock_level);if (ret <0 ) {mlog_errno (ret); goto out; } -ocfs2_inode_unlock (file->f_dentry->d_inode, lock_level); +ocfs2_inode_unlock (filp_dentry (file)->d_inode, lock_level); out: vma->vm_ops = &ocfs2_file_vm_ops; vma->vm_flags |=VM_CAN_NONLINEAR ;
kapi-compat/include/fpath.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef KAPI_FPATH_H +#define KAPI_FPATH_H + +#ifdef NO_F_PATH_IN_STRUCT_FILE +# define filp_dentry (i) (i)->f_dentry +# define filp_mnt (i) (i)->f_vfsmnt +#else +# define filp_dentry (i) (i)->f_path.dentry +# define filp_mnt (i) (i)->f_path.mnt +#endif + +#endif
Signature · 1 line
1.5.6.5
PATCH 7/10 ocfs2: Handle struct f_path in struct file
Quoted 2 lines · Sunil Mushran
Mainline commit
0f7fc9e4d03987fe29f6dd4aa67e4c56eb7ecb05added struct path into struct file.
Again, put #ifndef filp_dentry() in fs/ocfs2/kapi-defaults.h and
only include kapi-include/fpath.h if necessary.
Joel
Signature · 8 lines
"Get right to the heart of matters. It's the heart that matters more." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
PATCH 8/10 ocfs2: Handle struct address_space_operations_ext
In reply to Sunil MushranAround in 2.6.24 or so, two new aops, write_begin() and write_end(), were added. In that release, OCFS2 was updated to make use of these aops instead of the older prepare_write() and commit_write().
EL5 U4 backports the new aops in a new struct address_space_operations_ext.
This patch looks for the new struct failing which looks for the new aops in the older struct. If both lookups fail, the build errors out.
--- Config.make.in | 1 + configure.in | 13 +++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/aops.c | 16 ++++++++++++++++ fs/ocfs2/inode.c | 5 +++++ fs/ocfs2/inode.h | 4 ++++ fs/ocfs2/super.c | 4 ++++ 7 files changed, 47 insertions(+), 0 deletions(-)
Config.make.in +1 -0
@@ -60,6 +60,7 @@ EXTRA_CFLAGS += @KAPI_COMPAT_CFLAGS@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ +ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ OCFS_DEBUG = @OCFS_DEBUG@
configure.in +13 -0
@@ -199,6 +199,19 @@ 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" +ADDRESS_SPACE_OPS_EXT= +OCFS2_CHECK_KERNEL([ struct address_space_operations_ext in fs.h], fs.h, + ADDRESS_SPACE_OPS_EXT=yes, , [^struct address_space_operations_ext {]) +AC_SUBST(ADDRESS_SPACE_OPS_EXT) +if test "x$ADDRESS_SPACE_OPS_EXT" = "x" ; then + has_write_begin= + OCFS2_CHECK_KERNEL([ write_begin() in fs.h], fs.h, + has_write_begin=yes, , [int (\*write_begin)(struct file \*]) + if test "x$has_write_begin" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel that does not have aops->write_begin()) + fi +fi + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -48,6 +48,10 @@ ifdef NO_F_PATH_IN_STRUCT_FILE EXTRA_CFLAGS += -DNO_F_PATH_IN_STRUCT_FILE endif +ifdef ADDRESS_SPACE_OPS_EXT +EXTRA_CFLAGS += -DADDRESS_SPACE_OPS_EXT +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/aops.c +16 -0
@@ -2009,6 +2009,7 @@ static int ocfs2_write_end(struct file *file, struct address_space *mapping,return ret; } +#ifndef ADDRESS_SPACE_OPS_EXT const struct address_space_operations ocfs2_aops = { .readpage = ocfs2_readpage, .readpages = ocfs2_readpages,
@@ -2024,3 +2025,18 @@ const struct address_space_operations ocfs2_aops = { .is_partially_uptodate = block_is_partially_uptodate, .error_remove_page = generic_error_remove_page, }; +#else +const struct address_space_operations_ext ocfs2_aops_ext = { + .orig_aops.readpage = ocfs2_readpage, + .orig_aops.readpages = ocfs2_readpages, + .orig_aops.writepage = ocfs2_writepage, + .write_begin = ocfs2_write_begin, + .write_end = ocfs2_write_end, + .orig_aops.bmap = ocfs2_bmap, + .orig_aops.sync_page = block_sync_page, + .orig_aops.direct_IO = ocfs2_direct_IO, + .orig_aops.invalidatepage = ocfs2_invalidatepage, + .orig_aops.releasepage = ocfs2_releasepage, + .orig_aops.migratepage = buffer_migrate_page, +}; +#endif
fs/ocfs2/inode.c +5 -0
@@ -285,7 +285,12 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, inode->i_blocks =0 ; else inode->i_blocks = ocfs2_inode_sector_count(inode); +#ifndef ADDRESS_SPACE_OPS_EXT inode->i_mapping->a_ops = &ocfs2_aops; +#else + inode->i_mapping->a_ops = + (struct address_space_operations *)&ocfs2_aops_ext; +#endif inode->i_atime.tv_sec =le64_to_cpu (fe->i_atime); inode->i_atime.tv_nsec =le32_to_cpu (fe->i_atime_nsec); inode->i_mtime.tv_sec =le64_to_cpu (fe->i_mtime);
fs/ocfs2/inode.h +4 -0
@@ -111,7 +111,11 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode)extern struct kmem_cache *ocfs2_inode_cache; +#ifndef ADDRESS_SPACE_OPS_EXT extern const struct address_space_operations ocfs2_aops; +#else +extern const struct address_space_operations_ext ocfs2_aops_ext; +#endif extern const struct ocfs2_caching_operations ocfs2_inode_caching_ops;static inline struct ocfs2_caching_info *INODE_CACHE (struct inode *inode)
fs/ocfs2/super.c +4 -0
@@ -1044,6 +1044,10 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) sb->s_flags = (sb->s_flags & ~MS_POSIXACL ) | ((osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) ?MS_POSIXACL :0 ); +#ifdef ADDRESS_SPACE_OPS_EXT + sb->s_flags |=MS_HAS_NEW_AOPS ; +#endif +/* Hard readonly mode only if: bdev_read_only, MS_RDONLY, * heartbeat=none */ if (bdev_read_only (sb->s_bdev)) {
Signature · 1 line
1.5.6.5
PATCH 9/10 ocfs2: Handle missing USHORT_MAX
In reply to Sunil MushranMainline commit 44f564a4bf6ac70f2a84806203045cf515bc9367 USHORT_MAX.
--- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/ushortmax.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/ushortmax.h
Makefile +2 -1
@@ -14,7 +14,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/task_pid_nr.h \ kapi-compat/include/current_umask.h \ kapi-compat/include/sync_mapping.h \ - kapi-compat/include/fpath.h + kapi-compat/include/fpath.h \ + kapi-compat/include/ushortmax.h PATCH_FILES =
configure.in +5 -0
@@ -212,6 +212,11 @@ if test "x$ADDRESS_SPACE_OPS_EXT" = "x" ; then fi fi +ushort_max_compat_header= +OCFS2_CHECK_KERNEL([USHORT_MAX in kernel.h], kernel.h, + , ushort_max_compat_header="ushortmax.h", [#define USHORT_MAX]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $ushort_max_compat_header" + # End kapi_compat checks
kapi-compat/include/ushortmax.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef KAPI_USHORTMAX_H +#define KAPI_USHORTMAX_H + +#define USHORT_MAX ((u16)(~0U)) + +#endif
Signature · 1 line
1.5.6.5
PATCH 10/10 ocfs2: Handle different f_version types
In reply to Sunil MushranMainline commit 2b47c3611de05c585e2d81204f6c7e3e255a3461 changed type of file->f_version from unsigned long to u64. This patch allows building with kernels having either definition. Build fails if the type is something else.
--- Config.make.in | 1 + Makefile | 3 ++- configure.in | 14 ++++++++++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dir.c | 12 ++++++------ kapi-compat/include/fversion.h | 10 ++++++++++ 6 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 kapi-compat/include/fversion.h
Config.make.in +1 -0
@@ -61,6 +61,7 @@ NO_DELAYED_WORK_STRUCT = @NO_DELAYED_WORK_STRUCT@ NO_DLMCONSTANTS_HEADER = @NO_DLMCONSTANTS_HEADER@ NO_F_PATH_IN_STRUCT_FILE = @NO_F_PATH_IN_STRUCT_FILE@ ADDRESS_SPACE_OPS_EXT = @ADDRESS_SPACE_OPS_EXT@ +FVERSION_IS_ULONG = @FVERSION_IS_ULONG@ OCFS_DEBUG = @OCFS_DEBUG@
Makefile +2 -1
@@ -15,7 +15,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/current_umask.h \ kapi-compat/include/sync_mapping.h \ kapi-compat/include/fpath.h \ - kapi-compat/include/ushortmax.h + kapi-compat/include/ushortmax.h \ + kapi-compat/include/fversion.h PATCH_FILES =
configure.in +14 -0
@@ -217,6 +217,20 @@ OCFS2_CHECK_KERNEL([USHORT_MAX in kernel.h], kernel.h, , ushort_max_compat_header="ushortmax.h", [#define USHORT_MAX]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $ushort_max_compat_header" +FVERSION_IS_ULONG= +OCFS2_CHECK_KERNEL([ f_version is type unsigned long in fs.h], fs.h, + FVERSION_IS_ULONG=yes, , [unsigned long.*f_version;]) +AC_SUBST(FVERSION_IS_ULONG) +if test "x$FVERSION_IS_ULONG" = "x" ; then + fversion_is_u64= + OCFS2_CHECK_KERNEL([ f_version is type u64 in fs.h], fs.h, + fversion_is_u64=yes, , [u64.*f_version;]) + if test "x$fversion_is_u64" = "x" ; then + AC_MSG_ERROR(Cannot build with kernel in which f_version type is neither unsigned long nor u64) + fi +fi +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS fversion.h" + # End kapi_compat checks
fs/ocfs2/Makefile +4 -0
@@ -52,6 +52,10 @@ ifdef ADDRESS_SPACE_OPS_EXT EXTRA_CFLAGS += -DADDRESS_SPACE_OPS_EXT endif +ifdef FVERSION_IS_ULONG +EXTRA_CFLAGS += -DFVERSION_IS_ULONG +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes.
fs/ocfs2/dir.c +6 -6
@@ -1771,7 +1771,7 @@ bail: }static int ocfs2_dir_foreach_blk_id (struct inode *inode, -u64 *f_version, +f_version_t *f_version,loff_t *f_pos,void *priv,filldir_t filldir,int *filldir_err) {
@@ -1832,7 +1832,7 @@ revalidate:* not the directory has been modified * during the copy operation. */ -u64 version = *f_version; +f_version_t version = *f_version;unsigned char d_type =DT_UNKNOWN ;if (de->file_type <OCFS2_FT_MAX )
@@ -1865,7 +1865,7 @@ out:* and indexed ones. */ static int ocfs2_dir_foreach_blk_el (struct inode *inode, -u64 *f_version, +f_version_t *f_version,loff_t *f_pos,void *priv,filldir_t filldir,int *filldir_err) {
@@ -1952,7 +1952,7 @@ revalidate:* not the directory has been modified * during the copy operation. */ -unsigned long version = *f_version; +f_version_t version = *f_version;unsigned char d_type =DT_UNKNOWN ;if (de->file_type <OCFS2_FT_MAX )
@@ -1983,7 +1983,7 @@ out:return stored; } -static int ocfs2_dir_foreach_blk (struct inode *inode,u64 *f_version, +static int ocfs2_dir_foreach_blk (struct inode *inode,f_version_t *f_version,loff_t *f_pos,void *priv,filldir_t filldir,int *filldir_err) {
@@ -2003,7 +2003,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, filldir_t filldir) {int ret =0 , filldir_err =0 ; -u64 version = inode->i_version; +f_version_t version = inode->i_version;while (*f_pos <i_size_read (inode)) { ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv,
kapi-compat/include/fversion.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef KAPI_FVERSION_H +#define KAPI_FVERSION_H + +#ifdef FVERSION_IS_ULONG +typedef unsigned long f_version_t ; +#else +typedef u64 f_version_t ; +#endif + +#endif
Signature · 1 line
1.5.6.5
PATCH 10/10 ocfs2: Handle different f_version types
Quoted 3 lines · Sunil Mushran
Mainline commit
2b47c3611de05c585e2d81204f6c7e3e255a3461changed type offile->f_versionfrom unsigned long to u64. This patch allows building with kernels having either definition. Build fails if the type is something else.
I was trying to come up with a way to not create f_version_t.
You know, pass around a u64 and cast it when comparing to inode->i_version. But I'm not terribly happy with that, so I guess we leave f_version_t. Please reorganize it so that kapi-include/ is not needed for mainline.
Joel
Signature · 10 lines
"In the beginning, the universe was created. This has made a lot
of people very angry, and is generally considered to have been a
bad move."
- Douglas Adams
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127