* @lock: protects mux_list (?)
* @mux_list: list link for mux to manage multiple connections (?)
* @client: reference to client instance for this connection
- * @tagpool: id accounting for transactions
* @err: error state
* @req_list: accounting for requests which have been sent
* @unsent_req_list: accounting for requests that haven't been sent
spinlock_t lock; /* protect lock structure */
struct list_head mux_list;
struct p9_client *client;
- struct p9_idpool *tagpool;
int err;
struct list_head req_list;
struct list_head unsent_req_list;
static struct workqueue_struct *p9_mux_wq;
static struct task_struct *p9_poll_task;
-static u16 p9_mux_get_tag(struct p9_conn *m)
-{
- int tag;
-
- tag = p9_idpool_get(m->tagpool);
- if (tag < 0)
- return P9_NOTAG;
- else
- return (u16) tag;
-}
-
-static void p9_mux_put_tag(struct p9_conn *m, u16 tag)
-{
- if (tag != P9_NOTAG && p9_idpool_check(tag, m->tagpool))
- p9_idpool_put(tag, m->tagpool);
-}
-
static void p9_mux_poll_stop(struct p9_conn *m)
{
unsigned long flags;
static void p9_mux_free_request(struct p9_conn *m, struct p9_req *req)
{
- p9_mux_put_tag(m, req->tag);
+ if (req->tag != P9_NOTAG &&
+ p9_idpool_check(req->tag, m->client->tagpool))
+ p9_idpool_put(req->tag, m->client->tagpool);
kfree(req);
}
spin_lock_init(&m->lock);
INIT_LIST_HEAD(&m->mux_list);
m->client = client;
- m->tagpool = p9_idpool_create();
- if (IS_ERR(m->tagpool)) {
- kfree(m);
- return ERR_PTR(-ENOMEM);
- }
INIT_LIST_HEAD(&m->req_list);
INIT_LIST_HEAD(&m->unsent_req_list);
if (!req)
return ERR_PTR(-ENOMEM);
- if (tc->id == P9_TVERSION)
- n = P9_NOTAG;
- else
- n = p9_mux_get_tag(m);
-
- if (n < 0) {
- kfree(req);
- return ERR_PTR(-ENOMEM);
+ n = P9_NOTAG;
+ if (tc->id != P9_TVERSION) {
+ n = p9_idpool_get(m->client->tagpool);
+ if (n < 0) {
+ kfree(req);
+ return ERR_PTR(-ENOMEM);
+ }
}
p9_set_tag(tc, n);
p9_conn_cancel(m, -ECONNRESET);
m->client = NULL;
- p9_idpool_destroy(m->tagpool);
kfree(m);
}