[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/12] block: Convert throttle_group_get_name() to B
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 05/12] block: Convert throttle_group_get_name() to BlockBackend |
Date: |
Tue, 22 Mar 2016 16:33:05 +0100 |
Signed-off-by: Kevin Wolf <address@hidden>
---
block/block-backend.c | 2 +-
block/io.c | 2 +-
block/qapi.c | 2 +-
block/throttle-groups.c | 12 ++++++------
include/block/throttle-groups.h | 2 +-
tests/test-throttle.c | 4 ++--
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 4394950..ed8550f 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1563,7 +1563,7 @@ void blk_update_root_state(BlockBackend *blk)
throttle_group_unref(blk->root_state.throttle_state);
}
if (blk->root->bs->throttle_state) {
- const char *name = throttle_group_get_name(blk->root->bs);
+ const char *name = throttle_group_get_name(blk);
blk->root_state.throttle_group = g_strdup(name);
blk->root_state.throttle_state = throttle_group_incref(name);
} else {
diff --git a/block/io.c b/block/io.c
index fbfbbb2..b589857 100644
--- a/block/io.c
+++ b/block/io.c
@@ -112,7 +112,7 @@ void bdrv_io_limits_update_group(BlockDriverState *bs,
const char *group)
}
/* this bs is a part of the same group than the one we want */
- if (!g_strcmp0(throttle_group_get_name(bs), group)) {
+ if (!g_strcmp0(throttle_group_get_name(bs->blk), group)) {
return;
}
diff --git a/block/qapi.c b/block/qapi.c
index f01894a..e908757 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -117,7 +117,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
info->iops_size = cfg.op_size;
info->has_group = true;
- info->group = g_strdup(throttle_group_get_name(bs));
+ info->group = g_strdup(throttle_group_get_name(bs->blk));
}
info->write_threshold = bdrv_write_threshold_get(bs);
diff --git a/block/throttle-groups.c b/block/throttle-groups.c
index 4ba0fa3..295bed0 100644
--- a/block/throttle-groups.c
+++ b/block/throttle-groups.c
@@ -133,16 +133,16 @@ void throttle_group_unref(ThrottleState *ts)
qemu_mutex_unlock(&throttle_groups_lock);
}
-/* Get the name from a BlockDriverState's ThrottleGroup. The name (and
- * the pointer) is guaranteed to remain constant during the lifetime
- * of the group.
+/* Get the name from a BlockBackend's ThrottleGroup. The name (and the pointer)
+ * is guaranteed to remain constant during the lifetime of the group.
*
- * @bs: a BlockDriverState that is member of a throttling group
+ * @blk: a BlockBackend that is member of a throttling group
* @ret: the name of the group.
*/
-const char *throttle_group_get_name(BlockDriverState *bs)
+const char *throttle_group_get_name(BlockBackend *blk)
{
- ThrottleGroup *tg = container_of(bs->throttle_state, ThrottleGroup, ts);
+ ThrottleGroup *tg = container_of(blk_bs(blk)->throttle_state,
+ ThrottleGroup, ts);
return tg->name;
}
diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h
index 46b843e..61e84f3 100644
--- a/include/block/throttle-groups.h
+++ b/include/block/throttle-groups.h
@@ -28,7 +28,7 @@
#include "qemu/throttle.h"
#include "block/block_int.h"
-const char *throttle_group_get_name(BlockDriverState *bs);
+const char *throttle_group_get_name(BlockBackend *blk);
ThrottleState *throttle_group_incref(const char *name);
void throttle_group_unref(ThrottleState *ts);
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index f03f71a..85d3de2 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -597,8 +597,8 @@ static void test_groups(void)
g_assert(bdrv2->throttle_state != NULL);
g_assert(bdrv3->throttle_state != NULL);
- g_assert(!strcmp(throttle_group_get_name(bdrv1), "bar"));
- g_assert(!strcmp(throttle_group_get_name(bdrv2), "foo"));
+ g_assert(!strcmp(throttle_group_get_name(blk1), "bar"));
+ g_assert(!strcmp(throttle_group_get_name(blk2), "foo"));
g_assert(bdrv1->throttle_state == bdrv3->throttle_state);
/* Setting the config of a group member affects the whole group */
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 01/12] block: Don't disable I/O throttling on sync requests, (continued)
[Qemu-devel] [PATCH 04/12] block: throttle-groups: Use BlockBackend pointers internally, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 08/12] block: Move I/O throttling configuration functions to BlockBackend, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 11/12] block: Decouple throttling from BlockDriverState, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 05/12] block: Convert throttle_group_get_name() to BlockBackend,
Kevin Wolf <=
[Qemu-devel] [PATCH 07/12] block: Move actual I/O throttling to BlockBackend, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 10/12] block: Drain throttling queue with BdrvChild callback, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 06/12] block: Move throttling fields from BDS to BB, Kevin Wolf, 2016/03/22
[Qemu-devel] [PATCH 12/12] block: Don't check throttled reqs in bdrv_requests_pending(), Kevin Wolf, 2016/03/22
Re: [Qemu-devel] [PATCH 00/12] block: Move I/O throttling to BlockBackend, Paolo Bonzini, 2016/03/22