mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
3ca5a21a9c
commit
0f30af98cb
3 changed files with 9 additions and 6 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <linux/dm-io.h>
|
||||
#include <linux/dm-kcopyd.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -1547,8 +1548,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs,
|
|||
|
||||
static int need_commit_due_to_time(struct cache *cache)
|
||||
{
|
||||
return jiffies < cache->last_commit_jiffies ||
|
||||
jiffies > cache->last_commit_jiffies + COMMIT_PERIOD;
|
||||
return !time_in_range(jiffies, cache->last_commit_jiffies,
|
||||
cache->last_commit_jiffies + COMMIT_PERIOD);
|
||||
}
|
||||
|
||||
static int commit_if_needed(struct cache *cache)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue