]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: omit lock state in debug output when it's uninteresting (sync, no locks)
authorSage Weil <sage@newdream.net>
Thu, 26 Aug 2010 04:31:34 +0000 (21:31 -0700)
committerSage Weil <sage@newdream.net>
Thu, 26 Aug 2010 04:36:19 +0000 (21:36 -0700)
src/mds/CDentry.cc
src/mds/CInode.cc
src/mds/ScatterLock.h
src/mds/SimpleLock.h

index 6abba341d3ae0a8ddc8848f300074d323b1efff8..2a9e1fbcb732c37910220d97afd4877e9693667d 100644 (file)
@@ -85,8 +85,10 @@ ostream& operator<<(ostream& out, CDentry& dn)
     out << ")";
   }
 
-  out << " " << dn.lock;
-  out << " " << dn.versionlock;
+  if (!dn.lock.is_sync_and_unlocked())
+    out << " " << dn.lock;
+  if (!dn.versionlock.is_sync_and_unlocked())
+    out << " " << dn.versionlock;
 
   if (dn.get_projected_version() != dn.get_version())
     out << " pv=" << dn.get_projected_version();
index 0ee4648d20fe89998a499f764d4ebc700ebfdc1a..aaa0e7503408a6857d2393c321735214c72fc5ea 100644 (file)
@@ -149,18 +149,27 @@ ostream& operator<<(ostream& out, CInode& in)
 
 
   // locks
-  out << " " << in.authlock;
-  out << " " << in.linklock;
+  if (!in.authlock.is_sync_and_unlocked())
+    out << " " << in.authlock;
+  if (!in.linklock.is_sync_and_unlocked())
+    out << " " << in.linklock;
   if (in.inode.is_dir()) {
-    out << " " << in.dirfragtreelock;
-    out << " " << in.snaplock;
-    out << " " << in.nestlock;
+    if (!in.dirfragtreelock.is_sync_and_unlocked())
+      out << " " << in.dirfragtreelock;
+    if (!in.snaplock.is_sync_and_unlocked())
+      out << " " << in.snaplock;
+    if (!in.nestlock.is_sync_and_unlocked())
+      out << " " << in.nestlock;
   } else  {
-    out << " " << in.flocklock;
+    if (!in.flocklock.is_sync_and_unlocked())
+      out << " " << in.flocklock;
   }
-  out << " " << in.filelock;
-  out << " " << in.xattrlock;
-  out << " " << in.versionlock;
+  if (!in.filelock.is_sync_and_unlocked())
+    out << " " << in.filelock;
+  if (!in.xattrlock.is_sync_and_unlocked())
+    out << " " << in.xattrlock;
+  if (!in.versionlock.is_sync_and_unlocked())  
+    out << " " << in.versionlock;
 
   // hack: spit out crap on which clients have caps
   if (in.inode.client_ranges.size())
index ffcdbee4a2da3ccb7e56a86168702cb170bddc61..ea593e41eb99cbaff74f81b3793aceacc95b9df8 100644 (file)
@@ -40,7 +40,7 @@ class ScatterLock : public SimpleLock {
   };
   more_bits_t *_more;
 
-  bool have_more() { return _more ? true : false; }
+  bool have_more() const { return _more ? true : false; }
   void try_clear_more() {
     if (_more && _more->empty()) {
       delete _more;
@@ -64,6 +64,14 @@ public:
     }
   }
 
+  bool is_sync_and_unlocked() const {
+    return
+      SimpleLock::is_sync_and_unlocked() && 
+      !is_dirty() &&
+      !is_flushing();
+  }
+
+
   xlist<ScatterLock*>::item *get_updated_item() { return &more()->item_updated; }
   utime_t get_update_stamp() { return more()->update_stamp; }
   void set_update_stamp(utime_t t) { more()->update_stamp = t; }
@@ -79,10 +87,10 @@ public:
     return have_more() ? _more->scatter_wanted : false; 
   }
 
-  bool is_dirty() {
+  bool is_dirty() const {
     return have_more() ? _more->dirty : false;
   }
-  bool is_flushing() {
+  bool is_flushing() const {
     return have_more() ? _more->flushing : false;
   }
 
index a686aa19ab41ece428bfb1203c52f309a8648271..1151c3305148c1a9e4114dbfee793ca4fa789eea 100644 (file)
@@ -298,7 +298,7 @@ public:
   
 
   // state
-  int get_state() { return state; }
+  int get_state() const { return state; }
   int set_state(int s) { 
     state = s; 
     //assert(!is_stable() || gather_set.size() == 0);  // gather should be empty in stable states.
@@ -314,13 +314,24 @@ public:
     take_waiting(SimpleLock::WAIT_ALL, waiters);
   }
 
-  bool is_stable() {
+  bool is_stable() const {
     return get_sm()->states[state].next == 0;
   }
   int get_next_state() {
     return get_sm()->states[state].next;
   }
 
+
+  bool is_sync_and_unlocked() const {
+    return
+      get_state() == LOCK_SYNC &&
+      !is_rdlocked() &&
+      !is_leased() &&
+      !is_wrlocked() &&
+      !is_xlocked();
+  }
+
+
   /*
   bool fw_rdlock_to_auth() {
     return get_sm()->states[state].can_rdlock == FW;
@@ -397,7 +408,7 @@ public:
   }
 
   // rdlock
-  bool is_rdlocked() { return num_rdlock > 0; }
+  bool is_rdlocked() const { return num_rdlock > 0; }
   int get_rdlock() { 
     if (!num_rdlock)
       parent->get(MDSCacheObject::PIN_LOCK);
@@ -426,7 +437,7 @@ public:
       try_clear_more();
     }
   }
-  bool is_wrlocked() { return have_more() && more()->num_wrlock > 0; }
+  bool is_wrlocked() const { return have_more() && more()->num_wrlock > 0; }
   int get_num_wrlocks() { return have_more() ? more()->num_wrlock : 0; }
 
   // xlock
@@ -454,7 +465,7 @@ public:
       try_clear_more();
     }
   }
-  bool is_xlocked() { return have_more() && more()->num_xlock > 0; }
+  bool is_xlocked() const { return have_more() && more()->num_xlock > 0; }
   int get_num_xlocks() { return have_more() ? more()->num_xlock : 0; }
   client_t get_xlock_by_client() {
     return have_more() ? more()->xlock_by_client : -1;
@@ -475,7 +486,7 @@ public:
       try_clear_more();
     }
   }
-  bool is_leased() { return num_client_lease > 0; }
+  bool is_leased() const { return num_client_lease > 0; }
   int get_num_client_lease() {
     return num_client_lease;
   }