diff mbox series

[RFC,31/39] blktrace: add trace_synthesize helper

Message ID 20210225070231.21136-32-chaitanya.kulkarni@wdc.com (mailing list archive)
State New
Headers show
Series blktrace: add block trace extension support | expand

Commit Message

Chaitanya Kulkarni Feb. 25, 2021, 7:02 a.m. UTC
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 kernel/trace/blktrace.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 75b2ec88d8c4..a904a800b696 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -2416,6 +2416,21 @@  static void blk_trace_synthesize_old_trace(struct trace_iterator *iter)
 			 sizeof(old) - offset + t->pdu_len);
 }
 
+static void blk_trace_synthesize_old_trace_ext(struct trace_iterator *iter)
+{
+	struct trace_seq *s = &iter->seq;
+	struct blk_io_trace_ext *t = (struct blk_io_trace_ext *)iter->ent;
+	const int offset = offsetof(struct blk_io_trace_ext, sector);
+	struct blk_io_trace_ext old = {
+		.magic	  = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION_EXT,
+		.time     = iter->ts,
+	};
+
+	trace_seq_putmem(s, &old, offset);
+	trace_seq_putmem(s, &t->sector,
+			 sizeof(old) - offset + t->pdu_len);
+}
+
 static enum print_line_t
 blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
 			     struct trace_event *event)