From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLZ10-0000ri-5T for qemu-devel@nongnu.org; Wed, 02 Nov 2011 07:29:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLZ0y-0001AN-UT for qemu-devel@nongnu.org; Wed, 02 Nov 2011 07:29:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLZ0y-0001AB-GD for qemu-devel@nongnu.org; Wed, 02 Nov 2011 07:29:52 -0400 Message-ID: <4EB12A68.3020705@redhat.com> Date: Wed, 02 Nov 2011 12:32:56 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1320213705-8097-1-git-send-email-wuzhy@linux.vnet.ibm.com> <1320213705-8097-2-git-send-email-wuzhy@linux.vnet.ibm.com> In-Reply-To: <1320213705-8097-2-git-send-email-wuzhy@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v11 1/4] block: add the blockio limits command line support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: zwu.kernel@gmail.com, ryanh@us.ibm.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 02.11.2011 07:01, schrieb Zhi Yong Wu: > Signed-off-by: Zhi Yong Wu > Signed-off-by: Stefan Hajnoczi > --- > block.c | 40 ++++++++++++++++++++++++++++++++++++++++ > block.h | 4 ++++ > block_int.h | 29 +++++++++++++++++++++++++++++ > blockdev.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ > qemu-config.c | 24 ++++++++++++++++++++++++ > qemu-options.hx | 1 + > 6 files changed, 142 insertions(+), 0 deletions(-) > > diff --git a/block.c b/block.c > index 9bb236c..c70f86d 100644 > --- a/block.c > +++ b/block.c > @@ -30,6 +30,7 @@ > #include "qjson.h" > #include "qemu-coroutine.h" > #include "qmp-commands.h" > +#include "qemu-timer.h" > > #ifdef CONFIG_BSD > #include > @@ -105,6 +106,37 @@ int is_windows_drive(const char *filename) > } > #endif > > +/* throttling disk I/O limits */ > +static void bdrv_block_timer(void *opaque) > +{ > + BlockDriverState *bs = opaque; > + > + qemu_co_queue_next(&bs->throttled_reqs); > +} This runs only one request, whereas in previous versions all queued requests were resubmitted. Is this change intentional? > diff --git a/block_int.h b/block_int.h > index f4547f6..0abe843 100644 > --- a/block_int.h > +++ b/block_int.h > @@ -34,6 +34,12 @@ > #define BLOCK_FLAG_ENCRYPT 1 > #define BLOCK_FLAG_COMPAT6 4 > > +#define BLOCK_IO_LIMIT_READ 0 > +#define BLOCK_IO_LIMIT_WRITE 1 > +#define BLOCK_IO_LIMIT_TOTAL 2 > + > +#define BLOCK_IO_SLICE_TIME 100000000 > + > #define BLOCK_OPT_SIZE "size" > #define BLOCK_OPT_ENCRYPT "encryption" > #define BLOCK_OPT_COMPAT6 "compat6" > @@ -50,6 +56,16 @@ typedef struct AIOPool { > BlockDriverAIOCB *free_aiocb; > } AIOPool; > > +typedef struct BlockIOLimit { > + int64_t bps[3]; > + int64_t iops[3]; > +} BlockIOLimit; > + > +typedef struct BlockIODisp { > + uint64_t bytes[2]; > + uint64_t ios[2]; > +} BlockIODisp; I would prefer a different name. Something like BlockIOBaseValue maybe (no, I don't really like this either, I'm open for suggestions) Kevin