diff mbox series

[v2,23/33] block: Drop child_backing

Message ID 20200204170848.614480-24-mreitz@redhat.com (mailing list archive)
State New, archived
Headers show
Series block: Introduce real BdrvChildRole | expand

Commit Message

Max Reitz Feb. 4, 2020, 5:08 p.m. UTC
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block.c                   | 62 +++------------------------------------
 include/block/block_int.h |  1 -
 2 files changed, 4 insertions(+), 59 deletions(-)

Comments

Eric Blake Feb. 5, 2020, 10:48 p.m. UTC | #1
On 2/4/20 11:08 AM, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   block.c                   | 62 +++------------------------------------
>   include/block/block_int.h |  1 -
>   2 files changed, 4 insertions(+), 59 deletions(-)

More code deletion.

> 
> diff --git a/block.c b/block.c
> index 6b705ee23a..e245b5d8d9 100644
> --- a/block.c
> +++ b/block.c
> @@ -1169,15 +1169,6 @@ static void bdrv_backing_attach(BdrvChild *c)
>                       parent->backing_blocker);
>   }
>   
> -/* XXX: Will be removed along with child_backing */
> -static void bdrv_child_cb_attach_backing(BdrvChild *c)

In fact, more promised code deletion :)

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

Patch

diff --git a/block.c b/block.c
index 6b705ee23a..e245b5d8d9 100644
--- a/block.c
+++ b/block.c
@@ -1169,15 +1169,6 @@  static void bdrv_backing_attach(BdrvChild *c)
                     parent->backing_blocker);
 }
 
-/* XXX: Will be removed along with child_backing */
-static void bdrv_child_cb_attach_backing(BdrvChild *c)
-{
-    if (!(c->role & BDRV_CHILD_COW)) {
-        bdrv_backing_attach(c);
-    }
-    bdrv_child_cb_attach(c);
-}
-
 static void bdrv_backing_detach(BdrvChild *c)
 {
     BlockDriverState *parent = c->opaque;
@@ -1188,28 +1179,6 @@  static void bdrv_backing_detach(BdrvChild *c)
     parent->backing_blocker = NULL;
 }
 
-/* XXX: Will be removed along with child_backing */
-static void bdrv_child_cb_detach_backing(BdrvChild *c)
-{
-    if (!(c->role & BDRV_CHILD_COW)) {
-        bdrv_backing_detach(c);
-    }
-    bdrv_child_cb_detach(c);
-}
-
-/*
- * Returns the options and flags that bs->backing should get, based on the
- * given options and flags for the parent BDS
- */
-static void bdrv_backing_options(BdrvChildRole role, bool parent_is_format,
-                                 int *child_flags, QDict *child_options,
-                                 int parent_flags, QDict *parent_options)
-{
-    bdrv_inherited_options(BDRV_CHILD_COW, true,
-                           child_flags, child_options,
-                           parent_flags, parent_options);
-}
-
 static int bdrv_backing_update_filename(BdrvChild *c, BlockDriverState *base,
                                         const char *filename, Error **errp)
 {
@@ -1237,21 +1206,6 @@  static int bdrv_backing_update_filename(BdrvChild *c, BlockDriverState *base,
     return ret;
 }
 
-const BdrvChildClass child_backing = {
-    .parent_is_bds   = true,
-    .get_parent_desc = bdrv_child_get_parent_desc,
-    .attach          = bdrv_child_cb_attach_backing,
-    .detach          = bdrv_child_cb_detach_backing,
-    .inherit_options = bdrv_backing_options,
-    .drained_begin   = bdrv_child_cb_drained_begin,
-    .drained_poll    = bdrv_child_cb_drained_poll,
-    .drained_end     = bdrv_child_cb_drained_end,
-    .inactivate      = bdrv_child_cb_inactivate,
-    .update_filename = bdrv_backing_update_filename,
-    .can_set_aio_ctx = bdrv_child_cb_can_set_aio_ctx,
-    .set_aio_ctx     = bdrv_child_cb_set_aio_ctx,
-};
-
 static int bdrv_open_flags(BlockDriverState *bs, int flags)
 {
     int open_flags = flags;
@@ -2258,8 +2212,7 @@  static void bdrv_default_perms_for_backing(BlockDriverState *bs, BdrvChild *c,
                                            uint64_t perm, uint64_t shared,
                                            uint64_t *nperm, uint64_t *nshared)
 {
-    assert(child_class == &child_backing ||
-           (child_class == &child_of_bds && (role & BDRV_CHILD_COW)));
+    assert(child_class == &child_of_bds && (role & BDRV_CHILD_COW));
 
     /*
      * We want consistent read from backing files if the parent needs it.
@@ -2371,23 +2324,16 @@  void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,
                                uint64_t perm, uint64_t shared,
                                uint64_t *nperm, uint64_t *nshared)
 {
-    bool backing = (child_class == &child_backing);
-
     if (child_class == &child_of_bds) {
         bdrv_default_perms(bs, c, child_class, role, reopen_queue,
                            perm, shared, nperm, nshared);
         return;
     }
 
-    assert(child_class == &child_backing || child_class == &child_file);
+    assert(child_class == &child_file);
 
-    if (!backing) {
-        bdrv_default_perms_for_metadata(bs, c, child_class, role, reopen_queue,
-                                        perm, shared, nperm, nshared);
-    } else {
-        bdrv_default_perms_for_backing(bs, c, child_class, role, reopen_queue,
-                                       perm, shared, nperm, nshared);
-    }
+    bdrv_default_perms_for_metadata(bs, c, child_class, role, reopen_queue,
+                                    perm, shared, nperm, nshared);
 }
 
 void bdrv_default_perms(BlockDriverState *bs, BdrvChild *c,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 21ece88d41..7b51866678 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -742,7 +742,6 @@  struct BdrvChildClass {
 
 extern const BdrvChildClass child_of_bds;
 extern const BdrvChildClass child_file;
-extern const BdrvChildClass child_backing;
 
 struct BdrvChild {
     BlockDriverState *bs;