summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsaf Vertz <asaf.vertz@tandemg.com>2015-01-06 16:44:15 +0300
committerMike Snitzer <snitzer@redhat.com>2015-02-09 21:06:48 +0300
commitf495339c441b9a69c43327f71c23ffa7632e3020 (patch)
tree7a87c692342e825a2f093c6f574212bf30cd798f
parent0f30af98cbb111cebd99f09cb7b8cc8c9351c0b3 (diff)
downloadlinux-f495339c441b9a69c43327f71c23ffa7632e3020.tar.xz
dm bufio: fix time comparison to use time_after_eq()
To be future-proof and for better readability the time comparison is modified to use time_after_eq() instead of plain, error-prone math. Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-bufio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index c33b49792b87..86dbbc737402 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -11,6 +11,7 @@
#include <linux/device-mapper.h>
#include <linux/dm-io.h>
#include <linux/slab.h>
+#include <linux/jiffies.h>
#include <linux/vmalloc.h>
#include <linux/shrinker.h>
#include <linux/module.h>
@@ -1739,7 +1740,7 @@ static unsigned get_max_age_hz(void)
static bool older_than(struct dm_buffer *b, unsigned long age_hz)
{
- return (jiffies - b->last_accessed) >= age_hz;
+ return time_after_eq(jiffies, b->last_accessed + age_hz);
}
static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz)