[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/25] blkdebug: optionally tie errors to a specific
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 14/25] blkdebug: optionally tie errors to a specific sector |
Date: |
Mon, 9 Jul 2012 16:16:17 +0200 |
From: Paolo Bonzini <address@hidden>
This makes blkdebug scripts more powerful, and independent of the
exact sequence of operations performed by streaming.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/blkdebug.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index d12ebbf..59dcea0 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -59,6 +59,7 @@ typedef struct BlkdebugRule {
int error;
int immediately;
int once;
+ int64_t sector;
} inject;
struct {
int new_state;
@@ -85,6 +86,10 @@ static QemuOptsList inject_error_opts = {
.type = QEMU_OPT_NUMBER,
},
{
+ .name = "sector",
+ .type = QEMU_OPT_NUMBER,
+ },
+ {
.name = "once",
.type = QEMU_OPT_BOOL,
},
@@ -213,6 +218,7 @@ static int add_rule(QemuOpts *opts, void *opaque)
rule->options.inject.once = qemu_opt_get_bool(opts, "once", 0);
rule->options.inject.immediately =
qemu_opt_get_bool(opts, "immediately", 0);
+ rule->options.inject.sector = qemu_opt_get_number(opts, "sector", -1);
break;
case ACTION_SET_STATE:
@@ -343,7 +349,15 @@ static BlockDriverAIOCB
*blkdebug_aio_readv(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque)
{
BDRVBlkdebugState *s = bs->opaque;
- BlkdebugRule *rule = QSIMPLEQ_FIRST(&s->active_rules);
+ BlkdebugRule *rule = NULL;
+
+ QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
+ if (rule->options.inject.sector == -1 ||
+ (rule->options.inject.sector >= sector_num &&
+ rule->options.inject.sector < sector_num + nb_sectors)) {
+ break;
+ }
+ }
if (rule && rule->options.inject.error) {
return inject_error(bs, cb, opaque, rule);
@@ -357,7 +371,15 @@ static BlockDriverAIOCB
*blkdebug_aio_writev(BlockDriverState *bs,
BlockDriverCompletionFunc *cb, void *opaque)
{
BDRVBlkdebugState *s = bs->opaque;
- BlkdebugRule *rule = QSIMPLEQ_FIRST(&s->active_rules);
+ BlkdebugRule *rule = NULL;
+
+ QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
+ if (rule->options.inject.sector == -1 ||
+ (rule->options.inject.sector >= sector_num &&
+ rule->options.inject.sector < sector_num + nb_sectors)) {
+ break;
+ }
+ }
if (rule && rule->options.inject.error) {
return inject_error(bs, cb, opaque, rule);
--
1.7.6.5
- [Qemu-devel] [PATCH 04/25] sheepdog: fix dprintf format strings, (continued)
- [Qemu-devel] [PATCH 04/25] sheepdog: fix dprintf format strings, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 05/25] sheepdog: restart I/O when socket becomes ready in do_co_req(), Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 03/25] blockdev: warn when copy_on_read=on and readonly=on, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 01/25] qcow2: fix #ifdef'd qcow2_check_refcounts() callers, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 07/25] sheepdog: make sure we don't free aiocb before sending all requests, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 12/25] blkdebug: pass getlength to underlying file, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 02/25] qcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 06/25] sheepdog: use coroutine based socket functions in coroutine context, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 08/25] sheepdog: split outstanding list into inflight and pending, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 09/25] sheepdog: traverse pending_list from the first for each time, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 14/25] blkdebug: optionally tie errors to a specific sector,
Kevin Wolf <=
- [Qemu-devel] [PATCH 10/25] blkdebug: remove sync i/o events, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 16/25] block: copy over job and dirty bitmap fields in bdrv_append, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 11/25] blkdebug: tiny cleanup, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 17/25] block: introduce bdrv_swap, implement bdrv_append on top of it, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 18/25] fdc: rewrite seek and DSKCHG bit handling, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 20/25] fdc_test: update media_change test, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 13/25] blkdebug: store list of active rules, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 15/25] raw: hook into blkdebug, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 24/25] qtest: Tidy up temporary files properly, Kevin Wolf, 2012/07/09
- [Qemu-devel] [PATCH 21/25] fdc_test: introduce test_sense_interrupt, Kevin Wolf, 2012/07/09