diff --git a/block/blk-core.c b/block/blk-core.c index 715b61c239ea6ef1046789fd875ce2440907abe6..109fb2750453a32913b9ff531fec43c44e913497 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1292,13 +1292,16 @@ void blk_account_io_done(struct request *req, u64 now) !(req->rq_flags & RQF_FLUSH_SEQ)) { const int sgrp = op_stat_group(req_op(req)); struct hd_struct *part; +#ifdef CONFIG_64BIT u64 stat_time; struct request_wrapper *rq_wrapper = request_to_wrapper(req); +#endif part_stat_lock(); part = req->part; update_io_ticks(part, jiffies, true); part_stat_inc(part, ios[sgrp]); +#ifdef CONFIG_64BIT stat_time = READ_ONCE(rq_wrapper->stat_time_ns); /* * This might fail if 'stat_time_ns' is updated @@ -1312,6 +1315,9 @@ void blk_account_io_done(struct request *req, u64 now) part_stat_add(req->part, nsecs[sgrp], duation); } +#else + part_stat_add(part, nsecs[sgrp], now - req->start_time_ns); +#endif part_stat_unlock(); hd_struct_put(part); diff --git a/block/blk-mq.c b/block/blk-mq.c index 5031c4fc4412f0393cd2d5fd09d65efad1cb0eed..1941ffc4db85c2819047fd95cb429878f9a38a5e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -102,6 +102,7 @@ struct mq_inflight { unsigned int inflight[2]; }; +#ifdef CONFIG_64BIT static bool blk_mq_check_inflight_with_stat(struct blk_mq_hw_ctx *hctx, struct request *rq, void *priv, bool reserved) @@ -154,7 +155,7 @@ unsigned int blk_mq_in_flight_with_stat(struct request_queue *q, return mi.inflight[0] + mi.inflight[1]; } - +#endif static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq, void *priv, diff --git a/block/blk-mq.h b/block/blk-mq.h index 6897b4c09b7cfefd759c73b834a4e00c64d202b0..ad2d74f887f20e7909e1a1ae0e1c9f619a555acc 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -187,8 +187,10 @@ static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx) unsigned int blk_mq_in_flight(struct request_queue *q, struct hd_struct *part); void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part, unsigned int inflight[2]); +#ifdef CONFIG_64BIT unsigned int blk_mq_in_flight_with_stat(struct request_queue *q, struct hd_struct *part); +#endif static inline void blk_mq_put_dispatch_budget(struct request_queue *q) { diff --git a/block/genhd.c b/block/genhd.c index fcd6210417bcad48aa2386594d8cd44701bc96e0..8b37fcfa10d18995c83f14810f479c1cf77f31f0 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1293,6 +1293,7 @@ ssize_t part_size_show(struct device *dev, (unsigned long long)part_nr_sects_read(p)); } +#ifdef CONFIG_64BIT static void part_set_stat_time(struct hd_struct *hd) { u64 now = ktime_get_ns(); @@ -1304,12 +1305,13 @@ static void part_set_stat_time(struct hd_struct *hd) goto again; } } +#endif static void part_get_stat_info(struct hd_struct *hd, struct disk_stats *stat, unsigned int *inflight) { +#ifdef CONFIG_64BIT struct request_queue *q = part_to_disk(hd)->queue; - if (queue_is_mq(q)) { mutex_lock(&part_to_dev(hd)->mutex); part_stat_lock(); @@ -1320,7 +1322,9 @@ static void part_get_stat_info(struct hd_struct *hd, struct disk_stats *stat, } else { *inflight = part_in_flight(hd); } - +#else + *inflight = part_in_flight(hd); +#endif if (*inflight) { part_stat_lock(); update_io_ticks(hd, jiffies, true);