diff options
author | David Teigland <teigland@redhat.com> | 2009-01-07 17:50:41 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2009-01-08 16:12:39 -0500 |
commit | c7be761a8163d2f1ac0b606c21e4316b7abc5af7 (patch) | |
tree | 1687373b56379c1c310f43b1c05ac486c67dec48 /fs/dlm/lock.c | |
parent | 892c4467e335e9050c95e0d8409c136c4dadaca2 (diff) |
dlm: change rsbtbl rwlock to spinlock
The rwlock is almost always used in write mode, so there's no reason
to not use a spinlock instead.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lock.c')
-rw-r--r-- | fs/dlm/lock.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 6cfe65bbf4a2..01e7d39c5fba 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -412,9 +412,9 @@ static int search_rsb(struct dlm_ls *ls, char *name, int len, int b, | |||
412 | unsigned int flags, struct dlm_rsb **r_ret) | 412 | unsigned int flags, struct dlm_rsb **r_ret) |
413 | { | 413 | { |
414 | int error; | 414 | int error; |
415 | write_lock(&ls->ls_rsbtbl[b].lock); | 415 | spin_lock(&ls->ls_rsbtbl[b].lock); |
416 | error = _search_rsb(ls, name, len, b, flags, r_ret); | 416 | error = _search_rsb(ls, name, len, b, flags, r_ret); |
417 | write_unlock(&ls->ls_rsbtbl[b].lock); | 417 | spin_unlock(&ls->ls_rsbtbl[b].lock); |
418 | return error; | 418 | return error; |
419 | } | 419 | } |
420 | 420 | ||
@@ -478,16 +478,16 @@ static int find_rsb(struct dlm_ls *ls, char *name, int namelen, | |||
478 | r->res_nodeid = nodeid; | 478 | r->res_nodeid = nodeid; |
479 | } | 479 | } |
480 | 480 | ||
481 | write_lock(&ls->ls_rsbtbl[bucket].lock); | 481 | spin_lock(&ls->ls_rsbtbl[bucket].lock); |
482 | error = _search_rsb(ls, name, namelen, bucket, 0, &tmp); | 482 | error = _search_rsb(ls, name, namelen, bucket, 0, &tmp); |
483 | if (!error) { | 483 | if (!error) { |
484 | write_unlock(&ls->ls_rsbtbl[bucket].lock); | 484 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); |
485 | dlm_free_rsb(r); | 485 | dlm_free_rsb(r); |
486 | r = tmp; | 486 | r = tmp; |
487 | goto out; | 487 | goto out; |
488 | } | 488 | } |
489 | list_add(&r->res_hashchain, &ls->ls_rsbtbl[bucket].list); | 489 | list_add(&r->res_hashchain, &ls->ls_rsbtbl[bucket].list); |
490 | write_unlock(&ls->ls_rsbtbl[bucket].lock); | 490 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); |
491 | error = 0; | 491 | error = 0; |
492 | out: | 492 | out: |
493 | *r_ret = r; | 493 | *r_ret = r; |
@@ -530,9 +530,9 @@ static void put_rsb(struct dlm_rsb *r) | |||
530 | struct dlm_ls *ls = r->res_ls; | 530 | struct dlm_ls *ls = r->res_ls; |
531 | uint32_t bucket = r->res_bucket; | 531 | uint32_t bucket = r->res_bucket; |
532 | 532 | ||
533 | write_lock(&ls->ls_rsbtbl[bucket].lock); | 533 | spin_lock(&ls->ls_rsbtbl[bucket].lock); |
534 | kref_put(&r->res_ref, toss_rsb); | 534 | kref_put(&r->res_ref, toss_rsb); |
535 | write_unlock(&ls->ls_rsbtbl[bucket].lock); | 535 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); |
536 | } | 536 | } |
537 | 537 | ||
538 | void dlm_put_rsb(struct dlm_rsb *r) | 538 | void dlm_put_rsb(struct dlm_rsb *r) |
@@ -967,7 +967,7 @@ static int shrink_bucket(struct dlm_ls *ls, int b) | |||
967 | 967 | ||
968 | for (;;) { | 968 | for (;;) { |
969 | found = 0; | 969 | found = 0; |
970 | write_lock(&ls->ls_rsbtbl[b].lock); | 970 | spin_lock(&ls->ls_rsbtbl[b].lock); |
971 | list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss, | 971 | list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss, |
972 | res_hashchain) { | 972 | res_hashchain) { |
973 | if (!time_after_eq(jiffies, r->res_toss_time + | 973 | if (!time_after_eq(jiffies, r->res_toss_time + |
@@ -978,20 +978,20 @@ static int shrink_bucket(struct dlm_ls *ls, int b) | |||
978 | } | 978 | } |
979 | 979 | ||
980 | if (!found) { | 980 | if (!found) { |
981 | write_unlock(&ls->ls_rsbtbl[b].lock); | 981 | spin_unlock(&ls->ls_rsbtbl[b].lock); |
982 | break; | 982 | break; |
983 | } | 983 | } |
984 | 984 | ||
985 | if (kref_put(&r->res_ref, kill_rsb)) { | 985 | if (kref_put(&r->res_ref, kill_rsb)) { |
986 | list_del(&r->res_hashchain); | 986 | list_del(&r->res_hashchain); |
987 | write_unlock(&ls->ls_rsbtbl[b].lock); | 987 | spin_unlock(&ls->ls_rsbtbl[b].lock); |
988 | 988 | ||
989 | if (is_master(r)) | 989 | if (is_master(r)) |
990 | dir_remove(r); | 990 | dir_remove(r); |
991 | dlm_free_rsb(r); | 991 | dlm_free_rsb(r); |
992 | count++; | 992 | count++; |
993 | } else { | 993 | } else { |
994 | write_unlock(&ls->ls_rsbtbl[b].lock); | 994 | spin_unlock(&ls->ls_rsbtbl[b].lock); |
995 | log_error(ls, "tossed rsb in use %s", r->res_name); | 995 | log_error(ls, "tossed rsb in use %s", r->res_name); |
996 | } | 996 | } |
997 | } | 997 | } |
@@ -4224,7 +4224,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket) | |||
4224 | { | 4224 | { |
4225 | struct dlm_rsb *r, *r_ret = NULL; | 4225 | struct dlm_rsb *r, *r_ret = NULL; |
4226 | 4226 | ||
4227 | read_lock(&ls->ls_rsbtbl[bucket].lock); | 4227 | spin_lock(&ls->ls_rsbtbl[bucket].lock); |
4228 | list_for_each_entry(r, &ls->ls_rsbtbl[bucket].list, res_hashchain) { | 4228 | list_for_each_entry(r, &ls->ls_rsbtbl[bucket].list, res_hashchain) { |
4229 | if (!rsb_flag(r, RSB_LOCKS_PURGED)) | 4229 | if (!rsb_flag(r, RSB_LOCKS_PURGED)) |
4230 | continue; | 4230 | continue; |
@@ -4233,7 +4233,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket) | |||
4233 | r_ret = r; | 4233 | r_ret = r; |
4234 | break; | 4234 | break; |
4235 | } | 4235 | } |
4236 | read_unlock(&ls->ls_rsbtbl[bucket].lock); | 4236 | spin_unlock(&ls->ls_rsbtbl[bucket].lock); |
4237 | return r_ret; | 4237 | return r_ret; |
4238 | } | 4238 | } |
4239 | 4239 | ||