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 <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
e1af8728f6
commit
46d6e722d8
|
@ -99,13 +99,13 @@ do { \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DLM_RTF_SHRINK 0x00000001
|
#define DLM_RTF_SHRINK_BIT 0
|
||||||
|
|
||||||
struct dlm_rsbtable {
|
struct dlm_rsbtable {
|
||||||
struct rb_root keep;
|
struct rb_root keep;
|
||||||
struct rb_root toss;
|
struct rb_root toss;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
uint32_t flags;
|
unsigned long flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1139,7 +1139,7 @@ static void toss_rsb(struct kref *kref)
|
||||||
rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep);
|
rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep);
|
||||||
rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss);
|
rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss);
|
||||||
r->res_toss_time = jiffies;
|
r->res_toss_time = jiffies;
|
||||||
ls->ls_rsbtbl[r->res_bucket].flags |= DLM_RTF_SHRINK;
|
set_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[r->res_bucket].flags);
|
||||||
if (r->res_lvbptr) {
|
if (r->res_lvbptr) {
|
||||||
dlm_free_lvb(r->res_lvbptr);
|
dlm_free_lvb(r->res_lvbptr);
|
||||||
r->res_lvbptr = NULL;
|
r->res_lvbptr = NULL;
|
||||||
|
@ -1588,7 +1588,7 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
|
||||||
|
|
||||||
spin_lock(&ls->ls_rsbtbl[b].lock);
|
spin_lock(&ls->ls_rsbtbl[b].lock);
|
||||||
|
|
||||||
if (!(ls->ls_rsbtbl[b].flags & DLM_RTF_SHRINK)) {
|
if (!test_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags)) {
|
||||||
spin_unlock(&ls->ls_rsbtbl[b].lock);
|
spin_unlock(&ls->ls_rsbtbl[b].lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1643,9 +1643,9 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_shrink)
|
if (need_shrink)
|
||||||
ls->ls_rsbtbl[b].flags |= DLM_RTF_SHRINK;
|
set_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags);
|
||||||
else
|
else
|
||||||
ls->ls_rsbtbl[b].flags &= ~DLM_RTF_SHRINK;
|
clear_bit(DLM_RTF_SHRINK_BIT, &ls->ls_rsbtbl[b].flags);
|
||||||
spin_unlock(&ls->ls_rsbtbl[b].lock);
|
spin_unlock(&ls->ls_rsbtbl[b].lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue