Merge tag 'dm-3.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[linux-drm-fsl-dcu.git] / drivers / md / dm-thin.c
index 07705ee181e3d2837c47954626276f9dea52cac0..654773cb1eeea23b39db0fcf0e6fb00d91d9476d 100644 (file)
@@ -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)