From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adYgx-0004iO-1Q for qemu-devel@nongnu.org; Wed, 09 Mar 2016 02:38:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adYgn-0001au-Vd for qemu-devel@nongnu.org; Wed, 09 Mar 2016 02:37:58 -0500 Sender: Paolo Bonzini References: <1455645388-32401-1-git-send-email-pbonzini@redhat.com> <1455645388-32401-3-git-send-email-pbonzini@redhat.com> <20160309012650.GB17947@ad.usersys.redhat.com> From: Paolo Bonzini Message-ID: <56DFD2C0.2070809@redhat.com> Date: Wed, 9 Mar 2016 08:37:36 +0100 MIME-Version: 1.0 In-Reply-To: <20160309012650.GB17947@ad.usersys.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/16] block: move restarting of throttled reqs to block/throttle-groups.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, stefanha@redhat.com On 09/03/2016 02:26, Fam Zheng wrote: >> diff --git a/block/throttle-groups.c b/block/throttle-groups.c >> index 4920e09..eccfc0d 100644 >> --- a/block/throttle-groups.c >> +++ b/block/throttle-groups.c >> @@ -313,6 +313,17 @@ void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs, >> qemu_mutex_unlock(&tg->lock); >> } >> >> +void throttle_group_restart_bs(BlockDriverState *bs) >> +{ >> + int i; >> + >> + for (i = 0; i < 2; i++) { >> + while (qemu_co_enter_next(&bs->throttled_reqs[i])) { >> + ; >> + } >> + } >> +} >> + >> /* Update the throttle configuration for a particular group. Similar >> * to throttle_config(), but guarantees atomicity within the >> * throttling group. >> @@ -335,6 +346,10 @@ void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg) >> } >> throttle_config(ts, tt, cfg); >> qemu_mutex_unlock(&tg->lock); >> + >> + aio_context_acquire(bdrv_get_aio_context(bs)); >> + throttle_group_restart_bs(bs); >> + aio_context_release(bdrv_get_aio_context(bs)); > > Could you explain why does this hunk belong to this patch? > > Otherwise looks good. Sure. It's moved from bdrv_set_io_limits, which calls throttle_group_config, to throttle_group_config itself: >> void bdrv_set_io_limits(BlockDriverState *bs, >> ThrottleConfig *cfg) >> { >> - int i; >> - >> throttle_group_config(bs, cfg); >> - >> - for (i = 0; i < 2; i++) { >> - qemu_co_enter_next(&bs->throttled_reqs[i]); >> - } >> } >> But in v2 I'll change it to only restart the first request so there is no semantic change. Paolo