From 8a31f935a46307763bb3f917234fd2e9a67a09cc Mon Sep 17 00:00:00 2001 From: patiencew Date: Sat, 1 Dec 2007 19:11:01 +0000 Subject: [PATCH] Oops wrong check git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2165 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/kernel/ktcp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/trunk/ceph/kernel/ktcp.c b/trunk/ceph/kernel/ktcp.c index 7b830099324fd..08b1ccaa9654d 100644 --- a/trunk/ceph/kernel/ktcp.c +++ b/trunk/ceph/kernel/ktcp.c @@ -7,6 +7,7 @@ struct workqueue_struct *recv_wq = NULL; /* receive work queue */ struct workqueue_struct *send_wq = NULL; /* send work queue */ +struct workqueue_struct *accept_wq = NULL; /* accept work queue */ /* * socket callback functions @@ -20,7 +21,7 @@ static void ceph_accept_ready(struct sock *sk, int count_unused) dout(30, "ceph_accept_ready messenger %p sk_state = %u\n", msgr, sk->sk_state); if (msgr && (sk->sk_state == TCP_LISTEN)) - queue_work(recv_wq, &msgr->awork); + queue_work(accept_wq, &msgr->awork); } /* Data available on socket or listen socket received a connect */ @@ -40,7 +41,8 @@ static void ceph_write_space(struct sock *sk) struct ceph_connection *con = (struct ceph_connection *)sk->sk_user_data; dout(30, "ceph_write_space %p state = %u\n", con, con->state); - if (con && test_bit(WRITE_PENDING, &con->state)) { + /* only queue to workqueue if not already queued */ + if (con && !test_and_set_bit(WRITE_PENDING, &con->state)) { dout(30, "ceph_write_space %p queueing write work\n", con); queue_work(send_wq, &con->swork); } @@ -292,6 +294,18 @@ int ceph_workqueue_init(void) destroy_workqueue(send_wq); return ret; } + + /* + * Create a single thread to handle send requests + * note: may use same thread pool as receive workers later... + */ + accept_wq = create_singlethread_workqueue("ceph-accept"); + ret = IS_ERR(accept_wq); + if (ret) { + printk(KERN_INFO "accept worker failed to start: %d\n", ret); + destroy_workqueue(accept_wq); + return ret; + } printk(KERN_INFO "successfully created wrkqueues\n"); return(ret); @@ -302,6 +316,7 @@ int ceph_workqueue_init(void) */ void ceph_workqueue_shutdown(void) { + destroy_workqueue(accept_wq); destroy_workqueue(send_wq); destroy_workqueue(recv_wq); } -- 2.39.5