cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 524a3586abb4a10aa87f1b36518f6645caf586c8 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Tue, 4 Feb 2014 11:54:13 +0100
0a122b
Subject: [PATCH 03/37] raw: Fix BlockLimits passthrough
0a122b
0a122b
Message-id: <1392117622-28812-4-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 57168
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 03/37] raw: Fix BlockLimits passthrough
0a122b
Bugzilla: 748906
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
0a122b
raw copies over the BlockLimits of bs->file during bdrv_open().
0a122b
However, since commit d34682cd it is immediately overwritten during
0a122b
bdrv_refresh_limits(). This caused all fields except for
0a122b
opt_transfer_length and opt_mem_alignment (which happen to be correctly
0a122b
inherited in generic code) to be zeroed.
0a122b
0a122b
Move the BlockLimit assignment to a .bdrv_refresh_limits() callback to
0a122b
make it work again for all fields.
0a122b
0a122b
Reported-by: Laszlo Ersek <lersek@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Conflicts:
0a122b
	block/raw_bsd.c
0a122b
0a122b
Conflicts because RHEL 7 still has the old raw driver.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block/raw.c | 8 +++++++-
0a122b
 1 file changed, 7 insertions(+), 1 deletion(-)
0a122b
---
0a122b
 block/raw.c |    8 +++++++-
0a122b
 1 files changed, 7 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/block/raw.c b/block/raw.c
0a122b
index c853258..eeadba5 100644
0a122b
--- a/block/raw.c
0a122b
+++ b/block/raw.c
0a122b
@@ -7,7 +7,6 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
0a122b
                     Error **errp)
0a122b
 {
0a122b
     bs->sg = bs->file->sg;
0a122b
-    bs->bl = bs->file->bl;
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
@@ -59,6 +58,12 @@ static int64_t raw_getlength(BlockDriverState *bs)
0a122b
     return bdrv_getlength(bs->file);
0a122b
 }
0a122b
 
0a122b
+static int raw_refresh_limits(BlockDriverState *bs)
0a122b
+{
0a122b
+    bs->bl = bs->file->bl;
0a122b
+    return 0;
0a122b
+}
0a122b
+
0a122b
 static int raw_truncate(BlockDriverState *bs, int64_t offset)
0a122b
 {
0a122b
     return bdrv_truncate(bs->file, offset);
0a122b
@@ -154,6 +159,7 @@ static BlockDriver bdrv_raw = {
0a122b
     .bdrv_probe         = raw_probe,
0a122b
     .bdrv_getlength     = raw_getlength,
0a122b
     .has_variable_length = true,
0a122b
+    .bdrv_refresh_limits = raw_refresh_limits,
0a122b
     .bdrv_truncate      = raw_truncate,
0a122b
 
0a122b
     .bdrv_is_inserted   = raw_is_inserted,
0a122b
-- 
0a122b
1.7.1
0a122b