aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/blockdev.c b/blockdev.c
index b5570f403f..d74cd1d802 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -486,16 +486,16 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
void do_commit(Monitor *mon, const QDict *qdict)
{
- int all_devices;
- DriveInfo *dinfo;
const char *device = qdict_get_str(qdict, "device");
+ BlockDriverState *bs;
- all_devices = !strcmp(device, "all");
- QTAILQ_FOREACH(dinfo, &drives, next) {
- if (!all_devices)
- if (strcmp(bdrv_get_device_name(dinfo->bdrv), device))
- continue;
- bdrv_commit(dinfo->bdrv);
+ if (!strcmp(device, "all")) {
+ bdrv_commit_all();
+ } else {
+ bs = bdrv_find(device);
+ if (bs) {
+ bdrv_commit(bs);
+ }
}
}