提交 c69e8839 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm:
  dlm: change rsbtbl rwlock to spinlock
  dlm: fix seq_file usage in debugfs lock dump
此差异已折叠。
...@@ -105,7 +105,7 @@ struct dlm_dirtable { ...@@ -105,7 +105,7 @@ struct dlm_dirtable {
struct dlm_rsbtable { struct dlm_rsbtable {
struct list_head list; struct list_head list;
struct list_head toss; struct list_head toss;
rwlock_t lock; spinlock_t lock;
}; };
struct dlm_lkbtable { struct dlm_lkbtable {
......
...@@ -412,9 +412,9 @@ static int search_rsb(struct dlm_ls *ls, char *name, int len, int b, ...@@ -412,9 +412,9 @@ static int search_rsb(struct dlm_ls *ls, char *name, int len, int b,
unsigned int flags, struct dlm_rsb **r_ret) unsigned int flags, struct dlm_rsb **r_ret)
{ {
int error; int error;
write_lock(&ls->ls_rsbtbl[b].lock); spin_lock(&ls->ls_rsbtbl[b].lock);
error = _search_rsb(ls, name, len, b, flags, r_ret); error = _search_rsb(ls, name, len, b, flags, r_ret);
write_unlock(&ls->ls_rsbtbl[b].lock); spin_unlock(&ls->ls_rsbtbl[b].lock);
return error; return error;
} }
...@@ -478,16 +478,16 @@ static int find_rsb(struct dlm_ls *ls, char *name, int namelen, ...@@ -478,16 +478,16 @@ static int find_rsb(struct dlm_ls *ls, char *name, int namelen,
r->res_nodeid = nodeid; r->res_nodeid = nodeid;
} }
write_lock(&ls->ls_rsbtbl[bucket].lock); spin_lock(&ls->ls_rsbtbl[bucket].lock);
error = _search_rsb(ls, name, namelen, bucket, 0, &tmp); error = _search_rsb(ls, name, namelen, bucket, 0, &tmp);
if (!error) { if (!error) {
write_unlock(&ls->ls_rsbtbl[bucket].lock); spin_unlock(&ls->ls_rsbtbl[bucket].lock);
dlm_free_rsb(r); dlm_free_rsb(r);
r = tmp; r = tmp;
goto out; goto out;
} }
list_add(&r->res_hashchain, &ls->ls_rsbtbl[bucket].list); list_add(&r->res_hashchain, &ls->ls_rsbtbl[bucket].list);
write_unlock(&ls->ls_rsbtbl[bucket].lock); spin_unlock(&ls->ls_rsbtbl[bucket].lock);
error = 0; error = 0;
out: out:
*r_ret = r; *r_ret = r;
...@@ -530,9 +530,9 @@ static void put_rsb(struct dlm_rsb *r) ...@@ -530,9 +530,9 @@ static void put_rsb(struct dlm_rsb *r)
struct dlm_ls *ls = r->res_ls; struct dlm_ls *ls = r->res_ls;
uint32_t bucket = r->res_bucket; uint32_t bucket = r->res_bucket;
write_lock(&ls->ls_rsbtbl[bucket].lock); spin_lock(&ls->ls_rsbtbl[bucket].lock);
kref_put(&r->res_ref, toss_rsb); kref_put(&r->res_ref, toss_rsb);
write_unlock(&ls->ls_rsbtbl[bucket].lock); spin_unlock(&ls->ls_rsbtbl[bucket].lock);
} }
void dlm_put_rsb(struct dlm_rsb *r) void dlm_put_rsb(struct dlm_rsb *r)
...@@ -967,7 +967,7 @@ static int shrink_bucket(struct dlm_ls *ls, int b) ...@@ -967,7 +967,7 @@ static int shrink_bucket(struct dlm_ls *ls, int b)
for (;;) { for (;;) {
found = 0; found = 0;
write_lock(&ls->ls_rsbtbl[b].lock); spin_lock(&ls->ls_rsbtbl[b].lock);
list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss, list_for_each_entry_reverse(r, &ls->ls_rsbtbl[b].toss,
res_hashchain) { res_hashchain) {
if (!time_after_eq(jiffies, r->res_toss_time + if (!time_after_eq(jiffies, r->res_toss_time +
...@@ -978,20 +978,20 @@ static int shrink_bucket(struct dlm_ls *ls, int b) ...@@ -978,20 +978,20 @@ static int shrink_bucket(struct dlm_ls *ls, int b)
} }
if (!found) { if (!found) {
write_unlock(&ls->ls_rsbtbl[b].lock); spin_unlock(&ls->ls_rsbtbl[b].lock);
break; break;
} }
if (kref_put(&r->res_ref, kill_rsb)) { if (kref_put(&r->res_ref, kill_rsb)) {
list_del(&r->res_hashchain); list_del(&r->res_hashchain);
write_unlock(&ls->ls_rsbtbl[b].lock); spin_unlock(&ls->ls_rsbtbl[b].lock);
if (is_master(r)) if (is_master(r))
dir_remove(r); dir_remove(r);
dlm_free_rsb(r); dlm_free_rsb(r);
count++; count++;
} else { } else {
write_unlock(&ls->ls_rsbtbl[b].lock); spin_unlock(&ls->ls_rsbtbl[b].lock);
log_error(ls, "tossed rsb in use %s", r->res_name); log_error(ls, "tossed rsb in use %s", r->res_name);
} }
} }
...@@ -4224,7 +4224,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket) ...@@ -4224,7 +4224,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket)
{ {
struct dlm_rsb *r, *r_ret = NULL; struct dlm_rsb *r, *r_ret = NULL;
read_lock(&ls->ls_rsbtbl[bucket].lock); spin_lock(&ls->ls_rsbtbl[bucket].lock);
list_for_each_entry(r, &ls->ls_rsbtbl[bucket].list, res_hashchain) { list_for_each_entry(r, &ls->ls_rsbtbl[bucket].list, res_hashchain) {
if (!rsb_flag(r, RSB_LOCKS_PURGED)) if (!rsb_flag(r, RSB_LOCKS_PURGED))
continue; continue;
...@@ -4233,7 +4233,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket) ...@@ -4233,7 +4233,7 @@ static struct dlm_rsb *find_purged_rsb(struct dlm_ls *ls, int bucket)
r_ret = r; r_ret = r;
break; break;
} }
read_unlock(&ls->ls_rsbtbl[bucket].lock); spin_unlock(&ls->ls_rsbtbl[bucket].lock);
return r_ret; return r_ret;
} }
......
...@@ -464,7 +464,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace, ...@@ -464,7 +464,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
INIT_LIST_HEAD(&ls->ls_rsbtbl[i].list); INIT_LIST_HEAD(&ls->ls_rsbtbl[i].list);
INIT_LIST_HEAD(&ls->ls_rsbtbl[i].toss); INIT_LIST_HEAD(&ls->ls_rsbtbl[i].toss);
rwlock_init(&ls->ls_rsbtbl[i].lock); spin_lock_init(&ls->ls_rsbtbl[i].lock);
} }
size = dlm_config.ci_lkbtbl_size; size = dlm_config.ci_lkbtbl_size;
......
...@@ -726,7 +726,7 @@ int dlm_create_root_list(struct dlm_ls *ls) ...@@ -726,7 +726,7 @@ int dlm_create_root_list(struct dlm_ls *ls)
} }
for (i = 0; i < ls->ls_rsbtbl_size; i++) { for (i = 0; i < ls->ls_rsbtbl_size; i++) {
read_lock(&ls->ls_rsbtbl[i].lock); spin_lock(&ls->ls_rsbtbl[i].lock);
list_for_each_entry(r, &ls->ls_rsbtbl[i].list, res_hashchain) { list_for_each_entry(r, &ls->ls_rsbtbl[i].list, res_hashchain) {
list_add(&r->res_root_list, &ls->ls_root_list); list_add(&r->res_root_list, &ls->ls_root_list);
dlm_hold_rsb(r); dlm_hold_rsb(r);
...@@ -737,7 +737,7 @@ int dlm_create_root_list(struct dlm_ls *ls) ...@@ -737,7 +737,7 @@ int dlm_create_root_list(struct dlm_ls *ls)
but no other recovery steps should do anything with them. */ but no other recovery steps should do anything with them. */
if (dlm_no_directory(ls)) { if (dlm_no_directory(ls)) {
read_unlock(&ls->ls_rsbtbl[i].lock); spin_unlock(&ls->ls_rsbtbl[i].lock);
continue; continue;
} }
...@@ -745,7 +745,7 @@ int dlm_create_root_list(struct dlm_ls *ls) ...@@ -745,7 +745,7 @@ int dlm_create_root_list(struct dlm_ls *ls)
list_add(&r->res_root_list, &ls->ls_root_list); list_add(&r->res_root_list, &ls->ls_root_list);
dlm_hold_rsb(r); dlm_hold_rsb(r);
} }
read_unlock(&ls->ls_rsbtbl[i].lock); spin_unlock(&ls->ls_rsbtbl[i].lock);
} }
out: out:
up_write(&ls->ls_root_sem); up_write(&ls->ls_root_sem);
...@@ -775,7 +775,7 @@ void dlm_clear_toss_list(struct dlm_ls *ls) ...@@ -775,7 +775,7 @@ void dlm_clear_toss_list(struct dlm_ls *ls)
int i; int i;
for (i = 0; i < ls->ls_rsbtbl_size; i++) { for (i = 0; i < ls->ls_rsbtbl_size; i++) {
write_lock(&ls->ls_rsbtbl[i].lock); spin_lock(&ls->ls_rsbtbl[i].lock);
list_for_each_entry_safe(r, safe, &ls->ls_rsbtbl[i].toss, list_for_each_entry_safe(r, safe, &ls->ls_rsbtbl[i].toss,
res_hashchain) { res_hashchain) {
if (dlm_no_directory(ls) || !is_master(r)) { if (dlm_no_directory(ls) || !is_master(r)) {
...@@ -783,7 +783,7 @@ void dlm_clear_toss_list(struct dlm_ls *ls) ...@@ -783,7 +783,7 @@ void dlm_clear_toss_list(struct dlm_ls *ls)
dlm_free_rsb(r); dlm_free_rsb(r);
} }
} }
write_unlock(&ls->ls_rsbtbl[i].lock); spin_unlock(&ls->ls_rsbtbl[i].lock);
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册