[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V2 4/7] block: Add bdrv_dedup_control to start and sto
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V2 4/7] block: Add bdrv_dedup_control to start and stop deduplication. |
Date: |
Wed, 6 Feb 2013 13:32:23 +0100 |
---
block.c | 16 ++++++++++++++++
include/block/block.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/block.c b/block.c
index e9d7764..3f0bccc 100644
--- a/block.c
+++ b/block.c
@@ -4306,6 +4306,22 @@ bool bdrv_has_dedup(BlockDriverState *bs)
return bdi.has_dedup;
}
+/* Start or stop deduplication given the value of enable */
+int bdrv_dedup_control(BlockDriverState *bs, const bool enable)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (!bdrv_has_dedup(bs)) {
+ return -EINVAL;
+ }
+
+ if (drv && drv->bdrv_dedup_control) {
+ drv->bdrv_dedup_control(bs, enable);
+ }
+
+ 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 55549ae..e06c571 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);
+int bdrv_dedup_control(BlockDriverState *bs, const bool enable);
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 V2 0/7] QCOW2 asynchronous deduplication, Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 2/7] qcow2: Add code to deduplicate cluster flagged with QCOW_OFLAG_TO_DEDUP., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 6/7] qcow2: Make dedup status persists., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 5/7] qcow2: Add qcow2_dedup_control., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 7/7] qmp: Add block-dedup-control., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 4/7] block: Add bdrv_dedup_control to start and stop deduplication.,
Benoît Canet <=
- [Qemu-devel] [RFC V2 3/7] block: Add bdrv_has_dedup., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 1/7] block: Add BlockDriver function prototype to pause and resume deduplication., Benoît Canet, 2013/02/06