[PATCH] blktrace: fix payload tracing
authorJens Axboe <axboe@nelson>
Mon, 29 Aug 2005 13:49:05 +0000 (15:49 +0200)
committerJens Axboe <axboe@nelson>
Mon, 29 Aug 2005 13:49:05 +0000 (15:49 +0200)
Endianness conversion was done before reading ->pdu_len, thus screwing it
up and hanging forever waiting for data.

CHANGELOG
blktrace.c

index e671d72678e7cc8f4d56bc8ecf85d36591b26e8c..ef2bfb4ee4c39e21db5a4695250a6464e57b94fa 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
        - Always store trace data in big endian format
        - Oops, don't clear rb_root in sort_entries()
        - Account dispathces as well, split stats into per-cpu
+       - blktrace: fix payload logging
 20050827:
        - Various cleanups and killing unused variables
 20050826:
index 2a21c4c83e7492201f05c64fa31d0947b25d1b3d..1af278375c8a202e2b5750cef9e696294b5381d5 100644 (file)
@@ -110,7 +110,7 @@ static void extract_data(int cpu, char *ifn, int ifd, char *ofn, int ofd,
 static void *extract(void *arg)
 {
        struct thread_information *tip = arg;
-       int tracefd, ret, ofd;
+       int tracefd, ret, ofd, pdu_len;
        char ip[64], op[64], dp[64];
        struct blk_io_trace t;
        pid_t pid = getpid();
@@ -161,6 +161,8 @@ static void *extract(void *arg)
                if (verify_trace(&t))
                        exit(1);
 
+               pdu_len = t.pdu_len;
+
                trace_to_be(&t);
 
                ret = write(ofd, &t, sizeof(t));
@@ -171,8 +173,8 @@ static void *extract(void *arg)
                        exit(1);
                }
 
-               if (t.pdu_len)
-                       extract_data(tip->cpu, ip, tracefd, dp, ofd, t.pdu_len);
+               if (pdu_len)
+                       extract_data(tip->cpu, ip, tracefd, dp, ofd, pdu_len);
 
                tip->events_processed++;
        }