aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-08-03 15:08:10 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-06 11:24:07 +0200
commitc602a489f9685407d93beab3b121408811d20ce4 (patch)
tree79818e20adad895a115b1b3029d57b77491b3778 /block.c
parent18d90055293adc4937c91fb7b87743b1994d8bc5 (diff)
downloadqemu-c602a489f9685407d93beab3b121408811d20ce4.zip
qemu-c602a489f9685407d93beab3b121408811d20ce4.tar.gz
qemu-c602a489f9685407d93beab3b121408811d20ce4.tar.bz2
block: Clean up bdrv_flush_all()
Change (!bdrv_is_removable(bs) || bdrv_is_inserted(bs)) to just bdrv_is_inserted(). Rationale: The value of bdrv_is_removable(bs) matters only when bdrv_is_inserted(bs) is false. bdrv_is_inserted(bs) is true when bs is open (bs->drv != NULL) and not an empty host drive (CD-ROM or floppy). Therefore, bdrv_is_removable(bs) matters only when: 1. bs is not open old: may call bdrv_flush(bs), which does nothing new: won't call 2. bs is an empty host drive old: may call bdrv_flush(bs), which calls driver method raw_flush(), which calls fdatasync() or equivalent, which can't do anything useful while the drive is empty new: won't call Result is bs->drv && !bdrv_is_read_only(bs) && bdrv_is_inserted(bs). bdrv_is_inserted(bs) implies bs->drv. Drop the redundant test. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block.c b/block.c
index 2158f83..487a6a9 100644
--- a/block.c
+++ b/block.c
@@ -1753,8 +1753,7 @@ void bdrv_flush_all(void)
BlockDriverState *bs;
QTAILQ_FOREACH(bs, &bdrv_states, list) {
- if (bs->drv && !bdrv_is_read_only(bs) &&
- (!bdrv_is_removable(bs) || bdrv_is_inserted(bs))) {
+ if (!bdrv_is_read_only(bs) && bdrv_is_inserted(bs)) {
bdrv_flush(bs);
}
}