diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-25 14:59:53 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-25 14:59:53 +0100 |
commit | 03bf012e523ecdf047ac56b2057950247256064d (patch) | |
tree | 6e1b06a3c71cfb191bc2aabc8a79d436c9d05d72 /include | |
parent | bad76ac319556dab2497429d473b49a237672e1c (diff) | |
parent | 5e9785505210e2477e590e61b1ab100d0ec22b01 (diff) | |
download | qemu-03bf012e523ecdf047ac56b2057950247256064d.zip qemu-03bf012e523ecdf047ac56b2057950247256064d.tar.gz qemu-03bf012e523ecdf047ac56b2057950247256064d.tar.bz2 |
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches:
- qcow2: Fix data corruption bug that is triggered in partial cluster
allocation with default options
- qapi: add support for blkreplay driver
- doc: Describe missing generic -blockdev options
- iotests: Fix 118 when run as root
- Minor code cleanups
# gpg: Signature made Fri 25 Oct 2019 14:19:04 BST
# gpg: using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6
* remotes/kevin/tags/for-upstream:
qcow2: Fix corruption bug in qcow2_detect_metadata_preallocation()
coroutine: Add qemu_co_mutex_assert_locked()
doc: Describe missing generic -blockdev options
block/backup: drop dead code from backup_job_create
blockdev: Use error_report() in hmp_commit()
iotests: Skip read-only cases in 118 when run as root
qapi: add support for blkreplay driver
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/coroutine.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 8d55663..dfd261c 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -167,6 +167,21 @@ void coroutine_fn qemu_co_mutex_lock(CoMutex *mutex); */ void coroutine_fn qemu_co_mutex_unlock(CoMutex *mutex); +/** + * Assert that the current coroutine holds @mutex. + */ +static inline coroutine_fn void qemu_co_mutex_assert_locked(CoMutex *mutex) +{ + /* + * mutex->holder doesn't need any synchronisation if the assertion holds + * true because the mutex protects it. If it doesn't hold true, we still + * don't mind if another thread takes or releases mutex behind our back, + * because the condition will be false no matter whether we read NULL or + * the pointer for any other coroutine. + */ + assert(atomic_read(&mutex->locked) && + mutex->holder == qemu_coroutine_self()); +} /** * CoQueues are a mechanism to queue coroutines in order to continue executing |