Skip to content

Commit

Permalink
Merge pull request #14780 from liewegas/wip-osdmap-mempool
Browse files Browse the repository at this point in the history
osd: put osdmap in mempool

Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
liewegas committed Apr 26, 2017
2 parents b584c7e + 64ae61a commit 3608a00
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 187 deletions.
3 changes: 2 additions & 1 deletion src/crush/CrushWrapper.h
Expand Up @@ -1208,8 +1208,9 @@ class CrushWrapper {
choose_args.clear();
}

template<typename WeightVector>
void do_rule(int rule, int x, vector<int>& out, int maxout,
const vector<__u32>& weight,
const WeightVector& weight,
uint64_t choose_args_index) const {
int rawout[maxout];
char work[crush_work_size(crush, maxout)];
Expand Down
51 changes: 24 additions & 27 deletions src/include/encoding.h
Expand Up @@ -389,7 +389,7 @@ inline typename std::enable_if<!traits::supported>::type
{
__u32 n = (__u32)(ls.size()); // c++11 std::list::size() is O(1)
encode(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(*p, bl);
}
template<class T, class Alloc, typename traits=denc_traits<T>>
Expand All @@ -401,7 +401,7 @@ inline typename std::enable_if<!traits::supported>::type
unsigned pos = bl.length();
unsigned n = 0;
encode(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p) {
for (auto p = ls.begin(); p != ls.end(); ++p) {
n++;
encode(*p, bl, features);
}
Expand All @@ -411,7 +411,7 @@ inline typename std::enable_if<!traits::supported>::type
} else {
__u32 n = (__u32)(ls.size()); // FIXME: this is slow on a list.
encode(n, bl);
for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(*p, bl, features);
}
}
Expand All @@ -436,7 +436,7 @@ inline void encode(const std::list<ceph::shared_ptr<T>, Alloc>& ls,
{
__u32 n = (__u32)(ls.size()); // c++11 std::list::size() is O(1)
encode(n, bl);
for (typename std::list<ceph::shared_ptr<T> >::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(**p, bl);
}
template<class T, class Alloc>
Expand All @@ -445,7 +445,7 @@ inline void encode(const std::list<ceph::shared_ptr<T>, Alloc>& ls,
{
__u32 n = (__u32)(ls.size()); // c++11 std::list::size() is O(1)
encode(n, bl);
for (typename std::list<ceph::shared_ptr<T> >::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(**p, bl, features);
}
template<class T, class Alloc>
Expand All @@ -469,7 +469,7 @@ inline typename std::enable_if<!traits::supported>::type
{
__u32 n = (__u32)(s.size());
encode(n, bl);
for (typename std::set<T>::const_iterator p = s.begin(); p != s.end(); ++p)
for (auto p = s.begin(); p != s.end(); ++p)
encode(*p, bl);
}
template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
Expand All @@ -490,7 +490,7 @@ template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
inline typename std::enable_if<!traits::supported>::type
encode_nohead(const std::set<T,Comp,Alloc>& s, bufferlist& bl)
{
for (typename std::set<T,Comp>::const_iterator p = s.begin(); p != s.end(); ++p)
for (auto p = s.begin(); p != s.end(); ++p)
encode(*p, bl);
}
template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
Expand Down Expand Up @@ -554,7 +554,7 @@ inline void encode(const std::multiset<T,Comp,Alloc>& s, bufferlist& bl)
{
__u32 n = (__u32)(s.size());
encode(n, bl);
for (typename std::multiset<T,Comp>::const_iterator p = s.begin(); p != s.end(); ++p)
for (auto p = s.begin(); p != s.end(); ++p)
encode(*p, bl);
}
template<class T, class Comp, class Alloc>
Expand Down Expand Up @@ -623,7 +623,7 @@ template<class T, class Alloc, typename traits=denc_traits<T>>
inline typename std::enable_if<!traits::supported>::type
encode_nohead(const std::vector<T,Alloc>& v, bufferlist& bl)
{
for (typename std::vector<T>::const_iterator p = v.begin(); p != v.end(); ++p)
for (auto p = v.begin(); p != v.end(); ++p)
encode(*p, bl);
}
template<class T, class Alloc, typename traits=denc_traits<T>>
Expand All @@ -643,7 +643,7 @@ inline void encode(const std::vector<ceph::shared_ptr<T>,Alloc>& v,
{
__u32 n = (__u32)(v.size());
encode(n, bl);
for (typename std::vector<ceph::shared_ptr<T> >::const_iterator p = v.begin(); p != v.end(); ++p)
for (auto p = v.begin(); p != v.end(); ++p)
if (*p)
encode(**p, bl, features);
else
Expand All @@ -655,7 +655,7 @@ inline void encode(const std::vector<ceph::shared_ptr<T>,Alloc>& v,
{
__u32 n = (__u32)(v.size());
encode(n, bl);
for (typename std::vector<ceph::shared_ptr<T> >::const_iterator p = v.begin(); p != v.end(); ++p)
for (auto p = v.begin(); p != v.end(); ++p)
if (*p)
encode(**p, bl);
else
Expand Down Expand Up @@ -708,7 +708,7 @@ inline typename std::enable_if<!t_traits::supported ||
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename std::map<T,U,Comp>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl);
encode(p->second, bl);
}
Expand All @@ -721,7 +721,7 @@ inline typename std::enable_if<!t_traits::supported ||
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename std::map<T,U,Comp>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl, features);
encode(p->second, bl, features);
}
Expand Down Expand Up @@ -758,7 +758,7 @@ inline typename std::enable_if<!t_traits::supported ||
!u_traits::supported>::type
encode_nohead(const std::map<T,U,Comp,Alloc>& m, bufferlist& bl)
{
for (typename std::map<T,U,Comp>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl);
encode(p->second, bl);
}
Expand All @@ -769,7 +769,7 @@ inline typename std::enable_if<!t_traits::supported ||
!u_traits::supported>::type
encode_nohead(const std::map<T,U,Comp,Alloc>& m, bufferlist& bl, uint64_t features)
{
for (typename std::map<T,U,Comp>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl, features);
encode(p->second, bl, features);
}
Expand Down Expand Up @@ -812,8 +812,7 @@ template<class T, class U, class Comp, class Alloc,
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename boost::container::flat_map<T,U,Comp>::const_iterator p
= m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl, features);
encode(p->second, bl, features);
}
Expand Down Expand Up @@ -852,8 +851,7 @@ template<class T, class U, class Comp, class Alloc,
encode_nohead(const boost::container::flat_map<T,U,Comp,Alloc>& m,
bufferlist& bl)
{
for (typename boost::container::flat_map<T,U,Comp>::const_iterator p
= m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl);
encode(p->second, bl);
}
Expand All @@ -865,8 +863,7 @@ template<class T, class U, class Comp, class Alloc,
encode_nohead(const boost::container::flat_map<T,U,Comp,Alloc>& m,
bufferlist& bl, uint64_t features)
{
for (typename boost::container::flat_map<T,U,Comp>::const_iterator p
= m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl, features);
encode(p->second, bl, features);
}
Expand All @@ -892,7 +889,7 @@ inline void encode(const std::multimap<T,U,Comp,Alloc>& m, bufferlist& bl)
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename std::multimap<T,U,Comp>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl);
encode(p->second, bl);
}
Expand All @@ -918,7 +915,7 @@ inline void encode(const unordered_map<T,U,Hash,Pred,Alloc>& m, bufferlist& bl,
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename unordered_map<T,U,Hash,Pred>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl, features);
encode(p->second, bl, features);
}
Expand All @@ -928,7 +925,7 @@ inline void encode(const unordered_map<T,U,Hash,Pred,Alloc>& m, bufferlist& bl)
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename unordered_map<T,U,Hash,Pred,Alloc>::const_iterator p = m.begin(); p != m.end(); ++p) {
for (auto p = m.begin(); p != m.end(); ++p) {
encode(p->first, bl);
encode(p->second, bl);
}
Expand All @@ -952,7 +949,7 @@ inline void encode(const ceph::unordered_set<T,Hash,Pred,Alloc>& m, bufferlist&
{
__u32 n = (__u32)(m.size());
encode(n, bl);
for (typename ceph::unordered_set<T,Hash,Pred>::const_iterator p = m.begin(); p != m.end(); ++p)
for (auto p = m.begin(); p != m.end(); ++p)
encode(*p, bl);
}
template<class T, class Hash, class Pred, class Alloc>
Expand All @@ -974,15 +971,15 @@ inline void encode(const std::deque<T,Alloc>& ls, bufferlist& bl, uint64_t featu
{
__u32 n = ls.size();
encode(n, bl);
for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(*p, bl, features);
}
template<class T, class Alloc>
inline void encode(const std::deque<T,Alloc>& ls, bufferlist& bl)
{
__u32 n = ls.size();
encode(n, bl);
for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
for (auto p = ls.begin(); p != ls.end(); ++p)
encode(*p, bl);
}
template<class T, class Alloc>
Expand Down
1 change: 1 addition & 0 deletions src/include/mempool.h
Expand Up @@ -149,6 +149,7 @@ namespace mempool {
f(buffer_meta) \
f(buffer_data) \
f(osd) \
f(osdmap) \
f(osdmap_mapping) \
f(unittest_1) \
f(unittest_2)
Expand Down
2 changes: 1 addition & 1 deletion src/mgr/DaemonServer.cc
Expand Up @@ -572,7 +572,7 @@ bool DaemonServer::handle_command(MCommand *m)
string no_increasing;
cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
string out_str;
map<int32_t, uint32_t> new_weights;
mempool::osdmap::map<int32_t, uint32_t> new_weights;
r = cluster_state.with_pgmap([&](const PGMap& pgmap) {
return cluster_state.with_osdmap([&](const OSDMap& osdmap) {
return reweight::by_utilization(osdmap, pgmap,
Expand Down

0 comments on commit 3608a00

Please sign in to comment.