mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 07:31:45 +00:00
ceph: add __send_request helper
Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
9a6bed4fe0
commit
9cf54563b0
@ -2522,6 +2522,26 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* called under mdsc->mutex
|
||||
*/
|
||||
static int __send_request(struct ceph_mds_client *mdsc,
|
||||
struct ceph_mds_session *session,
|
||||
struct ceph_mds_request *req,
|
||||
bool drop_cap_releases)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = __prepare_send_request(mdsc, req, session->s_mds,
|
||||
drop_cap_releases);
|
||||
if (!err) {
|
||||
ceph_msg_get(req->r_request);
|
||||
ceph_con_send(&session->s_con, req->r_request);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* send request, or put it on the appropriate wait list.
|
||||
*/
|
||||
@ -2611,11 +2631,7 @@ static void __do_request(struct ceph_mds_client *mdsc,
|
||||
if (req->r_request_started == 0) /* note request start time */
|
||||
req->r_request_started = jiffies;
|
||||
|
||||
err = __prepare_send_request(mdsc, req, mds, false);
|
||||
if (!err) {
|
||||
ceph_msg_get(req->r_request);
|
||||
ceph_con_send(&session->s_con, req->r_request);
|
||||
}
|
||||
err = __send_request(mdsc, session, req, false);
|
||||
|
||||
out_session:
|
||||
ceph_put_mds_session(session);
|
||||
@ -3217,7 +3233,6 @@ bad:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* called under session->mutex.
|
||||
*/
|
||||
@ -3226,18 +3241,12 @@ static void replay_unsafe_requests(struct ceph_mds_client *mdsc,
|
||||
{
|
||||
struct ceph_mds_request *req, *nreq;
|
||||
struct rb_node *p;
|
||||
int err;
|
||||
|
||||
dout("replay_unsafe_requests mds%d\n", session->s_mds);
|
||||
|
||||
mutex_lock(&mdsc->mutex);
|
||||
list_for_each_entry_safe(req, nreq, &session->s_unsafe, r_unsafe_item) {
|
||||
err = __prepare_send_request(mdsc, req, session->s_mds, true);
|
||||
if (!err) {
|
||||
ceph_msg_get(req->r_request);
|
||||
ceph_con_send(&session->s_con, req->r_request);
|
||||
}
|
||||
}
|
||||
list_for_each_entry_safe(req, nreq, &session->s_unsafe, r_unsafe_item)
|
||||
__send_request(mdsc, session, req, true);
|
||||
|
||||
/*
|
||||
* also re-send old requests when MDS enters reconnect stage. So that MDS
|
||||
@ -3252,14 +3261,8 @@ static void replay_unsafe_requests(struct ceph_mds_client *mdsc,
|
||||
if (req->r_attempts == 0)
|
||||
continue; /* only old requests */
|
||||
if (req->r_session &&
|
||||
req->r_session->s_mds == session->s_mds) {
|
||||
err = __prepare_send_request(mdsc, req,
|
||||
session->s_mds, true);
|
||||
if (!err) {
|
||||
ceph_msg_get(req->r_request);
|
||||
ceph_con_send(&session->s_con, req->r_request);
|
||||
}
|
||||
}
|
||||
req->r_session->s_mds == session->s_mds)
|
||||
__send_request(mdsc, session, req, true);
|
||||
}
|
||||
mutex_unlock(&mdsc->mutex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user