diff mbox

[2/3] block/null: Support reopen

Message ID 1427707400-4323-3-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng March 30, 2015, 9:23 a.m. UTC
Reopen is used in block-commit. With this always-succeed operation, it
is now possible to test committing to a null drive, by specifying
"null-aio://" or "null-co://" as the backing image when creating the
qcow2 image.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/null.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Eric Blake March 30, 2015, 12:54 p.m. UTC | #1
On 03/30/2015 03:23 AM, Fam Zheng wrote:
> Reopen is used in block-commit. With this always-succeed operation, it
> is now possible to test committing to a null drive, by specifying
> "null-aio://" or "null-co://" as the backing image when creating the
> qcow2 image.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/null.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/block/null.c b/block/null.c
index fa56eac..e0cb612 100644
--- a/block/null.c
+++ b/block/null.c
@@ -178,6 +178,12 @@  static BlockAIOCB *null_aio_flush(BlockDriverState *bs,
     return null_aio_common(bs, cb, opaque);
 }
 
+static int null_reopen_prepare(BDRVReopenState *reopen_state,
+                               BlockReopenQueue *queue, Error **errp)
+{
+    return 0;
+}
+
 static BlockDriver bdrv_null_co = {
     .format_name            = "null-co",
     .protocol_name          = "null-co",
@@ -190,6 +196,7 @@  static BlockDriver bdrv_null_co = {
     .bdrv_co_readv          = null_co_readv,
     .bdrv_co_writev         = null_co_writev,
     .bdrv_co_flush_to_disk  = null_co_flush,
+    .bdrv_reopen_prepare    = null_reopen_prepare,
 };
 
 static BlockDriver bdrv_null_aio = {
@@ -204,6 +211,7 @@  static BlockDriver bdrv_null_aio = {
     .bdrv_aio_readv         = null_aio_readv,
     .bdrv_aio_writev        = null_aio_writev,
     .bdrv_aio_flush         = null_aio_flush,
+    .bdrv_reopen_prepare    = null_reopen_prepare,
 };
 
 static void bdrv_null_init(void)