aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/dlm_internal.h
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2012-05-10 11:18:07 -0400
committerDavid Teigland <teigland@redhat.com>2012-07-16 15:16:19 -0400
commitc04fecb4d9f7753e0cbff7edd03ec68f8721cdce (patch)
treeecd82017d49c7bb03b96a8ad1eb4e9a5bb84409a /fs/dlm/dlm_internal.h
parentecc728467fb0c3e350b57fc66ed7585c15be50f5 (diff)
dlm: use rsbtbl as resource directory
Remove the dir hash table (dirtbl), and use the rsb hash table (rsbtbl) as the resource directory. It has always been an unnecessary duplication of information. This improves efficiency by using a single rsbtbl lookup in many cases where both rsbtbl and dirtbl lookups were needed previously. This eliminates the need to handle cases of rsbtbl and dirtbl being out of sync. In many cases there will be memory savings because the dir hash table no longer exists. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/dlm_internal.h')
-rw-r--r--fs/dlm/dlm_internal.h46
1 files changed, 27 insertions, 19 deletions
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index bc342f7ac3af..3093207a7684 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -55,8 +55,6 @@ struct dlm_lkb;
55struct dlm_rsb; 55struct dlm_rsb;
56struct dlm_member; 56struct dlm_member;
57struct dlm_rsbtable; 57struct dlm_rsbtable;
58struct dlm_dirtable;
59struct dlm_direntry;
60struct dlm_recover; 58struct dlm_recover;
61struct dlm_header; 59struct dlm_header;
62struct dlm_message; 60struct dlm_message;
@@ -98,18 +96,6 @@ do { \
98} 96}
99 97
100 98
101struct dlm_direntry {
102 struct list_head list;
103 uint32_t master_nodeid;
104 uint16_t length;
105 char name[1];
106};
107
108struct dlm_dirtable {
109 struct list_head list;
110 spinlock_t lock;
111};
112
113struct dlm_rsbtable { 99struct dlm_rsbtable {
114 struct rb_root keep; 100 struct rb_root keep;
115 struct rb_root toss; 101 struct rb_root toss;
@@ -283,6 +269,15 @@ struct dlm_lkb {
283 }; 269 };
284}; 270};
285 271
272/*
273 * res_master_nodeid is "normal": 0 is unset/invalid, non-zero is the real
274 * nodeid, even when nodeid is our_nodeid.
275 *
276 * res_nodeid is "odd": -1 is unset/invalid, zero means our_nodeid,
277 * greater than zero when another nodeid.
278 *
279 * (TODO: remove res_nodeid and only use res_master_nodeid)
280 */
286 281
287struct dlm_rsb { 282struct dlm_rsb {
288 struct dlm_ls *res_ls; /* the lockspace */ 283 struct dlm_ls *res_ls; /* the lockspace */
@@ -291,6 +286,8 @@ struct dlm_rsb {
291 unsigned long res_flags; 286 unsigned long res_flags;
292 int res_length; /* length of rsb name */ 287 int res_length; /* length of rsb name */
293 int res_nodeid; 288 int res_nodeid;
289 int res_master_nodeid;
290 int res_dir_nodeid;
294 uint32_t res_lvbseq; 291 uint32_t res_lvbseq;
295 uint32_t res_hash; 292 uint32_t res_hash;
296 uint32_t res_bucket; /* rsbtbl */ 293 uint32_t res_bucket; /* rsbtbl */
@@ -313,10 +310,21 @@ struct dlm_rsb {
313 char res_name[DLM_RESNAME_MAXLEN+1]; 310 char res_name[DLM_RESNAME_MAXLEN+1];
314}; 311};
315 312
313/* dlm_master_lookup() flags */
314
315#define DLM_LU_RECOVER_DIR 1
316#define DLM_LU_RECOVER_MASTER 2
317
318/* dlm_master_lookup() results */
319
320#define DLM_LU_MATCH 1
321#define DLM_LU_ADD 2
322
316/* find_rsb() flags */ 323/* find_rsb() flags */
317 324
318#define R_MASTER 1 /* only return rsb if it's a master */ 325#define R_REQUEST 0x00000001
319#define R_CREATE 2 /* create/add rsb if not found */ 326#define R_RECEIVE_REQUEST 0x00000002
327#define R_RECEIVE_RECOVER 0x00000004
320 328
321/* rsb_flags */ 329/* rsb_flags */
322 330
@@ -509,9 +517,6 @@ struct dlm_ls {
509 struct dlm_rsbtable *ls_rsbtbl; 517 struct dlm_rsbtable *ls_rsbtbl;
510 uint32_t ls_rsbtbl_size; 518 uint32_t ls_rsbtbl_size;
511 519
512 struct dlm_dirtable *ls_dirtbl;
513 uint32_t ls_dirtbl_size;
514
515 struct mutex ls_waiters_mutex; 520 struct mutex ls_waiters_mutex;
516 struct list_head ls_waiters; /* lkbs needing a reply */ 521 struct list_head ls_waiters; /* lkbs needing a reply */
517 522
@@ -545,6 +550,7 @@ struct dlm_ls {
545 struct dentry *ls_debug_waiters_dentry; /* debugfs */ 550 struct dentry *ls_debug_waiters_dentry; /* debugfs */
546 struct dentry *ls_debug_locks_dentry; /* debugfs */ 551 struct dentry *ls_debug_locks_dentry; /* debugfs */
547 struct dentry *ls_debug_all_dentry; /* debugfs */ 552 struct dentry *ls_debug_all_dentry; /* debugfs */
553 struct dentry *ls_debug_toss_dentry; /* debugfs */
548 554
549 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ 555 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */
550 int ls_uevent_result; 556 int ls_uevent_result;
@@ -573,6 +579,8 @@ struct dlm_ls {
573 struct mutex ls_requestqueue_mutex; 579 struct mutex ls_requestqueue_mutex;
574 struct dlm_rcom *ls_recover_buf; 580 struct dlm_rcom *ls_recover_buf;
575 int ls_recover_nodeid; /* for debugging */ 581 int ls_recover_nodeid; /* for debugging */
582 unsigned int ls_recover_dir_sent_res; /* for log info */
583 unsigned int ls_recover_dir_sent_msg; /* for log info */
576 unsigned int ls_recover_locks_in; /* for log info */ 584 unsigned int ls_recover_locks_in; /* for log info */
577 uint64_t ls_rcom_seq; 585 uint64_t ls_rcom_seq;
578 spinlock_t ls_rcom_spin; 586 spinlock_t ls_rcom_spin;