From 663962f7f02e893347220dbe6527c493d0bbca60 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 20 Feb 2006 10:19:30 +0100 Subject: [PATCH] [PATCH] blktrace: bad ->data_read increment, and poll() delay fix for sendfile() --- blktrace.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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) { -- 2.25.1