mirror of
https://github.com/ceph/ceph
synced 2024-12-26 21:43:10 +00:00
client: move all mds selection code into choose_target_mds
This commit is contained in:
parent
060d22d043
commit
4f2f78dd0e
@ -712,6 +712,12 @@ int Client::choose_target_mds(MetaRequest *req)
|
||||
{
|
||||
int mds = 0;
|
||||
|
||||
if (req->resend_mds >= 0) {
|
||||
mds = req->resend_mds;
|
||||
req->resend_mds = -1;
|
||||
dout(10) << "target resend_mds specified as mds" << mds << dendl;
|
||||
return mds;
|
||||
}
|
||||
// find deepest known prefix
|
||||
Inode *diri = root; // the deepest known containing dir
|
||||
Inode *item = 0; // the actual item... if we know it
|
||||
@ -768,6 +774,12 @@ int Client::choose_target_mds(MetaRequest *req)
|
||||
<< " mds" << mds << dendl;
|
||||
}
|
||||
}
|
||||
|
||||
if (mds < 0) {
|
||||
mds = mdsmap->get_random_up_mds();
|
||||
if (mds < 0) mds = 0; //why is this necessary?
|
||||
dout(10) << "did not get mds through better means, so chose random mds " << mds << dendl;
|
||||
}
|
||||
dout(20) << "mds is " << mds << dendl;
|
||||
|
||||
return mds;
|
||||
@ -840,20 +852,7 @@ int Client::make_request(MetaRequest *request,
|
||||
// choose mds
|
||||
int mds;
|
||||
// force use of a particular mds?
|
||||
if (request->resend_mds >= 0) {
|
||||
mds = request->resend_mds;
|
||||
request->resend_mds = -1;
|
||||
dout(10) << "target resend_mds specified as mds" << mds << dendl;
|
||||
} else {
|
||||
mds = choose_target_mds(request);
|
||||
if (mds >= 0) {
|
||||
dout(10) << "chose target mds" << mds << " based on hierarchy" << dendl;
|
||||
} else {
|
||||
mds = mdsmap->get_random_up_mds();
|
||||
if (mds < 0) mds = 0; // hrm.
|
||||
dout(10) << "chose random target mds" << mds << " for lack of anything better" << dendl;
|
||||
}
|
||||
}
|
||||
mds = choose_target_mds(request);
|
||||
|
||||
// open a session?
|
||||
if (mds_sessions.count(mds) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user