From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2nz0-0001oM-HI for qemu-devel@nongnu.org; Sun, 21 Dec 2014 16:24:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2nys-0004sI-Rt for qemu-devel@nongnu.org; Sun, 21 Dec 2014 16:24:10 -0500 Received: from e9.ny.us.ibm.com ([32.97.182.139]:60029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2nys-0004s5-O8 for qemu-devel@nongnu.org; Sun, 21 Dec 2014 16:24:02 -0500 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 21 Dec 2014 16:24:02 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id A8714C9003E for ; Sun, 21 Dec 2014 16:16:02 -0500 (EST) Received: from d01av05.pok.ibm.com (d01av05.pok.ibm.com [9.56.224.195]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBLLNxZB21823642 for ; Sun, 21 Dec 2014 21:23:59 GMT Received: from d01av05.pok.ibm.com (localhost [127.0.0.1]) by d01av05.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBLLNxsF029934 for ; Sun, 21 Dec 2014 16:23:59 -0500 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1417849159-6568-5-git-send-email-zhang.zhanghailiang@huawei.com> References: <1417849159-6568-1-git-send-email-zhang.zhanghailiang@huawei.com> <1417849159-6568-5-git-send-email-zhang.zhanghailiang@huawei.com> Message-ID: <20141221212353.15420.65974@loki> Date: Sun, 21 Dec 2014 15:23:53 -0600 Subject: Re: [Qemu-devel] [PATCH RFC for-2.3 4/6] qga: implement qmp_guest_set_memory_blocks() for Linux with sysfs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: peter.huangpeng@huawei.com Quoting zhanghailiang (2014-12-06 00:59:17) > Signed-off-by: zhanghailiang > --- > qga/commands-posix.c | 42 +++++++++++++++++++++++++++++++++++------- > 1 file changed, 35 insertions(+), 7 deletions(-) > = > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index d3f7d4f..1010e86 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -2059,6 +2059,34 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(= Error **errp) > error_propagate(errp, local_err); > return NULL; > } > + > +int64_t qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, > + Error **errp) > +{ > + int64_t processed; > + Error *local_err =3D NULL; > + > + processed =3D 0; > + while (mem_blks !=3D NULL) { > + transfer_memory_block(mem_blks->value, false, &local_err); > + if (local_err) { > + break; > + } The documentation claims to maximize the number of blocks we set in the eve= nt of an error, which would suggest we continue processing the remainder of the list rather than breaking here. > + ++processed; > + mem_blks =3D mem_blks->next; > + } > + > + if (local_err) { > + if (processed =3D=3D 0) { > + error_propagate(errp, local_err); > + } else { > + error_free(local_err); > + } Really think a list of error/status would make it easier for management to = make sense of things. > + } > + > + return processed; > +} > + > #else /* defined(__linux__) */ > = > void qmp_guest_suspend_disk(Error **errp) > @@ -2100,6 +2128,13 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(= Error **errp) > return NULL; > } > = > +int64_t qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, > + Error **errp) > +{ > + error_set(errp, QERR_UNSUPPORTED); > + return -1; > +} > + > #endif > = > #if !defined(CONFIG_FSFREEZE) > @@ -2186,13 +2221,6 @@ GList *ga_command_blacklist_init(GList *blacklist) > return blacklist; > } > = > -int64_t qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, > - Error **errp) > -{ > - error_set(errp, QERR_UNSUPPORTED); > - return -1; > -} > - Same comment here as with prior patch > int64_t qmp_guest_get_memory_block_size(Error **errp) > { > error_set(errp, QERR_UNSUPPORTED); > -- = > 1.7.12.4