Error **errp)
{
IO_OR_GS_CODE();
+ GRAPH_RDLOCK_GUARD();
if (!blk_is_available(blk)) {
error_setg(errp, "No medium inserted");
return -ENOMEDIUM;
return ret;
}
-static int coroutine_fn
+static int coroutine_fn GRAPH_RDLOCK
block_crypto_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
PreallocMode prealloc, BdrvRequestFlags flags,
Error **errp)
int64_t old_size, new_bytes;
int ret;
IO_CODE();
+ assert_bdrv_graph_readable();
/* if bs->drv == NULL, bs is closed, so there's nothing to do here */
if (!drv) {
return start_off;
}
-static coroutine_fn int64_t allocate_clusters(BlockDriverState *bs,
- int64_t sector_num,
- int nb_sectors, int *pnum)
+static int64_t coroutine_fn GRAPH_RDLOCK
+allocate_clusters(BlockDriverState *bs, int64_t sector_num,
+ int nb_sectors, int *pnum)
{
int ret = 0;
BDRVParallelsState *s = bs->opaque;
QEMUIOVector hd_qiov;
int ret = 0;
+ assume_graph_lock(); /* FIXME */
+
qemu_iovec_init(&hd_qiov, qiov->niov);
while (nb_sectors > 0) {
}
-static int coroutine_fn parallels_co_check(BlockDriverState *bs,
- BdrvCheckResult *res,
- BdrvCheckMode fix)
+static int coroutine_fn GRAPH_RDLOCK
+parallels_co_check(BlockDriverState *bs, BdrvCheckResult *res,
+ BdrvCheckMode fix)
{
BDRVParallelsState *s = bs->opaque;
int64_t size, prev_off, high_off;
flags);
}
-static int coroutine_fn
+static int coroutine_fn GRAPH_RDLOCK
preallocate_co_truncate(BlockDriverState *bs, int64_t offset,
bool exact, PreallocMode prealloc,
BdrvRequestFlags flags, Error **errp)
* return 0 if not allocated, 1 if *result is assigned, and negative
* errno on failure.
*/
-static int coroutine_fn get_cluster_offset(BlockDriverState *bs,
- uint64_t offset, int allocate,
- int compressed_size,
- int n_start, int n_end,
- uint64_t *result)
+static int coroutine_fn GRAPH_RDLOCK
+get_cluster_offset(BlockDriverState *bs, uint64_t offset, int allocate,
+ int compressed_size, int n_start, int n_end,
+ uint64_t *result)
{
BDRVQcowState *s = bs->opaque;
int min_index, i, j, l1_index, l2_index, ret;
int64_t n;
uint64_t cluster_offset;
+ assume_graph_lock(); /* FIXME */
+
qemu_co_mutex_lock(&s->lock);
ret = get_cluster_offset(bs, offset, 0, 0, 0, 0, &cluster_offset);
qemu_co_mutex_unlock(&s->lock);
uint8_t *buf;
void *orig_buf;
+ assume_graph_lock(); /* FIXME */
+
if (qiov->niov > 1) {
buf = orig_buf = qemu_try_blockalign(bs, qiov->size);
if (buf == NULL) {
uint8_t *buf;
void *orig_buf;
+ assume_graph_lock(); /* FIXME */
+
s->cluster_cache_offset = -1; /* disable compressed cache */
/* We must always copy the iov when encrypting, so we
uint8_t *buf, *out_buf;
uint64_t cluster_offset;
+ assume_graph_lock(); /* FIXME */
+
buf = qemu_blockalign(bs, s->cluster_size);
if (bytes != s->cluster_size) {
if (bytes > s->cluster_size ||
*
* Returns: 0 on success, -errno on failure.
*/
-static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,
- uint64_t new_length, PreallocMode mode,
- Error **errp)
+static int coroutine_fn GRAPH_RDLOCK
+preallocate_co(BlockDriverState *bs, uint64_t offset, uint64_t new_length,
+ PreallocMode mode, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
uint64_t bytes;
return ret;
}
-static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
- bool exact, PreallocMode prealloc,
- BdrvRequestFlags flags, Error **errp)
+static int coroutine_fn GRAPH_RDLOCK
+qcow2_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
uint64_t old_length;
AioTaskPool *aio = NULL;
int ret = 0;
+ assume_graph_lock(); /* FIXME */
+
if (has_data_file(bs)) {
return -ENOTSUP;
}
}
}
-static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
- bool exact, PreallocMode prealloc,
- BdrvRequestFlags flags, Error **errp)
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
{
BDRVRawState *s = bs->opaque;
vmdk_co_pwritev_compressed(BlockDriverState *bs, int64_t offset, int64_t bytes,
QEMUIOVector *qiov)
{
+ assume_graph_lock(); /* FIXME */
+
if (bytes == 0) {
/* The caller will write bytes 0 to signal EOF.
* When receive it, we align EOF to a sector boundary. */
int coroutine_fn bdrv_co_pwrite_zeroes(BdrvChild *child, int64_t offset,
int64_t bytes, BdrvRequestFlags flags);
-int coroutine_fn bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
- PreallocMode prealloc, BdrvRequestFlags flags,
- Error **errp);
+int coroutine_fn GRAPH_RDLOCK
+bdrv_co_truncate(BdrvChild *child, int64_t offset, bool exact,
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
int64_t coroutine_fn bdrv_co_nb_sectors(BlockDriverState *bs);
int64_t co_wrapper_mixed bdrv_nb_sectors(BlockDriverState *bs);
* If @exact is true and this function fails but would succeed
* with @exact = false, it should return -ENOTSUP.
*/
- int coroutine_fn (*bdrv_co_truncate)(BlockDriverState *bs, int64_t offset,
- bool exact, PreallocMode prealloc,
- BdrvRequestFlags flags, Error **errp);
+ int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_truncate)(
+ BlockDriverState *bs, int64_t offset, bool exact,
+ PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
+
int64_t coroutine_fn (*bdrv_co_getlength)(BlockDriverState *bs);
int64_t coroutine_fn (*bdrv_co_get_allocated_file_size)(
BlockDriverState *bs);