[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V1 04/12] block: Add bdrv_is_dedup_running.
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V1 04/12] block: Add bdrv_is_dedup_running. |
Date: |
Wed, 16 Jan 2013 17:25:10 +0100 |
---
block.c | 19 +++++++++++++++++++
include/block/block.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/block.c b/block.c
index aee33e0..e83666a 100644
--- a/block.c
+++ b/block.c
@@ -4342,6 +4342,25 @@ bool bdrv_has_dedup(BlockDriverState *bs)
return bdi.has_dedup;
}
+/* Return true if the device has deduplication and it's running */
+bool bdrv_is_dedup_running(BlockDriverState *bs)
+{
+ BlockDriverInfo bdi;
+ int ret = 0;
+
+ ret = bdrv_get_info((BlockDriverState *) bs, &bdi);
+
+ if (ret < 0) {
+ return false;
+ }
+
+ if (!bdi.has_dedup) {
+ return false;
+ }
+
+ return bdi.dedup_running;
+}
+
/* 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 e6f86ac..f4e1d2a 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -307,6 +307,7 @@ 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);
+bool bdrv_is_dedup_running(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
- [Qemu-devel] [RFC V1 01/12] block: Add BlockDriver function prototype to pause and resume deduplication., (continued)
- [Qemu-devel] [RFC V1 01/12] block: Add BlockDriver function prototype to pause and resume deduplication., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 02/12] qcow2: Add code to deduplicate cluster flagged with QCOW_OFLAG_TO_DEDUP., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 07/12] qcow2: Add qcow2_pause_dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 08/12] qcow2: Add qcow2_resume_dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 09/12] qcow2: Make dedup status persists., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 12/12] qmp: Add block_resume_dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 06/12] block: Add bdrv_pause_dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 11/12] qmp: Add block-pause-dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 04/12] block: Add bdrv_is_dedup_running.,
Benoît Canet <=
- [Qemu-devel] [RFC V1 05/12] block: Add bdrv_resume_dedup., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 10/12] qerror: Add QERR_DEVICE_NOT_DEDUPLICATED., Benoît Canet, 2013/01/16
- [Qemu-devel] [RFC V1 03/12] block: Add bdrv_has_dedup., Benoît Canet, 2013/01/16