Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Asaf Vertz and committed by
Mike Snitzer
f495339c 0f30af98

+2 -1
+2 -1
drivers/md/dm-bufio.c
··· 11 11 #include <linux/device-mapper.h> 12 12 #include <linux/dm-io.h> 13 13 #include <linux/slab.h> 14 + #include <linux/jiffies.h> 14 15 #include <linux/vmalloc.h> 15 16 #include <linux/shrinker.h> 16 17 #include <linux/module.h> ··· 1740 1739 1741 1740 static bool older_than(struct dm_buffer *b, unsigned long age_hz) 1742 1741 { 1743 - return (jiffies - b->last_accessed) >= age_hz; 1742 + return time_after_eq(jiffies, b->last_accessed + age_hz); 1744 1743 } 1745 1744 1746 1745 static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz)