From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyc2Q-0008GH-Sq for qemu-devel@nongnu.org; Tue, 17 Nov 2015 03:54:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyc2L-0000fF-FY for qemu-devel@nongnu.org; Tue, 17 Nov 2015 03:54:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyc2L-0000et-A8 for qemu-devel@nongnu.org; Tue, 17 Nov 2015 03:54:49 -0500 Date: Tue, 17 Nov 2015 16:54:41 +0800 From: Stefan Hajnoczi Message-ID: <20151117085441.GA26236@stefanha-x1.localdomain> References: <1447687481-29244-1-git-send-email-den@openvz.org> <1447687481-29244-6-git-send-email-den@openvz.org> <20151117072201.GI16268@stefanha-x1.localdomain> <564AE0F2.5010208@openvz.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline In-Reply-To: <564AE0F2.5010208@openvz.org> Subject: Re: [Qemu-devel] [PATCH 05/10] snapshot: create bdrv_all_find_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 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Nov 17, 2015 at 11:10:26AM +0300, Denis V. Lunev wrote: > On 11/17/2015 10:22 AM, Stefan Hajnoczi wrote: > >On Mon, Nov 16, 2015 at 06:24:36PM +0300, Denis V. Lunev wrote: > >>@@ -2168,21 +2157,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict) > >> available_snapshots = g_new0(int, nb_sns); > >> total = 0; > >> for (i = 0; i < nb_sns; i++) { > >>- sn = &sn_tab[i]; > >>- available = 1; > >>- bs1 = NULL; > >>- > >>- while ((bs1 = bdrv_next(bs1))) { > >>- if (bdrv_can_snapshot(bs1) && bs1 != bs) { > >>- ret = bdrv_snapshot_find(bs1, sn_info, sn->id_str); > >>- if (ret < 0) { > >>- available = 0; > >>- break; > >>- } > >>- } > >>- } > >>- > >>- if (available) { > >>+ if (bdrv_all_find_snapshot(sn_tab[i].id_str, false, &bs1) == 0) { > >bdrv_all_find_snapshot() doesn't do the bs1 != bs exclusion so the new > >code behaves differently from the old code. That seems like a bug. > no. The result will be the same. This is a minor optimisation: > - we get the first block device we can make snapshot on > - we get snapshot list on that device > - after that we start iterations over the list and removing not available > snapshots on other devices > This means that if bs == bs1 the check will be "always true" Ah, I see. Thanks! Stefan --qDbXVdCdHGoSgWSk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWSutRAAoJEJykq7OBq3PIXTcH/jun9nfC0SxH8cCr2Yxm5FJ4 cZGKcddl8q0HoCJM3j1y+Eg/YWTGJtBYGjbKNybsuVIaSs2JEin87s+esFsNin6V h4KkGje4gQCzl8x0y+WPe7QZIxgyYcpfQD92N+8r+ISgkVJ02DrnCEi317LXcvQ7 b2gdtRSiIQSK3FJNroNqTtMCvgS6jZxwIgosfDpgeLKTISFSO0GVv4wMOe6MVP/S VfbDC5qDPATcgHud05Yq2ZfnC0pdtlytkqVrMUb9rpQhsP1pghascIC8jVCBqQaf QjePefehfY9I2nrEmimbVBUbHpDnuLlW32uQpNNgVk35/As41h8ZSR6L7vlyOC8= =UuyJ -----END PGP SIGNATURE----- --qDbXVdCdHGoSgWSk--