@@ -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)
@@ -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);