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