linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / ocfs2 / dlm / dlmcommon.h
index 14530ee..9c77258 100644 (file)
 #define DLM_THREAD_SHUFFLE_INTERVAL    5     // flush everything every 5 passes
 #define DLM_THREAD_MS                  200   // flush at least every 200 ms
 
-#define DLM_HASH_SIZE_DEFAULT  (1 << 14)
-#if DLM_HASH_SIZE_DEFAULT < PAGE_SIZE
-# define DLM_HASH_PAGES                1
-#else
-# define DLM_HASH_PAGES                (DLM_HASH_SIZE_DEFAULT / PAGE_SIZE)
-#endif
-#define DLM_BUCKETS_PER_PAGE   (PAGE_SIZE / sizeof(struct hlist_head))
-#define DLM_HASH_BUCKETS       (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE)
-
-/* Intended to make it easier for us to switch out hash functions */
-#define dlm_lockid_hash(_n, _l) full_name_hash(_n, _l)
+#define DLM_HASH_BUCKETS     (PAGE_SIZE / sizeof(struct hlist_head))
 
 enum dlm_ast_type {
        DLM_AST = 0,
@@ -71,8 +61,7 @@ static inline int dlm_is_recovery_lock(const char *lock_name, int name_len)
        return 0;
 }
 
-#define DLM_RECO_STATE_ACTIVE    0x0001
-#define DLM_RECO_STATE_FINALIZE  0x0002
+#define DLM_RECO_STATE_ACTIVE  0x0001
 
 struct dlm_recovery_ctxt
 {
@@ -96,7 +85,7 @@ enum dlm_ctxt_state {
 struct dlm_ctxt
 {
        struct list_head list;
-       struct hlist_head **lockres_hash;
+       struct hlist_head *lockres_hash;
        struct list_head dirty_list;
        struct list_head purge_list;
        struct list_head pending_asts;
@@ -131,7 +120,6 @@ struct dlm_ctxt
        struct o2hb_callback_func dlm_hb_down;
        struct task_struct *dlm_thread_task;
        struct task_struct *dlm_reco_thread_task;
-       struct workqueue_struct *dlm_worker;
        wait_queue_head_t dlm_thread_wq;
        wait_queue_head_t dlm_reco_thread_wq;
        wait_queue_head_t ast_wq;
@@ -144,11 +132,6 @@ struct dlm_ctxt
        struct list_head        dlm_eviction_callbacks;
 };
 
-static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned i)
-{
-       return dlm->lockres_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + (i % DLM_BUCKETS_PER_PAGE);
-}
-
 /* these keventd work queue items are for less-frequently
  * called functions that cannot be directly called from the
  * net message handlers for some reason, usually because
@@ -233,29 +216,20 @@ struct dlm_lock_resource
        /* WARNING: Please see the comment in dlm_init_lockres before
         * adding fields here. */
        struct hlist_node hash_node;
-       struct qstr lockname;
        struct kref      refs;
 
-       /*
-        * Please keep granted, converting, and blocked in this order,
-        * as some funcs want to iterate over all lists.
-        *
-        * All four lists are protected by the hash's reference.
-        */
+       /* please keep these next 3 in this order
+        * some funcs want to iterate over all lists */
        struct list_head granted;
        struct list_head converting;
        struct list_head blocked;
-       struct list_head purge;
 
-       /*
-        * These two lists require you to hold an additional reference
-        * while they are on the list.
-        */
        struct list_head dirty;
        struct list_head recovering; // dlm_recovery_ctxt.resources list
 
        /* unused lock resources have their last_used stamped and are
         * put on a list for the dlm thread to run. */
+       struct list_head purge;
        unsigned long    last_used;
 
        unsigned migration_pending:1;
@@ -264,6 +238,7 @@ struct dlm_lock_resource
        wait_queue_head_t wq;
        u8  owner;              //node which owns the lock resource, or unknown
        u16 state;
+       struct qstr lockname;
        char lvb[DLM_LVB_LEN];
 };
 
