From: Jens Axboe Date: Mon, 20 Feb 2006 09:19:30 +0000 (+0100) Subject: [PATCH] blktrace: bad ->data_read increment, and poll() delay fix for sendfile() X-Git-Tag: blktrace-0.99.1~27 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=663962f7f02e893347220dbe6527c493d0bbca60;p=blktrace.git [PATCH] blktrace: bad ->data_read increment, and poll() delay fix for sendfile() --- diff --git a/blktrace.c b/blktrace.c index c8f9ffb..c05e2f1 100644 --- a/blktrace.c +++ b/blktrace.c @@ -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) {