diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-02-03 16:21:48 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-02-23 19:49:14 +0100 |
commit | abaf8b750baef0337efb06c1d3465512b5d9b5dc (patch) | |
tree | bc0ba96a776aa07dcb7c1788de7d07009db3c215 /block/preallocate.c | |
parent | 9a5a1c621ed72161abcf461d46c7b7b7f97938bf (diff) |
block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_pwrite_zeroes() need to hold a reader lock for the graph.
For some places, we know that they will hold the lock, but we don't have
the GRAPH_RDLOCK annotations yet. In this case, add assume_graph_lock()
with a FIXME comment. These places will be removed once everything is
properly annotated.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230203152202.49054-10-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/preallocate.c')
-rw-r--r-- | block/preallocate.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/block/preallocate.c b/block/preallocate.c index c2c2dc8a8c..91d73c81c6 100644 --- a/block/preallocate.c +++ b/block/preallocate.c @@ -269,8 +269,9 @@ static bool has_prealloc_perms(BlockDriverState *bs) * want_merge_zero is used to merge write-zero request with preallocation in * one bdrv_co_pwrite_zeroes() call. */ -static bool coroutine_fn handle_write(BlockDriverState *bs, int64_t offset, - int64_t bytes, bool want_merge_zero) +static bool coroutine_fn GRAPH_RDLOCK +handle_write(BlockDriverState *bs, int64_t offset, int64_t bytes, + bool want_merge_zero) { BDRVPreallocateState *s = bs->opaque; int64_t end = offset + bytes; @@ -345,8 +346,9 @@ static bool coroutine_fn handle_write(BlockDriverState *bs, int64_t offset, return want_merge_zero; } -static int coroutine_fn preallocate_co_pwrite_zeroes(BlockDriverState *bs, - int64_t offset, int64_t bytes, BdrvRequestFlags flags) +static int coroutine_fn GRAPH_RDLOCK +preallocate_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, + int64_t bytes, BdrvRequestFlags flags) { bool want_merge_zero = !(flags & ~(BDRV_REQ_ZERO_WRITE | BDRV_REQ_NO_FALLBACK)); @@ -364,6 +366,7 @@ static coroutine_fn int preallocate_co_pwritev_part(BlockDriverState *bs, size_t qiov_offset, BdrvRequestFlags flags) { + assume_graph_lock(); /* FIXME */ handle_write(bs, offset, bytes, false); return bdrv_co_pwritev_part(bs->file, offset, bytes, qiov, qiov_offset, |