]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: logging in SessionMap
authorJohn Spray <john.spray@redhat.com>
Wed, 20 Aug 2014 16:56:16 +0000 (17:56 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 21 Aug 2014 22:22:36 +0000 (23:22 +0100)
(move definitions to .cc to get it)

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/SessionMap.cc
src/mds/SessionMap.h

index 8b797f763c97640f3b440f50e1578b9ad3e75aef..15fc25854c76a63077d4446efbbeaa7ffa4ab7e4 100644 (file)
@@ -290,3 +290,39 @@ size_t Session::get_request_count()
   return result;
 }
 
+void SessionMap::add_session(Session *s)
+{
+  dout(10) << __func__ << " s=" << s << " name=" << s->info.inst.name << dendl;
+
+  assert(session_map.count(s->info.inst.name) == 0);
+  session_map[s->info.inst.name] = s;
+  if (by_state.count(s->state) == 0)
+    by_state[s->state] = new xlist<Session*>;
+  by_state[s->state]->push_back(&s->item_session_list);
+  s->get();
+}
+
+void SessionMap::remove_session(Session *s)
+{
+  dout(10) << __func__ << " s=" << s << " name=" << s->info.inst.name << dendl;
+
+  s->trim_completed_requests(0);
+  s->item_session_list.remove_myself();
+  session_map.erase(s->info.inst.name);
+  s->put();
+}
+
+void SessionMap::touch_session(Session *session)
+{
+  dout(10) << __func__ << " s=" << session << " name=" << session->info.inst.name << dendl;
+
+  // Move to the back of the session list for this state (should
+  // already be on a list courtesy of add_session and set_state)
+  assert(session->item_session_list.is_on_list());
+  if (by_state.count(session->state) == 0)
+    by_state[session->state] = new xlist<Session*>;
+  by_state[session->state]->push_back(&session->item_session_list);
+
+  session->last_cap_renew = ceph_clock_now(g_ceph_context);
+}
+
index fefda91fdd22f415a78f5201b38749226af86d44..9c395e190fe1efe3effc70f4a0ee7a3f12dd775f 100644 (file)
@@ -294,30 +294,10 @@ public:
     }
     return s;
   }
-  void add_session(Session *s) {
-    assert(session_map.count(s->info.inst.name) == 0);
-    session_map[s->info.inst.name] = s;
-    if (by_state.count(s->state) == 0)
-      by_state[s->state] = new xlist<Session*>;
-    by_state[s->state]->push_back(&s->item_session_list);
-    s->get();
-  }
-  void remove_session(Session *s) {
-    s->trim_completed_requests(0);
-    s->item_session_list.remove_myself();
-    session_map.erase(s->info.inst.name);
-    s->put();
-  }
-  void touch_session(Session *session) {
-    if (session->item_session_list.is_on_list()) {
-      if (by_state.count(session->state) == 0)
-       by_state[session->state] = new xlist<Session*>;
-      by_state[session->state]->push_back(&session->item_session_list);
-      session->last_cap_renew = ceph_clock_now(g_ceph_context);
-    } else {
-      assert(0);  // hrm, should happen?
-    }
-  }
+  void add_session(Session *s);
+  void remove_session(Session *s);
+  void touch_session(Session *session);
+
   Session *get_oldest_session(int state) {
     if (by_state.count(state) == 0 || by_state[state]->empty())
       return 0;