@@ -325,15 +300,6 @@ enum dlm_lockres_list {
        DLM_BLOCKED_LIST
 };
 
-static inline int dlm_lvb_is_empty(char *lvb)
-{
-       int i;
-       for (i=0; i<DLM_LVB_LEN; i++)
-               if (lvb[i])
-                       return 0;
-       return 1;
-}
-
 static inline struct list_head *
 dlm_list_idx_to_ptr(struct dlm_lock_resource *res, enum dlm_lockres_list idx)
 {
@@ -643,8 +609,7 @@ struct dlm_finalize_reco
 {
        u8 node_idx;
        u8 dead_node;
-       u8 flags;
-       u8 pad1;
+       __be16 pad1;
        __be32 pad2;
 };
 
@@ -665,21 +630,6 @@ __dlm_lockres_state_to_status(struct dlm_lock_resource *res)
        return status;
 }
 
-static inline u8 dlm_get_lock_cookie_node(u64 cookie)
-{
-       u8 ret;
-       cookie >>= 56;
-       ret = (u8)(cookie & 0xffULL);
-       return ret;
-}
-
-static inline unsigned long long dlm_get_lock_cookie_seq(u64 cookie)
-{
-       unsigned long long ret;
-       ret = ((unsigned long long)cookie) & 0x00ffffffffffffffULL;
-       return ret;
-}
-
 struct dlm_lock * dlm_new_lock(int type, u8 node, u64 cookie,
                               struct dlm_lockstatus *lksb);
 void dlm_lock_get(struct dlm_lock *lock);
@@ -708,10 +658,8 @@ void dlm_complete_thread(struct dlm_ctxt *dlm);
 int dlm_launch_recovery_thread(struct dlm_ctxt *dlm);
 void dlm_complete_recovery_thread(struct dlm_ctxt *dlm);
 void dlm_wait_for_recovery(struct dlm_ctxt *dlm);
-void dlm_kick_recovery_thread(struct dlm_ctxt *dlm);
 int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node);
 int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout);
-int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout);
 
 void dlm_put(struct dlm_ctxt *dlm);
 struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm);
@@ -723,20 +671,14 @@ void dlm_lockres_calc_usage(struct dlm_ctxt *dlm,
                            struct dlm_lock_resource *res);
 void dlm_purge_lockres(struct dlm_ctxt *dlm,
                       struct dlm_lock_resource *lockres);
-static inline void dlm_lockres_get(struct dlm_lock_resource *res)
-{
-       /* This is called on every lookup, so it might be worth
-        * inlining. */
-       kref_get(&res->refs);
-}
+void dlm_lockres_get(struct dlm_lock_resource *res);
 void dlm_lockres_put(struct dlm_lock_resource *res);
 void __dlm_unhash_lockres(struct dlm_lock_resource *res);
 void __dlm_insert_lockres(struct dlm_ctxt *dlm,
                          struct dlm_lock_resource *res);
 struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
                                                const char *name,
-                                               unsigned int len,
-                                               unsigned int hash);
+                                               unsigned int len);
 struct dlm_lock_resource * dlm_lookup_lockres(struct dlm_ctxt *dlm,
                                              const char *name,
                                              unsigned int len);
@@ -820,9 +762,6 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data);
 int dlm_reco_data_done_handler(struct o2net_msg *msg, u32 len, void *data);
 int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data);
 int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data);
-int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
-                         u8 nodenum, u8 *real_master);
-
 
 int dlm_dispatch_assert_master(struct dlm_ctxt *dlm,
                               struct dlm_lock_resource *res,
@@ -859,7 +798,6 @@ void dlm_clean_master_list(struct dlm_ctxt *dlm,
                           u8 dead_node);
 int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock);
 
-int __dlm_lockres_unused(struct dlm_lock_resource *res);
 
 static inline const char * dlm_lock_mode_name(int mode)
 {