mds/CInode.cc \
mds/LogEvent.cc \
mds/MDSTable.cc \
- mds/IdAllocator.cc \
+ mds/InoTable.cc \
mds/MDSTableClient.cc \
mds/MDSTableServer.cc \
mds/AnchorServer.cc \
mds/AnchorClient.h\
mds/CDentry.h\
mds/CDir.h\
- mds/IdAllocator.h\
+ mds/InoTable.h\
mds/LocalLock.h\
mds/LogEvent.h\
mds/MDBalancer.h\
+++ /dev/null
-// -*- 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++;
-}
-
+++ /dev/null
-// -*- 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
--- /dev/null
+// -*- 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;
+}
+
--- /dev/null
+// -*- 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
#include "messages/MMDSFragmentNotify.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
#include "common/Timer.h"
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
#include "AnchorServer.h"
#include "AnchorClient.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
#include "SnapTable.h"
#include "common/Logger.h"
mdlog = new MDLog(this);
balancer = new MDBalancer(this);
- idalloc = new IdAllocator(this);
+ inotable = new InoTable(this);
snaptable = new SnapTable(this);
anchorserver = new AnchorServer(this);
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; }
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());
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());
class MMDSBeacon;
-class IdAllocator;
+class InoTable;
class SnapTable;
class MDSTableClient;
MDLog *mdlog;
MDBalancer *balancer;
- IdAllocator *idalloc;
+ InoTable *inotable;
AnchorServer *anchorserver;
AnchorClient *anchorclient;
#include "Migrator.h"
#include "MDBalancer.h"
#include "AnchorClient.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
#include "SnapTable.h"
#include "msg/Messenger.h"
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);
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
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);
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);
#include "MDCache.h"
#include "Server.h"
#include "Migrator.h"
-#include "IdAllocator.h"
+#include "InoTable.h"
#include "SnapTable.h"
#include "MDSTableClient.h"
}
// 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
// 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());
}
}