[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/19] block: Decouple block device "commit all" fro
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 12/19] block: Decouple block device "commit all" from DriveInfo |
Date: |
Tue, 15 Jun 2010 16:19:34 +0200 |
From: Markus Armbruster <address@hidden>
do_commit() and mux_proc_byte() iterate over the list of drives
defined with drive_init(). This misses host block devices defined by
other means. Such means don't exist now, but will be introduced later
in this series.
Change them to use new bdrv_commit_all(), which iterates over all host
block devices.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 9 +++++++++
block.h | 1 +
blockdev.c | 16 ++++++++--------
qemu-char.c | 7 +------
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/block.c b/block.c
index e701ec0..df2d3a6 100644
--- a/block.c
+++ b/block.c
@@ -788,6 +788,15 @@ ro_cleanup:
return ret;
}
+void bdrv_commit_all(void)
+{
+ BlockDriverState *bs;
+
+ QTAILQ_FOREACH(bs, &bdrv_states, list) {
+ bdrv_commit(bs);
+ }
+}
+
/*
* Return values:
* 0 - success
diff --git a/block.h b/block.h
index d22401f..1f69cbd 100644
--- a/block.h
+++ b/block.h
@@ -85,6 +85,7 @@ int64_t bdrv_getlength(BlockDriverState *bs);
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int
*psecs);
int bdrv_commit(BlockDriverState *bs);
+void bdrv_commit_all(void);
int bdrv_change_backing_file(BlockDriverState *bs,
const char *backing_file, const char *backing_fmt);
void bdrv_register(BlockDriver *bdrv);
diff --git a/blockdev.c b/blockdev.c
index b5570f4..d74cd1d 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);
+ }
}
}
diff --git a/qemu-char.c b/qemu-char.c
index 87628ea..9b69d92 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -351,12 +351,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver
*d, int ch)
break;
}
case 's':
- {
- DriveInfo *dinfo;
- QTAILQ_FOREACH(dinfo, &drives, next) {
- bdrv_commit(dinfo->bdrv);
- }
- }
+ bdrv_commit_all();
break;
case 'b':
qemu_chr_event(chr, CHR_EVENT_BREAK);
--
1.6.6.1
- [Qemu-devel] [PATCH 01/19] vpc: Read/write multiple sectors at once, (continued)
- [Qemu-devel] [PATCH 01/19] vpc: Read/write multiple sectors at once, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 03/19] qcow2: Allow alloc_clusters_noref to return errors, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 02/19] qcow2: Allow get_refcount to return errors, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 04/19] qcow2: Return real error code in load_refcount_block, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 05/19] savevm: Really verify if a drive supports snapshots, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 07/19] qcow2: Restore L1 entry on l2_allocate failure, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 08/19] cow: use pread/pwrite, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 06/19] Fix regression for "-drive file=", Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 10/19] cow: use qemu block API, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 14/19] block: New bdrv_next(), Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 12/19] block: Decouple block device "commit all" from DriveInfo,
Kevin Wolf <=
- [Qemu-devel] [PATCH 13/19] monitor: Make "commit FOO" complain when FOO doesn't exist, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 11/19] block: Move error actions from DriveInfo to BlockDriverState, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 15/19] block: Decouple savevm from DriveInfo, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 09/19] cow: stop using mmap, Kevin Wolf, 2010/06/15
- [Qemu-devel] [PATCH 17/19] Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE, Kevin Wolf, 2010/06/15