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