From: Sage Weil Date: Mon, 4 Aug 2014 22:01:15 +0000 (-0700) Subject: osd: simplify dout_prefix macros X-Git-Tag: v0.84~25^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2198%2Fhead;p=ceph.git osd: simplify dout_prefix macros Use a get_osdmap_epoch() helper that is a bit lighter weight (by avoiding copying around an OSDMapRef). Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 800732c8a714..307def8f5f78 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -135,12 +135,10 @@ #define dout_subsys ceph_subsys_osd #undef dout_prefix -#define dout_prefix _prefix(_dout, whoami, get_osdmap()) +#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch()) -static ostream& _prefix(std::ostream* _dout, int whoami, OSDMapRef osdmap) { - return *_dout << "osd." << whoami << " " - << (osdmap ? osdmap->get_epoch():0) - << " "; +static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) { + return *_dout << "osd." << whoami << " " << epoch << " "; } //Initial features in new superblock. @@ -1610,7 +1608,7 @@ int OSD::peek_meta(ObjectStore *store, std::string& magic, #undef dout_prefix -#define dout_prefix _prefix(_dout, whoami, osdmap) +#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch()) // cons/des diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 2ae77e3523f5..4608c0ff59a7 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -390,6 +390,10 @@ public: Mutex::Locker l(publish_lock); return osdmap; } + epoch_t get_osdmap_epoch() { + Mutex::Locker l(publish_lock); + return osdmap ? osdmap->get_epoch() : 0; + } void publish_map(OSDMapRef map) { Mutex::Locker l(publish_lock); osdmap = map; @@ -1531,6 +1535,10 @@ private: OSDMapRef get_osdmap() { return osdmap; } + epoch_t get_osdmap_epoch() { + return osdmap ? osdmap->get_epoch() : 0; + } + utime_t had_map_since; RWLock map_lock; list waiting_for_osdmap;