qemu/block
Kevin Wolf 4e4bf5c42c block: Attach bs->file only during .bdrv_open()
The way that attaching bs->file worked was a bit unusual in that it was
the only child that would be attached to a node which is not opened yet.
Because of this, the block layer couldn't know yet which permissions the
driver would eventually need.

This patch moves the point where bs->file is attached to the beginning
of the individual .bdrv_open() implementations, so drivers already know
what they are going to do with the child. This is also more consistent
with how driver-specific children work.

For a moment, bdrv_open() gets its own BdrvChild to perform image
probing, but instead of directly assigning this BdrvChild to the BDS, it
becomes a temporary one and the node name is passed as an option to the
drivers, so that they can simply use bdrv_open_child() to create another
reference for their own use.

This duplicated child for (the not opened yet) bs is not the final
state, a follow-up patch will change the image probing code to use a
BlockBackend, which is completely independent of bs.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
2017-02-24 16:09:23 +01:00
..
accounting.c block: Clean up includes 2016-01-20 13:36:23 +01:00
archipelago.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
backup.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
blkdebug.c block: Pass BdrvChild to bdrv_truncate() 2017-02-24 16:09:23 +01:00
blkreplay.c block: explicitly acquire aiocontext in bottom halves that need it 2017-02-21 11:39:39 +00:00
blkverify.c blkverify: Implement bdrv_co_preadv/pwritev/flush 2017-01-09 13:30:52 +01:00
block-backend.c block: Pass BdrvChild to bdrv_truncate() 2017-02-24 16:09:23 +01:00
bochs.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
cloop.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
commit.c blockjob: add block_job_start 2016-11-14 22:47:34 -05:00
crypto.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
curl.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
dirty-bitmap.c block: More operations for meta dirty bitmap 2016-10-24 17:56:07 +02:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
dmg.h dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
file-posix.c qemu-img: Improve documentation for PREALLOC_MODE_FALLOC 2017-02-24 16:09:23 +01:00
file-win32.c block: Rename raw-{posix,win32} to file-*.c 2017-01-09 13:30:53 +01:00
gluster.c block: explicitly acquire aiocontext in bottom halves that need it 2017-02-21 11:39:39 +00:00
io.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
iscsi-opts.c block/iscsi: statically link qemu_iscsi_opts 2017-01-27 18:07:58 +01:00
iscsi.c iscsi: Add blockdev-add support 2017-02-21 10:37:34 -05:00
linux-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
Makefile.objs block/iscsi: statically link qemu_iscsi_opts 2017-01-27 18:07:58 +01:00
mirror.c mirror: Resize active commit base in mirror_run() 2017-02-24 16:09:23 +01:00
nbd-client.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
nbd-client.h nbd: convert to use qio_channel_yield 2017-02-21 11:14:08 +00:00
nbd.c block/nbd: Fix the leaked visitor 2016-11-11 15:54:55 +01:00
nfs.c block: explicitly acquire aiocontext in bottom halves that need it 2017-02-21 11:39:39 +00:00
null.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
parallels.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
qapi.c block/qapi: reduce the execution time of qmp_query_blockstats 2017-02-12 00:47:42 +01:00
qcow2-cache.c qcow2: Remove stale comment 2016-11-25 13:51:30 +01:00
qcow2-cluster.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
qcow2-refcount.c block: Pass BdrvChild to bdrv_truncate() 2017-02-24 16:09:23 +01:00
qcow2-snapshot.c block: Convert bdrv_pwrite(v/_sync) to BdrvChild 2016-07-05 16:46:27 +02:00
qcow2.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
qcow2.h qcow2: Optimize the refcount-block overlap check 2017-02-12 00:47:43 +01:00
qcow.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
qed-check.c qed: Use DIV_ROUND_UP 2016-06-07 18:19:24 +03:00
qed-cluster.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
qed-gencb.c block: Clean up includes 2016-01-20 13:36:23 +01:00
qed-l2-cache.c block: Clean up includes 2016-01-20 13:36:23 +01:00
qed-table.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
qed.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
qed.h block: explicitly acquire aiocontext in timers that need it 2017-02-21 11:14:08 +00:00
quorum.c quorum: Clean up quorum_aio_get() 2017-01-09 13:30:52 +01:00
raw-format.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
rbd.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
replication.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
sheepdog.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
snapshot.c error: Remove NULL checks on error_propagate() calls 2016-06-20 16:38:13 +02:00
ssh.c block: explicitly acquire aiocontext in callbacks that need it 2017-02-21 11:39:36 +00:00
stream.c blockjob: add block_job_start 2016-11-14 22:47:34 -05:00
throttle-groups.c coroutine-lock: add mutex argument to CoQueue APIs 2017-02-21 11:39:40 +00:00
trace-events trace: clean up trace-events files 2017-01-31 17:12:15 +00:00
vdi.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
vhdx-endian.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-log.c block: Pass BdrvChild to bdrv_truncate() 2017-02-24 16:09:23 +01:00
vhdx.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
vhdx.h block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec 2014-12-12 15:42:22 +00:00
vmdk.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
vpc.c block: Attach bs->file only during .bdrv_open() 2017-02-24 16:09:23 +01:00
vvfat.c migration: disallow migrate_add_blocker during migration 2017-01-24 18:00:30 +00:00
win32-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
write-threshold.c block: use bdrv_add_before_write_notifier 2016-10-07 13:34:07 +02:00