mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-07-22 10:55:31 +00:00
block: Mark preadv_snapshot/snapshot_block_status GRAPH_RDLOCK
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230203152202.49054-16-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
742bf09b20
commit
7b9e8b22bc
|
@ -256,7 +256,7 @@ cbw_snapshot_read_unlock(BlockDriverState *bs, BlockReq *req)
|
||||||
g_free(req);
|
g_free(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
static coroutine_fn int
|
static int coroutine_fn GRAPH_RDLOCK
|
||||||
cbw_co_preadv_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
cbw_co_preadv_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||||
QEMUIOVector *qiov, size_t qiov_offset)
|
QEMUIOVector *qiov, size_t qiov_offset)
|
||||||
{
|
{
|
||||||
|
@ -264,8 +264,6 @@ cbw_co_preadv_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||||
BdrvChild *file;
|
BdrvChild *file;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
assume_graph_lock(); /* FIXME */
|
|
||||||
|
|
||||||
/* TODO: upgrade to async loop using AioTask */
|
/* TODO: upgrade to async loop using AioTask */
|
||||||
while (bytes) {
|
while (bytes) {
|
||||||
int64_t cur_bytes;
|
int64_t cur_bytes;
|
||||||
|
@ -290,7 +288,7 @@ cbw_co_preadv_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn
|
static int coroutine_fn GRAPH_RDLOCK
|
||||||
cbw_co_snapshot_block_status(BlockDriverState *bs,
|
cbw_co_snapshot_block_status(BlockDriverState *bs,
|
||||||
bool want_zero, int64_t offset, int64_t bytes,
|
bool want_zero, int64_t offset, int64_t bytes,
|
||||||
int64_t *pnum, int64_t *map,
|
int64_t *pnum, int64_t *map,
|
||||||
|
|
|
@ -3532,6 +3532,7 @@ bdrv_co_preadv_snapshot(BdrvChild *child, int64_t offset, int64_t bytes,
|
||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
int ret;
|
int ret;
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
return -ENOMEDIUM;
|
return -ENOMEDIUM;
|
||||||
|
@ -3557,6 +3558,7 @@ bdrv_co_snapshot_block_status(BlockDriverState *bs,
|
||||||
BlockDriver *drv = bs->drv;
|
BlockDriver *drv = bs->drv;
|
||||||
int ret;
|
int ret;
|
||||||
IO_CODE();
|
IO_CODE();
|
||||||
|
assert_bdrv_graph_readable();
|
||||||
|
|
||||||
if (!drv) {
|
if (!drv) {
|
||||||
return -ENOMEDIUM;
|
return -ENOMEDIUM;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
|
|
||||||
static coroutine_fn int
|
static int coroutine_fn GRAPH_RDLOCK
|
||||||
snapshot_access_co_preadv_part(BlockDriverState *bs,
|
snapshot_access_co_preadv_part(BlockDriverState *bs,
|
||||||
int64_t offset, int64_t bytes,
|
int64_t offset, int64_t bytes,
|
||||||
QEMUIOVector *qiov, size_t qiov_offset,
|
QEMUIOVector *qiov, size_t qiov_offset,
|
||||||
|
@ -39,7 +39,7 @@ snapshot_access_co_preadv_part(BlockDriverState *bs,
|
||||||
return bdrv_co_preadv_snapshot(bs->file, offset, bytes, qiov, qiov_offset);
|
return bdrv_co_preadv_snapshot(bs->file, offset, bytes, qiov, qiov_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn
|
static int coroutine_fn GRAPH_RDLOCK
|
||||||
snapshot_access_co_block_status(BlockDriverState *bs,
|
snapshot_access_co_block_status(BlockDriverState *bs,
|
||||||
bool want_zero, int64_t offset,
|
bool want_zero, int64_t offset,
|
||||||
int64_t bytes, int64_t *pnum,
|
int64_t bytes, int64_t *pnum,
|
||||||
|
|
|
@ -624,11 +624,13 @@ struct BlockDriver {
|
||||||
* - receive the snapshot's actual length (which may differ from bs's
|
* - receive the snapshot's actual length (which may differ from bs's
|
||||||
* length)
|
* length)
|
||||||
*/
|
*/
|
||||||
int coroutine_fn (*bdrv_co_preadv_snapshot)(BlockDriverState *bs,
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_preadv_snapshot)(
|
||||||
int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset);
|
BlockDriverState *bs, int64_t offset, int64_t bytes,
|
||||||
int coroutine_fn (*bdrv_co_snapshot_block_status)(BlockDriverState *bs,
|
QEMUIOVector *qiov, size_t qiov_offset);
|
||||||
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
|
|
||||||
int64_t *map, BlockDriverState **file);
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_snapshot_block_status)(
|
||||||
|
BlockDriverState *bs, bool want_zero, int64_t offset, int64_t bytes,
|
||||||
|
int64_t *pnum, int64_t *map, BlockDriverState **file);
|
||||||
|
|
||||||
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_pdiscard_snapshot)(
|
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_pdiscard_snapshot)(
|
||||||
BlockDriverState *bs, int64_t offset, int64_t bytes);
|
BlockDriverState *bs, int64_t offset, int64_t bytes);
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
* the I/O API.
|
* the I/O API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int coroutine_fn bdrv_co_preadv_snapshot(BdrvChild *child,
|
int coroutine_fn GRAPH_RDLOCK bdrv_co_preadv_snapshot(BdrvChild *child,
|
||||||
int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset);
|
int64_t offset, int64_t bytes, QEMUIOVector *qiov, size_t qiov_offset);
|
||||||
int coroutine_fn bdrv_co_snapshot_block_status(BlockDriverState *bs,
|
int coroutine_fn GRAPH_RDLOCK bdrv_co_snapshot_block_status(
|
||||||
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
|
BlockDriverState *bs, bool want_zero, int64_t offset, int64_t bytes,
|
||||||
int64_t *map, BlockDriverState **file);
|
int64_t *pnum, int64_t *map, BlockDriverState **file);
|
||||||
int coroutine_fn GRAPH_RDLOCK bdrv_co_pdiscard_snapshot(BlockDriverState *bs,
|
int coroutine_fn GRAPH_RDLOCK bdrv_co_pdiscard_snapshot(BlockDriverState *bs,
|
||||||
int64_t offset, int64_t bytes);
|
int64_t offset, int64_t bytes);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue