LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drivers: md: remove duplication with time_after
@ 2015-02-05 21:39 Pierre Chevalier
  0 siblings, 0 replies; only message in thread
From: Pierre Chevalier @ 2015-02-05 21:39 UTC (permalink / raw)
  To: agk; +Cc: linux-raid, linux-kernel, Pierre Chevalier

The logic that was expressed previously was equivalent of calling
time_after.
Remove duplication.

Signed-off-by: Pierre Chevalier <pierrechevalier83@gmail.com>
---
 drivers/md/dm-cache-target.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index e165053..855e3b3 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -14,6 +14,7 @@
 #include <linux/init.h>
 #include <linux/mempool.h>
 #include <linux/module.h>
+#include <linux/jiffies.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
@@ -1562,8 +1563,7 @@ static void process_bio(struct cache *cache, struct prealloc *structs,
 
 static int need_commit_due_to_time(struct cache *cache)
 {
-	return jiffies < cache->last_commit_jiffies ||
-	       jiffies > cache->last_commit_jiffies + COMMIT_PERIOD;
+	return time_after(jiffies, cache->last_commit_jiffies + COMMIT_PERIOD);
 }
 
 static int commit_if_needed(struct cache *cache)
-- 
2.2.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-05 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 21:39 [PATCH] drivers: md: remove duplication with time_after Pierre Chevalier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).