From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEeU6-0001RL-8G for qemu-devel@nongnu.org; Tue, 05 Aug 2014 09:09:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEeU0-0001rv-30 for qemu-devel@nongnu.org; Tue, 05 Aug 2014 09:08:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEeTz-0001rm-QF for qemu-devel@nongnu.org; Tue, 05 Aug 2014 09:08:52 -0400 Date: Tue, 5 Aug 2014 14:08:46 +0100 From: Stefan Hajnoczi Message-ID: <20140805130846.GA12251@stefanha-thinkpad.redhat.com> References: <1404830964-10733-1-git-send-email-fromani@redhat.com> <1404830964-10733-2-git-send-email-fromani@redhat.com> <20140801113940.GC7258@stefanha-thinkpad.redhat.com> <20140805084757.GB4391@noname.str.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline In-Reply-To: <20140805084757.GB4391@noname.str.redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: add watermark event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: mdroth@linux.vnet.ibm.com, Francesco Romani , qemu-devel@nongnu.org, lcapitulino@redhat.com --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 05, 2014 at 10:47:57AM +0200, Kevin Wolf wrote: > Am 01.08.2014 um 13:39 hat Stefan Hajnoczi geschrieben: > > On Tue, Jul 08, 2014 at 04:49:24PM +0200, Francesco Romani wrote: > > > @@ -5813,3 +5815,57 @@ void bdrv_flush_io_queue(BlockDriverState *bs) > > > bdrv_flush_io_queue(bs->file); > > > } > > > } > > > + > > > +static bool watermark_exceeded(BlockDriverState *bs, > > > + int64_t sector_num, > > > + int nb_sectors) > > > +{ > > > + > > > + if (bs->wr_watermark_perc > 0) { > > > + int64_t watermark =3D (bs->total_sectors) / 100 * bs->wr_wat= ermark_perc; > >=20 > > bs->total_sectors should not be used directly. > >=20 > > Have you considered making the watermark parameter take sector units > > instead of a percentage? > >=20 > > I'm not sure whether a precentage makes sense because 25% of a 10GB > > image is 2.5 GB so a 75% watermark might be reasonable. 25% of a 1 TB > > image is 250 GB and that's probably not a reasonable watermark. > >=20 > > So let the block-set-watermark caller pass an absolute sector number > > instead. It keeps things simple for both QEMU and thin provisioning > > manager. >=20 > No sector numbers in external interfaces, please. These units of 512 > bytes are completely arbitrary and don't make any sense. I hope to get > rid of BDRV_SECTOR_* eventually even internally. >=20 > So for external APIs, please use bytes instead. I agree and forgot about that. Please use bytes instead of sectors or a percentage. --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT4NdeAAoJEJykq7OBq3PIL44H/0L1H324S5Cf8Ep6D5g3ozaI IeE8cH0uz3BEMaib648JlYNEng+PJ6ukZpOvHL/cEOuNiZ9lAv52vcx8Efci4eNc MrOdugfqVCHMK+uSv51tYMxFzskMH993ES1IIDt8XyRSGGMLx7dqdmsLm0latEHL 7bq39Y/sRpT+MIusMRvMhbY9FIu+SXQ3F4n2hAbZ6/wfqaFjacBXcEuFiNf9iG67 wgqld1eH1NNjtpSTZj1fyUgAXhMvVn6P0v2lyLeRavD539i5MhEfJYuyNIMdXcsb L7M9/KK1jqJLUqjd6Ord9IFLScxv0ELyCDO9WCjxbuMGRTdg7WufAIFF+aSbF9A= =gORN -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--