| 2870 | // READs |
| 2871 | |
| 2872 | bool OSDMonitor::preprocess_get_osdmap(MonOpRequestRef op) |
| 2873 | { |
| 2874 | op->mark_osdmon_event(__func__); |
| 2875 | auto m = op->get_req<MMonGetOSDMap>(); |
| 2876 | |
| 2877 | uint64_t features = mon.get_quorum_con_features(); |
| 2878 | if (op->get_session() && op->get_session()->con_features) |
| 2879 | features = op->get_session()->con_features; |
| 2880 | |
| 2881 | dout(10) << __func__ << " " << *m << dendl; |
| 2882 | MOSDMap *reply = new MOSDMap(mon.monmap->fsid, features); |
| 2883 | epoch_t first = get_first_committed(); |
| 2884 | epoch_t last = osdmap.get_epoch(); |
| 2885 | int max = g_conf()->osd_map_message_max; |
| 2886 | ssize_t max_bytes = g_conf()->osd_map_message_max_bytes; |
| 2887 | for (epoch_t e = std::max(first, m->get_full_first()); |
| 2888 | e <= std::min(last, m->get_full_last()) && max > 0 && max_bytes > 0; |
| 2889 | ++e, --max) { |
| 2890 | bufferlist& bl = reply->maps[e]; |
| 2891 | int r = get_version_full(e, features, bl); |
| 2892 | ceph_assert(r >= 0); |
| 2893 | max_bytes -= bl.length(); |
| 2894 | } |
| 2895 | for (epoch_t e = std::max(first, m->get_inc_first()); |
| 2896 | e <= std::min(last, m->get_inc_last()) && max > 0 && max_bytes > 0; |
| 2897 | ++e, --max) { |
| 2898 | bufferlist& bl = reply->incremental_maps[e]; |
| 2899 | int r = get_version(e, features, bl); |
| 2900 | ceph_assert(r >= 0); |
| 2901 | max_bytes -= bl.length(); |
| 2902 | } |
| 2903 | reply->cluster_osdmap_trim_lower_bound = first; |
| 2904 | reply->newest_map = last; |
| 2905 | mon.send_reply(op, reply); |
| 2906 | return true; |
| 2907 | } |
| 2908 | |
| 2909 | |
| 2910 | // --------------------------- |
nothing calls this directly
no test coverage detected