From: xinxin shu Date: Thu, 29 Jan 2015 18:05:11 +0000 (+0800) Subject: add is_acting_osd function to check if pg is on that osd X-Git-Tag: v0.93~65^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e046bde5a83b4aeea74f34951453c4143bd55ae;p=ceph.git add is_acting_osd function to check if pg is on that osd Signed-off-by: xinxin shu --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 18998bfca7e..139ea8628a3 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1751,6 +1751,21 @@ void object_stat_collection_t::generate_test_instances(list::const_iterator it = acting.begin(); + it != acting.end(); it++) + { + if (*it == osd) + return true; + } + } + return false; +} + void pg_stat_t::dump(Formatter *f) const { f->dump_stream("version") << version; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index f08ff93f31f..02a88f0020c 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1493,6 +1493,7 @@ struct pg_stat_t { ondisk_log_size -= o.ondisk_log_size; } + bool is_acting_osd(int32_t osd, bool primary) const; void dump(Formatter *f) const; void dump_brief(Formatter *f) const; void encode(bufferlist &bl) const;