From patchwork Wed Jan 16 16:25:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,V1,06/12] block: Add bdrv_pause_dedup. From: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 212865 Message-Id: <1358353518-5421-7-git-send-email-benoit@irqsave.net> To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , stefanha@redhat.com Date: Wed, 16 Jan 2013 17:25:12 +0100 --- block.c | 19 +++++++++++++++++++ include/block/block.h | 1 + 2 files changed, 20 insertions(+) diff --git a/block.c b/block.c index 4e80da8..8c527b6 100644 --- a/block.c +++ b/block.c @@ -4380,6 +4380,25 @@ int bdrv_resume_dedup(BlockDriverState *bs) return 0; } +int bdrv_pause_dedup(BlockDriverState *bs) +{ + BlockDriver *drv = bs->drv; + + if (!bdrv_has_dedup(bs)) { + return -EINVAL; + } + + if (!bdrv_is_dedup_running(bs)) { + return 0; + } + + if (drv && drv->bdrv_pause_dedup) { + drv->bdrv_pause_dedup(bs); + } + + return 0; +} + /* needed for generic scsi interface */ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) diff --git a/include/block/block.h b/include/block/block.h index 94ac50a..1328a27 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -309,6 +309,7 @@ void bdrv_lock_medium(BlockDriverState *bs, bool locked); bool bdrv_has_dedup(BlockDriverState *bs); bool bdrv_is_dedup_running(BlockDriverState *bs); int bdrv_resume_dedup(BlockDriverState *bs); +int bdrv_pause_dedup(BlockDriverState *bs); void bdrv_eject(BlockDriverState *bs, bool eject_flag); const char *bdrv_get_format_name(BlockDriverState *bs); BlockDriverState *bdrv_find(const char *name);