From patchwork Tue Jan 21 16:14:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 312995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 064652C0236 for ; Wed, 22 Jan 2014 03:15:14 +1100 (EST) Received: from localhost ([::1]:59250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5dyp-0003LE-Q4 for incoming@patchwork.ozlabs.org; Tue, 21 Jan 2014 11:15:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5dyO-0002d0-St for qemu-devel@nongnu.org; Tue, 21 Jan 2014 11:14:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5dyI-0003wq-Tg for qemu-devel@nongnu.org; Tue, 21 Jan 2014 11:14:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5dyI-0003wc-Ld for qemu-devel@nongnu.org; Tue, 21 Jan 2014 11:14:38 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0LGEZK2000924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Jan 2014 11:14:36 -0500 Received: from localhost (ovpn-112-40.phx2.redhat.com [10.3.112.40]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0LGEXlm008186 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 21 Jan 2014 11:14:34 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 21 Jan 2014 11:14:32 -0500 Message-Id: <0715fccd414384a7c177ff93e976a40b2e938650.1390320839.git.jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH] block: remove unnecessary code; image always r/w if snapshot=on X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Important note: this patch should only be applied after patch "block: do not allow read-only=on and snapshot=on to be used together" Now that 'read-only=on' and 'snapshot=on' are not allowed together, forcing open_flags to have BDRV_O_RDWR set is redundant code, and can be removed. This is because unless read-only=on is specified, the image will always be opened with BDRV_O_RDWR set. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- block.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/block.c b/block.c index dea7591..1a16450 100644 --- a/block.c +++ b/block.c @@ -722,13 +722,6 @@ static int bdrv_open_flags(BlockDriverState *bs, int flags) */ open_flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); - /* - * Snapshots should be writable. - */ - if (bs->is_temporary) { - open_flags |= BDRV_O_RDWR; - } - return open_flags; }