Skip to content

Commit

Permalink
sunrpc: simplify do_cache_clean
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
J. Bruce Fields committed Sep 25, 2020
1 parent 9dbc1f4 commit 0aa99c4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 0aa99c4

Please sign in to comment.