From 771d0b3633a2c304df9893411b9b8f569b8497a6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 22 Dec 2014 14:43:46 -0800 Subject: [PATCH] osd: add coll_t is_temp() and is_meta() Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 8 ++++++++ src/osd/osd_types.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index eeaab4db0ebb9..c17d03de9fc87 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -548,6 +548,14 @@ ostream& operator<<(ostream& out, const pg_t &pg) // -- coll_t -- +bool coll_t::is_temp() const +{ + if (str.length() > 5 && + strncmp(str.c_str() + str.length() - 5, "_TEMP", 5) == 0) + return true; + return false; +} + bool coll_t::is_temp(spg_t& pgid) const { const char *cstr(str.c_str()); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index b21e68044d3f3..ab349dfe1d0cf 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -506,9 +506,13 @@ public: return str < rhs.str; } + bool is_meta() const { + return str == string("meta"); + } bool is_pg_prefix(spg_t& pgid) const; bool is_pg(spg_t& pgid, snapid_t& snap) const; bool is_temp(spg_t& pgid) const; + bool is_temp() const; bool is_removal(uint64_t *seq, spg_t *pgid) const; void encode(bufferlist& bl) const; void decode(bufferlist::iterator& bl); -- 2.39.5