@@ -395,18 +395,19 @@ void MDSMap::get_health(list<pair<health_status_t,string> >& summary,
395395
396396void MDSMap::mds_info_t::encode_versioned (bufferlist& bl, uint64_t features) const
397397{
398- ENCODE_START (4 , 4 , bl);
398+ ENCODE_START (5 , 4 , bl);
399399 ::encode (global_id, bl);
400400 ::encode (name, bl);
401401 ::encode (rank, bl);
402402 ::encode (inc, bl);
403403 ::encode ((int32_t )state, bl);
404404 ::encode (state_seq, bl);
405- ::encode (addr, bl);
405+ ::encode (addr, bl, features );
406406 ::encode (laggy_since, bl);
407407 ::encode (standby_for_rank, bl);
408408 ::encode (standby_for_name, bl);
409409 ::encode (export_targets, bl);
410+ ::encode (mds_features, bl);
410411 ENCODE_FINISH (bl);
411412}
412413
@@ -420,7 +421,7 @@ void MDSMap::mds_info_t::encode_unversioned(bufferlist& bl) const
420421 ::encode (inc, bl);
421422 ::encode ((int32_t )state, bl);
422423 ::encode (state_seq, bl);
423- ::encode (addr, bl);
424+ ::encode (addr, bl, 0 );
424425 ::encode (laggy_since, bl);
425426 ::encode (standby_for_rank, bl);
426427 ::encode (standby_for_name, bl);
@@ -429,7 +430,7 @@ void MDSMap::mds_info_t::encode_unversioned(bufferlist& bl) const
429430
430431void MDSMap::mds_info_t::decode (bufferlist::iterator& bl)
431432{
432- DECODE_START_LEGACY_COMPAT_LEN (4 , 4 , 4 , bl);
433+ DECODE_START_LEGACY_COMPAT_LEN (5 , 4 , 4 , bl);
433434 ::decode (global_id, bl);
434435 ::decode (name, bl);
435436 ::decode (rank, bl);
@@ -442,6 +443,10 @@ void MDSMap::mds_info_t::decode(bufferlist::iterator& bl)
442443 ::decode (standby_for_name, bl);
443444 if (struct_v >= 2 )
444445 ::decode (export_targets, bl);
446+ if (struct_v >= 5 )
447+ ::decode (mds_features, bl);
448+ else
449+ mds_features = 0 ;
445450 DECODE_FINISH (bl);
446451}
447452
@@ -634,4 +639,29 @@ void MDSMap::decode(bufferlist::iterator& p)
634639 ::decode (damaged, p);
635640 }
636641 DECODE_FINISH (p);
642+
643+ decode_post ();
644+ }
645+
646+
647+ void MDSMap::calc_up_in_features ()
648+ {
649+ in_features = 0 ;
650+ bool first = true ;
651+ for (set<int32_t >::iterator p = in.begin (); p != in.end (); ++p) {
652+ if (first)
653+ in_features = mds_info[up[*p]].mds_features ;
654+ else
655+ in_features &= mds_info[up[*p]].mds_features ;
656+ }
657+
658+ up_features = 0 ;
659+ for (map<uint64_t , mds_info_t >::iterator p = mds_info.begin ();
660+ p != mds_info.end ();
661+ ++p) {
662+ if (first)
663+ up_features = p->second .mds_features ;
664+ else
665+ up_features &= p->second .mds_features ;
666+ }
637667}
0 commit comments