9p: Add client parameter to p9_req_put()
[ Upstream commit 8b11ff098a
]
This is to aid in adding mempools, in the next patch.
Link: https://lkml.kernel.org/r/20220704014243.153050-2-kent.overstreet@gmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
3ac76cdab9
Коммит
273c16d93f
|
@ -237,7 +237,7 @@ static inline int p9_req_try_get(struct p9_req_t *r)
|
||||||
return refcount_inc_not_zero(&r->refcount);
|
return refcount_inc_not_zero(&r->refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int p9_req_put(struct p9_req_t *r);
|
int p9_req_put(struct p9_client *c, struct p9_req_t *r);
|
||||||
|
|
||||||
void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
|
void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,7 @@ again:
|
||||||
if (!p9_req_try_get(req))
|
if (!p9_req_try_get(req))
|
||||||
goto again;
|
goto again;
|
||||||
if (req->tc.tag != tag) {
|
if (req->tc.tag != tag) {
|
||||||
p9_req_put(req);
|
p9_req_put(c, req);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,10 +369,10 @@ static int p9_tag_remove(struct p9_client *c, struct p9_req_t *r)
|
||||||
spin_lock_irqsave(&c->lock, flags);
|
spin_lock_irqsave(&c->lock, flags);
|
||||||
idr_remove(&c->reqs, tag);
|
idr_remove(&c->reqs, tag);
|
||||||
spin_unlock_irqrestore(&c->lock, flags);
|
spin_unlock_irqrestore(&c->lock, flags);
|
||||||
return p9_req_put(r);
|
return p9_req_put(c, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
int p9_req_put(struct p9_req_t *r)
|
int p9_req_put(struct p9_client *c, struct p9_req_t *r)
|
||||||
{
|
{
|
||||||
if (refcount_dec_and_test(&r->refcount)) {
|
if (refcount_dec_and_test(&r->refcount)) {
|
||||||
p9_fcall_fini(&r->tc);
|
p9_fcall_fini(&r->tc);
|
||||||
|
@ -425,7 +425,7 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status)
|
||||||
|
|
||||||
wake_up(&req->wq);
|
wake_up(&req->wq);
|
||||||
p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag);
|
p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag);
|
||||||
p9_req_put(req);
|
p9_req_put(c, req);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(p9_client_cb);
|
EXPORT_SYMBOL(p9_client_cb);
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ static struct p9_req_t *p9_client_prepare_req(struct p9_client *c,
|
||||||
reterr:
|
reterr:
|
||||||
p9_tag_remove(c, req);
|
p9_tag_remove(c, req);
|
||||||
/* We have to put also the 2nd reference as it won't be used */
|
/* We have to put also the 2nd reference as it won't be used */
|
||||||
p9_req_put(req);
|
p9_req_put(c, req);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
|
||||||
err = c->trans_mod->request(c, req);
|
err = c->trans_mod->request(c, req);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
/* write won't happen */
|
/* write won't happen */
|
||||||
p9_req_put(req);
|
p9_req_put(c, req);
|
||||||
if (err != -ERESTARTSYS && err != -EFAULT)
|
if (err != -ERESTARTSYS && err != -EFAULT)
|
||||||
c->status = Disconnected;
|
c->status = Disconnected;
|
||||||
goto recalc_sigpending;
|
goto recalc_sigpending;
|
||||||
|
|
|
@ -380,7 +380,7 @@ static void p9_read_work(struct work_struct *work)
|
||||||
m->rc.sdata = NULL;
|
m->rc.sdata = NULL;
|
||||||
m->rc.offset = 0;
|
m->rc.offset = 0;
|
||||||
m->rc.capacity = 0;
|
m->rc.capacity = 0;
|
||||||
p9_req_put(m->rreq);
|
p9_req_put(m->client, m->rreq);
|
||||||
m->rreq = NULL;
|
m->rreq = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ static void p9_write_work(struct work_struct *work)
|
||||||
m->wpos += err;
|
m->wpos += err;
|
||||||
if (m->wpos == m->wsize) {
|
if (m->wpos == m->wsize) {
|
||||||
m->wpos = m->wsize = 0;
|
m->wpos = m->wsize = 0;
|
||||||
p9_req_put(m->wreq);
|
p9_req_put(m->client, m->wreq);
|
||||||
m->wreq = NULL;
|
m->wreq = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
|
||||||
if (req->status == REQ_STATUS_UNSENT) {
|
if (req->status == REQ_STATUS_UNSENT) {
|
||||||
list_del(&req->req_list);
|
list_del(&req->req_list);
|
||||||
req->status = REQ_STATUS_FLSHD;
|
req->status = REQ_STATUS_FLSHD;
|
||||||
p9_req_put(req);
|
p9_req_put(client, req);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
spin_unlock(&client->lock);
|
spin_unlock(&client->lock);
|
||||||
|
@ -724,7 +724,7 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
|
||||||
list_del(&req->req_list);
|
list_del(&req->req_list);
|
||||||
req->status = REQ_STATUS_FLSHD;
|
req->status = REQ_STATUS_FLSHD;
|
||||||
spin_unlock(&client->lock);
|
spin_unlock(&client->lock);
|
||||||
p9_req_put(req);
|
p9_req_put(client, req);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -885,12 +885,12 @@ static void p9_conn_destroy(struct p9_conn *m)
|
||||||
p9_mux_poll_stop(m);
|
p9_mux_poll_stop(m);
|
||||||
cancel_work_sync(&m->rq);
|
cancel_work_sync(&m->rq);
|
||||||
if (m->rreq) {
|
if (m->rreq) {
|
||||||
p9_req_put(m->rreq);
|
p9_req_put(m->client, m->rreq);
|
||||||
m->rreq = NULL;
|
m->rreq = NULL;
|
||||||
}
|
}
|
||||||
cancel_work_sync(&m->wq);
|
cancel_work_sync(&m->wq);
|
||||||
if (m->wreq) {
|
if (m->wreq) {
|
||||||
p9_req_put(m->wreq);
|
p9_req_put(m->client, m->wreq);
|
||||||
m->wreq = NULL;
|
m->wreq = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc)
|
||||||
c->busa, c->req->tc.size,
|
c->busa, c->req->tc.size,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
up(&rdma->sq_sem);
|
up(&rdma->sq_sem);
|
||||||
p9_req_put(c->req);
|
p9_req_put(client, c->req);
|
||||||
kfree(c);
|
kfree(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req)
|
||||||
/* Reply won't come, so drop req ref */
|
/* Reply won't come, so drop req ref */
|
||||||
static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *req)
|
static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *req)
|
||||||
{
|
{
|
||||||
p9_req_put(req);
|
p9_req_put(client, req);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ err_out:
|
||||||
kvfree(out_pages);
|
kvfree(out_pages);
|
||||||
if (!kicked) {
|
if (!kicked) {
|
||||||
/* reply won't come */
|
/* reply won't come */
|
||||||
p9_req_put(req);
|
p9_req_put(client, req);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ again:
|
||||||
ring->intf->out_prod = prod;
|
ring->intf->out_prod = prod;
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->lock, flags);
|
||||||
notify_remote_via_irq(ring->irq);
|
notify_remote_via_irq(ring->irq);
|
||||||
p9_req_put(p9_req);
|
p9_req_put(client, p9_req);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче