From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1Efx-0004YB-U2 for qemu-devel@nongnu.org; Mon, 31 Oct 2016 11:39:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1Efx-0004zn-2y for qemu-devel@nongnu.org; Mon, 31 Oct 2016 11:39:05 -0400 From: Fam Zheng Date: Mon, 31 Oct 2016 23:38:25 +0800 Message-Id: <1477928314-11184-6-git-send-email-famz@redhat.com> In-Reply-To: <1477928314-11184-1-git-send-email-famz@redhat.com> References: <1477928314-11184-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH 05/14] block: Set "share-rw" flag in drive-backup when sync=none List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Daniel P. Berrange" , Kevin Wolf , Max Reitz , qemu-block@nongnu.org, rjones@redhat.com In this case we may open the source's backing image chain multiple times. Setting share flag means the new open won't try to acquire or check any lock, once we implement image locking. Signed-off-by: Fam Zheng --- An alternative is reusing (and bdrv_ref) the existing source's backing bs instead of opening another one. If we decide that approach is better, it's better to do it in a separate series. --- blockdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/blockdev.c b/blockdev.c index d11a74f..9992c5d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3160,6 +3160,7 @@ static void do_drive_backup(DriveBackup *backup, BlockJobTxn *txn, Error **errp) } if (backup->sync == MIRROR_SYNC_MODE_NONE) { source = bs; + flags |= BDRV_O_SHARE_RW; } size = bdrv_getlength(bs); -- 2.7.4