Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2227843/?format=api
{ "id": 2227843, "url": "http://patchwork.ozlabs.org/api/patches/2227843/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260424105949.254757-1-den@openvz.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260424105949.254757-1-den@openvz.org>", "list_archive_url": null, "date": "2026-04-24T10:59:49", "name": "[v3,1/1] qemu-img: add sub-command --remove-all to 'qemu-img bitmap'", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "52d0ac5606b03c1f07ddc0edf1a0dee3759318ac", "submitter": { "id": 71296, "url": "http://patchwork.ozlabs.org/api/people/71296/?format=api", "name": "Denis V. Lunev\" via qemu development", "email": "qemu-devel@nongnu.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260424105949.254757-1-den@openvz.org/mbox/", "series": [ { "id": 501346, "url": "http://patchwork.ozlabs.org/api/series/501346/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501346", "date": "2026-04-24T10:59:49", "name": "[v3,1/1] qemu-img: add sub-command --remove-all to 'qemu-img bitmap'", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/501346/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227843/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227843/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n secure) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256\n header.s=relay header.b=scklV46o;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g294L1vrxz1yDD\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 21:01:04 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wGEGL-0000Q8-Ej; Fri, 24 Apr 2026 06:59:57 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <den@openvz.org>)\n id 1wGEGI-0000PL-V6; Fri, 24 Apr 2026 06:59:55 -0400", "from relay.virtuozzo.com ([130.117.225.111])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <den@openvz.org>)\n id 1wGEGG-0000zf-N3; Fri, 24 Apr 2026 06:59:54 -0400", "from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=iris.sw.ru)\n by relay.virtuozzo.com with esmtp (Exim 4.96)\n (envelope-from <den@openvz.org>) id 1wGEDW-00FcSF-24;\n Fri, 24 Apr 2026 12:59:46 +0200" ], "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From:\n Content-Type; bh=MY3Ui24DiO+ty5K/7ChL4aiQuI6zKz+dZPOdvsiLArA=; b=scklV46o8rdl\n qhNrIRrCyzdpJALI1YCQ9uZ+4RU9N1kN+bOEfUulPBjlhj22rEHCSAde2XKAHssFj5hY3+Z5jsa2z\n 7dicATKnB+xFkcqnYSrAORSgJgWoXr8uBGFwVluLkRyXvePOiMmorii75YkpwUuLqUL7O0WYzOl60\n LfcRAywnjftUOO/2rIOx9xaaB6rreU9VLkSLZrohfV8/OCPE7Szweft0pr3iiiG5PQ1xg9MYzicjt\n AAqfpiQNZnSD2QeXN+RcTrcPXBpK4okNd2D0ojBb3cxf/x3Ejm/rCC3TagWWIG2PKcNPgbX8os+WT\n Fu2OVDXNtTbHE/PglRV+Pw==;", "To": "qemu-devel@nongnu.org", "Cc": "qemu-block@nongnu.org, \"Denis V. Lunev\" <den@openvz.org>,\n Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>", "Subject": "[PATCH v3 1/1] qemu-img: add sub-command --remove-all to 'qemu-img\n bitmap'", "Date": "Fri, 24 Apr 2026 12:59:49 +0200", "Message-ID": "<20260424105949.254757-1-den@openvz.org>", "X-Mailer": "git-send-email 2.51.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "softfail client-ip=130.117.225.111;\n envelope-from=den@openvz.org;\n helo=relay.virtuozzo.com", "X-Spam_score_int": "-34", "X-Spam_score": "-3.5", "X-Spam_bar": "---", "X-Spam_report": "(-3.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,\n SPF_SOFTFAIL=0.665 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Reply-to": "\"Denis V. Lunev\" <den@openvz.org>", "From": "\"Denis V. Lunev\" via qemu development <qemu-devel@nongnu.org>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From time to time it is needed to remove all bitmaps from the image.\nBefore this patch the process is not very convenient. One should\nperform\n qemu-img info\nand parse the output to obtain all names. After that one should\nsequentially call\n qemu-img bitmap --remove\nfor each present bitmap.\n\nThe patch adds --remove-all sub-command to 'qemu-img bitmap'.\n\nSigned-off-by: Denis V. Lunev <den@openvz.org>\nCC: Kevin Wolf <kwolf@redhat.com>\nCC: Hanna Reitz <hreitz@redhat.com>\n---\nChanges from v2:\n* rebased to the lastest head\n\nChanges from v1:\n* rebased to latest head\n* adopted bitmap help to the new layout\n\n docs/tools/qemu-img.rst | 10 +++++---\n qemu-img.c | 53 ++++++++++++++++++++++++++++++++++-------\n 2 files changed, 52 insertions(+), 11 deletions(-)", "diff": "diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst\nindex 558b0eb84d..b0c798b77a 100644\n--- a/docs/tools/qemu-img.rst\n+++ b/docs/tools/qemu-img.rst\n@@ -301,15 +301,19 @@ Command description:\n For write tests, by default a buffer filled with zeros is written. This can be\n overridden with a pattern byte specified by *PATTERN*.\n \n-.. option:: bitmap (--merge SOURCE | --add | --remove | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME BITMAP\n+.. option:: bitmap (--merge SOURCE | --add | --remove | --remove-all | --clear | --enable | --disable)... [-b SOURCE_FILE [-F SOURCE_FMT]] [-g GRANULARITY] [--object OBJECTDEF] [--image-opts | -f FMT] FILENAME [BITMAP]\n \n- Perform one or more modifications of the persistent bitmap *BITMAP*\n- in the disk image *FILENAME*. The various modifications are:\n+ Perform one or more modifications of persistent bitmaps in the disk\n+ image *FILENAME*. Most operations require *BITMAP* to be specified;\n+ ``--remove-all`` operates on all bitmaps and does not take *BITMAP*.\n+ The various modifications are:\n \n ``--add`` to create *BITMAP*, enabled to record future edits.\n \n ``--remove`` to remove *BITMAP*.\n \n+ ``--remove-all`` to remove all bitmaps.\n+\n ``--clear`` to clear *BITMAP*.\n \n ``--enable`` to change *BITMAP* to start recording future edits.\ndiff --git a/qemu-img.c b/qemu-img.c\nindex c42dd4e995..22ddc7a627 100644\n--- a/qemu-img.c\n+++ b/qemu-img.c\n@@ -87,6 +87,7 @@ enum {\n OPTION_FORCE = 276,\n OPTION_SKIP_BROKEN = 277,\n OPTION_LIMITS = 278,\n+ OPTION_REMOVE_ALL = 279,\n };\n \n typedef enum OutputFormat {\n@@ -5018,6 +5019,7 @@ enum ImgBitmapAct {\n BITMAP_ENABLE,\n BITMAP_DISABLE,\n BITMAP_MERGE,\n+ BITMAP_REMOVE_ALL,\n };\n typedef struct ImgBitmapAction {\n enum ImgBitmapAct act;\n@@ -5036,7 +5038,7 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n BlockDriverState *bs = NULL, *src_bs = NULL;\n bool image_opts = false;\n int64_t granularity = 0;\n- bool add = false, merge = false;\n+ bool add = false, merge = false, remove_all = false, any = false;\n QSIMPLEQ_HEAD(, ImgBitmapAction) actions;\n ImgBitmapAction *act, *act_next;\n const char *op;\n@@ -5052,6 +5054,7 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n {\"add\", no_argument, 0, OPTION_ADD},\n {\"granularity\", required_argument, 0, 'g'},\n {\"remove\", no_argument, 0, OPTION_REMOVE},\n+ {\"remove-all\", no_argument, 0, OPTION_REMOVE_ALL},\n {\"clear\", no_argument, 0, OPTION_CLEAR},\n {\"enable\", no_argument, 0, OPTION_ENABLE},\n {\"disable\", no_argument, 0, OPTION_DISABLE},\n@@ -5070,8 +5073,8 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n switch (c) {\n case 'h':\n cmd_help(ccmd, \"[-f FMT | --image-opts]\\n\"\n-\" ( --add [-g SIZE] | --remove | --clear | --enable | --disable |\\n\"\n-\" --merge SOURCE [-b SRC_FILE [-F SRC_FMT]] )..\\n\"\n+\" ( --add [-g SIZE] | --remove | --remove-all | --clear | --enable |\\n\"\n+\" --disable | --merge SOURCE [-b SRC_FILE [-F SRC_FMT]] )..\\n\"\n \" [--object OBJDEF] FILE BITMAP\\n\"\n ,\n \" -f, --format FMT\\n\"\n@@ -5086,6 +5089,8 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n \" with optional multiplier suffix (in powers of 1024)\\n\"\n \" --remove\\n\"\n \" removes BITMAP from FILE\\n\"\n+\" --remove-all\\n\"\n+\" removes all bitmaps from FILE\\n\"\n \" --clear\\n\"\n \" clears BITMAP in FILE\\n\"\n \" --enable, --disable\\n\"\n@@ -5115,7 +5120,7 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_ADD;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n- add = true;\n+ add = any = true;\n break;\n case 'g':\n granularity = cvtnum(\"granularity\", optarg, true);\n@@ -5127,28 +5132,38 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_REMOVE;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n+ any = true;\n+ break;\n+ case OPTION_REMOVE_ALL:\n+ act = g_new0(ImgBitmapAction, 1);\n+ act->act = BITMAP_REMOVE_ALL;\n+ QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n+ remove_all = true;\n break;\n case OPTION_CLEAR:\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_CLEAR;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n+ any = true;\n break;\n case OPTION_ENABLE:\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_ENABLE;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n+ any = true;\n break;\n case OPTION_DISABLE:\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_DISABLE;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n+ any = true;\n break;\n case OPTION_MERGE:\n act = g_new0(ImgBitmapAction, 1);\n act->act = BITMAP_MERGE;\n act->src = optarg;\n QSIMPLEQ_INSERT_TAIL(&actions, act, next);\n- merge = true;\n+ any = merge = true;\n break;\n case 'b':\n src_filename = optarg;\n@@ -5165,8 +5180,8 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n }\n \n if (QSIMPLEQ_EMPTY(&actions)) {\n- error_report(\"Need at least one of --add, --remove, --clear, \"\n- \"--enable, --disable, or --merge\");\n+ error_report(\"Need at least one of --add, --remove, --remove-all, \"\n+ \"--clear, --enable, --disable, or --merge\");\n goto out;\n }\n \n@@ -5184,10 +5199,14 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n goto out;\n }\n \n- if (optind != argc - 2) {\n+ if (any && optind != argc - 2) {\n error_report(\"Expecting filename and bitmap name\");\n goto out;\n }\n+ if (!any && remove_all && optind != argc - 1) {\n+ error_report(\"Expecting filename\");\n+ goto out;\n+ }\n \n filename = argv[optind];\n bitmap = argv[optind + 1];\n@@ -5225,6 +5244,24 @@ static int img_bitmap(const img_cmd_t *ccmd, int argc, char **argv)\n qmp_block_dirty_bitmap_remove(bs->node_name, bitmap, &err);\n op = \"remove\";\n break;\n+ case BITMAP_REMOVE_ALL: {\n+ while (1) {\n+ const char *name;\n+ BdrvDirtyBitmap *bm = bdrv_dirty_bitmap_first(bs);\n+ if (bm == NULL) {\n+ break;\n+ }\n+ name = bdrv_dirty_bitmap_name(bm);\n+ qmp_block_dirty_bitmap_remove(bs->node_name, name, &err);\n+ if (err) {\n+ /* Save name for proper error reporting */\n+ bitmap = name;\n+ break;\n+ }\n+ }\n+ op = \"remove-all\";\n+ break;\n+ }\n case BITMAP_CLEAR:\n qmp_block_dirty_bitmap_clear(bs->node_name, bitmap, &err);\n op = \"clear\";\n", "prefixes": [ "v3", "1/1" ] }