mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
rbd: call flush, if available
librbd recently added async writeback and flush support. If the new rbd_flush() call is available, call it. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
9e1fbcde57
commit
7a3f5fe9af
1 changed files with 12 additions and 0 deletions
12
block/rbd.c
12
block/rbd.c
|
@ -680,6 +680,17 @@ static BlockDriverAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
|
||||||
return rbd_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 1);
|
return rbd_aio_rw_vector(bs, sector_num, qiov, nb_sectors, cb, opaque, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qemu_rbd_flush(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 1)
|
||||||
|
/* rbd_flush added in 0.1.1 */
|
||||||
|
BDRVRBDState *s = bs->opaque;
|
||||||
|
return rbd_flush(s->image);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static int qemu_rbd_getinfo(BlockDriverState *bs, BlockDriverInfo *bdi)
|
static int qemu_rbd_getinfo(BlockDriverState *bs, BlockDriverInfo *bdi)
|
||||||
{
|
{
|
||||||
BDRVRBDState *s = bs->opaque;
|
BDRVRBDState *s = bs->opaque;
|
||||||
|
@ -815,6 +826,7 @@ static BlockDriver bdrv_rbd = {
|
||||||
.bdrv_file_open = qemu_rbd_open,
|
.bdrv_file_open = qemu_rbd_open,
|
||||||
.bdrv_close = qemu_rbd_close,
|
.bdrv_close = qemu_rbd_close,
|
||||||
.bdrv_create = qemu_rbd_create,
|
.bdrv_create = qemu_rbd_create,
|
||||||
|
.bdrv_flush = qemu_rbd_flush,
|
||||||
.bdrv_get_info = qemu_rbd_getinfo,
|
.bdrv_get_info = qemu_rbd_getinfo,
|
||||||
.create_options = qemu_rbd_create_options,
|
.create_options = qemu_rbd_create_options,
|
||||||
.bdrv_getlength = qemu_rbd_getlength,
|
.bdrv_getlength = qemu_rbd_getlength,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue