qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC V2 3/7] block: Add bdrv_has_dedup.


From: Benoît Canet
Subject: [Qemu-devel] [RFC V2 3/7] block: Add bdrv_has_dedup.
Date: Wed, 6 Feb 2013 13:32:22 +0100

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

diff --git a/block.c b/block.c
index fec29f4..e9d7764 100644
--- a/block.c
+++ b/block.c
@@ -4291,6 +4291,21 @@ void bdrv_lock_medium(BlockDriverState *bs, bool locked)
     }
 }
 
+/* Return true if the device has deduplication */
+bool bdrv_has_dedup(BlockDriverState *bs)
+{
+    BlockDriverInfo bdi;
+    int ret = 0;
+
+    ret = bdrv_get_info((BlockDriverState *) bs, &bdi);
+
+    if (ret < 0) {
+        return false;
+    }
+
+    return bdi.has_dedup;
+}
+
 /* 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 4d61ff4..55549ae 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -306,6 +306,7 @@ void bdrv_set_enable_write_cache(BlockDriverState *bs, bool 
wce);
 int bdrv_is_inserted(BlockDriverState *bs);
 int bdrv_media_changed(BlockDriverState *bs);
 void bdrv_lock_medium(BlockDriverState *bs, bool locked);
+bool bdrv_has_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]