diff options
Diffstat (limited to 'fs/ocfs2/dlm/dlmcommon.h')
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index bb53714813ab..0102be35980c 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -52,16 +52,12 @@ | |||
52 | enum dlm_mle_type { | 52 | enum dlm_mle_type { |
53 | DLM_MLE_BLOCK, | 53 | DLM_MLE_BLOCK, |
54 | DLM_MLE_MASTER, | 54 | DLM_MLE_MASTER, |
55 | DLM_MLE_MIGRATION | 55 | DLM_MLE_MIGRATION, |
56 | }; | 56 | DLM_MLE_NUM_TYPES |
57 | |||
58 | struct dlm_lock_name { | ||
59 | u8 len; | ||
60 | u8 name[DLM_LOCKID_NAME_MAX]; | ||
61 | }; | 57 | }; |
62 | 58 | ||
63 | struct dlm_master_list_entry { | 59 | struct dlm_master_list_entry { |
64 | struct list_head list; | 60 | struct hlist_node master_hash_node; |
65 | struct list_head hb_events; | 61 | struct list_head hb_events; |
66 | struct dlm_ctxt *dlm; | 62 | struct dlm_ctxt *dlm; |
67 | spinlock_t spinlock; | 63 | spinlock_t spinlock; |
@@ -78,10 +74,10 @@ struct dlm_master_list_entry { | |||
78 | enum dlm_mle_type type; | 74 | enum dlm_mle_type type; |
79 | struct o2hb_callback_func mle_hb_up; | 75 | struct o2hb_callback_func mle_hb_up; |
80 | struct o2hb_callback_func mle_hb_down; | 76 | struct o2hb_callback_func mle_hb_down; |
81 | union { | 77 | struct dlm_lock_resource *mleres; |
82 | struct dlm_lock_resource *res; | 78 | unsigned char mname[DLM_LOCKID_NAME_MAX]; |
83 | struct dlm_lock_name name; | 79 | unsigned int mnamelen; |
84 | } u; | 80 | unsigned int mnamehash; |
85 | }; | 81 | }; |
86 | 82 | ||
87 | enum dlm_ast_type { | 83 | enum dlm_ast_type { |
@@ -151,13 +147,14 @@ struct dlm_ctxt | |||
151 | unsigned long recovery_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 147 | unsigned long recovery_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
152 | struct dlm_recovery_ctxt reco; | 148 | struct dlm_recovery_ctxt reco; |
153 | spinlock_t master_lock; | 149 | spinlock_t master_lock; |
154 | struct list_head master_list; | 150 | struct hlist_head **master_hash; |
155 | struct list_head mle_hb_events; | 151 | struct list_head mle_hb_events; |
156 | 152 | ||
157 | /* these give a really vague idea of the system load */ | 153 | /* these give a really vague idea of the system load */ |
158 | atomic_t local_resources; | 154 | atomic_t mle_tot_count[DLM_MLE_NUM_TYPES]; |
159 | atomic_t remote_resources; | 155 | atomic_t mle_cur_count[DLM_MLE_NUM_TYPES]; |
160 | atomic_t unknown_resources; | 156 | atomic_t res_tot_count; |
157 | atomic_t res_cur_count; | ||
161 | 158 | ||
162 | struct dlm_debug_ctxt *dlm_debug_ctxt; | 159 | struct dlm_debug_ctxt *dlm_debug_ctxt; |
163 | struct dentry *dlm_debugfs_subroot; | 160 | struct dentry *dlm_debugfs_subroot; |
@@ -195,6 +192,13 @@ static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned | |||
195 | return dlm->lockres_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + (i % DLM_BUCKETS_PER_PAGE); | 192 | return dlm->lockres_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + (i % DLM_BUCKETS_PER_PAGE); |
196 | } | 193 | } |
197 | 194 | ||
195 | static inline struct hlist_head *dlm_master_hash(struct dlm_ctxt *dlm, | ||
196 | unsigned i) | ||
197 | { | ||
198 | return dlm->master_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + | ||
199 | (i % DLM_BUCKETS_PER_PAGE); | ||
200 | } | ||
201 | |||
198 | /* these keventd work queue items are for less-frequently | 202 | /* these keventd work queue items are for less-frequently |
199 | * called functions that cannot be directly called from the | 203 | * called functions that cannot be directly called from the |
200 | * net message handlers for some reason, usually because | 204 | * net message handlers for some reason, usually because |
@@ -848,9 +852,7 @@ struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm, | |||
848 | unsigned int len); | 852 | unsigned int len); |
849 | 853 | ||
850 | int dlm_is_host_down(int errno); | 854 | int dlm_is_host_down(int errno); |
851 | void dlm_change_lockres_owner(struct dlm_ctxt *dlm, | 855 | |
852 | struct dlm_lock_resource *res, | ||
853 | u8 owner); | ||
854 | struct dlm_lock_resource * dlm_get_lock_resource(struct dlm_ctxt *dlm, | 856 | struct dlm_lock_resource * dlm_get_lock_resource(struct dlm_ctxt *dlm, |
855 | const char *lockid, | 857 | const char *lockid, |
856 | int namelen, | 858 | int namelen, |
@@ -1008,6 +1010,9 @@ static inline void __dlm_wait_on_lockres(struct dlm_lock_resource *res) | |||
1008 | DLM_LOCK_RES_MIGRATING)); | 1010 | DLM_LOCK_RES_MIGRATING)); |
1009 | } | 1011 | } |
1010 | 1012 | ||
1013 | void __dlm_unlink_mle(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle); | ||
1014 | void __dlm_insert_mle(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle); | ||
1015 | |||
1011 | /* create/destroy slab caches */ | 1016 | /* create/destroy slab caches */ |
1012 | int dlm_init_master_caches(void); | 1017 | int dlm_init_master_caches(void); |
1013 | void dlm_destroy_master_caches(void); | 1018 | void dlm_destroy_master_caches(void); |
@@ -1110,6 +1115,23 @@ static inline int dlm_node_iter_next(struct dlm_node_iter *iter) | |||
1110 | return bit; | 1115 | return bit; |
1111 | } | 1116 | } |
1112 | 1117 | ||
1118 | static inline void dlm_set_lockres_owner(struct dlm_ctxt *dlm, | ||
1119 | struct dlm_lock_resource *res, | ||
1120 | u8 owner) | ||
1121 | { | ||
1122 | assert_spin_locked(&res->spinlock); | ||
1123 | |||
1124 | res->owner = owner; | ||
1125 | } | ||
1113 | 1126 | ||
1127 | static inline void dlm_change_lockres_owner(struct dlm_ctxt *dlm, | ||
1128 | struct dlm_lock_resource *res, | ||
1129 | u8 owner) | ||
1130 | { | ||
1131 | assert_spin_locked(&res->spinlock); | ||
1132 | |||
1133 | if (owner != res->owner) | ||
1134 | dlm_set_lockres_owner(dlm, res, owner); | ||
1135 | } | ||
1114 | 1136 | ||
1115 | #endif /* DLMCOMMON_H */ | 1137 | #endif /* DLMCOMMON_H */ |