[PATCH] blkparse: add %N format for bytes
authorJens Axboe <axboe@suse.de>
Mon, 26 Sep 2005 17:05:40 +0000 (19:05 +0200)
committerJens Axboe <axboe@suse.de>
Mon, 26 Sep 2005 17:05:40 +0000 (19:05 +0200)
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
blkparse_fmt.c

diff --git a/README b/README
index c96d20a533e5b79a19c6c965928c37ccbac042e5..7cd2ba56f73d79ff35a92ef274fb5e0ec5c5aad9 100644 (file)
--- a/README
+++ b/README
@@ -80,7 +80,8 @@ $ blkparse -i <input> [ -o <output> ] [ -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
index 242dc1316349e6e7b93f3c9fb262057b76d6d297..ebf97c66d27d08efca0ad3bf17c3c990d39013da 100644 (file)
@@ -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);