diff options
author | Christoph Hellwig <hch@lst.de> | 2020-05-27 07:24:13 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-05-27 05:21:23 -0600 |
commit | 9123bf6f21b015cce16f3ce066c72aac9fc78d2f (patch) | |
tree | 6de6b2f2a239ecaad7993ab01557a0675afcda3c /block/blk-core.c | |
parent | e722fff238bbfe6308d7778a8c2163c181bf998a (diff) |
block: move update_io_ticks to blk-core.c
All callers are in blk-core.c, so move update_io_ticks over.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 8973104f88d9..c1675d43c2da 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1381,6 +1381,21 @@ unsigned int blk_rq_err_bytes(const struct request *rq) } EXPORT_SYMBOL_GPL(blk_rq_err_bytes); +static void update_io_ticks(struct hd_struct *part, unsigned long now, bool end) +{ + unsigned long stamp; +again: + stamp = READ_ONCE(part->stamp); + if (unlikely(stamp != now)) { + if (likely(cmpxchg(&part->stamp, stamp, now) == stamp)) + __part_stat_add(part, io_ticks, end ? now - stamp : 1); + } + if (part->partno) { + part = &part_to_disk(part)->part0; + goto again; + } +} + static void blk_account_io_completion(struct request *req, unsigned int bytes) { if (req->part && blk_do_io_stat(req)) { |