From 1c8ca7b5a1016d63caa1248e4a62d22600234f93 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 26 Sep 2005 19:05:40 +0200 Subject: [PATCH] [PATCH] blkparse: add %N format for bytes We need this for PC requests, they are not multiples of 512 like the FS requests. At the same time change the default for PC requests to dump in bytes. --- README | 3 ++- blkparse_fmt.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index c96d20a..7cd2ba5 100644 --- a/README +++ b/README @@ -80,7 +80,8 @@ $ blkparse -i [ -o ] [ -b rb_batch ] [ -s ] [ -t ] [ -q ] %e - Error number %M - Major %m - Minor - %n - Nblocks + %N - Number of bytes + %n - Number of sectors %p - PID %P - PDU %s - Sequence number diff --git a/blkparse_fmt.c b/blkparse_fmt.c index 242dc13..ebf97c6 100644 --- a/blkparse_fmt.c +++ b/blkparse_fmt.c @@ -151,6 +151,9 @@ static void print_field(char *act, struct per_cpu_info *pci, case 'n': fprintf(ofp, strcat(format, "u"), t->bytes >> 9); break; + case 'N': + fprintf(ofp, strcat(format, "u"), t->bytes); + break; case 'p': fprintf(ofp, strcat(format, "u"), t->pid); break; @@ -259,7 +262,7 @@ static void process_default(char *act, struct per_cpu_info *pci, case 'W': /* Bounce */ if (t->action & BLK_TC_ACT(BLK_TC_PC)) { char *p; - fprintf(ofp, "%u ", t->bytes >> 9); + fprintf(ofp, "%u ", t->bytes); p = dump_pdu(pdu_buf, pdu_len); if (p) fprintf(ofp, "(%s) ", p); -- 2.25.1