From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPdE-0007vl-KR for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiPd3-0005wZ-3J for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:24 -0400 Received: from mail-pd0-x231.google.com ([2607:f8b0:400e:c02::231]:38417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiPd2-0005vw-Dc for qemu-devel@nongnu.org; Sun, 26 Oct 2014 11:21:13 -0400 Received: by mail-pd0-f177.google.com with SMTP id v10so4112592pde.36 for ; Sun, 26 Oct 2014 08:21:04 -0700 (PDT) From: Jun Li Date: Sun, 26 Oct 2014 23:20:46 +0800 Message-Id: <1414336849-21179-1-git-send-email-junmuzi@gmail.com> Subject: [Qemu-devel] [PATCH v5 0/3] qcow2: Patch for shrinking qcow2 disk image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, juli@redhat.com, famz@redhat.com, Jun Li , stefanha@redhat.com v5: Add qemu-iotests for qcow2 shrinking. Do some modifications based on MAX's suggestions in v4. v4: Add deal with COW clusters in l2 table. When using COW, some of (l2_entry >> s->cluster_bits) will larger than s->refcount_table_size, so need to discard this l2_entry. v3: Fixed host cluster leak. In file block/qcow2.c, just using ftruncate to fix host cluster leak. In file block/qcow2-cluster.c, just re-copy qcow2_grow_l1_table to realize qcow2_shrink_l1_and_l2_table. In file block/qcow2-refcount.c, also update the realization to handle self-describing refcount blocks in function update_refcount. Thanks. Jun Li (3): qcow2: Add qcow2_shrink_l1_and_l2_table for qcow2 shrinking qcow2: add update refcount table realization for update_refcount qcow2: Add qemu-iotests for qcow2 shrinking block/qcow2-cluster.c | 182 +++++++++++++++++++++++++++++++++++++++++++++ block/qcow2-refcount.c | 49 +++++++++++- block/qcow2.c | 37 ++++++++- block/qcow2.h | 2 + tests/qemu-iotests/110 | 76 +++++++++++++++++++ tests/qemu-iotests/110.out | 13 ++++ tests/qemu-iotests/group | 1 + 7 files changed, 356 insertions(+), 4 deletions(-) create mode 100755 tests/qemu-iotests/110 create mode 100644 tests/qemu-iotests/110.out -- 1.9.3