qemu/include/block
Kevin Wolf 018e5987b5 blockjob: Adhere to rate limit even when reentered early
When jobs are sleeping, for example to enforce a given rate limit, they
can be reentered early, in particular in order to get paused, to update
the rate limit or to get cancelled.

Before this patch, they behave in this case as if they had fully
completed their rate limiting delay. This means that requests are sped
up beyond their limit, violating the constraints that the user gave us.

Change the block jobs to sleep in a loop until the necessary delay is
completed, while still allowing cancelling them immediately as well
pausing (handled by the pause point in job_sleep_ns()) and updating the
rate limit.

This change is also motivated by iotests cases being prone to fail
because drain operations pause and unpause them so often that block jobs
complete earlier than they are supposed to. In particular, the next
commit would fail iotests 030 without this change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230510203601.418015-8-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-05-19 19:12:12 +02:00
..
accounting.h block: add accounting for zone append operation 2023-05-15 08:18:10 -04:00
aio_task.h coroutine: Move coroutine_fn to qemu/osdep.h, trim includes 2023-01-19 10:18:28 +01:00
aio-wait.h aio-wait: avoid AioContext lock in aio_wait_bh_oneshot() 2023-05-10 14:15:13 +02:00
aio.h async: Add an optional reentrancy guard to the BH API 2023-04-28 11:31:07 +02:00
block_backup.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block_int-common.h block: Call .bdrv_co_create(_opts) unlocked 2023-05-19 19:12:12 +02:00
block_int-global-state.h block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
block_int-io.h block: Mark bdrv_co_refresh_total_sectors() and callers GRAPH_RDLOCK 2023-02-23 19:49:33 +01:00
block_int.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block-common.h file-posix: add tracking of the zone write pointers 2023-05-15 08:17:55 -04:00
block-copy.h block: Mark bdrv_co_block_status() and callers GRAPH_RDLOCK 2023-02-23 19:49:07 +01:00
block-global-state.h block: Call .bdrv_co_create(_opts) unlocked 2023-05-19 19:12:12 +02:00
block-hmp-cmds.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
block-io.h block: introduce zone append write for zoned devices 2023-05-15 08:18:10 -04:00
block.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
blockjob_int.h blockjob: Adhere to rate limit even when reentered early 2023-05-19 19:12:12 +02:00
blockjob.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
dirty-bitmap.h block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK 2023-02-23 19:49:32 +01:00
export.h block/export: Move blk to BlockExport 2020-10-02 15:46:40 +02:00
fuse.h fuse: Allow exporting BDSs via FUSE 2020-12-11 17:52:39 +01:00
graph-lock.h graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock 2023-05-10 14:16:53 +02:00
nbd.h block/nbd: Add missing <qemu/bswap.h> include 2023-02-01 16:52:32 +01:00
nvme.h hw/nvme: flexible data placement emulation 2023-03-06 15:28:02 +01:00
qapi.h block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK 2023-05-10 14:16:54 +02:00
qdict.h include: move qdict_{crumple,flatten} declarations 2022-04-21 17:03:51 +04:00
raw-aio.h block: introduce zone append write for zoned devices 2023-05-15 08:18:10 -04:00
replication.h replication: move include out of root directory 2021-05-26 14:49:46 +02:00
reqlist.h block/reqlist: add reqlist_wait_all() 2022-03-07 09:33:30 +01:00
snapshot.h include/block/snapshot: global state API + assertions 2022-03-04 18:18:25 +01:00
thread-pool.h thread-pool: avoid passing the pool parameter every time 2023-04-25 13:17:28 +02:00
throttle-groups.h include/block: Untangle inclusion loops 2023-01-20 07:24:28 +01:00
write-threshold.h block: Clean up includes 2023-02-08 07:28:05 +01:00