From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a44rR-0007Z2-LV for qemu-devel@nongnu.org; Wed, 02 Dec 2015 05:42:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a44rO-0007Ya-ED for qemu-devel@nongnu.org; Wed, 02 Dec 2015 05:42:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a44rO-0007Y5-8M for qemu-devel@nongnu.org; Wed, 02 Dec 2015 05:42:06 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id E1D158E221 for ; Wed, 2 Dec 2015 10:42:05 +0000 (UTC) Date: Wed, 2 Dec 2015 18:41:54 +0800 From: Peter Xu Message-ID: <20151202104153.GE19485@pxdev.xzpeter.org> References: <1448976530-15984-1-git-send-email-peterx@redhat.com> <1448976530-15984-10-git-send-email-peterx@redhat.com> <20151202013257.GF9399@ad.usersys.redhat.com> <20151202084919.GD19485@pxdev.xzpeter.org> <20151202094918.GA21121@ad.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20151202094918.GA21121@ad.usersys.redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 09/11] DumpState: adding total_size and written_size fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: drjones@redhat.com, lersek@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com, lcapitulino@redhat.com On Wed, Dec 02, 2015 at 05:49:18PM +0800, Fam Zheng wrote: > On Wed, 12/02 16:49, Peter Xu wrote: > > On Wed, Dec 02, 2015 at 09:32:57AM +0800, Fam Zheng wrote: > > > > @@ -1301,6 +1303,7 @@ static void write_dump_pages(DumpState *s, Error **errp) > > > > goto out; > > > > } > > > > } > > > > + s->written_size += TARGET_PAGE_SIZE; > > > > > > The same question applies here. > > > > For kdump case, it is using "goto out" when error happens. So it > > seems to have no problem here? > > write_cache can fail after you increment it here, no? I am adding it at the end of loop. It looks like: while (get_next_page(&block_iter, &pfn_iter, &buf, s)) { if (is_zero_page(buf, TARGET_PAGE_SIZE)) { ret = write_cache(&page_desc, &pd_zero, sizeof(PageDescriptor), false); if (ret < 0) { error_setg(errp, "XXXXXXXX"); goto out; } } else { ... ret = write_cache(&page_desc, &pd, sizeof(PageDescriptor), false); if (ret < 0) { error_setg(errp, "XXXXXXXX"); goto out; } ... } s->written_size += TARGET_PAGE_SIZE; } Label "out" is out of the loop. So, when error happens, it sets the errp and directly jump out of the loop. Did I miss anything? Thanks! Peter > > Fam