diff options
author | Sage Weil <sage@newdream.net> | 2011-09-15 14:11:11 -0700 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-20 12:27:44 +0200 |
commit | 7a3f5fe9afbef3c55c1527f61fcfd0b9d4783c0d (patch) | |
tree | 033fb0900f3d7e961e1f6f84ece00e757e2fd392 /block/rbd.c | |
parent | 9e1fbcde578b0ab3cd2732e5334e772ab19371ac (diff) |
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>
Diffstat (limited to 'block/rbd.c')
-rw-r--r-- | block/rbd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/rbd.c b/block/rbd.c index 23d8751d03..98efd2cf16 100644 --- a/block/rbd.c +++ b/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); } +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) { BDRVRBDState *s = bs->opaque; @@ -815,6 +826,7 @@ static BlockDriver bdrv_rbd = { .bdrv_file_open = qemu_rbd_open, .bdrv_close = qemu_rbd_close, .bdrv_create = qemu_rbd_create, + .bdrv_flush = qemu_rbd_flush, .bdrv_get_info = qemu_rbd_getinfo, .create_options = qemu_rbd_create_options, .bdrv_getlength = qemu_rbd_getlength, |