mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
block: Mark public read/write functions GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_pread*/pwrite*() 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-12-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
7b1fb72e2c
commit
b9b10c35e5
31 changed files with 233 additions and 238 deletions
|
@ -270,7 +270,11 @@ static void quorum_report_bad_versions(BDRVQuorumState *s,
|
|||
}
|
||||
}
|
||||
|
||||
static void coroutine_fn quorum_rewrite_entry(void *opaque)
|
||||
/*
|
||||
* This function can count as GRAPH_RDLOCK because read_quorum_children() holds
|
||||
* the graph lock and keeps it until this coroutine has terminated.
|
||||
*/
|
||||
static void coroutine_fn GRAPH_RDLOCK quorum_rewrite_entry(void *opaque)
|
||||
{
|
||||
QuorumCo *co = opaque;
|
||||
QuorumAIOCB *acb = co->acb;
|
||||
|
@ -290,8 +294,8 @@ static void coroutine_fn quorum_rewrite_entry(void *opaque)
|
|||
}
|
||||
}
|
||||
|
||||
static bool quorum_rewrite_bad_versions(QuorumAIOCB *acb,
|
||||
QuorumVoteValue *value)
|
||||
static bool coroutine_fn GRAPH_RDLOCK
|
||||
quorum_rewrite_bad_versions(QuorumAIOCB *acb, QuorumVoteValue *value)
|
||||
{
|
||||
QuorumVoteVersion *version;
|
||||
QuorumVoteItem *item;
|
||||
|
@ -491,7 +495,7 @@ static int quorum_vote_error(QuorumAIOCB *acb)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void quorum_vote(QuorumAIOCB *acb)
|
||||
static void coroutine_fn GRAPH_RDLOCK quorum_vote(QuorumAIOCB *acb)
|
||||
{
|
||||
bool quorum = true;
|
||||
int i, j, ret;
|
||||
|
@ -571,7 +575,11 @@ free_exit:
|
|||
quorum_free_vote_list(&acb->votes);
|
||||
}
|
||||
|
||||
static void coroutine_fn read_quorum_children_entry(void *opaque)
|
||||
/*
|
||||
* This function can count as GRAPH_RDLOCK because read_quorum_children() holds
|
||||
* the graph lock and keeps it until this coroutine has terminated.
|
||||
*/
|
||||
static void coroutine_fn GRAPH_RDLOCK read_quorum_children_entry(void *opaque)
|
||||
{
|
||||
QuorumCo *co = opaque;
|
||||
QuorumAIOCB *acb = co->acb;
|
||||
|
@ -599,7 +607,7 @@ static void coroutine_fn read_quorum_children_entry(void *opaque)
|
|||
}
|
||||
}
|
||||
|
||||
static int coroutine_fn read_quorum_children(QuorumAIOCB *acb)
|
||||
static int coroutine_fn GRAPH_RDLOCK read_quorum_children(QuorumAIOCB *acb)
|
||||
{
|
||||
BDRVQuorumState *s = acb->bs->opaque;
|
||||
int i;
|
||||
|
@ -640,7 +648,7 @@ static int coroutine_fn read_quorum_children(QuorumAIOCB *acb)
|
|||
return acb->vote_ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn read_fifo_child(QuorumAIOCB *acb)
|
||||
static int coroutine_fn GRAPH_RDLOCK read_fifo_child(QuorumAIOCB *acb)
|
||||
{
|
||||
BDRVQuorumState *s = acb->bs->opaque;
|
||||
int n, ret;
|
||||
|
@ -661,10 +669,9 @@ static int coroutine_fn read_fifo_child(QuorumAIOCB *acb)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int coroutine_fn quorum_co_preadv(BlockDriverState *bs,
|
||||
int64_t offset, int64_t bytes,
|
||||
QEMUIOVector *qiov,
|
||||
BdrvRequestFlags flags)
|
||||
static int coroutine_fn GRAPH_RDLOCK
|
||||
quorum_co_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||
QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||
{
|
||||
BDRVQuorumState *s = bs->opaque;
|
||||
QuorumAIOCB *acb = quorum_aio_get(bs, qiov, offset, bytes, flags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue