diff options
author | Manuel Schölling <manuel.schoelling@gmx.de> | 2014-05-22 22:42:37 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-02-09 19:06:48 +0100 |
commit | 0f30af98cbb111cebd99f09cb7b8cc8c9351c0b3 (patch) | |
tree | 1fa005c7f05e77550f0ef6cd0a3752a0422786df /drivers/md/dm-thin.c | |
parent | dm raid: fix a couple integer overflows (diff) | |
download | linux-0f30af98cbb111cebd99f09cb7b8cc8c9351c0b3.tar.xz linux-0f30af98cbb111cebd99f09cb7b8cc8c9351c0b3.zip |
dm: use time_in_range() and time_after()
To be future-proof and for better readability the time comparisons are modified
to use time_in_range() and time_after() instead of plain, error-prone math.
Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin.c')
-rw-r--r-- | drivers/md/dm-thin.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 493478989dbd..0f781451ea3f 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -11,6 +11,7 @@ #include <linux/device-mapper.h> #include <linux/dm-io.h> #include <linux/dm-kcopyd.h> +#include <linux/jiffies.h> #include <linux/log2.h> #include <linux/list.h> #include <linux/rculist.h> @@ -1700,8 +1701,8 @@ static void process_cell_fail(struct thin_c *tc, struct dm_bio_prison_cell *cell */ static int need_commit_due_to_time(struct pool *pool) { - return jiffies < pool->last_commit_jiffies || - jiffies > pool->last_commit_jiffies + COMMIT_PERIOD; + return !time_in_range(jiffies, pool->last_commit_jiffies, + pool->last_commit_jiffies + COMMIT_PERIOD); } #define thin_pbd(node) rb_entry((node), struct dm_thin_endio_hook, rb_node) |