[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 13/24] block: Add blk_set_allow_aio_context_change()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 13/24] block: Add blk_set_allow_aio_context_change() |
Date: |
Mon, 20 May 2019 18:14:42 +0200 |
Some users (like block jobs) can tolerate an AioContext change for their
BlockBackend. Add a function that tells the BlockBackend that it can
allow changes.
Signed-off-by: Kevin Wolf <address@hidden>
---
include/sysemu/block-backend.h | 1 +
block/block-backend.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 5be6224226..938de34fe9 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -103,6 +103,7 @@ int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t
shared_perm,
void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm);
void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow);
+void blk_set_allow_aio_context_change(BlockBackend *blk, bool allow);
void blk_iostatus_enable(BlockBackend *blk);
bool blk_iostatus_is_enabled(const BlockBackend *blk);
BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk);
diff --git a/block/block-backend.c b/block/block-backend.c
index 0e75fc8849..4c0a8ef88d 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -71,6 +71,7 @@ struct BlockBackend {
uint64_t shared_perm;
bool disable_perm;
+ bool allow_aio_context_change;
bool allow_write_beyond_eof;
NotifierList remove_bs_notifiers, insert_bs_notifiers;
@@ -1092,6 +1093,11 @@ void blk_set_allow_write_beyond_eof(BlockBackend *blk,
bool allow)
blk->allow_write_beyond_eof = allow;
}
+void blk_set_allow_aio_context_change(BlockBackend *blk, bool allow)
+{
+ blk->allow_aio_context_change = allow;
+}
+
static int blk_check_byte_request(BlockBackend *blk, int64_t offset,
size_t size)
{
@@ -1891,6 +1897,10 @@ static bool blk_root_can_set_aio_ctx(BdrvChild *child,
AioContext *ctx,
{
BlockBackend *blk = child->opaque;
+ if (blk->allow_aio_context_change) {
+ return true;
+ }
+
/* Only manually created BlockBackends that are not attached to anything
* can change their AioContext without updating their user. */
if (!blk->name || blk->dev) {
--
2.20.1
- [Qemu-block] [PULL 03/24] block: Use BDRV_REQUEST_MAX_BYTES instead of BDRV_REQUEST_MAX_SECTORS, (continued)
- [Qemu-block] [PULL 03/24] block: Use BDRV_REQUEST_MAX_BYTES instead of BDRV_REQUEST_MAX_SECTORS, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 01/24] block/file-posix: Truncate in xfs_write_zeroes(), Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 02/24] qcow2: Define and use QCOW2_COMPRESSED_SECTOR_SIZE, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 09/24] block: Move recursion to bdrv_set_aio_context(), Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 12/24] block: Implement .(can_)set_aio_ctx for BlockBackend, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 07/24] block: Add bdrv_try_set_aio_context(), Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 05/24] iotest: fix 169: do not run qmp_cont in RUN_STATE_FINISH_MIGRATE, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 10/24] block: Propagate AioContext change to parents, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 11/24] test-block-iothread: Test AioContext propagation through the tree, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 16/24] test-block-iothread: Test AioContext propagation for block jobs, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 13/24] block: Add blk_set_allow_aio_context_change(),
Kevin Wolf <=
- [Qemu-block] [PULL 08/24] block: Make bdrv_attach/detach_aio_context() static, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 15/24] blockjob: Remove AioContext notifiers, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 14/24] blockjob: Propagate AioContext change to all job nodes, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 17/24] block/file-posix: Unaligned O_DIRECT block-status, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 22/24] iotests.py: Let assert_qmp() accept an array, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 18/24] iotests: Test unaligned raw images with O_DIRECT, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 24/24] iotests: Make 245 faster and more reliable, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 21/24] block: Improve "Block node is read-only" message, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 19/24] qemu-img.texi: Be specific about JSON object types, Kevin Wolf, 2019/05/20
- [Qemu-block] [PULL 20/24] qemu-img.texi: Describe human-readable info output, Kevin Wolf, 2019/05/20