Received: from eggs.gnu.org ([2001:4830:134:3::10]:37051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1djnwf-0003Z8-Cm for qemu-devel@nongnu.org; Mon, 21 Aug 2017 10:44:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1djnwc-00027h-PT for qemu-devel@nongnu.org; Mon, 21 Aug 2017 10:44:49 -0400 From: Alberto Garcia In-Reply-To: <20170815135012.2kjflh6z2b6pdw44@postretch> References: <20170809140256.25584-1-el13635@mail.ntua.gr> <20170809140256.25584-2-el13635@mail.ntua.gr> <20170815135012.2kjflh6z2b6pdw44@postretch> Date: Mon, 21 Aug 2017 16:44:43 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 1/6] block: skip implicit nodes in snapshots, blockjobs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Manos Pitsidianakis Cc: qemu-devel , qemu-block , Stefan Hajnoczi , Kevin Wolf On Tue 15 Aug 2017 03:50:12 PM CEST, Manos Pitsidianakis wrote: >>> +static inline BlockDriverState *child_bs(BlockDriverState *bs) >>> +{ >>> + BdrvChild *child = QLIST_FIRST(&bs->children); >>> + assert(child && !QLIST_NEXT(child, next)); >>> + return child->bs; >>> +} >> >>This aborts if the bs has a number of children != 1. That's not >>something that I would expect from a function named like that. >> >>Considering that you're only using it in bdrv_get_first_explicit(), >>why don't you simply move the code there? > > It felt useful to have a function that also returns file->bs (we have > backing_bs() already) instead of doing backing_bs(bs) ? : file_bs(bs) >> >>The other question is of course whether we can rely for the future on >>the assumption that implicit nodes only have one children. > > This is only to get either bs->backing or bs->file (we can't have both > anyway). You can have other children (see Quorum for example). Berto