]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 4 Apr 2005 17:18:04 +0000 (17:18 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 4 Apr 2005 17:18:04 +0000 (17:18 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@134 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/mds/IdAllocator.cc
ceph/mds/IdAllocator.h
ceph/mds/MDS.h

index 83413d92d8f5d0d5903570d7d0a0dfca11392d96..939c87f099beb329d5fdcd5f3ddfc630966c3059 100644 (file)
@@ -1,5 +1,5 @@
 
-#include "InoAllocator.h"
+#include "IdAllocator.h"
 #include "MDS.h"
 
 #include <cassert>
@@ -30,7 +30,7 @@ void IdAllocator::save()
        write(fd, (char*)&ntypes, sizeof(ntypes));
        
        // over types
-       for (map<char, map<id_t,id_t> >::iterator ty = free.begin();
+       for (map<char, map<idno_t,idno_t> >::iterator ty = free.begin();
                 ty != free.end(); 
                 ty++) {
          char type = *ty;
@@ -40,11 +40,11 @@ void IdAllocator::save()
          write(fd, (char*)&mapsize, sizeof(mapsize));
          
          // over entries
-         for (map<id_t,id_t>::iterator it = free[type]..map_begin();
+         for (map<idno_t,idno_t>::iterator it = free[type]..map_begin();
                   it != free[type].map_end();
                   it++) {
-               id_t a = it->first;
-               id_t b = it->second;
+               idno_t a = it->first;
+               idno_t b = it->second;
                write(fd, &a, sizeof(a));
                write(fd, &b, sizeof(b));
          }
@@ -70,7 +70,7 @@ void IdAllocator::load()
          int mapsize = 0;
          read(fd, &mapsize, sizeof(mapsize));
          for (int i=0; i<mapsize; i++) {
-               id_t a,b;
+               idno_t a,b;
                read(fd, &a, sizeof(a));
                read(fd, &b, sizeof(b));
                free[type].map_insert(a,b);
index 4f6da8ed66ef39170c6596820077525a7e3bd492..f247cb6d65731bb298ea499d4bd12e2bceb2d635 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __INOALLOCATOR_H
-#define __INOALLOCATOR_H
+#ifndef __IDALLOCATOR_H
+#define __IDALLOCATOR_H
 
 #include "include/types.h"
 #include "rangeset.h"
@@ -9,12 +9,12 @@ class MDS;
 #define ID_INO    1  // inode
 #define ID_FH     2  // file handle
 
-typedef __uint64_t id_t
+typedef __uint64_t idno_t;
 
 class IdAllocator {
   MDS *mds;
 
-  map< char, rangeset<id_t> > free;  // type -> rangeset
+  map< char, rangeset<idno_t> > free;  // type -> rangeset
   
  public:
   IdAllocator();
@@ -25,17 +25,17 @@ class IdAllocator {
   //~InoAllocator();
 
   
-  id_t get_id(char type) {
+  idno_t get_id(char type) {
        free[type].dump();
-       id_t ino = free[type].first();
-       free[type].erase(ino);
-       cout << "id type " << type << " is " << ino << endl;
+       idno_t id = free[type].first();
+       free[type].erase(id);
+       cout << "id type " << type << " is " << id << endl;
        free[type].dump();
        save();
        return id;
   }
-  void reclaim_id(char type, id_t ino) {
-       free[type].insert(ino);
+  void reclaim_id(char type, idno_t id) {
+       free[type].insert(id);
        save();
   }
 
index 28f18105d0f1f6036b177fcb0596cfb8d5514f4c..0dadc5f15b68e2443209dfe8127c9f602a902c7c 100644 (file)
@@ -90,7 +90,9 @@ class MDS : public Dispatcher {
   bool         shut_down;
 
   // ino's and fh's
+  public:
   class IdAllocator  *idalloc;
+  protected:
   
   
   // import/export