]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: rename IdAllocator -> InoTable
authorSage Weil <sage@newdream.net>
Wed, 16 Jul 2008 20:54:02 +0000 (13:54 -0700)
committerSage Weil <sage@newdream.net>
Wed, 16 Jul 2008 20:54:02 +0000 (13:54 -0700)
src/Makefile.am
src/mds/IdAllocator.cc [deleted file]
src/mds/IdAllocator.h [deleted file]
src/mds/InoTable.cc [new file with mode: 0644]
src/mds/InoTable.h [new file with mode: 0644]
src/mds/MDCache.cc
src/mds/MDS.cc
src/mds/MDS.h
src/mds/Server.cc
src/mds/journal.cc

index 5583879187f4fa6413a40ac631c0222cfd72155b..d504fea2d41c29e478f87a1e2e153b7db6590d9e 100644 (file)
@@ -203,7 +203,7 @@ libmds_a_SOURCES = \
        mds/CInode.cc \
        mds/LogEvent.cc \
        mds/MDSTable.cc \
-       mds/IdAllocator.cc \
+       mds/InoTable.cc \
        mds/MDSTableClient.cc \
        mds/MDSTableServer.cc \
        mds/AnchorServer.cc \
@@ -340,7 +340,7 @@ noinst_HEADERS = \
        mds/AnchorClient.h\
        mds/CDentry.h\
        mds/CDir.h\
-       mds/IdAllocator.h\
+       mds/InoTable.h\
        mds/LocalLock.h\
        mds/LogEvent.h\
        mds/MDBalancer.h\
diff --git a/src/mds/IdAllocator.cc b/src/mds/IdAllocator.cc
deleted file mode 100644 (file)
index 2dfddbb..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#include "IdAllocator.h"
-#include "MDS.h"
-
-#include "include/types.h"
-
-#include "config.h"
-
-#define dout(x)  if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".idalloc: "
-
-void IdAllocator::init_inode()
-{
-  ino = MDS_INO_IDS_OFFSET + mds->get_nodeid();
-  layout = g_default_file_layout;
-}
-
-void IdAllocator::reset_state()
-{
-  // use generic range. FIXME THIS IS CRAP
-  free.clear();
-  //#ifdef __LP64__
-  uint64_t start = (uint64_t)(mds->get_nodeid()+1) << 40;
-  uint64_t end = ((uint64_t)(mds->get_nodeid()+2) << 40) - 1;
-  //#else
-  //# warning this looks like a 32-bit system, using small inode numbers.
-  //  uint64_t start = (uint64_t)(mds->get_nodeid()+1) << 25;
-  //  uint64_t end = ((uint64_t)(mds->get_nodeid()+2) << 25) - 1;
-  //#endif
-  free.insert(start, end);
-}
-
-inodeno_t IdAllocator::alloc_id() 
-{
-  assert(is_active());
-  
-  // pick one
-  inodeno_t id = free.start();
-  free.erase(id);
-  dout(10) << "idalloc " << this << ": alloc id " << id << dendl;
-
-  version++;
-  
-  return id;
-}
-
-void IdAllocator::reclaim_id(inodeno_t id) 
-{
-  assert(is_active());
-  
-  dout(10) << "idalloc " << this << ": reclaim id " << id << dendl;
-  free.insert(id);
-
-  version++;
-}
-
diff --git a/src/mds/IdAllocator.h b/src/mds/IdAllocator.h
deleted file mode 100644 (file)
index ab46c16..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-
-#ifndef __IDALLOCATOR_H
-#define __IDALLOCATOR_H
-
-#include "MDSTable.h"
-#include "include/interval_set.h"
-
-class MDS;
-
-class IdAllocator : public MDSTable {
-  interval_set<inodeno_t> free;   // unused ids
-
- public:
-  IdAllocator(MDS *m) : MDSTable(m, "idalloc") { }
-
-  // alloc or reclaim ids
-  inodeno_t alloc_id();
-  void reclaim_id(inodeno_t ino);
-  
-  void init_inode();
-  void reset_state();
-  void encode_state(bufferlist& bl) {
-    ::encode(free.m, bl);
-  }
-  void decode_state(bufferlist::iterator& bl) {
-    ::decode(free.m, bl);
-  }
-};
-
-#endif
diff --git a/src/mds/InoTable.cc b/src/mds/InoTable.cc
new file mode 100644 (file)
index 0000000..a0eb62f
--- /dev/null
@@ -0,0 +1,58 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#include "InoTable.h"
+#include "MDS.h"
+
+#include "include/types.h"
+
+#include "config.h"
+
+#define dout(x)  if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".inotable: "
+
+void InoTable::init_inode()
+{
+  ino = MDS_INO_IDS_OFFSET + mds->get_nodeid();
+  layout = g_default_file_layout;
+}
+
+void InoTable::reset_state()
+{
+  // use generic range. FIXME THIS IS CRAP
+  free.clear();
+  //#ifdef __LP64__
+  uint64_t start = (uint64_t)(mds->get_nodeid()+1) << 40;
+  uint64_t end = ((uint64_t)(mds->get_nodeid()+2) << 40) - 1;
+  //#else
+  //# warning this looks like a 32-bit system, using small inode numbers.
+  //  uint64_t start = (uint64_t)(mds->get_nodeid()+1) << 25;
+  //  uint64_t end = ((uint64_t)(mds->get_nodeid()+2) << 25) - 1;
+  //#endif
+  free.insert(start, end);
+}
+
+inodeno_t InoTable::alloc_id() 
+{
+  assert(is_active());
+  
+  // pick one
+  inodeno_t id = free.start();
+  free.erase(id);
+  dout(10) << "alloc id " << id << dendl;
+
+  version++;
+  
+  return id;
+}
+
diff --git a/src/mds/InoTable.h b/src/mds/InoTable.h
new file mode 100644 (file)
index 0000000..1ca30f9
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+
+#ifndef __INOTABLE_H
+#define __INOTABLE_H
+
+#include "MDSTable.h"
+#include "include/interval_set.h"
+
+class MDS;
+
+class InoTable : public MDSTable {
+  interval_set<inodeno_t> free;   // unused ids
+
+ public:
+  InoTable(MDS *m) : MDSTable(m, "idalloc") { }
+
+  // alloc or reclaim ids
+  inodeno_t alloc_id();
+  
+  void init_inode();
+  void reset_state();
+  void encode_state(bufferlist& bl) {
+    ::encode(free.m, bl);
+  }
+  void decode_state(bufferlist::iterator& bl) {
+    ::decode(free.m, bl);
+  }
+};
+
+#endif
index 55d54f258a26bbfe744061239f0b9e7885305e7e..9ee21fdbac55d4555bc6ba5fea66349fe718b111 100644 (file)
@@ -72,7 +72,7 @@
 #include "messages/MMDSFragmentNotify.h"
 
 
-#include "IdAllocator.h"
+#include "InoTable.h"
 
 #include "common/Timer.h"
 
@@ -150,7 +150,7 @@ CInode *MDCache::create_inode()
   CInode *in = new CInode(this);
 
   // assign ino
-  in->inode.ino = mds->idalloc->alloc_id();
+  in->inode.ino = mds->inotable->alloc_id();
   in->inode.version = 1;
   in->inode.nlink = 1;   // FIXME
 
index fa4cedb1d22d5f2b39a5182f47ec28717bebc986..e619f9df9bad8c3b2116b646225eaed247c10af6 100644 (file)
@@ -36,7 +36,7 @@
 #include "AnchorServer.h"
 #include "AnchorClient.h"
 
-#include "IdAllocator.h"
+#include "InoTable.h"
 #include "SnapTable.h"
 
 #include "common/Logger.h"
@@ -90,7 +90,7 @@ MDS::MDS(int whoami, Messenger *m, MonMap *mm) :
   mdlog = new MDLog(this);
   balancer = new MDBalancer(this);
 
-  idalloc = new IdAllocator(this);
+  inotable = new InoTable(this);
   snaptable = new SnapTable(this);
 
   anchorserver = new AnchorServer(this);
@@ -126,7 +126,7 @@ MDS::~MDS() {
   if (mdcache) { delete mdcache; mdcache = NULL; }
   if (mdlog) { delete mdlog; mdlog = NULL; }
   if (balancer) { delete balancer; balancer = NULL; }
-  if (idalloc) { delete idalloc; idalloc = NULL; }
+  if (inotable) { delete inotable; inotable = NULL; }
   if (anchorserver) { delete anchorserver; anchorserver = NULL; }
   if (snaptable) { delete snaptable; snaptable = NULL; }
   if (anchorclient) { delete anchorclient; anchorclient = NULL; }
@@ -761,10 +761,10 @@ void MDS::boot_create()
   straydir->mark_dirty(straydir->pre_dirty(), mdlog->get_current_segment());
   straydir->commit(0, fin->new_sub());
  
-  // fixme: fake out idalloc (reset, pretend loaded)
-  dout(10) << "boot_create creating fresh idalloc table" << dendl;
-  idalloc->reset();
-  idalloc->save(fin->new_sub());
+  // fixme: fake out inotable (reset, pretend loaded)
+  dout(10) << "boot_create creating fresh inotable table" << dendl;
+  inotable->reset();
+  inotable->save(fin->new_sub());
 
   // write empty sessionmap
   sessionmap.save(fin->new_sub());
@@ -813,8 +813,8 @@ void MDS::boot_start(int step, int r)
   case 1:
     {
       C_Gather *gather = new C_Gather(new C_MDS_BootStart(this, 2));
-      dout(2) << "boot_start " << step << ": opening idalloc" << dendl;
-      idalloc->load(gather->new_sub());
+      dout(2) << "boot_start " << step << ": opening inotable" << dendl;
+      inotable->load(gather->new_sub());
 
       dout(2) << "boot_start " << step << ": opening sessionmap" << dendl;
       sessionmap.load(gather->new_sub());
index 453b65f1c9dcd5b5a1ea0e284088a21b63364e3f..a5bbc1ac0b6b7ab56fa00a5cfd79df182c4f43b8 100644 (file)
@@ -72,7 +72,7 @@ class MHashReaddirReply;
 
 class MMDSBeacon;
 
-class IdAllocator;
+class InoTable;
 class SnapTable;
 
 class MDSTableClient;
@@ -104,7 +104,7 @@ class MDS : public Dispatcher {
   MDLog        *mdlog;
   MDBalancer   *balancer;
 
-  IdAllocator  *idalloc;
+  InoTable     *inotable;
 
   AnchorServer *anchorserver;
   AnchorClient *anchorclient;
index d81d9ef5b36ef7a57e333950d98242433282e7a8..b096096f4e42e0feedf552fb4ab69fa55887ace7 100644 (file)
@@ -20,7 +20,7 @@
 #include "Migrator.h"
 #include "MDBalancer.h"
 #include "AnchorClient.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
 #include "SnapTable.h"
 
 #include "msg/Messenger.h"
@@ -2080,7 +2080,7 @@ void Server::handle_client_mknod(MDRequest *mdr)
   mdr->ls = mdlog->get_current_segment();
   EUpdate *le = new EUpdate(mdlog, "mknod");
   le->metablob.add_client_req(req->get_reqid());
-  le->metablob.add_allocated_ino(newi->ino(), mds->idalloc->get_version());
+  le->metablob.add_allocated_ino(newi->ino(), mds->inotable->get_version());
   
   mds->locker->predirty_nested(mdr, &le->metablob, newi, dn->dir, PREDIRTY_PRIMARY|PREDIRTY_DIR, 1);
   le->metablob.add_primary_dentry(dn, true, newi);
@@ -2129,7 +2129,7 @@ void Server::handle_client_mkdir(MDRequest *mdr)
   mdr->ls = mdlog->get_current_segment();
   EUpdate *le = new EUpdate(mdlog, "mkdir");
   le->metablob.add_client_req(req->get_reqid());
-  le->metablob.add_allocated_ino(newi->ino(), mds->idalloc->get_version());
+  le->metablob.add_allocated_ino(newi->ino(), mds->inotable->get_version());
   mds->locker->predirty_nested(mdr, &le->metablob, newi, dn->dir, PREDIRTY_PRIMARY|PREDIRTY_DIR, 1);
   le->metablob.add_primary_dentry(dn, true, newi, &newi->inode);
   le->metablob.add_dir(newdir, true, true); // dirty AND complete
@@ -2170,7 +2170,7 @@ void Server::handle_client_symlink(MDRequest *mdr)
   mdr->ls = mdlog->get_current_segment();
   EUpdate *le = new EUpdate(mdlog, "symlink");
   le->metablob.add_client_req(req->get_reqid());
-  le->metablob.add_allocated_ino(newi->ino(), mds->idalloc->get_version());
+  le->metablob.add_allocated_ino(newi->ino(), mds->inotable->get_version());
   mds->locker->predirty_nested(mdr, &le->metablob, newi, dn->dir, PREDIRTY_PRIMARY|PREDIRTY_DIR, 1);
   le->metablob.add_primary_dentry(dn, true, newi);
 
@@ -4704,7 +4704,7 @@ void Server::handle_client_openc(MDRequest *mdr)
   mdr->ls = mdlog->get_current_segment();
   EUpdate *le = new EUpdate(mdlog, "openc");
   le->metablob.add_client_req(req->get_reqid());
-  le->metablob.add_allocated_ino(in->ino(), mds->idalloc->get_version());
+  le->metablob.add_allocated_ino(in->ino(), mds->inotable->get_version());
   mds->locker->predirty_nested(mdr, &le->metablob, in, dn->dir, PREDIRTY_PRIMARY|PREDIRTY_DIR, 1);
   le->metablob.add_primary_dentry(dn, true, in);
   
index bc6eb1ff6ea315e12d468c9ef9ac1340e235c7fe..1e338abf84ee7f925d63865300034b78f60d7f4f 100644 (file)
@@ -42,7 +42,7 @@
 #include "MDCache.h"
 #include "Server.h"
 #include "Migrator.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
 #include "SnapTable.h"
 
 #include "MDSTableClient.h"
@@ -170,13 +170,13 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
   }
 
   // idalloc
-  if (allocv > mds->idalloc->get_committed_version()) {
-    dout(10) << "try_to_expire saving idalloc table, need " << allocv
-             << ", committed is " << mds->idalloc->get_committed_version()
-             << " (" << mds->idalloc->get_committing_version() << ")"
+  if (allocv > mds->inotable->get_committed_version()) {
+    dout(10) << "try_to_expire saving inotable table, need " << allocv
+             << ", committed is " << mds->inotable->get_committed_version()
+             << " (" << mds->inotable->get_committing_version() << ")"
              << dendl;
     if (!gather) gather = new C_Gather;
-    mds->idalloc->save(gather->new_sub(), allocv);
+    mds->inotable->save(gather->new_sub(), allocv);
   }
 
   // sessionmap
@@ -485,21 +485,21 @@ void EMetaBlob::replay(MDS *mds, LogSegment *logseg)
 
   // allocated_inos
   if (!allocated_inos.empty()) {
-    if (mds->idalloc->get_version() >= alloc_tablev) {
-      dout(10) << "EMetaBlob.replay idalloc tablev " << alloc_tablev
-              << " <= table " << mds->idalloc->get_version() << dendl;
+    if (mds->inotable->get_version() >= alloc_tablev) {
+      dout(10) << "EMetaBlob.replay inotable tablev " << alloc_tablev
+              << " <= table " << mds->inotable->get_version() << dendl;
     } else {
       for (list<inodeno_t>::iterator p = allocated_inos.begin();
           p != allocated_inos.end();
           ++p) {
-       dout(10) << " EMetaBlob.replay idalloc " << *p << " tablev " << alloc_tablev
-                << " - 1 == table " << mds->idalloc->get_version() << dendl;
-       assert(alloc_tablev-1 == mds->idalloc->get_version());
+       dout(10) << " EMetaBlob.replay inotable " << *p << " tablev " << alloc_tablev
+                << " - 1 == table " << mds->inotable->get_version() << dendl;
+       assert(alloc_tablev-1 == mds->inotable->get_version());
        
-       inodeno_t ino = mds->idalloc->alloc_id();
+       inodeno_t ino = mds->inotable->alloc_id();
        assert(ino == *p);       // this should match.
       }        
-      assert(alloc_tablev == mds->idalloc->get_version());
+      assert(alloc_tablev == mds->inotable->get_version());
     }
   }