mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
thread-pool: Remove thread_pool_submit() function
This function name conflicts with one used by a future generic thread pool function and it was only used by one test anyway. Update the trace event name in thread_pool_submit_aio() accordingly. Acked-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Link: https://lore.kernel.org/qemu-devel/6830f07777f939edaf0a2d301c39adcaaf3817f0.1741124640.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
d3237d0d85
commit
03c6468a13
4 changed files with 6 additions and 12 deletions
|
@ -30,13 +30,12 @@ ThreadPool *thread_pool_new(struct AioContext *ctx);
|
||||||
void thread_pool_free(ThreadPool *pool);
|
void thread_pool_free(ThreadPool *pool);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* thread_pool_submit* API: submit I/O requests in the thread's
|
* thread_pool_submit_{aio,co} API: submit I/O requests in the thread's
|
||||||
* current AioContext.
|
* current AioContext.
|
||||||
*/
|
*/
|
||||||
BlockAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
|
BlockAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
|
||||||
BlockCompletionFunc *cb, void *opaque);
|
BlockCompletionFunc *cb, void *opaque);
|
||||||
int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg);
|
int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg);
|
||||||
void thread_pool_submit(ThreadPoolFunc *func, void *arg);
|
|
||||||
|
|
||||||
void thread_pool_update_params(ThreadPool *pool, struct AioContext *ctx);
|
void thread_pool_update_params(ThreadPool *pool, struct AioContext *ctx);
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,10 @@ static void done_cb(void *opaque, int ret)
|
||||||
active--;
|
active--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_submit(void)
|
static void test_submit_no_complete(void)
|
||||||
{
|
{
|
||||||
WorkerTestData data = { .n = 0 };
|
WorkerTestData data = { .n = 0 };
|
||||||
thread_pool_submit(worker_cb, &data);
|
thread_pool_submit_aio(worker_cb, &data, NULL, NULL);
|
||||||
while (data.n == 0) {
|
while (data.n == 0) {
|
||||||
aio_poll(ctx, true);
|
aio_poll(ctx, true);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ int main(int argc, char **argv)
|
||||||
ctx = qemu_get_current_aio_context();
|
ctx = qemu_get_current_aio_context();
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
g_test_add_func("/thread-pool/submit", test_submit);
|
g_test_add_func("/thread-pool/submit-no-complete", test_submit_no_complete);
|
||||||
g_test_add_func("/thread-pool/submit-aio", test_submit_aio);
|
g_test_add_func("/thread-pool/submit-aio", test_submit_aio);
|
||||||
g_test_add_func("/thread-pool/submit-co", test_submit_co);
|
g_test_add_func("/thread-pool/submit-co", test_submit_co);
|
||||||
g_test_add_func("/thread-pool/submit-many", test_submit_many);
|
g_test_add_func("/thread-pool/submit-many", test_submit_many);
|
||||||
|
|
|
@ -256,7 +256,7 @@ BlockAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
|
||||||
|
|
||||||
QLIST_INSERT_HEAD(&pool->head, req, all);
|
QLIST_INSERT_HEAD(&pool->head, req, all);
|
||||||
|
|
||||||
trace_thread_pool_submit(pool, req, arg);
|
trace_thread_pool_submit_aio(pool, req, arg);
|
||||||
|
|
||||||
qemu_mutex_lock(&pool->lock);
|
qemu_mutex_lock(&pool->lock);
|
||||||
if (pool->idle_threads == 0 && pool->cur_threads < pool->max_threads) {
|
if (pool->idle_threads == 0 && pool->cur_threads < pool->max_threads) {
|
||||||
|
@ -290,11 +290,6 @@ int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg)
|
||||||
return tpc.ret;
|
return tpc.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread_pool_submit(ThreadPoolFunc *func, void *arg)
|
|
||||||
{
|
|
||||||
thread_pool_submit_aio(func, arg, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void thread_pool_update_params(ThreadPool *pool, AioContext *ctx)
|
void thread_pool_update_params(ThreadPool *pool, AioContext *ctx)
|
||||||
{
|
{
|
||||||
qemu_mutex_lock(&pool->lock);
|
qemu_mutex_lock(&pool->lock);
|
||||||
|
|
|
@ -14,7 +14,7 @@ aio_co_schedule_bh_cb(void *ctx, void *co) "ctx %p co %p"
|
||||||
reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
|
reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
|
||||||
|
|
||||||
# thread-pool.c
|
# thread-pool.c
|
||||||
thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
|
thread_pool_submit_aio(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
|
||||||
thread_pool_complete(void *pool, void *req, void *opaque, int ret) "pool %p req %p opaque %p ret %d"
|
thread_pool_complete(void *pool, void *req, void *opaque, int ret) "pool %p req %p opaque %p ret %d"
|
||||||
thread_pool_cancel(void *req, void *opaque) "req %p opaque %p"
|
thread_pool_cancel(void *req, void *opaque) "req %p opaque %p"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue