From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvqJd-0002Gy-NI for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:33:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvqJa-0005Zl-5v for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:33:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvqJa-0005Z4-0l for qemu-devel@nongnu.org; Mon, 09 Nov 2015 12:33:10 -0500 Date: Mon, 9 Nov 2015 17:33:07 +0000 From: Stefan Hajnoczi Message-ID: <20151109173307.GC29494@stefanha-x1.localdomain> References: <1446911700-16803-1-git-send-email-den@openvz.org> <1446911700-16803-8-git-send-email-den@openvz.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eHhjakXzOLJAF9wJ" Content-Disposition: inline In-Reply-To: <1446911700-16803-8-git-send-email-den@openvz.org> Subject: Re: [Qemu-devel] [PATCH 07/10] snapshot: create bdrv_all_create_snapshot helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , qemu-devel@nongnu.org, Juan Quintela --eHhjakXzOLJAF9wJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 07, 2015 at 06:54:57PM +0300, Denis V. Lunev wrote: > +int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn, BlockDriverState **bad) > +{ > + int err = 0; > + BlockDriverState *bs = NULL; > + > + while (err == 0 && (bs = bdrv_next(bs))) { > + AioContext *ctx = bdrv_get_aio_context(bs); > + > + aio_context_acquire(ctx); > + if (bdrv_can_snapshot(bs)) { > + err = bdrv_snapshot_create(bs, sn); > + /* Tricky part here. First image contains VM state. The behavior > + * is matched one in bdrv_all_find_vmstate_bs */ > + sn->vm_state_size = 0; Please avoid the tricky part by passing in vm_state_bs and vm_state_size. Then this function can do: /* Write VM state size only to the image that contains the state */ sn->vm_state_size = (bs == bs1 ? vm_state_size : 0); without making assumptions about the algorithm for choosing the device to store vmstate data on. --eHhjakXzOLJAF9wJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWQNjTAAoJEJykq7OBq3PIAZUIAK77P5LD2ZO+dSE6sS+GjfhU lLGrCQoaXxeyiF5AX8NJ3iAz4/aMJCsYDMDb1x5UUczpj40H8Yk7zbmME9gGRACL OduUnR8rQ1sEmfIyOkdjU/VlfZzmH7n38oDY2YK1Fj3j8WpULMgMxJaKA0eRbMN0 KokP7OOq9Vg8MvHJCFmyA9ikM2PpmlylJzJPH+p/NV7VFZTkMwPdz8B2FKSqfrOH DD14Y457glneXMOathbJ6bcUSCsj6U8PMJdWEygD0NTFSM4mxwRa+fDsF2ktZT6G KKwedWmrZFiGHJBdGQY63adZ5Q3oDJk+dNuC6e2FRvp1NcECeLAaJbt+z3G1ezM= =gSUL -----END PGP SIGNATURE----- --eHhjakXzOLJAF9wJ--