Skip to content

Commit

Permalink
block: remove bdrv_co_lock()
Browse files Browse the repository at this point in the history
The bdrv_co_lock() and bdrv_co_unlock() functions are already no-ops.
Remove them.

Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-ID: <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
stefanhaRH authored and kevmw committed Dec 21, 2023
1 parent b49f475 commit c43d5bc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
10 changes: 0 additions & 10 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -7431,16 +7431,6 @@ void coroutine_fn bdrv_co_leave(BlockDriverState *bs, AioContext *old_ctx)
bdrv_dec_in_flight(bs);
}

void coroutine_fn bdrv_co_lock(BlockDriverState *bs)
{
/* TODO removed in next patch */
}

void coroutine_fn bdrv_co_unlock(BlockDriverState *bs)
{
/* TODO removed in next patch */
}

static void bdrv_do_remove_aio_context_notifier(BdrvAioNotifier *ban)
{
GLOBAL_STATE_CODE();
Expand Down
5 changes: 0 additions & 5 deletions blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2264,18 +2264,13 @@ void coroutine_fn qmp_block_resize(const char *device, const char *node_name,
return;
}

bdrv_co_lock(bs);
bdrv_drained_begin(bs);
bdrv_co_unlock(bs);

old_ctx = bdrv_co_enter(bs);
blk_co_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
bdrv_co_leave(bs, old_ctx);

bdrv_co_lock(bs);
bdrv_drained_end(bs);
bdrv_co_unlock(bs);

blk_co_unref(blk);
}

Expand Down
14 changes: 0 additions & 14 deletions include/block/block-global-state.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,6 @@ int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag);
int bdrv_debug_resume(BlockDriverState *bs, const char *tag);
bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag);

/**
* Locks the AioContext of @bs if it's not the current AioContext. This avoids
* double locking which could lead to deadlocks: This is a coroutine_fn, so we
* know we already own the lock of the current AioContext.
*
* May only be called in the main thread.
*/
void coroutine_fn bdrv_co_lock(BlockDriverState *bs);

/**
* Unlocks the AioContext of @bs if it's not the current AioContext.
*/
void coroutine_fn bdrv_co_unlock(BlockDriverState *bs);

bool bdrv_child_change_aio_context(BdrvChild *c, AioContext *ctx,
GHashTable *visited, Transaction *tran,
Error **errp);
Expand Down

0 comments on commit c43d5bc

Please sign in to comment.