From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a46t0-0006VF-K2 for qemu-devel@nongnu.org; Wed, 02 Dec 2015 07:51:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a46sx-00027x-Di for qemu-devel@nongnu.org; Wed, 02 Dec 2015 07:51:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a46sx-00027s-8F for qemu-devel@nongnu.org; Wed, 02 Dec 2015 07:51:51 -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 A7EEA68E33 for ; Wed, 2 Dec 2015 12:51:50 +0000 (UTC) Date: Wed, 2 Dec 2015 20:51:48 +0800 From: Fam Zheng Message-ID: <20151202125148.GA10157@ad.usersys.redhat.com> 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> <20151202104153.GE19485@pxdev.xzpeter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151202104153.GE19485@pxdev.xzpeter.org> 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: Peter Xu Cc: drjones@redhat.com, lersek@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com, lcapitulino@redhat.com On Wed, 12/02 18:41, Peter Xu wrote: > 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? > You are right, I misread the context of this incremental. Thanks. Fam