From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3vch-0002jS-Lr for qemu-devel@nongnu.org; Tue, 01 Dec 2015 19:50:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3vce-0002mo-Fv for qemu-devel@nongnu.org; Tue, 01 Dec 2015 19:50:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3vce-0002mi-8M for qemu-devel@nongnu.org; Tue, 01 Dec 2015 19:50:16 -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 D10538E375 for ; Wed, 2 Dec 2015 00:50:15 +0000 (UTC) Date: Wed, 2 Dec 2015 08:50:11 +0800 From: Fam Zheng Message-ID: <20151202005010.GC9399@ad.usersys.redhat.com> References: <1448976530-15984-1-git-send-email-peterx@redhat.com> <1448976530-15984-6-git-send-email-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448976530-15984-6-git-send-email-peterx@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 05/11] dump-guest-memory: introduce dump_process() helper function. 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 Tue, 12/01 21:28, Peter Xu wrote: > No functional change. Cleanup only. > > Signed-off-by: Peter Xu > --- > dump.c | 35 ++++++++++++++++++++++------------- > include/sysemu/dump.h | 3 +++ > 2 files changed, 25 insertions(+), 13 deletions(-) > > diff --git a/dump.c b/dump.c > index 3cf75db..e46749d 100644 > --- a/dump.c > +++ b/dump.c > @@ -1441,6 +1441,9 @@ static void dump_init(DumpState *s, int fd, bool has_format, > Error *err = NULL; > int ret; > > + s->has_format = has_format; > + s->format = format; > + > /* kdump-compressed is conflict with paging and filter */ > if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { > assert(!paging && !has_filter); > @@ -1594,6 +1597,24 @@ cleanup: > dump_cleanup(s); > } > > +/* this operation might be time consuming. */ > +static void dump_process(DumpState *s, Error **errp) > +{ > + if (s->has_format && s->format != DUMP_GUEST_MEMORY_FORMAT_ELF) { > + create_kdump_vmcore(s, errp); > + } else { > + create_vmcore(s, errp); > + } > + > + if (*errp) { > + s->status = DUMP_STATUS_FAILED; > + } else { > + s->status = DUMP_STATUS_COMPLETED; > + } As in patch 3, this should use local_err + error_propagate. > + > + dump_cleanup(s); > +} > + > void qmp_dump_guest_memory(bool paging, const char *file, > bool has_detach, bool detach, > bool has_begin, int64_t begin, bool has_length, > @@ -1679,19 +1700,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, > return; > } > > - if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) { > - create_kdump_vmcore(s, errp); > - } else { > - create_vmcore(s, errp); > - } > - > - if (*errp) { > - s->status = DUMP_STATUS_FAILED; > - } else { > - s->status = DUMP_STATUS_COMPLETED; > - } > - > - dump_cleanup(s); > + dump_process(s, errp); > } > > DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp) > diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h > index affef38..d6f4a9c 100644 > --- a/include/sysemu/dump.h > +++ b/include/sysemu/dump.h > @@ -185,6 +185,9 @@ typedef struct DumpState { > size_t num_dumpable; /* number of page that can be dumped */ > uint32_t flag_compress; /* indicate the compression format */ > DumpStatus status; /* current dump status */ > + > + bool has_format; /* whether format is provided */ > + DumpGuestMemoryFormat format; /* valid only if has_format == true */ > } DumpState; > > uint16_t cpu_to_dump16(DumpState *s, uint16_t val); > -- > 2.4.3 >