|
|
0a122b |
From 9f8b66d561d7b77338f79f2adf7a7d1102ad9d24 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
Date: Tue, 14 Jan 2014 13:44:35 +0100
|
|
|
0a122b |
Subject: [PATCH 31/37] blkdebug: Make required alignment configurable
|
|
|
0a122b |
|
|
|
0a122b |
Message-id: <1392117622-28812-32-git-send-email-kwolf@redhat.com>
|
|
|
0a122b |
Patchwork-id: 57196
|
|
|
0a122b |
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 31/37] blkdebug: Make required alignment configurable
|
|
|
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 |
The new 'align' option of blkdebug can be used in order to emulate
|
|
|
0a122b |
backends with a required 4k alignment on hosts which only really require
|
|
|
0a122b |
512 byte alignment.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
(cherry picked from commit b35ee7fb2308e09092488029b5a9e456ce61bbe6)
|
|
|
0a122b |
|
|
|
0a122b |
Conflicts:
|
|
|
0a122b |
block/blkdebug.c
|
|
|
0a122b |
qapi-schema.json
|
|
|
0a122b |
|
|
|
0a122b |
Conflicts because RHEL 7 doesn't have the blockdev-add support series
|
|
|
0a122b |
for blkdebug.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
block/blkdebug.c | 16 ++++++++++++++++
|
|
|
0a122b |
1 file changed, 16 insertions(+)
|
|
|
0a122b |
---
|
|
|
0a122b |
block/blkdebug.c | 16 ++++++++++++++++
|
|
|
0a122b |
1 files changed, 16 insertions(+), 0 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/block/blkdebug.c b/block/blkdebug.c
|
|
|
0a122b |
index 9ee4fbb..ccb562b 100644
|
|
|
0a122b |
--- a/block/blkdebug.c
|
|
|
0a122b |
+++ b/block/blkdebug.c
|
|
|
0a122b |
@@ -343,6 +343,11 @@ static QemuOptsList runtime_opts = {
|
|
|
0a122b |
.type = QEMU_OPT_STRING,
|
|
|
0a122b |
.help = "[internal use only, will be removed]",
|
|
|
0a122b |
},
|
|
|
0a122b |
+ {
|
|
|
0a122b |
+ .name = "align",
|
|
|
0a122b |
+ .type = QEMU_OPT_SIZE,
|
|
|
0a122b |
+ .help = "Required alignment in bytes",
|
|
|
0a122b |
+ },
|
|
|
0a122b |
{ /* end of list */ }
|
|
|
0a122b |
},
|
|
|
0a122b |
};
|
|
|
0a122b |
@@ -354,6 +359,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
0a122b |
QemuOpts *opts;
|
|
|
0a122b |
Error *local_err = NULL;
|
|
|
0a122b |
const char *filename, *config;
|
|
|
0a122b |
+ uint64_t align;
|
|
|
0a122b |
int ret;
|
|
|
0a122b |
|
|
|
0a122b |
opts = qemu_opts_create_nofail(&runtime_opts);
|
|
|
0a122b |
@@ -391,6 +397,16 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
0a122b |
goto fail;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
+ /* Set request alignment */
|
|
|
0a122b |
+ align = qemu_opt_get_size(opts, "align", bs->request_alignment);
|
|
|
0a122b |
+ if (align > 0 && align < INT_MAX && !(align & (align - 1))) {
|
|
|
0a122b |
+ bs->request_alignment = align;
|
|
|
0a122b |
+ } else {
|
|
|
0a122b |
+ error_setg(errp, "Invalid alignment");
|
|
|
0a122b |
+ ret = -EINVAL;
|
|
|
0a122b |
+ goto fail;
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+
|
|
|
0a122b |
ret = 0;
|
|
|
0a122b |
fail:
|
|
|
0a122b |
qemu_opts_del(opts);
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|