diff mbox series

[RFC,blktrace-tools,02/10] blktrace_api.h: update blktrace API header

Message ID 20190501043317.5507-3-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series blktrace: add blktrace extension support | expand

Commit Message

Chaitanya Kulkarni May 1, 2019, 4:33 a.m. UTC
This patch adds blktrace extension definitions to the blktrace_api.h
file. Here we add new block operations write-zeroes and zone reset.
Also, we update the size of the block trace action and add a new field
to mask the priorities.

Mainly we change the size of the action in the blk_io_trace and
size of action mask to keep it uniform across all the headers
and the kernel which allows us to add new trace actions.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 blktrace_api.h | 66 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 47 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/blktrace_api.h b/blktrace_api.h
index b222218..ac2ea43 100644
--- a/blktrace_api.h
+++ b/blktrace_api.h
@@ -2,34 +2,47 @@ 
 #define BLKTRACEAPI_H
 
 #include <asm/types.h>
+#include <stdint.h>
 
 /*
  * Trace categories
  */
-enum {
-	BLK_TC_READ	= 1 << 0,	/* reads */
-	BLK_TC_WRITE	= 1 << 1,	/* writes */
-	BLK_TC_FLUSH	= 1 << 2,	/* flush */
-	BLK_TC_SYNC	= 1 << 3,	/* sync */
-	BLK_TC_QUEUE	= 1 << 4,	/* queueing/merging */
-	BLK_TC_REQUEUE	= 1 << 5,	/* requeueing */
-	BLK_TC_ISSUE	= 1 << 6,	/* issue */
-	BLK_TC_COMPLETE	= 1 << 7,	/* completions */
-	BLK_TC_FS	= 1 << 8,	/* fs requests */
-	BLK_TC_PC	= 1 << 9,	/* pc requests */
-	BLK_TC_NOTIFY	= 1 << 10,	/* special message */
-	BLK_TC_AHEAD	= 1 << 11,	/* readahead */
-	BLK_TC_META	= 1 << 12,	/* metadata */
-	BLK_TC_DISCARD	= 1 << 13,	/* discard requests */
-	BLK_TC_DRV_DATA	= 1 << 14,	/* binary driver data */
-	BLK_TC_FUA	= 1 << 15,	/* fua requests */
+enum blktrace_cat {
+	BLK_TC_READ             = 1 << 0,       /* reads */
+	BLK_TC_WRITE            = 1 << 1,       /* writes */
+	BLK_TC_FLUSH            = 1 << 2,       /* flush */
+	BLK_TC_SYNC             = 1 << 3,       /* sync IO */
+	BLK_TC_SYNCIO           = BLK_TC_SYNC,
+	BLK_TC_QUEUE            = 1 << 4,       /* queueing/merging */
+	BLK_TC_REQUEUE          = 1 << 5,       /* requeueing */
+	BLK_TC_ISSUE            = 1 << 6,       /* issue */
+	BLK_TC_COMPLETE         = 1 << 7,       /* completions */
+	BLK_TC_FS               = 1 << 8,       /* fs requests */
+	BLK_TC_PC               = 1 << 9,       /* pc requests */
+	BLK_TC_NOTIFY           = 1 << 10,      /* special message */
+	BLK_TC_AHEAD            = 1 << 11,      /* readahead */
+	BLK_TC_META             = 1 << 12,      /* metadata */
+	BLK_TC_DISCARD          = 1 << 13,      /* discard requests */
+	BLK_TC_DRV_DATA         = 1 << 14,      /* binary per-driver data */
+	BLK_TC_FUA              = 1 << 15,      /* fua requests */
+
+#ifdef CONFIG_BLKTRACE_EXT
+	BLK_TC_WRITE_ZEROES	= 1 << 16,	/* write-zeores */
+	BLK_TC_ZONE_RESET	= 1 << 17,	/* zone-reset */
 
-	BLK_TC_END	= 1 << 15,	/* we've run out of bits! */
+	BLK_TC_END		= 1 << 31,	/* we've run out of bits! */
+#else
+	BLK_TC_END		= 1 << 15,	/* we've run out of bits! */
+#endif /* CONFIG_BLKTRACE_EXT */
 };
 
+#ifdef CONFIG_BLKTRACE_EXT
+#define BLK_TC_SHIFT		(32)
+#define BLK_TC_ACT(act)		(((uint64_t)act) << BLK_TC_SHIFT)
+#else
 #define BLK_TC_SHIFT		(16)
 #define BLK_TC_ACT(act)		((act) << BLK_TC_SHIFT)
-
+#endif /* CONFIG_BLKTRACE_EXT */
 /*
  * Basic trace actions
  */
@@ -88,7 +101,12 @@  enum blktrace_notify {
 #define BLK_TN_MESSAGE		(__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
 
 #define BLK_IO_TRACE_MAGIC	0x65617400
+
+#ifdef CONFIG_BLKTRACE_EXT
+#define BLK_IO_TRACE_VERSION	0x08
+#else
 #define BLK_IO_TRACE_VERSION	0x07
+#endif /* CONFIG_BLKTRACE_EXT */
 
 /*
  * The trace itself
@@ -99,7 +117,12 @@  struct blk_io_trace {
 	__u64 time;		/* in nanoseconds */
 	__u64 sector;		/* disk offset */
 	__u32 bytes;		/* transfer length */
+#ifdef CONFIG_BLKTRACE_EXT
+	__u64 action;		/* what happened */
+	__u32 ioprio;		/* ioprio */
+#else
 	__u32 action;		/* what happened */
+#endif /* CONFIG_BLKTRACE_EXT */
 	__u32 pid;		/* who did it */
 	__u32 device;		/* device identifier (dev_t) */
 	__u32 cpu;		/* on what cpu did it happen */
@@ -121,7 +144,12 @@  struct blk_io_trace_remap {
  */
 struct blk_user_trace_setup {
 	char name[32];			/* output */
+#ifdef CONFIG_BLKTRACE_EXT
+	__u64 act_mask;			/* input */
+	__u32 prio_mask;		/* input */
+#else
 	__u16 act_mask;			/* input */
+#endif /* CONFIG_BLKTRACE_EXT */
 	__u32 buf_size;			/* input */
 	__u32 buf_nr;			/* input */
 	__u64 start_lba;