Revision f8a2e5e3 block/qcow2.c
b/block/qcow2.c | ||
---|---|---|
344 | 344 |
return 0; |
345 | 345 |
} |
346 | 346 |
|
347 |
static int qcow2_is_allocated(BlockDriverState *bs, int64_t sector_num,
|
|
348 |
int nb_sectors, int *pnum)
|
|
347 |
static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,
|
|
348 |
int64_t sector_num, int nb_sectors, int *pnum)
|
|
349 | 349 |
{ |
350 |
BDRVQcowState *s = bs->opaque; |
|
350 | 351 |
uint64_t cluster_offset; |
351 | 352 |
int ret; |
352 | 353 |
|
353 | 354 |
*pnum = nb_sectors; |
354 |
/* FIXME We can get errors here, but the bdrv_is_allocated interface can't |
|
355 |
* pass them on today */ |
|
355 |
/* FIXME We can get errors here, but the bdrv_co_is_allocated interface |
|
356 |
* can't pass them on today */ |
|
357 |
qemu_co_mutex_lock(&s->lock); |
|
356 | 358 |
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset); |
359 |
qemu_co_mutex_unlock(&s->lock); |
|
357 | 360 |
if (ret < 0) { |
358 | 361 |
*pnum = 0; |
359 | 362 |
} |
... | ... | |
1277 | 1280 |
.bdrv_open = qcow2_open, |
1278 | 1281 |
.bdrv_close = qcow2_close, |
1279 | 1282 |
.bdrv_create = qcow2_create, |
1280 |
.bdrv_is_allocated = qcow2_is_allocated,
|
|
1283 |
.bdrv_co_is_allocated = qcow2_co_is_allocated,
|
|
1281 | 1284 |
.bdrv_set_key = qcow2_set_key, |
1282 | 1285 |
.bdrv_make_empty = qcow2_make_empty, |
1283 | 1286 |
|
Also available in: Unified diff