Skip to content

Commit

Permalink
Merge tag 'dlm-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…teigland/linux-dlm

Pull dlm update from David Teigland:
 "This includes a single patch to avoid excessive and unnecessary
  scanning of rsbs to free."

* tag 'dlm-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
  dlm: avoid scanning unchanged toss lists
  • Loading branch information
torvalds committed Feb 21, 2013
2 parents 2171ee8 + f117228 commit 850cb82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/dlm/dlm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ do { \
}


#define DLM_RTF_SHRINK 0x00000001

struct dlm_rsbtable {
struct rb_root keep;
struct rb_root toss;
spinlock_t lock;
uint32_t flags;
};


Expand Down
15 changes: 15 additions & 0 deletions fs/dlm/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ static void toss_rsb(struct kref *kref)
rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[r->res_bucket].keep);
rsb_insert(r, &ls->ls_rsbtbl[r->res_bucket].toss);
r->res_toss_time = jiffies;
ls->ls_rsbtbl[r->res_bucket].flags |= DLM_RTF_SHRINK;
if (r->res_lvbptr) {
dlm_free_lvb(r->res_lvbptr);
r->res_lvbptr = NULL;
Expand Down Expand Up @@ -1659,11 +1660,18 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
char *name;
int our_nodeid = dlm_our_nodeid();
int remote_count = 0;
int need_shrink = 0;
int i, len, rv;

memset(&ls->ls_remove_lens, 0, sizeof(int) * DLM_REMOVE_NAMES_MAX);

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

if (!(ls->ls_rsbtbl[b].flags & DLM_RTF_SHRINK)) {
spin_unlock(&ls->ls_rsbtbl[b].lock);
return;
}

for (n = rb_first(&ls->ls_rsbtbl[b].toss); n; n = next) {
next = rb_next(n);
r = rb_entry(n, struct dlm_rsb, res_hashnode);
Expand All @@ -1679,6 +1687,8 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
continue;
}

need_shrink = 1;

if (!time_after_eq(jiffies, r->res_toss_time +
dlm_config.ci_toss_secs * HZ)) {
continue;
Expand Down Expand Up @@ -1710,6 +1720,11 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
rb_erase(&r->res_hashnode, &ls->ls_rsbtbl[b].toss);
dlm_free_rsb(r);
}

if (need_shrink)
ls->ls_rsbtbl[b].flags |= DLM_RTF_SHRINK;
else
ls->ls_rsbtbl[b].flags &= ~DLM_RTF_SHRINK;
spin_unlock(&ls->ls_rsbtbl[b].lock);

/*
Expand Down

0 comments on commit 850cb82

Please sign in to comment.