mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-17 22:23:45 -04:00
dlm: merge toss and keep hash table lists into one list
There are several places where lock processing can perform two hash table lookups, first in the "keep" list, and if not found, in the "toss" list. This patch introduces a new rsb state flag "RSB_TOSS" to represent the difference between the state of being on keep vs toss list, so that the two lists can be combined. This avoids cases of two lookups. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
committed by
David Teigland
parent
dcdaad05ca
commit
2d90354027
@@ -450,12 +450,20 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
if (seq->op == &format4_seq_ops)
|
||||
ri->format = 4;
|
||||
|
||||
tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
|
||||
tree = &ls->ls_rsbtbl[bucket].r;
|
||||
|
||||
spin_lock_bh(&ls->ls_rsbtbl_lock);
|
||||
if (!RB_EMPTY_ROOT(tree)) {
|
||||
for (node = rb_first(tree); node; node = rb_next(node)) {
|
||||
r = rb_entry(node, struct dlm_rsb, res_hashnode);
|
||||
if (toss) {
|
||||
if (!rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
} else {
|
||||
if (rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!entry--) {
|
||||
dlm_hold_rsb(r);
|
||||
ri->rsb = r;
|
||||
@@ -482,12 +490,20 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
kfree(ri);
|
||||
return NULL;
|
||||
}
|
||||
tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
|
||||
tree = &ls->ls_rsbtbl[bucket].r;
|
||||
|
||||
spin_lock_bh(&ls->ls_rsbtbl_lock);
|
||||
if (!RB_EMPTY_ROOT(tree)) {
|
||||
node = rb_first(tree);
|
||||
r = rb_entry(node, struct dlm_rsb, res_hashnode);
|
||||
if (toss) {
|
||||
if (!rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
} else {
|
||||
if (rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
}
|
||||
|
||||
dlm_hold_rsb(r);
|
||||
ri->rsb = r;
|
||||
ri->bucket = bucket;
|
||||
@@ -548,12 +564,19 @@ static void *table_seq_next(struct seq_file *seq, void *iter_ptr, loff_t *pos)
|
||||
++*pos;
|
||||
return NULL;
|
||||
}
|
||||
tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
|
||||
tree = &ls->ls_rsbtbl[bucket].r;
|
||||
|
||||
spin_lock_bh(&ls->ls_rsbtbl_lock);
|
||||
if (!RB_EMPTY_ROOT(tree)) {
|
||||
next = rb_first(tree);
|
||||
r = rb_entry(next, struct dlm_rsb, res_hashnode);
|
||||
if (toss) {
|
||||
if (!rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
} else {
|
||||
if (rsb_flag(r, RSB_TOSS))
|
||||
continue;
|
||||
}
|
||||
dlm_hold_rsb(r);
|
||||
ri->rsb = r;
|
||||
ri->bucket = bucket;
|
||||
|
||||
Reference in New Issue
Block a user