Commit 36ebbdb9 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields

nfsd: cleanup nfsd_file_lru_dispose()

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 28c7d86b
...@@ -256,8 +256,6 @@ nfsd_file_do_unhash(struct nfsd_file *nf) ...@@ -256,8 +256,6 @@ nfsd_file_do_unhash(struct nfsd_file *nf)
nfsd_reset_boot_verifier(net_generic(nf->nf_net, nfsd_net_id)); nfsd_reset_boot_verifier(net_generic(nf->nf_net, nfsd_net_id));
--nfsd_file_hashtbl[nf->nf_hashval].nfb_count; --nfsd_file_hashtbl[nf->nf_hashval].nfb_count;
hlist_del_rcu(&nf->nf_node); hlist_del_rcu(&nf->nf_node);
if (!list_empty(&nf->nf_lru))
list_lru_del(&nfsd_file_lru, &nf->nf_lru);
atomic_long_dec(&nfsd_filecache_count); atomic_long_dec(&nfsd_filecache_count);
} }
...@@ -266,6 +264,8 @@ nfsd_file_unhash(struct nfsd_file *nf) ...@@ -266,6 +264,8 @@ nfsd_file_unhash(struct nfsd_file *nf)
{ {
if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
nfsd_file_do_unhash(nf); nfsd_file_do_unhash(nf);
if (!list_empty(&nf->nf_lru))
list_lru_del(&nfsd_file_lru, &nf->nf_lru);
return true; return true;
} }
return false; return false;
...@@ -402,15 +402,14 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru, ...@@ -402,15 +402,14 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
static void static void
nfsd_file_lru_dispose(struct list_head *head) nfsd_file_lru_dispose(struct list_head *head)
{ {
while(!list_empty(head)) { struct nfsd_file *nf;
struct nfsd_file *nf = list_first_entry(head,
struct nfsd_file, nf_lru); list_for_each_entry(nf, head, nf_lru) {
list_del_init(&nf->nf_lru);
spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
nfsd_file_do_unhash(nf); nfsd_file_do_unhash(nf);
spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
nfsd_file_put_noref(nf);
} }
nfsd_file_dispose_list(head);
} }
static unsigned long static unsigned long
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment