From 867d89676f7dd292f1c9bc605b992a876667a233 Mon Sep 17 00:00:00 2001 From: Jeffle Xu Date: Thu, 30 Jul 2020 16:54:10 +0800 Subject: [PATCH] alinux: blk: export sector and len fields for iohang fix #29612968 Sector address of all bios in a single request should be guaranteed to be contiguous, except for DISCARD request. We could get the whole sector range of the request by blk_rq_pos() and blk_rq_bytes() for normal read /write requests, but here we still print the sector range of every bio for code simpility. Since it is a low frequency operation, this design will lead to no performance penalty. Besides squash the 'if(bio)' and 'while(1)' into one single 'while(bio)'. Signed-off-by: Jeffle Xu Reviewed-by: Joseph Qi --- block/blk-mq-debugfs.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index c6db51075e8b..9886ced68449 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -442,22 +442,20 @@ static void blk_mq_debugfs_rq_hang_show(struct seq_file *m, struct request *rq) seq_printf(m, ", .current_time=%llu", ktime_get_ns()); bio = rq->bio; - if (bio) { - while (1) { - seq_printf(m, ", .bio = %px", bio); - seq_puts(m, ", .bio_pages = { "); - bio_for_each_segment_all(bvec, bio, i) { - struct page *page = bvec->bv_page; - - if (!page) - continue; - seq_printf(m, "%px ", page); - } - seq_puts(m, "}"); - bio = bio->bi_next; - if (bio == NULL) - break; + while (bio) { + seq_printf(m, ", .bio = %px", bio); + seq_printf(m, ", .sector = %lu, .len=%u", + bio->bi_iter.bi_sector, bio->bi_iter.bi_size); + seq_puts(m, ", .bio_pages = { "); + bio_for_each_segment_all(bvec, bio, i) { + struct page *page = bvec->bv_page; + + if (!page) + continue; + seq_printf(m, "%px ", page); } + seq_puts(m, "}"); + bio = bio->bi_next; } if (mq_ops->show_rq) mq_ops->show_rq(m, rq); -- GitLab