block: Move enable_write_cache to BB level
commitbfd18d1e0b06608226fcef1982c3a439c49c3366
authorKevin Wolf <kwolf@redhat.com>
Fri, 4 Mar 2016 13:28:01 +0000 (4 14:28 +0100)
committerKevin Wolf <kwolf@redhat.com>
Wed, 30 Mar 2016 10:16:02 +0000 (30 12:16 +0200)
tree86f43754a9f11d01c5521dee96f51660cd440bda
parent855a6a93a12b60b2799eb5999baabd7a85a37c99
block: Move enable_write_cache to BB level

Whether a write cache is used or not is a decision that concerns the
user (e.g. the guest device) rather than the backend. It was already
logically part of the BB level as bdrv_move_feature_fields() always kept
it on top of the BDS tree; with this patch, the core of it (the actual
flag and the additional flushes) is also implemented there.

Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs
doesn't have a BlockBackend attached.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block.c
block/block-backend.c
block/io.c
block/iscsi.c
include/block/block.h
include/block/block_int.h
tests/qemu-iotests/142
tests/qemu-iotests/142.out