mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
rbd: Add bdrv_truncate implementation
Reviewed-by: Christian Brunner <chb@muc.de> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
51a135287a
commit
30cdc48cc8
1 changed files with 14 additions and 0 deletions
14
block/rbd.c
14
block/rbd.c
|
@ -688,6 +688,19 @@ static int64_t qemu_rbd_getlength(BlockDriverState *bs)
|
|||
return info.size;
|
||||
}
|
||||
|
||||
static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset)
|
||||
{
|
||||
BDRVRBDState *s = bs->opaque;
|
||||
int r;
|
||||
|
||||
r = rbd_resize(s->image, offset);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemu_rbd_snap_create(BlockDriverState *bs,
|
||||
QEMUSnapshotInfo *sn_info)
|
||||
{
|
||||
|
@ -784,6 +797,7 @@ static BlockDriver bdrv_rbd = {
|
|||
.bdrv_get_info = qemu_rbd_getinfo,
|
||||
.create_options = qemu_rbd_create_options,
|
||||
.bdrv_getlength = qemu_rbd_getlength,
|
||||
.bdrv_truncate = qemu_rbd_truncate,
|
||||
.protocol_name = "rbd",
|
||||
|
||||
.bdrv_aio_readv = qemu_rbd_aio_readv,
|
||||
|
|
Loading…
Reference in a new issue