From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr2d7-0001Bk-U5 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:32:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vr2d1-0005vg-VN for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:32:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr2d1-0005va-On for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:32:19 -0500 Date: Thu, 12 Dec 2013 10:32:07 +0100 From: Kevin Wolf Message-ID: <20131212093207.GD10007@dhcp-200-207.str.redhat.com> References: <1386796109-15264-1-git-send-email-kwolf@redhat.com> <1386796109-15264-2-git-send-email-kwolf@redhat.com> <52A92570.6030303@linux.vnet.ibm.com> <52A9262D.7070406@linux.vnet.ibm.com> <20131212085110.55ec7b7c@oc7435384737.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131212085110.55ec7b7c@oc7435384737.ibm.com> Subject: Re: [Qemu-devel] [PATCH 01/22] block: Move initialisation of BlockLimits to bdrv_refresh_limits() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: pbonzini@redhat.com, pl@kamp.de, Wenchao Xia , stefanha@redhat.com, qemu-devel@nongnu.org Am 12.12.2013 um 08:51 hat Thomas Huth geschrieben: > On Thu, 12 Dec 2013 10:57:49 +0800 > Wenchao Xia wrote: > > > > > >> +static int bdrv_refresh_limits(BlockDriverState *bs) > > >> +{ > > >> + BlockDriver *drv = bs->drv; > > >> + > > >> + memset(&bs->bl, 0, sizeof(bs->bl)); > > >> + > > >> + if (!drv) { > > >> + return 0; > > >> + } else if (drv->bdrv_refresh_limits) { > > >> + return drv->bdrv_refresh_limits(bs); > > >> + } > > >> + > > >> + return 0; > > > It seems this line can be removed. > > > > > I missed the "else if", then the patch is OK. > > But it could also be written in a shorter way: > > if (drv && drv->bdrv_refresh_limits) { > return drv->bdrv_refresh_limits(bs); > } > > return 0; Indeed, with some code changes, this has become a bit more complicated than necessary. I need to touch the patch anyway for Peter's comments, so I'll change it, even though it disappears anyway later in the series. Kevin