[PATCH] blktrace: bad ->data_read increment, and poll() delay fix for sendfile()
authorJens Axboe <axboe@suse.de>
Mon, 20 Feb 2006 09:19:30 +0000 (10:19 +0100)
committerJens Axboe <axboe@suse.de>
Mon, 20 Feb 2006 09:19:30 +0000 (10:19 +0100)
blktrace.c

index c8f9ffb70e1f72418871e0e23f4afaea58e20205..c05e2f178bc4ab7707dbe42731571fdb7f11b6b8 100644 (file)
@@ -465,12 +465,7 @@ static int read_data_net(struct thread_information *tip, void *buf,
 static int read_data(struct thread_information *tip, void *buf,
                     unsigned int len)
 {
-       int ret = tip->read_data(tip, buf, len);
-
-       if (ret > 0)
-               tip->data_read += ret;
-
-       return ret;
+       return tip->read_data(tip, buf, len);
 }
 
 static inline struct tip_subbuf *
@@ -595,8 +590,14 @@ static int get_subbuf_sendfile(struct thread_information *tip,
        }
 
        ready = sb.st_size - tip->ofile_offset;
-       if (!ready)
+       if (!ready) {
+               /*
+                * delay a little, since we poll() will return data available
+                * until sendfile() is run
+                */
+               usleep(100);
                return 0;
+       }
 
        this_size = buf_size;
        while (ready) {