Skip to contentSkip to conversation

sunrpc: simplify do_cache_clean

PATCH New J. Bruce Fields 1 participant 1 message Sep 25, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: simplify do_cache_clean

From: "J. Bruce Fields" <[email protected]>

Is it just me, or is the logic written in a slightly convoluted way?

I find it a little easier to read this way.

---
 net/sunrpc/cache.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
net/sunrpc/cache.c +8 -7
index 9e68e443f497..2990a7ab9e2a 100644
@@ -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);
 }
 
 
Signature · 1 line
2.26.2