[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/11] block: make write-threshold thread-safe
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 02/11] block: make write-threshold thread-safe |
Date: |
Thu, 6 Jul 2017 18:38:19 +0200 |
For simplicity, use bdrv_drained_begin/end to avoid concurrent
writes to the write threshold, or reading it while it is being set.
qmp_block_set_write_threshold is protected by the BQL.
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/write-threshold.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/block/write-threshold.c b/block/write-threshold.c
index c8ebc32b4d..64ddd3d653 100644
--- a/block/write-threshold.c
+++ b/block/write-threshold.c
@@ -112,7 +112,6 @@ void qmp_block_set_write_threshold(const char *node_name,
Error **errp)
{
BlockDriverState *bs;
- AioContext *aio_context;
bs = bdrv_find_node(node_name);
if (!bs) {
@@ -120,10 +119,8 @@ void qmp_block_set_write_threshold(const char *node_name,
return;
}
- aio_context = bdrv_get_aio_context(bs);
- aio_context_acquire(aio_context);
-
+ /* Avoid a concurrent write_threshold_disable. */
+ bdrv_drained_begin(bs);
bdrv_write_threshold_set(bs, threshold_bytes);
-
- aio_context_release(aio_context);
+ bdrv_drained_end(bs);
}
--
2.13.0
- [Qemu-devel] [RFC PATCH 00/11] Block layer thread-safety, next part, Paolo Bonzini, 2017/07/06
- [Qemu-devel] [PATCH 01/11] block: prepare write threshold code for thread safety, Paolo Bonzini, 2017/07/06
- [Qemu-devel] [PATCH 04/11] block: make before-write notifiers thread-safe, Paolo Bonzini, 2017/07/06
- [Qemu-devel] [PATCH 02/11] block: make write-threshold thread-safe,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 03/11] util: use RCU accessors for notifiers, Paolo Bonzini, 2017/07/06
- [Qemu-devel] [PATCH 05/11] block-backup: add reqs_lock, Paolo Bonzini, 2017/07/06
- [Qemu-devel] [PATCH 08/11] block: drain I/O around key management, Paolo Bonzini, 2017/07/06