Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> --- kernel/trace/blktrace.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 9fd0e5758d3d..a95ed09990e1 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1416,16 +1416,36 @@ static void blk_add_trace_sleeprq(void *ignore, struct request_queue *q, struct bio *bio, int rw) { - if (bio) - blk_add_trace_bio(q, bio, BLK_TA_SLEEPRQ, 0); - else { + u64 ta = 0; + struct blk_trace *bt; + struct blk_trace_ext *bte; + + rcu_read_lock(); + bt = rcu_dereference(q->blk_trace); + bte = rcu_dereference(q->blk_trace_ext); + if (likely(!bt) && likely(!bte)) { + rcu_read_unlock(); + return; + } + if (bt) { + ta = BLK_TA_SLEEPRQ; + } else if (bte) { + ta = BLK_TA_SLEEPRQ_EXT; + } + rcu_read_unlock(); + if (bio) { + blk_add_trace_bio(q, bio, ta, 0); + } else { struct blk_trace *bt; rcu_read_lock(); bt = rcu_dereference(q->blk_trace); + bte = rcu_dereference(q->blk_trace_ext); if (bt) - __blk_add_trace(bt, 0, 0, rw, 0, BLK_TA_SLEEPRQ, - 0, 0, NULL, 0); + __blk_add_trace(bt, 0, 0, rw, 0, ta, 0, 0, NULL, 0); + else if (bte) + __blk_add_trace_ext(bte, 0, 0, rw, 0, ta, 0, 0, NULL, + 0, 0); rcu_read_unlock(); } } -- 2.22.0