Skip to content

Commit e913135

Browse files
Alexander Aringteigland
authored andcommitted
dlm: use rwlock for rsb hash table
The conversion to rhashtable introduced a hash table lock per lockspace, in place of per bucket locks. To make this more scalable, switch to using a rwlock for hash table access. The common case fast path uses it as a read lock. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent b1f2381 commit e913135

File tree

7 files changed

+206
-87
lines changed

7 files changed

+206
-87
lines changed

fs/dlm/debug_fs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
413413
else
414414
list = &ls->ls_keep;
415415

416-
spin_lock_bh(&ls->ls_rsbtbl_lock);
416+
read_lock_bh(&ls->ls_rsbtbl_lock);
417417
return seq_list_start(list, *pos);
418418
}
419419

@@ -434,7 +434,7 @@ static void table_seq_stop(struct seq_file *seq, void *iter_ptr)
434434
{
435435
struct dlm_ls *ls = seq->private;
436436

437-
spin_unlock_bh(&ls->ls_rsbtbl_lock);
437+
read_unlock_bh(&ls->ls_rsbtbl_lock);
438438
}
439439

440440
static const struct seq_operations format1_seq_ops = {

fs/dlm/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, const char *name,
200200
struct dlm_rsb *r;
201201
int rv;
202202

203-
spin_lock_bh(&ls->ls_rsbtbl_lock);
203+
read_lock_bh(&ls->ls_rsbtbl_lock);
204204
rv = dlm_search_rsb_tree(&ls->ls_rsbtbl, name, len, &r);
205-
spin_unlock_bh(&ls->ls_rsbtbl_lock);
205+
read_unlock_bh(&ls->ls_rsbtbl_lock);
206206
if (!rv)
207207
return r;
208208

fs/dlm/dlm_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ struct dlm_ls {
585585
spinlock_t ls_lkbidr_spin;
586586

587587
struct rhashtable ls_rsbtbl;
588-
spinlock_t ls_rsbtbl_lock;
588+
rwlock_t ls_rsbtbl_lock;
589589

590590
struct list_head ls_toss;
591591
struct list_head ls_keep;

0 commit comments

Comments
 (0)