From: Sage Weil Date: Thu, 14 Sep 2017 13:44:06 +0000 (-0400) Subject: osd/PG: expose static methods for ceph-objectstore-tool X-Git-Tag: v13.0.1~634^2~58 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3b300d9b2bd61742a9d947a58e0c57c25c4f12f;p=ceph.git osd/PG: expose static methods for ceph-objectstore-tool Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.h b/src/osd/PG.h index 966d0a42803..b16f88495e5 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -372,6 +372,7 @@ protected: pg_info_t info; ///< current pg info pg_info_t last_written_info; ///< last written info __u8 info_struct_v; +public: static const __u8 cur_struct_v = 10; // v10 is the new past_intervals encoding // v9 was fastinfo_key addition @@ -379,6 +380,7 @@ protected: // v7 was SnapMapper addition in 86658392516d5175b2756659ef7ffaaf95b0f8ad // (first appeared in cuttlefish). static const __u8 compat_struct_v = 10; +protected: bool must_upgrade() { return info_struct_v < cur_struct_v; } @@ -2438,6 +2440,7 @@ protected: // pg on-disk state void do_pending_flush(); +public: static void _create(ObjectStore::Transaction& t, spg_t pgid, int bits); static void _init(ObjectStore::Transaction& t, spg_t pgid, const pg_pool_t *pool); @@ -2448,6 +2451,7 @@ protected: void update_store_with_options(); void update_store_on_load(); +public: static int _prepare_write_info( CephContext* cct, map *km, @@ -2459,6 +2463,7 @@ protected: bool dirty_epoch, bool try_fast_info, PerfCounters *logger = nullptr); +protected: void write_if_dirty(ObjectStore::Transaction& t); PGLog::IndexedLog projected_log; @@ -2489,14 +2494,18 @@ protected: void trim_log(); std::string get_corrupt_pg_log_name() const; +public: static int read_info( ObjectStore *store, spg_t pgid, const coll_t &coll, bufferlist &bl, pg_info_t &info, PastIntervals &past_intervals, __u8 &); +protected: void read_state(ObjectStore *store, bufferlist &bl); +public: static bool _has_removal_flag(ObjectStore *store, spg_t pgid); static int peek_map_epoch(ObjectStore *store, spg_t pgid, epoch_t *pepoch, bufferlist *bl); +protected: void update_snap_map( const vector &log_entries, ObjectStore::Transaction& t); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 37a2e628efb..6e87d959dac 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -3477,7 +3477,7 @@ int main(int argc, char **argv) cerr << "read_info error " << cpp_strerror(ret) << std::endl; goto out; } - if (struct_ver < PG::compat_struct_v) { + if (struct_ver < PG::get_compat_struct_v()) { cerr << "PG is too old to upgrade, use older Ceph version" << std::endl; ret = -EFAULT; goto out;