All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, jcody@redhat.com,
	famz@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/6] block: Remove check_new_perm from bdrv_replace_child()
Date: Thu,  9 Mar 2017 12:38:57 +0100	[thread overview]
Message-ID: <1489059542-14232-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1489059542-14232-1-git-send-email-kwolf@redhat.com>

All callers pass false now, so the parameter can go away again.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/block.c b/block.c
index dd9ded8..756d607 100644
--- a/block.c
+++ b/block.c
@@ -1751,8 +1751,18 @@ static void bdrv_replace_child_noperm(BdrvChild *child,
     }
 }
 
-static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
-                               bool check_new_perm)
+/*
+ * Updates @child to change its reference to point to @new_bs, including
+ * checking and applying the necessary permisson updates both to the old node
+ * and to @new_bs.
+ *
+ * NULL is passed as @new_bs for removing the reference before freeing @child.
+ *
+ * If @new_bs is not NULL, bdrv_check_perm() must be called beforehand, as this
+ * function uses bdrv_set_perm() to update the permissions according to the new
+ * reference that @new_bs gets.
+ */
+static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
 {
     BlockDriverState *old_bs = child->bs;
     uint64_t perm, shared_perm;
@@ -1770,9 +1780,6 @@ static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
 
     if (new_bs) {
         bdrv_get_cumulative_perm(new_bs, &perm, &shared_perm);
-        if (check_new_perm) {
-            bdrv_check_perm(new_bs, perm, shared_perm, NULL, &error_abort);
-        }
         bdrv_set_perm(new_bs, perm, shared_perm);
     }
 }
@@ -1803,7 +1810,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
     };
 
     /* This performs the matching bdrv_set_perm() for the above check. */
-    bdrv_replace_child(child, child_bs, false);
+    bdrv_replace_child(child, child_bs);
 
     return child;
 }
@@ -1840,7 +1847,7 @@ static void bdrv_detach_child(BdrvChild *child)
         child->next.le_prev = NULL;
     }
 
-    bdrv_replace_child(child, NULL, false);
+    bdrv_replace_child(child, NULL);
 
     g_free(child->name);
     g_free(child);
-- 
1.8.3.1

  reply	other threads:[~2017-03-09 11:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 11:38 [Qemu-devel] [PATCH 0/6] block: More op blocker fixes Kevin Wolf
2017-03-09 11:38 ` Kevin Wolf [this message]
2017-03-09 11:38 ` [Qemu-devel] [PATCH 2/6] block: Request block status from *file for BDRV_BLOCK_RAW Kevin Wolf
2017-03-09 11:38 ` [Qemu-devel] [PATCH 3/6] commit: Implement bdrv_commit_top.bdrv_co_get_block_status Kevin Wolf
2017-03-09 11:39 ` [Qemu-devel] [PATCH 4/6] block: Refresh filename after changing backing file Kevin Wolf
2017-03-09 11:39 ` [Qemu-devel] [PATCH 5/6] mirror: Implement .bdrv_refresh_filename Kevin Wolf
2017-03-09 11:39 ` [Qemu-devel] [PATCH 6/6] commit: " Kevin Wolf
2017-03-09 14:23 ` [Qemu-devel] [PATCH 0/6] block: More op blocker fixes Eric Blake
2017-03-09 17:41   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489059542-14232-2-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.