[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 7/7] nbd: Allow export of multiple bitmaps for one device
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [PATCH v4 7/7] nbd: Allow export of multiple bitmaps for one device |
Date: |
Wed, 14 Oct 2020 17:42:14 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 |
10.10.2020 00:55, Eric Blake wrote:
With this, 'qemu-nbd -B b0 -B b1 -f qcow2 img.qcow2' can let you sniff
out multiple bitmaps from one server. qemu-img as client can still
only read one bitmap per client connection, but other NBD clients
(hello libnbd) can now read multiple bitmaps in a single pass.
Signed-off-by: Eric Blake <eblake@redhat.com>
You didn't update nbd_export_create failure patch, I suggest:
@@ -1533,6 +1537,7 @@ static int nbd_export_create(BlockExport *blk_exp,
BlockExportOptions *exp_args,
bool shared = !exp_args->writable;
strList *bitmaps;
int ret;
+ size_t i;
assert(exp_args->type == BLOCK_EXPORT_TYPE_NBD);
@@ -1632,11 +1637,15 @@ static int nbd_export_create(BlockExport *blk_exp, BlockExportOptions *exp_args,
goto fail;
}
- bdrv_dirty_bitmap_set_busy(bm, true);
exp->export_bitmaps[exp->nr_export_bitmaps++] = bm;
assert(strlen(bitmap) <= BDRV_BITMAP_MAX_NAME_SIZE);
}
+ /* Mark bitmaps busy in a separate loop, to not bother with roll-back */
+ for (i = 0; i < exp->nr_export_bitmaps; i++) {
+ bdrv_dirty_bitmap_set_busy(bm, true);
+ }
+
exp->allocation_depth = arg->allocation_depth;
blk_add_aio_context_notifier(blk, blk_aio_attached, blk_aio_detach, exp);
@@ -1646,6 +1655,7 @@ static int nbd_export_create(BlockExport *blk_exp,
BlockExportOptions *exp_args,
return 0;
fail:
+ g_free(exp->export_bitmaps);
g_free(exp->name);
g_free(exp->description);
return ret;
and with it:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Also, would be good to add a comment:
@@ -29,6 +29,10 @@
#define NBD_META_ID_BASE_ALLOCATION 0
#define NBD_META_ID_ALLOCATION_DEPTH 1
#define NBD_META_ID_DIRTY_BITMAP 2
+/*
+ * NBD_META_ID_DIRTY_BITMAP+i are reserved for dirty bitmaps, so keep
+ * NBD_META_ID_DIRTY_BITMAP the last one.
+ */
/*
* NBD_MAX_BLOCK_STATUS_EXTENTS: 1 MiB of extents data. An empirical
--
Best regards,
Vladimir
- [PATCH v4 3/7] nbd: Add 'qemu-nbd -A' to expose allocation depth, (continued)