From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUWiG-000372-20 for qemu-devel@nongnu.org; Wed, 26 Aug 2015 05:09:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUWiC-0004Gw-TF for qemu-devel@nongnu.org; Wed, 26 Aug 2015 05:09:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUWiC-0004Gd-Np for qemu-devel@nongnu.org; Wed, 26 Aug 2015 05:09:40 -0400 Date: Wed, 26 Aug 2015 10:09:35 +0100 From: Stefan Hajnoczi Message-ID: <20150826090935.GA30715@stefanha-thinkpad.redhat.com> References: <1433776886-27239-1-git-send-email-vsementsov@virtuozzo.com> <1433776886-27239-3-git-send-email-vsementsov@virtuozzo.com> <20150610143041.GE2430@stefanha-thinkpad.home> <55CE2206.9010301@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55CE2206.9010301@virtuozzo.com> Subject: Re: [Qemu-devel] [PATCH 2/8] qcow2: add dirty-bitmaps feature List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy Cc: kwolf@redhat.com, qemu-devel@nongnu.org, Vladimir Sementsov-Ogievskiy , pbonzini@redhat.com, den@openvz.org, jsnow@redhat.com On Fri, Aug 14, 2015 at 08:14:46PM +0300, Vladimir Sementsov-Ogievskiy wrote: > On 10.06.2015 17:30, Stefan Hajnoczi wrote: > >On Mon, Jun 08, 2015 at 06:21:20PM +0300, Vladimir Sementsov-Ogievskiy wrote: > >>+ ret = bdrv_pread(bs->file, bm->l1_table_offset, l1_table, > >>+ bm->l1_size * sizeof(uint64_t)); > >>+ if (ret < 0) { > >>+ goto fail; > >>+ } > >>+ > >>+ buf = g_malloc0(bm->l1_size * s->cluster_size); > >What is the maximum l1_size value? cluster_size and l1_size are 32-bit > >so with 64 KB cluster_size this overflows if l1_size > 65535. Do you > >want to cast to size_t? > > Hmm. What the maximum RAM space we'd like to spend on dirty bitmap? I think > 4Gb is too much.. So here should be limited not the l1_size but number of > bytes needed to store the bitmap. What is maximum disk size we are dealing > with? Modern file systems support up to exa- (XFS) or zetta- (ZFS) byte size. If the disk image size is large, then the cluster size will probably also be set larger than 64 KB (e.g. 1 MB). Anyway, with 64 KB cluster size & bitmap granularity a 128 MB dirty bitmap covers a 64 TB disk image. So how about 256 MB or 512 MB max dirty bitmap size? Stefan