Commit 9123bf6f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e722fff2
...@@ -1376,22 +1376,6 @@ void bio_check_pages_dirty(struct bio *bio) ...@@ -1376,22 +1376,6 @@ void bio_check_pages_dirty(struct bio *bio)
schedule_work(&bio_dirty_work); schedule_work(&bio_dirty_work);
} }
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 inline bool bio_remaining_done(struct bio *bio) static inline bool bio_remaining_done(struct bio *bio)
{ {
/* /*
......
...@@ -1381,6 +1381,21 @@ unsigned int blk_rq_err_bytes(const struct request *rq) ...@@ -1381,6 +1381,21 @@ unsigned int blk_rq_err_bytes(const struct request *rq)
} }
EXPORT_SYMBOL_GPL(blk_rq_err_bytes); 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) static void blk_account_io_completion(struct request *req, unsigned int bytes)
{ {
if (req->part && blk_do_io_stat(req)) { if (req->part && blk_do_io_stat(req)) {
......
...@@ -344,7 +344,6 @@ void blk_queue_free_zone_bitmaps(struct request_queue *q); ...@@ -344,7 +344,6 @@ void blk_queue_free_zone_bitmaps(struct request_queue *q);
static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {} static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
#endif #endif
void update_io_ticks(struct hd_struct *part, unsigned long now, bool end);
struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector); struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector);
int blk_alloc_devt(struct hd_struct *part, dev_t *devt); int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment