From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRMA0-00020m-Ih for qemu-devel@nongnu.org; Fri, 18 Nov 2011 05:59:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRM9z-0001jv-3m for qemu-devel@nongnu.org; Fri, 18 Nov 2011 05:59:08 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:61841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRM9y-0001jq-V1 for qemu-devel@nongnu.org; Fri, 18 Nov 2011 05:59:07 -0500 Received: by eyh6 with SMTP id 6so3522840eyh.4 for ; Fri, 18 Nov 2011 02:59:06 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1321607573-29744-1-git-send-email-zhihuili@linux.vnet.ibm.com> References: <1321607573-29744-1-git-send-email-zhihuili@linux.vnet.ibm.com> Date: Fri, 18 Nov 2011 10:59:05 +0000 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block: Use bdrv functions to replace file operation in qcow.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Zhi Hui Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On Fri, Nov 18, 2011 at 9:12 AM, Li Zhi Hui w= rote: > + =A0 =A0tmp =3D g_malloc0(sizeof(uint64_t)*l1_size); > + =A0 =A0ret =3D bdrv_pwrite(qcow_bs, header_size, tmp, sizeof(uint64_t)*= l1_size); > + =A0 =A0g_free(tmp); > + =A0 =A0if (ret !=3D sizeof(uint64_t)*l1_size) { > + =A0 =A0 =A0 =A0goto exit; > =A0 =A0 } qemu-img create -f qcow test.qcow 100T >>> 100 * 1024 * 1024 * 1024 * 1024 / ((1 << 12) * (1 << 9)) 52428800 >>> 52428800 * 8 419430400 That means 400 MB of RAM for the zero L1 table for a 100 TB image. Since qcow is a legacy format this probably doesn't matter in practice but in theory this approach can require a noticable amount of RAM. Looks okay to me. Stefan