summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-09-23 16:15:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-09-23 16:15:33 +0100
commit3b71ec8516bb50e9a743645bf139571de0b39f61 (patch)
tree95504b00e2940f8b23d33618b3afa9aa2ca99f5d /block
parenteaff9c4367ac3f7ac44f6c6f4cb7bcd4daa89af5 (diff)
parent9ec8873e684c2dae6fadb3a801057c613ccd2a6b (diff)
downloadqemu-3b71ec8516bb50e9a743645bf139571de0b39f61.zip
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches # gpg: Signature made Fri 23 Sep 2016 12:59:46 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (33 commits) block: Remove BB interface from blockdev-add/del qemu-iotests/141: Avoid blockdev-add with id block: Avoid printing NULL string in error messages qemu-iotests/139: Avoid blockdev-add with id qemu-iotests/124: Avoid blockdev-add with id qemu-iotests/118: Avoid blockdev-add with id qemu-iotests/117: Avoid blockdev-add with id qemu-iotests/087: Avoid blockdev-add with id qemu-iotests/081: Avoid blockdev-add with id qemu-iotests/071: Avoid blockdev-add with id qemu-iotests/067: Avoid blockdev-add with id qemu-iotests/041: Avoid blockdev-add with id qemu-iotests/118: Test media change with qdev name block: Accept device model name for block_set_io_throttle block: Accept device model name for blockdev-change-medium block: Accept device model name for eject block: Accept device model name for x-blockdev-remove-medium block: Accept device model name for x-blockdev-insert-medium block: Accept device model name for blockdev-open/close-tray qdev-monitor: Add blk_by_qdev_id() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c19
-rw-r--r--block/commit.c8
-rw-r--r--block/qcow2-cluster.c2
-rw-r--r--block/vvfat.c3
4 files changed, 26 insertions, 6 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index d1349d90e5..0bd19abdfb 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -560,6 +560,25 @@ void *blk_get_attached_dev(BlockBackend *blk)
}
/*
+ * Return the BlockBackend which has the device model @dev attached if it
+ * exists, else null.
+ *
+ * @dev must not be null.
+ */
+BlockBackend *blk_by_dev(void *dev)
+{
+ BlockBackend *blk = NULL;
+
+ assert(dev != NULL);
+ while ((blk = blk_all_next(blk)) != NULL) {
+ if (blk->dev == dev) {
+ return blk;
+ }
+ }
+ return NULL;
+}
+
+/*
* Set @blk's device model callbacks to @ops.
* @opaque is the opaque argument to pass to the callbacks.
* This is for use by device models.
diff --git a/block/commit.c b/block/commit.c
index a02539bacc..9f67a8b121 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -242,14 +242,14 @@ void commit_start(const char *job_id, BlockDriverState *bs,
orig_overlay_flags = bdrv_get_flags(overlay_bs);
/* convert base & overlay_bs to r/w, if necessary */
- if (!(orig_overlay_flags & BDRV_O_RDWR)) {
- reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,
- orig_overlay_flags | BDRV_O_RDWR);
- }
if (!(orig_base_flags & BDRV_O_RDWR)) {
reopen_queue = bdrv_reopen_queue(reopen_queue, base, NULL,
orig_base_flags | BDRV_O_RDWR);
}
+ if (!(orig_overlay_flags & BDRV_O_RDWR)) {
+ reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, NULL,
+ orig_overlay_flags | BDRV_O_RDWR);
+ }
if (reopen_queue) {
bdrv_reopen_multiple(reopen_queue, &local_err);
if (local_err != NULL) {
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 9ab445dd17..61d1ffd223 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -429,7 +429,7 @@ static int coroutine_fn do_perform_cow(BlockDriverState *bs,
if (bs->encrypted) {
Error *err = NULL;
- int64_t sector = (cluster_offset + offset_in_cluster)
+ int64_t sector = (src_cluster_offset + offset_in_cluster)
>> BDRV_SECTOR_BITS;
assert(s->cipher);
assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0);
diff --git a/block/vvfat.c b/block/vvfat.c
index ba2620f3c2..ded21092ee 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2971,7 +2971,8 @@ static BlockDriver vvfat_write_target = {
static void vvfat_qcow_options(int *child_flags, QDict *child_options,
int parent_flags, QDict *parent_options)
{
- *child_flags = BDRV_O_RDWR | BDRV_O_NO_FLUSH;
+ qdict_set_default_str(child_options, BDRV_OPT_READ_ONLY, "off");
+ *child_flags = BDRV_O_NO_FLUSH;
}
static const BdrvChildRole child_vvfat_qcow = {