]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify dout_prefix macros 2198/head
authorSage Weil <sage@redhat.com>
Mon, 4 Aug 2014 22:01:15 +0000 (15:01 -0700)
committerSage Weil <sage@redhat.com>
Mon, 4 Aug 2014 22:01:15 +0000 (15:01 -0700)
Use a get_osdmap_epoch() helper that is a bit lighter weight (by avoiding
copying around an OSDMapRef).

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 800732c8a714f374234f6b646dd46e29fcd95433..307def8f5f78a6c4ff3f527902ea71e1b0811b90 100644 (file)
 
 #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
 
index 2ae77e3523f52e4ef52246058f9bb8b798089ea9..4608c0ff59a722e562fe22919bfdf0f9846bd90e 100644 (file)
@@ -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<OpRequestRef>  waiting_for_osdmap;