From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVckq-00068Q-OP for qemu-devel@nongnu.org; Mon, 14 Oct 2013 03:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVckh-0004Iv-Q6 for qemu-devel@nongnu.org; Mon, 14 Oct 2013 03:39:52 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:32986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVckh-0004IS-56 for qemu-devel@nongnu.org; Mon, 14 Oct 2013 03:39:43 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Oct 2013 13:09:38 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 1F7FCE004A for ; Mon, 14 Oct 2013 13:10:59 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9E7gK8W36700332 for ; Mon, 14 Oct 2013 13:12:20 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r9E7dZwt032240 for ; Mon, 14 Oct 2013 13:09:35 +0530 Message-ID: <525B9FB5.1020806@linux.vnet.ibm.com> Date: Mon, 14 Oct 2013 15:39:33 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1378695482-29805-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1378695482-29805-7-git-send-email-xiawenc@linux.vnet.ibm.com> <5249F675.50501@redhat.com> <20131002122324.GB12200@stefanha-thinkpad.redhat.com> In-Reply-To: <20131002122324.GB12200@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V3 6/7] qcow2: print message for error path in snapshot creation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 于 2013/10/2 20:23, Stefan Hajnoczi 写道: > On Mon, Sep 30, 2013 at 04:08:53PM -0600, Eric Blake wrote: >> On 09/08/2013 08:58 PM, Wenchao Xia wrote: >>> The message will be print out with a macro enabled, which can >> s/print/printed/ >> >>> be used to check which error path is taken. >>> >>> Signed-off-by: Wenchao Xia >>> --- >>> block/qcow2-snapshot.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ >>> 1 files changed, 46 insertions(+), 0 deletions(-) >>> >>> @@ -381,12 +413,20 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) >>> ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, >>> sn->l1_table_offset, s->l1_size * sizeof(uint64_t)); >>> if (ret< 0) { >>> +#ifdef QCOW2_SNAPSHOT_PRINT_ERROR_PATH >>> + printf("qcow2: Failed in overlap check before update L1 table for " >>> + "snapshot\n"); >>> +#endif >>> goto dealloc_cluster; >>> } >>> >>> + BLKDBG_EVENT(bs->file, BLKDBG_SNAPSHOT_L1_UPDATE); >> Should this BLKDBG be part of patch 5? >> >> In general, the move to avoid fprintf except under recompilation seems >> okay; but it seems odd to be removing the diagnosis altogether. If you >> had gone one step further and refactored the code to wire in Error* >> support, then you could change fprintf to passing the Error back up the >> stack to the caller rather than losing it except during a debug build. > I agree with Eric. Use Error* and make snapshot commands print a > detailed error to the monitor. > > When diagnostics are compiled out we can't help troubleshoot user > problems. > > Stefan > Make sense, will add *errp to report the errors.