diff options
author | J. Bruce Fields <bfields@redhat.com> | 2020-09-21 09:45:35 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2020-09-25 18:02:02 -0400 |
commit | 0aa99c4d1f216318b1c4f4e4fe321868294a1d9f (patch) | |
tree | 19ea2fb5f5b401e46ab6a1755552b7e2624fb38c /net/sunrpc/cache.c | |
parent | 9dbc1f45d512f3a90c1df8ac35bcb7a4db548286 (diff) | |
download | linux-stable-0aa99c4d1f216318b1c4f4e4fe321868294a1d9f.tar.gz linux-stable-0aa99c4d1f216318b1c4f4e4fe321868294a1d9f.tar.bz2 linux-stable-0aa99c4d1f216318b1c4f4e4fe321868294a1d9f.zip |
sunrpc: simplify do_cache_clean
Is it just me, or is the logic written in a slightly convoluted way?
I find it a little easier to read this way.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r-- | net/sunrpc/cache.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 9e68e443f497..2990a7ab9e2a 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -498,16 +498,17 @@ static int cache_clean(void) */ static void do_cache_clean(struct work_struct *work) { - int delay = 5; - if (cache_clean() == -1) - delay = round_jiffies_relative(30*HZ); + int delay; if (list_empty(&cache_list)) - delay = 0; + return; + + if (cache_clean() == -1) + delay = round_jiffies_relative(30*HZ); + else + delay = 5; - if (delay) - queue_delayed_work(system_power_efficient_wq, - &cache_cleaner, delay); + queue_delayed_work(system_power_efficient_wq, &cache_cleaner, delay); } |