diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-01-15 14:45:07 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-05 10:07:22 -0700 |
commit | 08420cf70cfb32eed2a0abfeb5c54c5651bd0c99 (patch) | |
tree | ee9a278750a711e90babcb73cbde53fd7b4fdcf1 /block/blk-wbt.c | |
parent | c4e47bbb00dad9240f4c054859950e962042ecb8 (diff) | |
download | lwn-08420cf70cfb32eed2a0abfeb5c54c5651bd0c99.tar.gz lwn-08420cf70cfb32eed2a0abfeb5c54c5651bd0c99.zip |
block: add blk_time_get_ns() and blk_time_get() helpers
Convert any user of ktime_get_ns() to use blk_time_get_ns(), and
ktime_get() to blk_time_get(), so we have a unified API for querying the
current time in nanoseconds or as ktime.
No functional changes intended, this patch just wraps ktime_get_ns()
and ktime_get() with a block helper.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r-- | block/blk-wbt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 5ba3cd574eac..8cb53bf4c7b1 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -29,6 +29,7 @@ #include "blk-wbt.h" #include "blk-rq-qos.h" #include "elevator.h" +#include "blk.h" #define CREATE_TRACE_POINTS #include <trace/events/wbt.h> @@ -274,13 +275,12 @@ static inline bool stat_sample_valid(struct blk_rq_stat *stat) static u64 rwb_sync_issue_lat(struct rq_wb *rwb) { - u64 now, issue = READ_ONCE(rwb->sync_issue); + u64 issue = READ_ONCE(rwb->sync_issue); if (!issue || !rwb->sync_cookie) return 0; - now = ktime_to_ns(ktime_get()); - return now - issue; + return blk_time_get_ns() - issue; } static inline unsigned int wbt_inflight(struct rq_wb *rwb) |