From patchwork Sat May 12 01:25:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 912341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40jTzt325Sz9s1b for ; Sat, 12 May 2018 11:35:22 +1000 (AEST) Received: from localhost ([::1]:33855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHJRP-0008Ku-UQ for incoming@patchwork.ozlabs.org; Fri, 11 May 2018 21:35:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHJI9-0006MF-Fa for qemu-devel@nongnu.org; Fri, 11 May 2018 21:25:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHJI7-0006TG-Hk for qemu-devel@nongnu.org; Fri, 11 May 2018 21:25:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35626 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fHJI2-0006GA-NU; Fri, 11 May 2018 21:25:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFA0A40073B7; Sat, 12 May 2018 01:25:37 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-231.bos.redhat.com [10.18.17.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65403215CDA7; Sat, 12 May 2018 01:25:37 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 11 May 2018 21:25:25 -0400 Message-Id: <20180512012537.22478-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 12 May 2018 01:25:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 12 May 2018 01:25:38 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [RFC PATCH 00/12] qemu-img: add bitmap queries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Markus Armbruster , Max Reitz , John Snow Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Allow qemu-img to show information about bitmaps stored in qcow2 images. Add a 'bitmap' meta-command with 'dump' sub-command to retrieve a list of dirty regions in bitmaps stored in a qcow2 image. RFC: - I am not 1000% convinced the bm_list caching is perfectly safe, especially with respect to migration and inactivation. There are more efficiencies and tweaks I can make, but I think this is the minimal set. - I decided not to gate bitmap info in the "info" command behind extra flags. - Bitmap data-gathering in "bitmap dump" could be made more space-efficient by just reporting one segment at a time, probably. - `bitmap rm` and `bitmap mk` need extra work, so I am not submitting them just yet: rm needs more work around the remove persistence API, and make needs more work around the "can add" API. - None of these commands will work with "in use" bitmaps; we need qemu-img check -r bitmaps support for this. I'm not sure what the right behavior to "fix" in-use bitmaps should be: - Cleared: This might be dangerous. - Fully Set: This is safer, but stupid. - Deleted: This might be the best option. - Un-set in-use: VERY dangerous; would rather not. John Snow (12): qcow2-bitmap: cache bm_list qcow2/dirty-bitmap: cache loaded bitmaps block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO qcow2-bitmap: track bitmap type qapi: add bitmap info qcow2-bitmap: add basic bitmaps info qjson: allow caller to ask for arbitrary indent qapi/block-core: add BitmapMapping and BitmapEntry structs qemu-img: split off common chunk of map command qemu-img: add bitmap dump qemu-img: add bitmap clear block/qcow2-bitmap.c | 220 +++++++++++++++++-------- block/qcow2.c | 9 + block/qcow2.h | 3 + include/qapi/qmp/qjson.h | 1 + qapi/block-core.json | 92 ++++++++++- qemu-img-cmds.hx | 6 + qemu-img.c | 419 +++++++++++++++++++++++++++++++++++++---------- qobject/qjson.c | 21 +-- 8 files changed, 612 insertions(+), 159 deletions(-)