diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2023-03-07 16:04:25 -0500 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-04-25 13:15:21 +0200 |
commit | c4d5bf99b7fccf8849316b9f5100525b1beb8237 (patch) | |
tree | 9769d9318ce1d33ae3f458555d6f58ee55b071a9 /migration/qemu-file.c | |
parent | ac5f7bf8e208cd7893dbb1a9520559e569a4677c (diff) | |
download | qemu-c4d5bf99b7fccf8849316b9f5100525b1beb8237.zip qemu-c4d5bf99b7fccf8849316b9f5100525b1beb8237.tar.gz qemu-c4d5bf99b7fccf8849316b9f5100525b1beb8237.tar.bz2 |
block: make BlockBackend->quiesce_counter atomic
The main loop thread increments/decrements BlockBackend->quiesce_counter
when drained sections begin/end. The counter is read in the I/O code
path. Therefore this field is used to communicate between threads
without a lock.
Acquire/release are not necessary because the BlockBackend->in_flight
counter already uses sequentially consistent accesses and running I/O
requests hold that counter when blk_wait_while_drained() is called.
qatomic_read() can be used.
Use qatomic_fetch_inc()/qatomic_fetch_dec() for modifications even
though sequentially consistent atomic accesses are not strictly required
here. They are, however, nicer to read than multiple calls to
qatomic_read() and qatomic_set(). Since beginning and ending drain is
not a hot path the extra cost doesn't matter.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230307210427.269214-2-stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'migration/qemu-file.c')
0 files changed, 0 insertions, 0 deletions