[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 21/76] thread-pool: clean up thread_pool_completion_b
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 21/76] thread-pool: clean up thread_pool_completion_bh() |
Date: |
Tue, 28 Apr 2015 17:00:03 +0200 |
From: Stefan Hajnoczi <address@hidden>
This patch simplifies thread_pool_completion_bh().
The function first checks elem->state:
if (elem->state != THREAD_DONE) {
continue;
}
It then goes on to check elem->state == THREAD_DONE although we already
know this must be the case.
The QLIST_REMOVE() is duplicated down both branches of an if-else
statement so that can be lifted out as well.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
---
thread-pool.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/thread-pool.c b/thread-pool.c
index e2cac8e..ac909f4 100644
--- a/thread-pool.c
+++ b/thread-pool.c
@@ -170,12 +170,12 @@ restart:
if (elem->state != THREAD_DONE) {
continue;
}
- if (elem->state == THREAD_DONE) {
- trace_thread_pool_complete(pool, elem, elem->common.opaque,
- elem->ret);
- }
- if (elem->state == THREAD_DONE && elem->common.cb) {
- QLIST_REMOVE(elem, all);
+
+ trace_thread_pool_complete(pool, elem, elem->common.opaque,
+ elem->ret);
+ QLIST_REMOVE(elem, all);
+
+ if (elem->common.cb) {
/* Read state before ret. */
smp_rmb();
@@ -188,8 +188,6 @@ restart:
qemu_aio_unref(elem);
goto restart;
} else {
- /* remove the request */
- QLIST_REMOVE(elem, all);
qemu_aio_unref(elem);
}
}
--
1.8.3.1
- [Qemu-block] [PULL 11/76] checkpatch: complain about ffs(3) calls, (continued)
- [Qemu-block] [PULL 11/76] checkpatch: complain about ffs(3) calls, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 12/76] block: Switch to host monotonic clock for IO throttling, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 13/76] aio-posix: move pollfds to thread-local storage, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 15/76] iothread: release iothread around aio_poll, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 14/76] AioContext: acquire/release AioContext during aio_poll, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 16/76] block-backend: Expose bdrv_write_zeroes(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 18/76] qemu-iotests: Some qemu-img convert tests, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 17/76] qemu-img convert: Rewrite copying logic, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 19/76] blkdebug: Add bdrv_truncate(), Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 20/76] vhdx: Fix zero-fill iov length, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 21/76] thread-pool: clean up thread_pool_completion_bh(),
Kevin Wolf <=
- [Qemu-block] [PULL 22/76] scripts: add 'qemu coroutine' command to qemu-gdb.py, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 25/76] MAINTAINERS: Add Fam Zheng as Null block driver maintainer, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 24/76] block/null: Support reopen, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 23/76] block/null: Latency simulation by adding new option "latency-ns", Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 26/76] blockjob: Allow nested pause, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 27/76] block: Pause block jobs in bdrv_drain_all, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 28/76] qemu-iotests: Test that "stop" doesn't drain block jobs, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 31/76] virtio_blk: comment fix, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 29/76] blockjob: Update function name in comments, Kevin Wolf, 2015/04/28
- [Qemu-block] [PULL 32/76] m25p80: add missing blk_attach_dev_nofail, Kevin Wolf, 2015/04/28