From c7fb0958c15d48540644aef84208bd7f4d704d97 Mon Sep 17 00:00:00 2001 From: patiencew Date: Thu, 8 Nov 2007 19:30:13 +0000 Subject: [PATCH] more code git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2037 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/kernel/messenger.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/trunk/ceph/kernel/messenger.c b/trunk/ceph/kernel/messenger.c index 999c49f541e1c..3861186cfaa86 100644 --- a/trunk/ceph/kernel/messenger.c +++ b/trunk/ceph/kernel/messenger.c @@ -661,27 +661,36 @@ static struct ceph_messenger *new_messenger() { struct ceph_messenger *msgr; struct ceph_connection *con; + struct ceph_poll_task ptsk; + struct ceph_poll_task pfiles; msgr = kmalloc(sizeof(struct ceph_messenger), GFP_KERNEL); if (msgr == NULL) return 0; memset(&msgr, 0, sizeof(msgr)); - con = kmalloc(sizeof(struct ceph_connection), GFP_KERNEL); - if (con == NULL) return 0; - memset(&con, 0, sizeof(con)); + ptsk = kmalloc(sizeof(struct ceph_poll_task), GFP_KERNEL); + if (ptsk == NULL) { + kfree(msgr); + return 0; + } + memset(&ptsk, 0, sizeof(ptsk)); + + pfiles = kmalloc(sizeof(struct ceph_poll_task), GFP_KERNEL); + if (pfiles == NULL) { + kfree(msgr); + kfree(ptsk); + return 0; + } + memset(pfiles, 0, sizeof(pfiles)); /* create listener connection */ - spin_lock_init(&con->con_lock); - INIT_WORK(&con->awork, try_accept); /* setup work structure */ - con->msgr = msgr; - atomic_inc(&con->nref); + con = new_listener(msgr); + pfiles->con = con; + pfiles->file = con->sock->file; + ptsk->pfiles = pfiles /* start up poll thread */ - athread = kthread_run(ceph_poll, NULL, "ceph poll thread"); */ + ptsk->poll_task = kthread_run(ceph_poll, msgr, "ceph-poll"); + msgr->poll_task = ptsk; return msgr; } - -struct ceph_messenger *init_messenger() -{ - -} -- 2.39.5