]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/ocfs2-dlm-create-and-destroy-the-dlm-master_hash.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / ocfs2-dlm-create-and-destroy-the-dlm-master_hash.patch
CommitLineData
2cb7cef9
BS
1From: Sunil Mushran <sunil.mushran@oracle.com>
2Date: Thu, 26 Feb 2009 15:00:40 -0800
3Subject: ocfs2/dlm: Create and destroy the dlm->master_hash
4Patch-mainline: 2.6.30
5References: bnc#408304
6
7This patch adds code to create and destroy the dlm->master_hash.
8
9Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
10Signed-off-by: Mark Fasheh <mfasheh@suse.com>
11---
12 fs/ocfs2/dlm/dlmcommon.h | 8 ++++++++
13 fs/ocfs2/dlm/dlmdomain.c | 18 ++++++++++++++++++
14 2 files changed, 26 insertions(+), 0 deletions(-)
15
16Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h
17===================================================================
18--- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmcommon.h
19+++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h
20@@ -151,6 +151,7 @@ struct dlm_ctxt
21 unsigned long recovery_map[BITS_TO_LONGS(O2NM_MAX_NODES)];
22 struct dlm_recovery_ctxt reco;
23 spinlock_t master_lock;
24+ struct hlist_head **master_hash;
25 struct list_head master_list;
26 struct list_head mle_hb_events;
27
28@@ -195,6 +196,13 @@ static inline struct hlist_head *dlm_loc
29 return dlm->lockres_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + (i % DLM_BUCKETS_PER_PAGE);
30 }
31
32+static inline struct hlist_head *dlm_master_hash(struct dlm_ctxt *dlm,
33+ unsigned i)
34+{
35+ return dlm->master_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] +
36+ (i % DLM_BUCKETS_PER_PAGE);
37+}
38+
39 /* these keventd work queue items are for less-frequently
40 * called functions that cannot be directly called from the
41 * net message handlers for some reason, usually because
42Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdomain.c
43===================================================================
44--- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmdomain.c
45+++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdomain.c
46@@ -304,6 +304,9 @@ static void dlm_free_ctxt_mem(struct dlm
47 if (dlm->lockres_hash)
48 dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
49
50+ if (dlm->master_hash)
51+ dlm_free_pagevec((void **)dlm->master_hash, DLM_HASH_PAGES);
52+
53 if (dlm->name)
54 kfree(dlm->name);
55
56@@ -1534,12 +1537,27 @@ static struct dlm_ctxt *dlm_alloc_ctxt(c
57 for (i = 0; i < DLM_HASH_BUCKETS; i++)
58 INIT_HLIST_HEAD(dlm_lockres_hash(dlm, i));
59
60+ dlm->master_hash = (struct hlist_head **)
61+ dlm_alloc_pagevec(DLM_HASH_PAGES);
62+ if (!dlm->master_hash) {
63+ mlog_errno(-ENOMEM);
64+ dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
65+ kfree(dlm->name);
66+ kfree(dlm);
67+ dlm = NULL;
68+ goto leave;
69+ }
70+
71+ for (i = 0; i < DLM_HASH_BUCKETS; i++)
72+ INIT_HLIST_HEAD(dlm_master_hash(dlm, i));
73+
74 strcpy(dlm->name, domain);
75 dlm->key = key;
76 dlm->node_num = o2nm_this_node();
77
78 ret = dlm_create_debugfs_subroot(dlm);
79 if (ret < 0) {
80+ dlm_free_pagevec((void **)dlm->master_hash, DLM_HASH_PAGES);
81 dlm_free_pagevec((void **)dlm->lockres_hash, DLM_HASH_PAGES);
82 kfree(dlm->name);
83 kfree(dlm);