[PATCH] blktrace: speedup write out by aggregating writes
authorAlan D. Brunelle <Alan.Brunelle@hp.com>
Thu, 2 Feb 2006 08:23:20 +0000 (09:23 +0100)
committerJens Axboe <axboe@suse.de>
Thu, 2 Feb 2006 08:23:20 +0000 (09:23 +0100)
blktrace.c

index 992b4eb9af988005aeb6e1b41f9468b0ca42f296..024675b7b457ca22f378a80f44eaf37742ba562b 100644 (file)
@@ -454,8 +454,10 @@ static int flush_subbuf(struct thread_information *tip, struct tip_subbuf *ts)
        while (offset + sizeof(*t) <= ts->len) {
                t = ts->buf + offset;
 
-               if (verify_trace(t))
+               if (verify_trace(t)) {
+                       write_data(tip, ts->buf, offset);
                        return -1;
+               }
 
                pdu_len = t->pdu_len;
 
@@ -464,14 +466,14 @@ static int flush_subbuf(struct thread_information *tip, struct tip_subbuf *ts)
 
                trace_to_be(t);
 
-               if (write_data(tip, t, sizeof(*t) + pdu_len))
-                       return -1;
-
                offset += sizeof(*t) + pdu_len;
                tip->events_processed++;
                events++;
        }
 
+       if (write_data(tip, ts->buf, offset))
+               return -1;
+
        /*
         * leftover bytes, save them for next time
         */