dlm for 3.4
This set includes one trivial fix, and one simple recovery speed up. Directory recovery can use the standard hash table to find resources rather than always searching the linear recovery list. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPahBcAAoJEDgbc8f8gGmqeHEP/i288yZV8NVbIJG7XpX9JjTY 4n4R1CI/qTMDn74GXDkk/OolHc8XTSQwbp02oFlJbPzj71lsWBUWijTAnwxiLIRz OHQg7eZ2aYL0YmaxAlvM2/6xLNOINmLW/DVwwH4QnpnSB4ymoCHBzyXxrNxgvgRv KWKUUXj7SDaUmbcK0TFZ39VprTmpw3L+mXIm+Y6kCCS2m4GfISp3Zij4OnxztA/c brex0R97EoZwrQOvPSRbVA5IaK6BjwfNScXAKsYCOSLsd+tvelD+UgYBdVHBTOmG godQ5pg8C7SpUB9NQqnLc8r78xpIUcOHQbWRqtwNQ2/6uPI/mWFj+lhpcHRmmzPk TczdDZVg+pIl9U+SMqiG689KgvnUTciPte0sYqksEbk3NqUMJOWOB7Cv79ZYquaV Pdmg788Essq7/5BmgeSRlOvS08RvdVfHXqYGOA6/tJ3f0b15M1YuSLjJdwYVWJkS gVmo4raN44Yh99R/+eNqeI8dvoVfd1pNDAD9VYXk4KdIv3AtKfRZi8XvWZ0o5uQI EdXTIhiA78ogjxG92cnnzj3+CAIpK4Iv1s53Y0KZgJ7gyExvVHyGp7zl1J7hlFLP jLuORsL+xMKTGbSWom796QuVn3jL/CGj/OKbnd1D98S0uRuSS6wiy/6ucBFaKmt0 HvT7AVcX2Gh6t/qdTJ9h =ByvY -----END PGP SIGNATURE----- Merge tag 'dlm-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm Pull dlm updates for 3.4 from David Teigland: "This set includes one trivial fix, and one simple recovery speed up. Directory recovery can use the standard hash table to find resources rather than always searching the linear recovery list." * tag 'dlm-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: last element of dlm_local_addr[] never used dlm: fix slow rsb search in dir recovery
This commit is contained in:
commit
30d73f3752
17
fs/dlm/dir.c
17
fs/dlm/dir.c
|
@ -351,11 +351,28 @@ int dlm_dir_lookup(struct dlm_ls *ls, int nodeid, char *name, int namelen,
|
|||
static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len)
|
||||
{
|
||||
struct dlm_rsb *r;
|
||||
uint32_t hash, bucket;
|
||||
int rv;
|
||||
|
||||
hash = jhash(name, len, 0);
|
||||
bucket = hash & (ls->ls_rsbtbl_size - 1);
|
||||
|
||||
spin_lock(&ls->ls_rsbtbl[bucket].lock);
|
||||
rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].keep, name, len, 0, &r);
|
||||
if (rv)
|
||||
rv = dlm_search_rsb_tree(&ls->ls_rsbtbl[bucket].toss,
|
||||
name, len, 0, &r);
|
||||
spin_unlock(&ls->ls_rsbtbl[bucket].lock);
|
||||
|
||||
if (!rv)
|
||||
return r;
|
||||
|
||||
down_read(&ls->ls_root_sem);
|
||||
list_for_each_entry(r, &ls->ls_root_list, res_root_list) {
|
||||
if (len == r->res_length && !memcmp(name, r->res_name, len)) {
|
||||
up_read(&ls->ls_root_sem);
|
||||
log_error(ls, "find_rsb_root revert to root_list %s",
|
||||
r->res_name);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,8 +411,8 @@ static int rsb_cmp(struct dlm_rsb *r, const char *name, int nlen)
|
|||
return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN);
|
||||
}
|
||||
|
||||
static int search_rsb_tree(struct rb_root *tree, char *name, int len,
|
||||
unsigned int flags, struct dlm_rsb **r_ret)
|
||||
int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len,
|
||||
unsigned int flags, struct dlm_rsb **r_ret)
|
||||
{
|
||||
struct rb_node *node = tree->rb_node;
|
||||
struct dlm_rsb *r;
|
||||
|
@ -474,12 +474,12 @@ static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b,
|
|||
struct dlm_rsb *r;
|
||||
int error;
|
||||
|
||||
error = search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r);
|
||||
error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, flags, &r);
|
||||
if (!error) {
|
||||
kref_get(&r->res_ref);
|
||||
goto out;
|
||||
}
|
||||
error = search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r);
|
||||
error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ void dlm_scan_waiters(struct dlm_ls *ls);
|
|||
void dlm_scan_timeout(struct dlm_ls *ls);
|
||||
void dlm_adjust_timeouts(struct dlm_ls *ls);
|
||||
|
||||
int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len,
|
||||
unsigned int flags, struct dlm_rsb **r_ret);
|
||||
|
||||
int dlm_purge_locks(struct dlm_ls *ls);
|
||||
void dlm_purge_mstcpy_locks(struct dlm_rsb *r);
|
||||
void dlm_grant_after_purge(struct dlm_ls *ls);
|
||||
|
|
|
@ -1076,7 +1076,7 @@ static void init_local(void)
|
|||
int i;
|
||||
|
||||
dlm_local_count = 0;
|
||||
for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) {
|
||||
for (i = 0; i < DLM_MAX_ADDR_COUNT; i++) {
|
||||
if (dlm_our_addr(&sas, i))
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue