Commit 22ae4c11 authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever

nfsd: fix up the filecache laundrette scheduling

We don't really care whether there are hashed entries when it comes to
scheduling the laundrette. They might all be non-gc entries, after all.
We only want to schedule it if there are entries on the LRU.

Switch to using list_lru_count, and move the check into
nfsd_file_gc_worker. The other callsite in nfsd_file_put doesn't need to
count entries, since it only schedules the laundrette after adding an
entry to the LRU.
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 82141185
...@@ -211,10 +211,7 @@ static const struct rhashtable_params nfsd_file_rhash_params = { ...@@ -211,10 +211,7 @@ static const struct rhashtable_params nfsd_file_rhash_params = {
static void static void
nfsd_file_schedule_laundrette(void) nfsd_file_schedule_laundrette(void)
{ {
if ((atomic_read(&nfsd_file_rhash_tbl.nelems) == 0) || if (test_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags))
test_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags) == 0)
return;
queue_delayed_work(system_wq, &nfsd_filecache_laundrette, queue_delayed_work(system_wq, &nfsd_filecache_laundrette,
NFSD_LAUNDRETTE_DELAY); NFSD_LAUNDRETTE_DELAY);
} }
...@@ -666,6 +663,7 @@ static void ...@@ -666,6 +663,7 @@ static void
nfsd_file_gc_worker(struct work_struct *work) nfsd_file_gc_worker(struct work_struct *work)
{ {
nfsd_file_gc(); nfsd_file_gc();
if (list_lru_count(&nfsd_file_lru))
nfsd_file_schedule_laundrette(); nfsd_file_schedule_laundrette();
} }
......
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