From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjQsI-00027e-VR for qemu-devel@nongnu.org; Mon, 03 Jun 2013 05:16:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjQsF-0005Ww-Nu for qemu-devel@nongnu.org; Mon, 03 Jun 2013 05:16:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjQsF-0005Wr-GL for qemu-devel@nongnu.org; Mon, 03 Jun 2013 05:16:19 -0400 Date: Mon, 3 Jun 2013 11:16:15 +0200 From: Stefan Hajnoczi Message-ID: <20130603091615.GC16498@stefanha-thinkpad.redhat.com> References: <1369917299-5725-1-git-send-email-stefanha@redhat.com> <1369917299-5725-9-git-send-email-stefanha@redhat.com> <51A7D951.50909@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51A7D951.50909@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 08/11] blockdev: allow BdrvActionOps->commit() to be NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, xiawenc@linux.vnet.ibm.com, imain@redhat.com, Paolo Bonzini , dietmar@proxmox.com On Thu, May 30, 2013 at 04:57:21PM -0600, Eric Blake wrote: > On 05/30/2013 06:34 AM, Stefan Hajnoczi wrote: > > Some QMP 'transaction' types don't need to do anything on .commit(). > > Make .commit() optional just like .abort(). > > > > The "drive-backup" action will take advantage of this, it only needs to > > cancel the block job on .abort(). Other block job actions will probably > > follow the same pattern, so allow .commit() to be NULL. > > > > Suggested-by: Eric Blake > > Signed-off-by: Stefan Hajnoczi > > --- > > blockdev.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > Reviewed-by: Eric Blake > > Is it worth enforcing that at least one of commit or abort is supplied > (that is, assert if the user codes up an action that has neither > callback)? Or is that just overkill? I left it out because it seems like overkill. The action types are small in number, statically defined in an array, and we test both the commit and abort code paths. So there's no convenience place to put a compile-time check and developers would stumble across their mistake when running their tests. Stefan