diff options
author | Manuel Schölling <manuel.schoelling@gmx.de> | 2014-05-22 16:42:37 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-02-09 13:06:48 -0500 |
commit | 0f30af98cbb111cebd99f09cb7b8cc8c9351c0b3 (patch) | |
tree | 1fa005c7f05e77550f0ef6cd0a3752a0422786df /drivers/md/dm-cache-target.c | |
parent | 3ca5a21a9c02bdebe2d95268482031f002efcf23 (diff) |
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-cache-target.c')
-rw-r--r-- | drivers/md/dm-cache-target.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1e96d7889f51..2eca128a9d6a 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/dm-io.h> | 12 | #include <linux/dm-io.h> |
13 | #include <linux/dm-kcopyd.h> | 13 | #include <linux/dm-kcopyd.h> |
14 | #include <linux/jiffies.h> | ||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/mempool.h> | 16 | #include <linux/mempool.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
@@ -1547,8 +1548,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1547 | 1548 | ||
1548 | static int need_commit_due_to_time(struct cache *cache) | 1549 | static int need_commit_due_to_time(struct cache *cache) |
1549 | { | 1550 | { |
1550 | return jiffies < cache->last_commit_jiffies || | 1551 | return !time_in_range(jiffies, cache->last_commit_jiffies, |
1551 | jiffies > cache->last_commit_jiffies + COMMIT_PERIOD; | 1552 | cache->last_commit_jiffies + COMMIT_PERIOD); |
1552 | } | 1553 | } |
1553 | 1554 | ||
1554 | static int commit_if_needed(struct cache *cache) | 1555 | static int commit_if_needed(struct cache *cache) |