From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXnrM-0001wb-Q7 for qemu-devel@nongnu.org; Wed, 09 Apr 2014 04:27:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXnrG-0005mO-KT for qemu-devel@nongnu.org; Wed, 09 Apr 2014 04:27:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXnrG-0005mA-CN for qemu-devel@nongnu.org; Wed, 09 Apr 2014 04:27:46 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s398RjRk027058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Apr 2014 04:27:45 -0400 Date: Wed, 9 Apr 2014 10:27:43 +0200 From: Kevin Wolf Message-ID: <20140409082743.GA3288@noname.str.redhat.com> References: <1396961442-24046-1-git-send-email-mreitz@redhat.com> <1396961442-24046-5-git-send-email-mreitz@redhat.com> <20140408153452.GF6262@noname.str.redhat.com> <53442997.9040200@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <53442997.9040200@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 4/6] qemu-img: Enable progress output for commit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 08.04.2014 um 18:53 hat Eric Blake geschrieben: > On 04/08/2014 09:34 AM, Kevin Wolf wrote: > > Am 08.04.2014 um 14:50 hat Max Reitz geschrieben: > >> Implement progress output for the commit command by querying the > >> progress of the block job. > >> > >> Signed-off-by: Max Reitz > >> Reviewed-by: Eric Blake > >> --- >=20 > >> =20 > >> info =3D block_job_query(job); > >> =20 > >> + if (info->offset) { > >> + if (!mod_offset) { > >=20 > > On a fully populated image this doesn't look entirely right. I think the > > first 2 MB (or whatever the buffer size is) will be disregarded in the > > calculation, even though they are real work that is done. >=20 > Is there any (easy) way to calculate how many dirty sectors remain to be > committed, to use that rather than the image size as the job percentage > remaining? The very first thing that mirror_run() does is building the dirty bitmap depending on whether clusters are allocated or not. After this loop we have the necessary information, but we don't really communicate it to the caller. Max tries to guess the point at which the loop completed by checking when we make progress for the first time, but that means that we ignore the first actual buffer. We could probably simply change mirror_run() to update s->common.len by subtracting the parts that haven't been marked dirty. Then the caller could use the values as they are, and query-block-jobs would get more accurate values for mirroring jobs, too. commit_run(), for a commit somewhere down in the backing chain, we don't have this initialising loop yet, but we could add it without adding too much overhead, I think. qemu-img convert was changed in December to do the same and noone has complained yet (though it's not in a release yet, perhaps people will complain once 2.0 is out). Kevin --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTRQR/AAoJEH8JsnLIjy/WsBMQAKV3SsNemH1plh1hv9Y0IsEK bFpUMjFwHofB4ciCr1TZ1l0qVN6D6z8Ejatp8/dF8MobHuhrrqahv/afnifFPFlT 0ELpwhB2Hh/LjG1Kl6lorV77e3tXGlxMG40q7yd7N5HB4S4v4winv5Ocv49LtwX2 1soBrD2XzTcQ2VsNCU/X27ne/onEANnW0BJ2Hq/rYqeIa13KLn7u3hVaJ78Q2Zgk ePO+N1X8yq1F1m57YKBaIP4+DeKv08Hvbdr62NE/KYhpMKCs2Ob4rXgIFf+s77yC ZLWiY36VJKagS3XeBjpXegc9yVFb7aMfFw/f1u5+pT1D4OXUD543VvDluMtT6SyV F/kqquskhkzqbKxQkCan1+mmGwlw+QOjJgNUI43psZTXDD5577c6VToTcKBHHJHn pyyEm3ClfWq12XTFpGbJLMFnJHFYWx77YcBic/ws2YaZZSGTb38c4u6uYpAE7qKA NYIo/D0WqiZdsXIgkJxNUMq6CAJKoMsyW1fS2VF0XVlnagKLfznEQJXx2H+ov4Ru c1VWg4LnUAftbmYrf6ILKtoasqpwPqRMSL/UHF3qxWAeaf3nnicscgruC/oTlObR CyneJ9GCsgMwCEIGhOgpVvsrAwLNDeE1/R+f5Hl0aLKhN69U3Ns60oEyOCy1si2G QhviwNY2UszcothMNWWN =WgYP -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU--