Here we synchronize the blktrace extension definitions.

Signed-off-by: Chaitanya Kulkarni <[email protected]>
---
 iowatcher/blkparse.c | 70 +++++++++++++++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 21 deletions(-)

diff --git a/iowatcher/blkparse.c b/iowatcher/blkparse.c
index 41e20f0..fce7de3 100644
--- a/iowatcher/blkparse.c
+++ b/iowatcher/blkparse.c
@@ -52,29 +52,43 @@ extern int io_per_process;
 /*
  * 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 */
-
-       BLK_TC_END      = 1 << 15,      /* we've run out of bits! */
-};
-
+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 << 31,      /* we've run out of bits! */
+#else
+        BLK_TC_END              = 1 << 16,      /* we've run out of bits! */
+#endif
+ };
+
+#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
+
 #define BLK_DATADIR(a) (((a) >> BLK_TC_SHIFT) & (BLK_TC_READ | BLK_TC_WRITE))
 
 /*
@@ -100,7 +114,12 @@ enum {
        __BLK_TA_DRV_DATA,              /* binary driver data */
 };
 
+#ifdef CONFIG_BLKTRACE_EXT
+#define BLK_TA_MASK ((1ULL << BLK_TC_SHIFT) - 1)
+#else
 #define BLK_TA_MASK ((1 << BLK_TC_SHIFT) - 1)
+#endif
+
 
 /*
  * Notify events.
@@ -137,7 +156,11 @@ 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
 /*
  * The trace itself
  */
@@ -147,7 +170,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
        __u32 pid;              /* who did it */
        __u32 device;           /* device identifier (dev_t) */
        __u32 cpu;              /* on what cpu did it happen */
-- 
2.19.1

Reply via email to