From: J. Bruce Fields Date: Mon, 21 Sep 2020 13:45:35 +0000 (-0400) Subject: sunrpc: simplify do_cache_clean X-Git-Tag: v5.15~2609^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0aa99c4d1f216318b1c4f4e4fe321868294a1d9f;p=platform%2Fkernel%2Flinux-starfive.git 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 --- diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 9e68e44..2990a7a 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); }