qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC V1 05/12] block: Add bdrv_resume_dedup.


From: Benoît Canet
Subject: [Qemu-devel] [RFC V1 05/12] block: Add bdrv_resume_dedup.
Date: Wed, 16 Jan 2013 17:25:11 +0100

---
 block.c               |   19 +++++++++++++++++++
 include/block/block.h |    1 +
 2 files changed, 20 insertions(+)

diff --git a/block.c b/block.c
index e83666a..4e80da8 100644
--- a/block.c
+++ b/block.c
@@ -4361,6 +4361,25 @@ bool bdrv_is_dedup_running(BlockDriverState *bs)
     return bdi.dedup_running;
 }
 
+int bdrv_resume_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_resume_dedup) {
+        drv->bdrv_resume_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 f4e1d2a..94ac50a 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -308,6 +308,7 @@ int bdrv_media_changed(BlockDriverState *bs);
 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);
 void bdrv_eject(BlockDriverState *bs, bool eject_flag);
 const char *bdrv_get_format_name(BlockDriverState *bs);
 BlockDriverState *bdrv_find(const char *name);
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]