Skip to content

Commit

Permalink
dm bufio: fix time comparison to use time_after_eq()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Asaf Vertz authored and Mike Snitzer committed Feb 9, 2015
1 parent 0f30af9 commit f495339
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f495339

Please sign in to comment.