[RFC PATCH 17/39] blktrace: update blk_add_trace_bio_frontmerge()

Chaitanya Kulkarni <[email protected]>
Newsgroups org.kernel.vger.linux-btrace
Message-ID <[email protected]>
Signed-off-by: Chaitanya Kulkarni <[email protected]>
---
 kernel/trace/blktrace.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 84d22df8687e..ff7c263c426d 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1368,7 +1368,25 @@ static void blk_add_trace_bio_frontmerge(void *ignore,
 					 struct request *rq,
 					 struct bio *bio)
 {
-	blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE, 0);
+	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_FRONTMERGE;
+	} else if (bte) {
+		ta = BLK_TA_FRONTMERGE_EXT;
+	}
+	blk_add_trace_bio(q, bio, ta, 0);
+	rcu_read_unlock();
 }
 
 static void blk_add_trace_bio_queue(void *ignore,
-- 
2.22.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.