diff mbox

block: remove unnecessary code; image always r/w if snapshot=on

Message ID 0715fccd414384a7c177ff93e976a40b2e938650.1390320839.git.jcody@redhat.com
State New
Headers show

Commit Message

Jeff Cody Jan. 21, 2014, 4:14 p.m. UTC
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 <jcody@redhat.com>
---
 block.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Eric Blake Jan. 21, 2014, 4:17 p.m. UTC | #1
On 01/21/2014 09:14 AM, Jeff Cody wrote:
> 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 <jcody@redhat.com>
> ---
>  block.c | 7 -------
>  1 file changed, 7 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Kevin Wolf Jan. 21, 2014, 4:30 p.m. UTC | #2
Am 21.01.2014 um 17:17 hat Eric Blake geschrieben:
> On 01/21/2014 09:14 AM, Jeff Cody wrote:
> > 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 <jcody@redhat.com>
> > ---
> >  block.c | 7 -------
> >  1 file changed, 7 deletions(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

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;
 }