MCPcopy Create free account
hub / github.com/ceph/ceph / send_request

Method send_request

src/client/Client.cc:2807–2857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2805}
2806
2807void Client::send_request(MetaRequest *request, MetaSession *session,
2808 bool drop_cap_releases)
2809{
2810 // make the request
2811 mds_rank_t mds = session->mds_num;
2812 ldout(cct, 10) << __func__ << " rebuilding request " << request->get_tid()
2813 << " for mds." << mds << dendl;
2814 auto r = build_client_request(request, mds);
2815 if (!r)
2816 return;
2817
2818 if (request->dentry()) {
2819 r->set_dentry_wanted();
2820 }
2821 if (request->got_unsafe) {
2822 r->set_replayed_op();
2823 if (request->target)
2824 r->head.ino = request->target->ino;
2825 } else {
2826 encode_cap_releases(request, mds);
2827 if (drop_cap_releases) // we haven't send cap reconnect yet, drop cap releases
2828 request->cap_releases.clear();
2829 else
2830 r->releases.swap(request->cap_releases);
2831 }
2832 r->set_mdsmap_epoch(mdsmap->get_epoch());
2833 if (r->head.op == CEPH_MDS_OP_SETXATTR) {
2834 objecter->with_osdmap([r](const OSDMap& o) {
2835 r->set_osdmap_epoch(o.get_epoch());
2836 });
2837 }
2838
2839 if (request->mds == -1) {
2840 request->sent_stamp = ceph_clock_now();
2841 ldout(cct, 20) << __func__ << " set sent_stamp to " << request->sent_stamp << dendl;
2842 }
2843 request->mds = mds;
2844
2845 Inode *in = request->inode();
2846 if (in) {
2847 auto it = in->caps.find(mds);
2848 if (it != in->caps.end()) {
2849 request->sent_on_mseq = it->second.mseq;
2850 }
2851 }
2852
2853 session->requests.push_back(&request->item);
2854
2855 ldout(cct, 10) << __func__ << " " << *r << " to mds." << mds << dendl;
2856 session->con->send_message2(std::move(r));
2857}
2858
2859ref_t<MClientRequest> Client::build_client_request(MetaRequest *request, mds_rank_t mds)
2860{

Callers

nothing calls this directly

Calls 15

ceph_clock_nowFunction · 0.85
set_replayed_opMethod · 0.80
set_osdmap_epochMethod · 0.80
inodeMethod · 0.80
send_message2Method · 0.80
get_tidMethod · 0.45
dentryMethod · 0.45
set_dentry_wantedMethod · 0.45
clearMethod · 0.45
swapMethod · 0.45
set_mdsmap_epochMethod · 0.45
get_epochMethod · 0.45

Tested by

no test coverage detected