Skip to content

Commit 46d6e72

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: rsb hash table flag value to atomic ops
This patch moves the rsb hash table handling to atomic flag operations. The flag operations for DLM_RTF_SHRINK are protected by ls->ls_rsbtbl[b].lock. However we switch to atomic ops if new possible flags will be used in a different way and don't assume such lock dependencies. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent e1af872 commit 46d6e72

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

fs/dlm/dlm_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ do { \
9999
}
100100

101101

102-
#define DLM_RTF_SHRINK 0x00000001
102+
#define DLM_RTF_SHRINK_BIT 0
103103

104104
struct dlm_rsbtable {
105105
struct rb_root keep;
106106
struct rb_root toss;
107107
spinlock_t lock;
108-
uint32_t flags;
108+
unsigned long flags;
109109
};
110110

111111

fs/dlm/lock.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ static void toss_rsb(struct kref *kref)
11391139
rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep);
11401140
rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss);
11411141
r->res_toss_time = jiffies;
1142-
ls->ls_rsbtbl[r->res_bucket].flags |= DLM_RTF_SHRINK;
1142+
set_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[r->res_bucket].flags);
11431143
if (r->res_lvbptr) {
11441144
dlm_free_lvb(r->res_lvbptr);
11451145
r->res_lvbptr = NULL;
@@ -1588,7 +1588,7 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
15881588

15891589
spin_lock(&ls->ls_rsbtbl[b].lock);
15901590

1591-
if (!(ls->ls_rsbtbl[b].flags & DLM_RTF_SHRINK)) {
1591+
if (!test_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags)) {
15921592
spin_unlock(&ls->ls_rsbtbl[b].lock);
15931593
return;
15941594
}
@@ -1643,9 +1643,9 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
16431643
}
16441644

16451645
if (need_shrink)
1646-
ls->ls_rsbtbl[b].flags |= DLM_RTF_SHRINK;
1646+
set_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags);
16471647
else
1648-
ls->ls_rsbtbl[b].flags &= ~DLM_RTF_SHRINK;
1648+
clear_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags);
16491649
spin_unlock(&ls->ls_rsbtbl[b].lock);
16501650

16511651
/*

0 commit comments

Comments
 (0)