]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: move Inode specific cleanup to destructor 10168/head
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 7 Jul 2016 01:48:48 +0000 (21:48 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 8 Jul 2016 01:08:05 +0000 (21:08 -0400)
This better internalizes Inode management.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/client/Client.cc
src/client/Inode.cc
src/client/Inode.h

index a4758c228500a34810c0d6fa178f8677efe531ce..e6b5e555c990db22926a43a90db216b3e5faf2d0 100644 (file)
@@ -2831,9 +2831,6 @@ void Client::put_inode(Inode *in, int n)
     if (use_faked_inos())
       _release_faked_ino(in);
 
-    in->cap_item.remove_myself();
-    in->snaprealm_item.remove_myself();
-    in->snapdir_parent.reset();
     if (in == root) {
       root = 0;
       root_ancestor = 0;
@@ -2841,14 +2838,6 @@ void Client::put_inode(Inode *in, int n)
         root_parents.erase(root_parents.begin());
     }
 
-    if (!in->oset.objects.empty()) {
-      ldout(cct, 0) << __func__ << ": leftover objects on inode 0x"
-        << std::hex << in->ino << std::dec << dendl;
-      assert(in->oset.objects.empty());
-    }
-
-    delete in->fcntl_locks;
-    delete in->flock_locks;
     delete in;
   }
 }
index 8770c8693b2420f8a4cd6329c1bcd6fb660b8997..68446e7deefae033e137a1e1893fbada85362428 100644 (file)
@@ -9,6 +9,24 @@
 #include "ClientSnapRealm.h"
 #include "UserGroups.h"
 
+#include "mds/flock.h"
+
+Inode::~Inode()
+{
+  cap_item.remove_myself();
+  snaprealm_item.remove_myself();
+  snapdir_parent.reset();
+
+  if (!oset.objects.empty()) {
+    lsubdout(client->cct, client, 0) << __func__ << ": leftover objects on inode 0x"
+      << std::hex << ino << std::dec << dendl;
+    assert(oset.objects.empty());
+  }
+
+  delete fcntl_locks;
+  delete flock_locks;
+}
+
 ostream& operator<<(ostream &out, const Inode &in)
 {
   out << in.vino() << "("
index 5398c68c41f60a91b525c47a30caec05ade90f44..481ec8cad24921b0d36cffac534771a73bcdd762 100644 (file)
@@ -244,7 +244,7 @@ struct Inode {
     memset(&dir_layout, 0, sizeof(dir_layout));
     memset(&quota, 0, sizeof(quota));
   }
-  ~Inode() { }
+  ~Inode();
 
   vinodeno_t vino() const { return vinodeno_t(ino, snapid); }