2019-08-29 20:34:43 +02:00
|
|
|
block_ss.add(genh)
|
|
|
|
block_ss.add(files(
|
|
|
|
'accounting.c',
|
|
|
|
'aio_task.c',
|
|
|
|
'amend.c',
|
|
|
|
'backup.c',
|
block: rename backup-top to copy-before-write
We are going to convert backup_top to full featured public filter,
which can be used in separate of backup job. Start from renaming from
"how it used" to "what it does".
While updating comments in 283 iotest, drop and rephrase also things
about ".active", as this field is now dropped, and filter doesn't have
"inactive" mode.
Note that this change may be considered as incompatible interface
change, as backup-top filter format name was visible through
query-block and query-named-block-nodes.
Still, consider the following reasoning:
1. backup-top was never documented, so if someone depends on format
name (for driver that can't be used other than it is automatically
inserted on backup job start), it's a kind of "undocumented feature
use". So I think we are free to change it.
2. There is a hope, that there is no such users: it's a lot more native
to give a good node-name to backup-top filter if need to operate
with it somehow, and don't touch format name.
3. Another "incompatible" change in further commit would be moving
copy-before-write filter from using backing child to file child. And
this is even more reasonable than renaming: for now all public
filters are file-child based.
So, it's a risky change, but risk seems small and good interface worth
it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-6-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
2021-08-24 10:38:27 +02:00
|
|
|
'copy-before-write.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'blkdebug.c',
|
|
|
|
'blklogwrites.c',
|
|
|
|
'blkverify.c',
|
|
|
|
'block-backend.c',
|
|
|
|
'block-copy.c',
|
graph-lock: Introduce a lock to protect block graph operations
Block layer graph operations are always run under BQL in the main loop.
This is proved by the assertion qemu_in_main_thread() and its wrapper
macro GLOBAL_STATE_CODE.
However, there are also concurrent coroutines running in other iothreads
that always try to traverse the graph. Currently this is protected
(among various other things) by the AioContext lock, but once this is
removed, we need to make sure that reads do not happen while modifying
the graph.
We distinguish between writer (main loop, under BQL) that modifies the
graph, and readers (all other coroutines running in various AioContext),
that go through the graph edges, reading ->parents and->children.
The writer (main loop) has "exclusive" access, so it first waits for any
current read to finish, and then prevents incoming ones from entering
while it has the exclusive access.
The readers (coroutines in multiple AioContext) are free to access the
graph as long the writer is not modifying the graph. In case it is, they
go in a CoQueue and sleep until the writer is done.
If a coroutine changes AioContext, the counter in the original and new
AioContext are left intact, since the writer does not care where the
reader is, but only if there is one.
As a result, some AioContexts might have a negative reader count, to
balance the positive count of the AioContext that took the lock. This
also means that when an AioContext is deleted it may have a nonzero
reader count. In that case we transfer the count to a global shared
counter so that the writer is always aware of all readers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20221207131838.239125-3-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-12-07 14:18:22 +01:00
|
|
|
'graph-lock.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'commit.c',
|
|
|
|
'copy-on-read.c',
|
2020-10-21 16:58:46 +02:00
|
|
|
'preallocate.c',
|
2021-06-14 10:11:29 +02:00
|
|
|
'progress_meter.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'create.c',
|
|
|
|
'crypto.c',
|
|
|
|
'dirty-bitmap.c',
|
|
|
|
'filter-compress.c',
|
|
|
|
'io.c',
|
|
|
|
'mirror.c',
|
|
|
|
'nbd.c',
|
|
|
|
'null.c',
|
2023-05-30 20:09:54 +02:00
|
|
|
'plug.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'qapi.c',
|
|
|
|
'qcow2-bitmap.c',
|
|
|
|
'qcow2-cache.c',
|
|
|
|
'qcow2-cluster.c',
|
|
|
|
'qcow2-refcount.c',
|
|
|
|
'qcow2-snapshot.c',
|
|
|
|
'qcow2-threads.c',
|
|
|
|
'qcow2.c',
|
|
|
|
'quorum.c',
|
|
|
|
'raw-format.c',
|
2022-03-03 20:43:39 +01:00
|
|
|
'reqlist.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'snapshot.c',
|
2022-03-03 20:43:44 +01:00
|
|
|
'snapshot-access.c',
|
2019-08-29 20:34:43 +02:00
|
|
|
'throttle-groups.c',
|
|
|
|
'throttle.c',
|
|
|
|
'write-threshold.c',
|
2021-01-02 13:52:13 +01:00
|
|
|
), zstd, zlib, gnutls)
|
2019-08-29 20:34:43 +02:00
|
|
|
|
2023-06-13 15:33:47 +02:00
|
|
|
system_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
|
|
|
system_ss.add(files('block-ram-registrar.c'))
|
replay: do not build if TCG is not available
this fixes non-TCG builds broken recently by replay reverse debugging.
Stub the needed functions in stub/, splitting roughly between functions
needed only by system emulation, by system emulation and tools,
and by everyone. This includes duplicating some code in replay/, and
puts the logic for non-replay related events in the replay/ module (+
the stubs), so this should be revisited in the future.
Surprisingly, only _one_ qtest was affected by this, ide-test.c, which
resulted in a buzz as the bh events were never delivered, and the bh
never executed.
Many other subsystems _should_ have been affected.
This fixes the immediate issue, however a better way to group replay
functionality to TCG-only code could be developed in the long term.
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Message-Id: <20201013192123.22632-4-cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-10-13 21:21:23 +02:00
|
|
|
|
2021-10-13 11:42:25 +02:00
|
|
|
if get_option('qcow1').allowed()
|
|
|
|
block_ss.add(files('qcow.c'))
|
|
|
|
endif
|
|
|
|
if get_option('vdi').allowed()
|
|
|
|
block_ss.add(files('vdi.c'))
|
|
|
|
endif
|
2023-04-21 11:27:58 +02:00
|
|
|
if get_option('vhdx').allowed()
|
|
|
|
block_ss.add(files(
|
|
|
|
'vhdx-endian.c',
|
|
|
|
'vhdx-log.c',
|
|
|
|
'vhdx.c'
|
|
|
|
))
|
|
|
|
endif
|
|
|
|
if get_option('vmdk').allowed()
|
|
|
|
block_ss.add(files('vmdk.c'))
|
|
|
|
endif
|
|
|
|
if get_option('vpc').allowed()
|
|
|
|
block_ss.add(files('vpc.c'))
|
|
|
|
endif
|
2021-10-13 11:42:25 +02:00
|
|
|
if get_option('cloop').allowed()
|
|
|
|
block_ss.add(files('cloop.c'))
|
|
|
|
endif
|
|
|
|
if get_option('bochs').allowed()
|
|
|
|
block_ss.add(files('bochs.c'))
|
|
|
|
endif
|
|
|
|
if get_option('vvfat').allowed()
|
|
|
|
block_ss.add(files('vvfat.c'))
|
|
|
|
endif
|
|
|
|
if get_option('dmg').allowed()
|
|
|
|
block_ss.add(files('dmg.c'))
|
|
|
|
endif
|
|
|
|
if get_option('qed').allowed()
|
|
|
|
block_ss.add(files(
|
|
|
|
'qed-check.c',
|
|
|
|
'qed-cluster.c',
|
|
|
|
'qed-l2-cache.c',
|
|
|
|
'qed-table.c',
|
|
|
|
'qed.c',
|
|
|
|
))
|
|
|
|
endif
|
|
|
|
if get_option('parallels').allowed()
|
|
|
|
block_ss.add(files('parallels.c', 'parallels-ext.c'))
|
|
|
|
endif
|
|
|
|
|
2019-08-29 20:34:43 +02:00
|
|
|
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
|
|
|
|
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
|
2020-11-17 13:11:25 +01:00
|
|
|
block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
|
2019-08-29 20:34:43 +02:00
|
|
|
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
|
2023-04-28 21:49:19 +02:00
|
|
|
if get_option('replication').allowed()
|
2021-10-13 11:43:54 +02:00
|
|
|
block_ss.add(files('replication.c'))
|
|
|
|
endif
|
2021-10-07 15:08:20 +02:00
|
|
|
block_ss.add(when: libaio, if_true: files('linux-aio.c'))
|
meson: fix missing preprocessor symbols
While most libraries do not need a CONFIG_* symbol because the
"when:" clauses are enough, some do. Add them back or stop
using them if possible.
In the case of libpmem, the statement to add the CONFIG_* symbol
was still in configure, but could not be triggered because it
checked for "no" instead of "disabled" (and it would be wrong anyway
since the test for the library has not been done yet).
Reported-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Fixes: 587d59d6cc ("configure, meson: convert virgl detection to meson", 2021-07-06)
Fixes: 83ef16821a ("configure, meson: convert libdaxctl detection to meson", 2021-07-06)
Fixes: e36e8c70f6 ("configure, meson: convert libpmem detection to meson", 2021-07-06)
Fixes: 53c22b68e3 ("configure, meson: convert liburing detection to meson", 2021-07-06)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-07-08 13:50:06 +02:00
|
|
|
block_ss.add(when: linux_io_uring, if_true: files('io_uring.c'))
|
2019-08-29 20:34:43 +02:00
|
|
|
|
|
|
|
block_modules = {}
|
|
|
|
|
|
|
|
modsrc = []
|
|
|
|
foreach m : [
|
blkio: add libblkio block driver
libblkio (https://gitlab.com/libblkio/libblkio/) is a library for
high-performance disk I/O. It currently supports io_uring,
virtio-blk-vhost-user, and virtio-blk-vhost-vdpa with additional drivers
under development.
One of the reasons for developing libblkio is that other applications
besides QEMU can use it. This will be particularly useful for
virtio-blk-vhost-user which applications may wish to use for connecting
to qemu-storage-daemon.
libblkio also gives us an opportunity to develop in Rust behind a C API
that is easy to consume from QEMU.
This commit adds io_uring, nvme-io_uring, virtio-blk-vhost-user, and
virtio-blk-vhost-vdpa BlockDrivers to QEMU using libblkio. It will be
easy to add other libblkio drivers since they will share the majority of
code.
For now I/O buffers are copied through bounce buffers if the libblkio
driver requires it. Later commits add an optimization for
pre-registering guest RAM to avoid bounce buffers.
The syntax is:
--blockdev io_uring,node-name=drive0,filename=test.img,readonly=on|off,cache.direct=on|off
--blockdev nvme-io_uring,node-name=drive0,filename=/dev/ng0n1,readonly=on|off,cache.direct=on
--blockdev virtio-blk-vhost-vdpa,node-name=drive0,path=/dev/vdpa...,readonly=on|off,cache.direct=on
--blockdev virtio-blk-vhost-user,node-name=drive0,path=vhost-user-blk.sock,readonly=on|off,cache.direct=on
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20221013185908.1297568-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-10-13 20:58:57 +02:00
|
|
|
[blkio, 'blkio', files('blkio.c')],
|
2021-06-01 09:54:10 +02:00
|
|
|
[curl, 'curl', files('curl.c')],
|
|
|
|
[glusterfs, 'gluster', files('gluster.c')],
|
2021-06-01 10:00:48 +02:00
|
|
|
[libiscsi, 'iscsi', [files('iscsi.c'), libm]],
|
2021-06-01 09:54:10 +02:00
|
|
|
[libnfs, 'nfs', files('nfs.c')],
|
|
|
|
[libssh, 'ssh', files('ssh.c')],
|
|
|
|
[rbd, 'rbd', files('rbd.c')],
|
2019-08-29 20:34:43 +02:00
|
|
|
]
|
2020-11-17 12:59:57 +01:00
|
|
|
if m[0].found()
|
2021-06-01 09:54:10 +02:00
|
|
|
module_ss = ss.source_set()
|
|
|
|
module_ss.add(when: m[0], if_true: m[2])
|
2019-08-29 20:34:43 +02:00
|
|
|
if enable_modules
|
2021-06-01 09:54:10 +02:00
|
|
|
modsrc += module_ss.all_sources()
|
2019-08-29 20:34:43 +02:00
|
|
|
endif
|
|
|
|
block_modules += {m[1] : module_ss}
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
# those are not exactly regular block modules, so treat them apart
|
2021-10-13 11:42:25 +02:00
|
|
|
if get_option('dmg').allowed()
|
2019-08-29 20:34:43 +02:00
|
|
|
foreach m : [
|
2020-11-17 12:59:57 +01:00
|
|
|
[liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
|
|
|
|
[libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
|
2019-08-29 20:34:43 +02:00
|
|
|
]
|
2020-11-17 12:59:57 +01:00
|
|
|
if m[0].found()
|
2019-08-29 20:34:43 +02:00
|
|
|
module_ss = ss.source_set()
|
|
|
|
module_ss.add(when: m[2], if_true: files(m[3]))
|
|
|
|
block_modules += {m[1] : module_ss}
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
|
|
|
module_block_py = find_program('../scripts/modules/module_block.py')
|
|
|
|
module_block_h = custom_target('module_block.h',
|
|
|
|
output: 'module_block.h',
|
|
|
|
input: modsrc,
|
|
|
|
command: [module_block_py, '@OUTPUT0@', modsrc])
|
|
|
|
block_ss.add(module_block_h)
|
|
|
|
|
2020-09-24 20:54:11 +02:00
|
|
|
wrapper_py = find_program('../scripts/block-coroutine-wrapper.py')
|
|
|
|
block_gen_c = custom_target('block-gen.c',
|
|
|
|
output: 'block-gen.c',
|
2022-03-03 16:15:48 +01:00
|
|
|
input: files(
|
|
|
|
'../include/block/block-io.h',
|
2022-11-28 15:23:37 +01:00
|
|
|
'../include/block/dirty-bitmap.h',
|
2023-01-13 21:42:04 +01:00
|
|
|
'../include/block/block_int-io.h',
|
2022-03-03 16:15:48 +01:00
|
|
|
'../include/block/block-global-state.h',
|
2023-01-26 18:24:21 +01:00
|
|
|
'../include/sysemu/block-backend-global-state.h',
|
2022-07-05 18:15:14 +02:00
|
|
|
'../include/sysemu/block-backend-io.h',
|
2022-03-03 16:15:48 +01:00
|
|
|
'coroutines.h'
|
|
|
|
),
|
2020-09-24 20:54:11 +02:00
|
|
|
command: [wrapper_py, '@OUTPUT@', '@INPUT@'])
|
|
|
|
block_ss.add(block_gen_c)
|
|
|
|
|
2019-08-29 20:34:43 +02:00
|
|
|
block_ss.add(files('stream.c'))
|
|
|
|
|
2023-06-13 15:33:47 +02:00
|
|
|
system_ss.add(files('qapi-sysemu.c'))
|
2020-09-24 17:26:50 +02:00
|
|
|
|
|
|
|
subdir('export')
|
2019-08-29 20:34:43 +02:00
|
|
|
subdir('monitor')
|
|
|
|
|
|
|
|
modules += {'block': block_modules}
|