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