All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional
@ 2018-08-14 12:43 Vladimir Sementsov-Ogievskiy
  2018-08-14 12:43 ` [Qemu-devel] [PATCH 1/2] " Vladimir Sementsov-Ogievskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-08-14 12:43 UTC (permalink / raw
  To: qemu-devel, qemu-block
  Cc: famz, jcody, pbonzini, pavel.dovgaluk, mreitz, kwolf, vsementsov,
	den

Several block drivers have to define empty .bdrv_close handler. Let's
instead make it optional.

Vladimir Sementsov-Ogievskiy (2):
  block: make .bdrv_close optional
  block: drop empty .bdrv_close handlers

 block.c              | 4 +++-
 block/blkreplay.c    | 5 -----
 block/commit.c       | 5 -----
 block/copy-on-read.c | 6 ------
 block/mirror.c       | 5 -----
 block/null.c         | 6 ------
 block/raw-format.c   | 5 -----
 block/snapshot.c     | 4 +++-
 8 files changed, 6 insertions(+), 34 deletions(-)

-- 
2.11.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] block: make .bdrv_close optional
  2018-08-14 12:43 [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Vladimir Sementsov-Ogievskiy
@ 2018-08-14 12:43 ` Vladimir Sementsov-Ogievskiy
  2018-08-14 12:43 ` [Qemu-devel] [PATCH 2/2] block: drop empty .bdrv_close handlers Vladimir Sementsov-Ogievskiy
  2018-08-14 13:17 ` [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-08-14 12:43 UTC (permalink / raw
  To: qemu-devel, qemu-block
  Cc: famz, jcody, pbonzini, pavel.dovgaluk, mreitz, kwolf, vsementsov,
	den

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block.c          | 4 +++-
 block/snapshot.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index 39f373e035..9694018a68 100644
--- a/block.c
+++ b/block.c
@@ -3349,7 +3349,9 @@ static void bdrv_close(BlockDriverState *bs)
     bdrv_drain(bs); /* in case flush left pending I/O */
 
     if (bs->drv) {
-        bs->drv->bdrv_close(bs);
+        if (bs->drv->bdrv_close) {
+            bs->drv->bdrv_close(bs);
+        }
         bs->drv = NULL;
     }
 
diff --git a/block/snapshot.c b/block/snapshot.c
index f9903bc94e..3218a542df 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -218,7 +218,9 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
         qobject_unref(file_options);
         qdict_put_str(options, "file", bdrv_get_node_name(file));
 
-        drv->bdrv_close(bs);
+        if (drv->bdrv_close) {
+            drv->bdrv_close(bs);
+        }
         bdrv_unref_child(bs, bs->file);
         bs->file = NULL;
 
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] block: drop empty .bdrv_close handlers
  2018-08-14 12:43 [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Vladimir Sementsov-Ogievskiy
  2018-08-14 12:43 ` [Qemu-devel] [PATCH 1/2] " Vladimir Sementsov-Ogievskiy
@ 2018-08-14 12:43 ` Vladimir Sementsov-Ogievskiy
  2018-08-14 13:17 ` [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2018-08-14 12:43 UTC (permalink / raw
  To: qemu-devel, qemu-block
  Cc: famz, jcody, pbonzini, pavel.dovgaluk, mreitz, kwolf, vsementsov,
	den

.bdrv_close handler is optional after previous commit, no needs to keep
empty functions more.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 block/blkreplay.c    | 5 -----
 block/commit.c       | 5 -----
 block/copy-on-read.c | 6 ------
 block/mirror.c       | 5 -----
 block/null.c         | 6 ------
 block/raw-format.c   | 5 -----
 6 files changed, 32 deletions(-)

diff --git a/block/blkreplay.c b/block/blkreplay.c
index 766150ade6..b5d9efdeca 100755
--- a/block/blkreplay.c
+++ b/block/blkreplay.c
@@ -43,10 +43,6 @@ fail:
     return ret;
 }
 
-static void blkreplay_close(BlockDriverState *bs)
-{
-}
-
 static int64_t blkreplay_getlength(BlockDriverState *bs)
 {
     return bdrv_getlength(bs->file->bs);
@@ -135,7 +131,6 @@ static BlockDriver bdrv_blkreplay = {
     .instance_size          = 0,
 
     .bdrv_open              = blkreplay_open,
-    .bdrv_close             = blkreplay_close,
     .bdrv_child_perm        = bdrv_filter_default_perms,
     .bdrv_getlength         = blkreplay_getlength,
 
diff --git a/block/commit.c b/block/commit.c
index e1814d9693..eb414579bd 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -239,10 +239,6 @@ static void bdrv_commit_top_refresh_filename(BlockDriverState *bs, QDict *opts)
             bs->backing->bs->filename);
 }
 
-static void bdrv_commit_top_close(BlockDriverState *bs)
-{
-}
-
 static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,
                                        const BdrvChildRole *role,
                                        BlockReopenQueue *reopen_queue,
@@ -260,7 +256,6 @@ static BlockDriver bdrv_commit_top = {
     .bdrv_co_preadv             = bdrv_commit_top_preadv,
     .bdrv_co_block_status       = bdrv_co_block_status_from_backing,
     .bdrv_refresh_filename      = bdrv_commit_top_refresh_filename,
-    .bdrv_close                 = bdrv_commit_top_close,
     .bdrv_child_perm            = bdrv_commit_top_child_perm,
 };
 
diff --git a/block/copy-on-read.c b/block/copy-on-read.c
index a19164f9eb..64dcc424b5 100644
--- a/block/copy-on-read.c
+++ b/block/copy-on-read.c
@@ -45,11 +45,6 @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags,
 }
 
 
-static void cor_close(BlockDriverState *bs)
-{
-}
-
-
 #define PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \
                           | BLK_PERM_WRITE \
                           | BLK_PERM_RESIZE)
@@ -143,7 +138,6 @@ BlockDriver bdrv_copy_on_read = {
     .format_name                        = "copy-on-read",
 
     .bdrv_open                          = cor_open,
-    .bdrv_close                         = cor_close,
     .bdrv_child_perm                    = cor_child_perm,
 
     .bdrv_getlength                     = cor_getlength,
diff --git a/block/mirror.c b/block/mirror.c
index d2806812c8..e949aa1fc5 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1424,10 +1424,6 @@ static void bdrv_mirror_top_refresh_filename(BlockDriverState *bs, QDict *opts)
             bs->backing->bs->filename);
 }
 
-static void bdrv_mirror_top_close(BlockDriverState *bs)
-{
-}
-
 static void bdrv_mirror_top_child_perm(BlockDriverState *bs, BdrvChild *c,
                                        const BdrvChildRole *role,
                                        BlockReopenQueue *reopen_queue,
@@ -1454,7 +1450,6 @@ static BlockDriver bdrv_mirror_top = {
     .bdrv_co_flush              = bdrv_mirror_top_flush,
     .bdrv_co_block_status       = bdrv_co_block_status_from_backing,
     .bdrv_refresh_filename      = bdrv_mirror_top_refresh_filename,
-    .bdrv_close                 = bdrv_mirror_top_close,
     .bdrv_child_perm            = bdrv_mirror_top_child_perm,
 };
 
diff --git a/block/null.c b/block/null.c
index 5d610fdfba..d442d3e901 100644
--- a/block/null.c
+++ b/block/null.c
@@ -97,10 +97,6 @@ static int null_file_open(BlockDriverState *bs, QDict *options, int flags,
     return ret;
 }
 
-static void null_close(BlockDriverState *bs)
-{
-}
-
 static int64_t null_getlength(BlockDriverState *bs)
 {
     BDRVNullState *s = bs->opaque;
@@ -263,7 +259,6 @@ static BlockDriver bdrv_null_co = {
 
     .bdrv_file_open         = null_file_open,
     .bdrv_parse_filename    = null_co_parse_filename,
-    .bdrv_close             = null_close,
     .bdrv_getlength         = null_getlength,
 
     .bdrv_co_preadv         = null_co_preadv,
@@ -283,7 +278,6 @@ static BlockDriver bdrv_null_aio = {
 
     .bdrv_file_open         = null_file_open,
     .bdrv_parse_filename    = null_aio_parse_filename,
-    .bdrv_close             = null_close,
     .bdrv_getlength         = null_getlength,
 
     .bdrv_aio_preadv        = null_aio_preadv,
diff --git a/block/raw-format.c b/block/raw-format.c
index 2fd69cdb08..6f6dc99b2c 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -459,10 +459,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
     return 0;
 }
 
-static void raw_close(BlockDriverState *bs)
-{
-}
-
 static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)
 {
     /* smallest possible positive score so that raw is used if and only if no
@@ -543,7 +539,6 @@ BlockDriver bdrv_raw = {
     .bdrv_reopen_commit   = &raw_reopen_commit,
     .bdrv_reopen_abort    = &raw_reopen_abort,
     .bdrv_open            = &raw_open,
-    .bdrv_close           = &raw_close,
     .bdrv_child_perm      = bdrv_filter_default_perms,
     .bdrv_co_create_opts  = &raw_co_create_opts,
     .bdrv_co_preadv       = &raw_co_preadv,
-- 
2.11.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional
  2018-08-14 12:43 [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Vladimir Sementsov-Ogievskiy
  2018-08-14 12:43 ` [Qemu-devel] [PATCH 1/2] " Vladimir Sementsov-Ogievskiy
  2018-08-14 12:43 ` [Qemu-devel] [PATCH 2/2] block: drop empty .bdrv_close handlers Vladimir Sementsov-Ogievskiy
@ 2018-08-14 13:17 ` Kevin Wolf
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2018-08-14 13:17 UTC (permalink / raw
  To: Vladimir Sementsov-Ogievskiy
  Cc: qemu-devel, qemu-block, famz, jcody, pbonzini, pavel.dovgaluk,
	mreitz, den

Am 14.08.2018 um 14:43 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Several block drivers have to define empty .bdrv_close handler. Let's
> instead make it optional.

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-14 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-14 12:43 [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Vladimir Sementsov-Ogievskiy
2018-08-14 12:43 ` [Qemu-devel] [PATCH 1/2] " Vladimir Sementsov-Ogievskiy
2018-08-14 12:43 ` [Qemu-devel] [PATCH 2/2] block: drop empty .bdrv_close handlers Vladimir Sementsov-Ogievskiy
2018-08-14 13:17 ` [Qemu-devel] [PATCH 0/2] block: make .bdrv_close optional Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.