Parse completion of Zone Append commands in blkparse.

Signed-off-by: Johannes Thumshirn <[email protected]>
---
 blkparse_fmt.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/blkparse_fmt.c b/blkparse_fmt.c
index 2767edd..725ddbe 100644
--- a/blkparse_fmt.c
+++ b/blkparse_fmt.c
@@ -327,9 +327,31 @@ static char *parse_field(char *act, struct per_cpu_info 
*pci,
        return p;
 }
 
-static void process_zoned(char *act, struct blk_io_trace2 *t, char *name)
+static void process_zoned(char *act, struct blk_io_trace2 *t,
+                         unsigned long long elapsed, char *name)
 {
        switch (act[1]) {
+       case 'A':       /* Zone Append */
+               if (elapsed != -1ULL) {
+                       if (t_sec(t))
+                               fprintf(ofp, "%llu + %u (%8llu) [%d]\n",
+                                       (unsigned long long) t->sector,
+                                       t_sec(t), elapsed, t->error);
+                       else
+                               fprintf(ofp, "%llu (%8llu) [%d]\n",
+                                       (unsigned long long) t->sector,
+                                       elapsed, t->error);
+               } else {
+                       if (t_sec(t))
+                               fprintf(ofp, "%llu + %u [%d]\n",
+                                       (unsigned long long) t->sector,
+                                       t_sec(t), t->error);
+                       else
+                               fprintf(ofp, "%llu [%d]\n",
+                                       (unsigned long long) t->sector,
+                                       t->error);
+               }
+               break;
        case 'P': /* Zone Plug */
                fprintf(ofp, "[%s]\n", name);
                break;
@@ -471,7 +493,7 @@ static void process_default(char *act, struct per_cpu_info 
*pci,
                break;
 
        case 'Z':       /* Zoned command */
-               process_zoned(act, t, name);
+               process_zoned(act, t, elapsed, name);
                break;
        default:
                fprintf(stderr, "Unknown action %c\n", act[0]);
-- 
2.51.0


Reply via email to