diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 16:54:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 16:54:22 -0400 |
commit | 30d73f375238441d6dc31de0d90bc39f5bb0bfe5 (patch) | |
tree | 0a94e144fbb7d3fa84c443fb6cc61f2f01f61a1b /fs/dlm | |
parent | e2a0883e4071237d09b604a342c28b96b44a04b3 (diff) | |
parent | 1b189b8889b7d8e0bddc2655d171c43cfd344157 (diff) |
Merge tag 'dlm-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates for 3.4 from David Teigland:
"This set includes one trivial fix, and one simple recovery speed up.
Directory recovery can use the standard hash table to find resources
rather than always searching the linear recovery list."
* tag 'dlm-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
dlm: last element of dlm_local_addr[] never used
dlm: fix slow rsb search in dir recovery
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/dir.c | 17 | ||||
-rw-r--r-- | fs/dlm/lock.c | 8 | ||||
-rw-r--r-- | fs/dlm/lock.h | 3 | ||||
-rw-r--r-- | fs/dlm/lowcomms.c | 2 |
4 files changed, 25 insertions, 5 deletions
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c index 83641574b016..dc5eb598b81f 100644 --- a/fs/dlm/dir.c +++ b/fs/dlm/dir.c | |||
@@ -351,11 +351,28 @@ int dlm_dir_lookup(struct dlm_ls *ls, int nodeid, char *name, int namelen, | |||
351 | static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len) | 351 | static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len) |
352 | { | 352 | { |
353 | struct dlm_rsb *r; | 353 | struct dlm_rsb *r; |
354 | uint32_t hash, bucket; | ||
355 | int rv; | ||
356 | |||
357 | hash = jhash(name, len, 0); | ||
358 | bucket = hash & (ls->ls_rsbtbl_size - 1); | ||
359 | |||
360 | spin_lock(&ls->ls_rsbtbl[bucket].lock); | ||
361 | rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].keep, name, len, 0, &r); | ||
362 | if (rv) | ||
363 | rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].toss, | ||
364 | name, len, 0, &r); | ||
365 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); | ||
366 | |||
367 | if (!rv) | ||
368 | return r; | ||
354 | 369 | ||
355 | down_read(&ls->ls_root_sem); | 370 | down_read(&ls->ls_root_sem); |
356 | list_for_each_entry(r, &ls->ls_root_list, res_root_list) { | 371 | list_for_each_entry(r, &ls->ls_root_list, res_root_list) { |
357 | if (len == r->res_length && !memcmp(name, r->res_name, len)) { | 372 | if (len == r->res_length && !memcmp(name, r->res_name, len)) { |
358 | up_read(&ls->ls_root_sem); | 373 | up_read(&ls->ls_root_sem); |
374 | log_error(ls, "find_rsb_root revert to root_list %s", | ||
375 | r->res_name); | ||
359 | return r; | 376 | return r; |
360 | } | 377 | } |
361 | } | 378 | } |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index d47183043c59..fa5c07d51dcc 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -411,8 +411,8 @@ static int rsb_cmp(struct dlm_rsb *r, const char *name, int nlen) | |||
411 | return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN); | 411 | return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN); |
412 | } | 412 | } |
413 | 413 | ||
414 | static int search_rsb_tree(struct rb_root *tree, char *name, int len, | 414 | int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len, |
415 | unsigned int flags, struct dlm_rsb **r_ret) | 415 | unsigned int flags, struct dlm_rsb **r_ret) |
416 | { | 416 | { |
417 | struct rb_node *node = tree->rb_node; | 417 | struct rb_node *node = tree->rb_node; |
418 | struct dlm_rsb *r; | 418 | struct dlm_rsb *r; |
@@ -474,12 +474,12 @@ static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b, | |||
474 | struct dlm_rsb *r; | 474 | struct dlm_rsb *r; |
475 | int error; | 475 | int error; |
476 | 476 | ||
477 | error = search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r); | 477 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r); |
478 | if (!error) { | 478 | if (!error) { |
479 | kref_get(&r->res_ref); | 479 | kref_get(&r->res_ref); |
480 | goto out; | 480 | goto out; |
481 | } | 481 | } |
482 | error = search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); | 482 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); |
483 | if (error) | 483 | if (error) |
484 | goto out; | 484 | goto out; |
485 | 485 | ||
diff --git a/fs/dlm/lock.h b/fs/dlm/lock.h index 265017a7c3e7..1a255307f6ff 100644 --- a/fs/dlm/lock.h +++ b/fs/dlm/lock.h | |||
@@ -28,6 +28,9 @@ void dlm_scan_waiters(struct dlm_ls *ls); | |||
28 | void dlm_scan_timeout(struct dlm_ls *ls); | 28 | void dlm_scan_timeout(struct dlm_ls *ls); |
29 | void dlm_adjust_timeouts(struct dlm_ls *ls); | 29 | void dlm_adjust_timeouts(struct dlm_ls *ls); |
30 | 30 | ||
31 | int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len, | ||
32 | unsigned int flags, struct dlm_rsb **r_ret); | ||
33 | |||
31 | int dlm_purge_locks(struct dlm_ls *ls); | 34 | int dlm_purge_locks(struct dlm_ls *ls); |
32 | void dlm_purge_mstcpy_locks(struct dlm_rsb *r); | 35 | void dlm_purge_mstcpy_locks(struct dlm_rsb *r); |
33 | void dlm_grant_after_purge(struct dlm_ls *ls); | 36 | void dlm_grant_after_purge(struct dlm_ls *ls); |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index ca0c59a4246c..133ef6dc7cb7 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -1076,7 +1076,7 @@ static void init_local(void) | |||
1076 | int i; | 1076 | int i; |
1077 | 1077 | ||
1078 | dlm_local_count = 0; | 1078 | dlm_local_count = 0; |
1079 | for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) { | 1079 | for (i = 0; i < DLM_MAX_ADDR_COUNT; i++) { |
1080 | if (dlm_our_addr(&sas, i)) | 1080 | if (dlm_our_addr(&sas, i)) |
1081 | break; | 1081 | break; |
1082 | 1082 | ||