Skip to content

Commit

Permalink
nfsd: cleanup nfsd_file_lru_dispose()
Browse files Browse the repository at this point in the history
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
trondmy authored and J. Bruce Fields committed Jan 22, 2020
1 parent 28c7d86 commit 36ebbdb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions fs/nfsd/filecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_file_hashtbl[nf->nf_hashval].nfb_count;
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);
}

Expand All @@ -266,6 +264,8 @@ nfsd_file_unhash(struct nfsd_file *nf)
{
if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
nfsd_file_do_unhash(nf);
if (!list_empty(&nf->nf_lru))
list_lru_del(&nfsd_file_lru, &nf->nf_lru);
return true;
}
return false;
Expand Down Expand Up @@ -402,15 +402,14 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru,
static void
nfsd_file_lru_dispose(struct list_head *head)
{
while(!list_empty(head)) {
struct nfsd_file *nf = list_first_entry(head,
struct nfsd_file, nf_lru);
list_del_init(&nf->nf_lru);
struct nfsd_file *nf;

list_for_each_entry(nf, head, nf_lru) {
spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
nfsd_file_do_unhash(nf);
spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock);
nfsd_file_put_noref(nf);
}
nfsd_file_dispose_list(head);
}

static unsigned long
Expand Down

0 comments on commit 36ebbdb

Please sign in to comment.