]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
merged trunk changes r1361:1396 into branches/sage/pgs
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 5 Jun 2007 17:09:56 +0000 (17:09 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 5 Jun 2007 17:09:56 +0000 (17:09 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1397 29311d96-e01e-0410-9327-a35deaab8ce9

302 files changed:
branches/sage/pgs/Makefile
branches/sage/pgs/TODO
branches/sage/pgs/cfuse.cc
branches/sage/pgs/client/Client.cc
branches/sage/pgs/client/Client.h
branches/sage/pgs/client/FileCache.cc
branches/sage/pgs/client/FileCache.h
branches/sage/pgs/client/SyntheticClient.cc
branches/sage/pgs/client/SyntheticClient.h
branches/sage/pgs/client/Trace.cc
branches/sage/pgs/client/Trace.h
branches/sage/pgs/client/fuse.cc
branches/sage/pgs/client/fuse.h
branches/sage/pgs/client/hadoop/CephFSInterface.cc
branches/sage/pgs/client/hadoop/CephFSInterface.h
branches/sage/pgs/client/ldceph.cc
branches/sage/pgs/client/msgthread.h
branches/sage/pgs/cmds.cc
branches/sage/pgs/cmon.cc
branches/sage/pgs/cmonctl.cc
branches/sage/pgs/common/Clock.cc
branches/sage/pgs/common/Clock.h
branches/sage/pgs/common/Cond.h
branches/sage/pgs/common/DecayCounter.h
branches/sage/pgs/common/LogType.h
branches/sage/pgs/common/Logger.cc
branches/sage/pgs/common/Logger.h
branches/sage/pgs/common/Mutex.h
branches/sage/pgs/common/Semaphore.h
branches/sage/pgs/common/Thread.h
branches/sage/pgs/common/ThreadPool.h
branches/sage/pgs/common/Timer.cc
branches/sage/pgs/common/Timer.h
branches/sage/pgs/config.cc
branches/sage/pgs/config.h
branches/sage/pgs/cosd.cc
branches/sage/pgs/crush/BinaryTree.h
branches/sage/pgs/crush/Bucket.h
branches/sage/pgs/crush/Hash.h
branches/sage/pgs/crush/crush.h
branches/sage/pgs/csyn.cc
branches/sage/pgs/doc/header.txt
branches/sage/pgs/doc/modeline.txt [new file with mode: 0644]
branches/sage/pgs/ebofs/Allocator.cc
branches/sage/pgs/ebofs/Allocator.h
branches/sage/pgs/ebofs/BlockDevice.cc
branches/sage/pgs/ebofs/BlockDevice.h
branches/sage/pgs/ebofs/BufferCache.cc
branches/sage/pgs/ebofs/BufferCache.h
branches/sage/pgs/ebofs/Cnode.h
branches/sage/pgs/ebofs/Ebofs.cc
branches/sage/pgs/ebofs/Ebofs.h
branches/sage/pgs/ebofs/FileJournal.cc [new file with mode: 0644]
branches/sage/pgs/ebofs/FileJournal.h [new file with mode: 0644]
branches/sage/pgs/ebofs/Journal.h [new file with mode: 0644]
branches/sage/pgs/ebofs/Onode.h
branches/sage/pgs/ebofs/Table.h
branches/sage/pgs/ebofs/mkfs.ebofs.cc
branches/sage/pgs/ebofs/nodes.h
branches/sage/pgs/ebofs/test.ebofs.cc
branches/sage/pgs/ebofs/types.h
branches/sage/pgs/fakefuse.cc
branches/sage/pgs/fakesyn.cc
branches/sage/pgs/include/Context.h
branches/sage/pgs/include/Distribution.h
branches/sage/pgs/include/buffer.h
branches/sage/pgs/include/error.h
branches/sage/pgs/include/filepath.h
branches/sage/pgs/include/frag.h
branches/sage/pgs/include/interval_set.h
branches/sage/pgs/include/lru.h
branches/sage/pgs/include/object.h
branches/sage/pgs/include/oldbuffer.h
branches/sage/pgs/include/oldbufferlist.h
branches/sage/pgs/include/rangeset.h
branches/sage/pgs/include/statlite.h
branches/sage/pgs/include/types.h
branches/sage/pgs/include/uofs.h
branches/sage/pgs/include/utime.h
branches/sage/pgs/mds/Anchor.h
branches/sage/pgs/mds/AnchorClient.cc
branches/sage/pgs/mds/AnchorClient.h
branches/sage/pgs/mds/AnchorTable.cc
branches/sage/pgs/mds/AnchorTable.h
branches/sage/pgs/mds/CDentry.cc
branches/sage/pgs/mds/CDentry.h
branches/sage/pgs/mds/CDir.cc
branches/sage/pgs/mds/CDir.h
branches/sage/pgs/mds/CInode.cc
branches/sage/pgs/mds/CInode.h
branches/sage/pgs/mds/Capability.h
branches/sage/pgs/mds/ClientMap.h
branches/sage/pgs/mds/FileLock.h
branches/sage/pgs/mds/Hasher.cc
branches/sage/pgs/mds/IdAllocator.cc
branches/sage/pgs/mds/IdAllocator.h
branches/sage/pgs/mds/Locker.cc
branches/sage/pgs/mds/Locker.h
branches/sage/pgs/mds/LogEvent.cc
branches/sage/pgs/mds/LogEvent.h
branches/sage/pgs/mds/MDBalancer.cc
branches/sage/pgs/mds/MDBalancer.h
branches/sage/pgs/mds/MDCache.cc
branches/sage/pgs/mds/MDCache.h
branches/sage/pgs/mds/MDLog.cc
branches/sage/pgs/mds/MDLog.h
branches/sage/pgs/mds/MDS.cc
branches/sage/pgs/mds/MDS.h
branches/sage/pgs/mds/MDSMap.h
branches/sage/pgs/mds/Migrator.cc
branches/sage/pgs/mds/Migrator.h
branches/sage/pgs/mds/Renamer.cc
branches/sage/pgs/mds/Renamer.h
branches/sage/pgs/mds/ScatterLock.h
branches/sage/pgs/mds/Server.cc
branches/sage/pgs/mds/Server.h
branches/sage/pgs/mds/SimpleLock.h
branches/sage/pgs/mds/events/EAlloc.h
branches/sage/pgs/mds/events/EAnchor.h
branches/sage/pgs/mds/events/EAnchorClient.h
branches/sage/pgs/mds/events/EClientMap.h
branches/sage/pgs/mds/events/EExport.h
branches/sage/pgs/mds/events/EImportFinish.h
branches/sage/pgs/mds/events/EImportMap.h
branches/sage/pgs/mds/events/EImportStart.h
branches/sage/pgs/mds/events/EMetaBlob.h
branches/sage/pgs/mds/events/EOpen.h
branches/sage/pgs/mds/events/EPurgeFinish.h
branches/sage/pgs/mds/events/ESession.h
branches/sage/pgs/mds/events/ESlaveUpdate.h
branches/sage/pgs/mds/events/EString.h
branches/sage/pgs/mds/events/EUpdate.h
branches/sage/pgs/mds/journal.cc
branches/sage/pgs/mds/mdstypes.h
branches/sage/pgs/messages/MAnchor.h
branches/sage/pgs/messages/MCacheExpire.h
branches/sage/pgs/messages/MClientFileCaps.h
branches/sage/pgs/messages/MClientMount.h
branches/sage/pgs/messages/MClientReconnect.h
branches/sage/pgs/messages/MClientReply.h
branches/sage/pgs/messages/MClientRequest.h
branches/sage/pgs/messages/MClientRequestForward.h
branches/sage/pgs/messages/MClientSession.h
branches/sage/pgs/messages/MClientUnmount.h
branches/sage/pgs/messages/MDentryUnlink.h
branches/sage/pgs/messages/MDirUpdate.h
branches/sage/pgs/messages/MDiscover.h
branches/sage/pgs/messages/MDiscoverReply.h
branches/sage/pgs/messages/MExportDir.h
branches/sage/pgs/messages/MExportDirAck.h
branches/sage/pgs/messages/MExportDirCancel.h
branches/sage/pgs/messages/MExportDirDiscover.h
branches/sage/pgs/messages/MExportDirDiscoverAck.h
branches/sage/pgs/messages/MExportDirFinish.h
branches/sage/pgs/messages/MExportDirNotify.h
branches/sage/pgs/messages/MExportDirNotifyAck.h
branches/sage/pgs/messages/MExportDirPrep.h
branches/sage/pgs/messages/MExportDirPrepAck.h
branches/sage/pgs/messages/MExportDirWarning.h
branches/sage/pgs/messages/MExportDirWarningAck.h
branches/sage/pgs/messages/MGenericMessage.h
branches/sage/pgs/messages/MHashDir.h
branches/sage/pgs/messages/MHashDirAck.h
branches/sage/pgs/messages/MHashDirDiscover.h
branches/sage/pgs/messages/MHashDirDiscoverAck.h
branches/sage/pgs/messages/MHashDirNotify.h
branches/sage/pgs/messages/MHashDirPrep.h
branches/sage/pgs/messages/MHashDirPrepAck.h
branches/sage/pgs/messages/MHashReaddir.h
branches/sage/pgs/messages/MHashReaddirReply.h
branches/sage/pgs/messages/MHeartbeat.h
branches/sage/pgs/messages/MInodeFileCaps.h
branches/sage/pgs/messages/MInodeLink.h
branches/sage/pgs/messages/MInodeLinkAck.h
branches/sage/pgs/messages/MInodeUnlink.h
branches/sage/pgs/messages/MInodeUnlinkAck.h
branches/sage/pgs/messages/MLock.h
branches/sage/pgs/messages/MMDSBeacon.h
branches/sage/pgs/messages/MMDSBoot.h
branches/sage/pgs/messages/MMDSCacheRejoin.h
branches/sage/pgs/messages/MMDSCacheRejoinAck.h
branches/sage/pgs/messages/MMDSGetMap.h
branches/sage/pgs/messages/MMDSImportMap.h
branches/sage/pgs/messages/MMDSMap.h
branches/sage/pgs/messages/MMonCommand.h
branches/sage/pgs/messages/MMonCommandAck.h
branches/sage/pgs/messages/MMonElectionAck.h
branches/sage/pgs/messages/MMonElectionCollect.h
branches/sage/pgs/messages/MMonElectionPropose.h
branches/sage/pgs/messages/MMonElectionRefresh.h
branches/sage/pgs/messages/MMonElectionStatus.h
branches/sage/pgs/messages/MMonElectionVictory.h
branches/sage/pgs/messages/MMonOSDMapInfo.h
branches/sage/pgs/messages/MMonOSDMapLease.h
branches/sage/pgs/messages/MMonOSDMapLeaseAck.h
branches/sage/pgs/messages/MMonOSDMapUpdateAck.h
branches/sage/pgs/messages/MMonOSDMapUpdateCommit.h
branches/sage/pgs/messages/MMonOSDMapUpdatePrepare.h
branches/sage/pgs/messages/MMonPaxos.h
branches/sage/pgs/messages/MOSDBoot.h
branches/sage/pgs/messages/MOSDFailure.h
branches/sage/pgs/messages/MOSDGetMap.h
branches/sage/pgs/messages/MOSDIn.h
branches/sage/pgs/messages/MOSDMap.h
branches/sage/pgs/messages/MOSDOp.h
branches/sage/pgs/messages/MOSDOpReply.h
branches/sage/pgs/messages/MOSDOut.h
branches/sage/pgs/messages/MOSDPGLog.h
branches/sage/pgs/messages/MOSDPGNotify.h
branches/sage/pgs/messages/MOSDPGPeer.h
branches/sage/pgs/messages/MOSDPGPeerAck.h
branches/sage/pgs/messages/MOSDPGPeerRequest.h
branches/sage/pgs/messages/MOSDPGQuery.h
branches/sage/pgs/messages/MOSDPGRemove.h
branches/sage/pgs/messages/MOSDPGSummary.h
branches/sage/pgs/messages/MOSDPGUpdate.h
branches/sage/pgs/messages/MOSDPing.h
branches/sage/pgs/messages/MPing.h
branches/sage/pgs/messages/MPingAck.h
branches/sage/pgs/messages/MRename.h
branches/sage/pgs/messages/MRenameAck.h
branches/sage/pgs/messages/MRenameNotify.h
branches/sage/pgs/messages/MRenameNotifyAck.h
branches/sage/pgs/messages/MRenamePrep.h
branches/sage/pgs/messages/MRenameReq.h
branches/sage/pgs/messages/MRenameWarning.h
branches/sage/pgs/messages/MUnhashDir.h
branches/sage/pgs/messages/MUnhashDirAck.h
branches/sage/pgs/messages/MUnhashDirNotify.h
branches/sage/pgs/messages/MUnhashDirNotifyAck.h
branches/sage/pgs/messages/MUnhashDirPrep.h
branches/sage/pgs/messages/MUnhashDirPrepAck.h
branches/sage/pgs/mkmonmap.cc
branches/sage/pgs/mon/ClientMonitor.cc
branches/sage/pgs/mon/ClientMonitor.h
branches/sage/pgs/mon/Elector.cc
branches/sage/pgs/mon/Elector.h
branches/sage/pgs/mon/MDSMonitor.cc
branches/sage/pgs/mon/MDSMonitor.h
branches/sage/pgs/mon/MonMap.h
branches/sage/pgs/mon/Monitor.cc
branches/sage/pgs/mon/Monitor.h
branches/sage/pgs/mon/MonitorStore.cc
branches/sage/pgs/mon/MonitorStore.h
branches/sage/pgs/mon/OSDMonitor.cc
branches/sage/pgs/mon/OSDMonitor.h
branches/sage/pgs/mon/Paxos.cc
branches/sage/pgs/mon/Paxos.h
branches/sage/pgs/msg/Dispatcher.cc
branches/sage/pgs/msg/Dispatcher.h
branches/sage/pgs/msg/FakeMessenger.cc
branches/sage/pgs/msg/FakeMessenger.h
branches/sage/pgs/msg/HostMonitor.cc
branches/sage/pgs/msg/HostMonitor.h
branches/sage/pgs/msg/Message.cc
branches/sage/pgs/msg/Message.h
branches/sage/pgs/msg/Messenger.cc
branches/sage/pgs/msg/Messenger.h
branches/sage/pgs/msg/RWLock.h
branches/sage/pgs/msg/SerialMessenger.h
branches/sage/pgs/msg/SimpleMessenger.cc
branches/sage/pgs/msg/SimpleMessenger.h
branches/sage/pgs/msg/mpistarter.cc
branches/sage/pgs/msg/msg_types.h
branches/sage/pgs/msg/new_mpistarter.cc
branches/sage/pgs/msg/tcp.cc
branches/sage/pgs/msg/tcp.h
branches/sage/pgs/newsyn.cc
branches/sage/pgs/osbdb/OSBDB.cc
branches/sage/pgs/osbdb/OSBDB.h
branches/sage/pgs/osd/Ager.cc
branches/sage/pgs/osd/Ager.h
branches/sage/pgs/osd/BDBMap.h
branches/sage/pgs/osd/Fake.h
branches/sage/pgs/osd/FakeStore.cc
branches/sage/pgs/osd/FakeStore.h
branches/sage/pgs/osd/FakeStoreBDBCollections.h
branches/sage/pgs/osd/OBFSStore.cc
branches/sage/pgs/osd/OBFSStore.h
branches/sage/pgs/osd/OSD.cc
branches/sage/pgs/osd/OSD.h
branches/sage/pgs/osd/OSDMap.h
branches/sage/pgs/osd/ObjectStore.cc
branches/sage/pgs/osd/ObjectStore.h
branches/sage/pgs/osd/PG.cc
branches/sage/pgs/osd/PG.h
branches/sage/pgs/osd/ReplicatedPG.cc
branches/sage/pgs/osd/osd_types.h
branches/sage/pgs/osd/rush.cc
branches/sage/pgs/osd/rush.h
branches/sage/pgs/osd/tp.cc
branches/sage/pgs/osdc/Blinker.h
branches/sage/pgs/osdc/Filer.cc
branches/sage/pgs/osdc/Filer.h
branches/sage/pgs/osdc/Journaler.cc
branches/sage/pgs/osdc/Journaler.h
branches/sage/pgs/osdc/ObjectCacher.cc
branches/sage/pgs/osdc/ObjectCacher.h
branches/sage/pgs/osdc/Objecter.cc
branches/sage/pgs/osdc/Objecter.h
branches/sage/pgs/script/add_header.pl
branches/sage/pgs/script/fix_modeline.pl [new file with mode: 0755]

index 97246c8d618d991f0521658ee4b0b350ed705743..e85e18b56670f684f6ecbbd24b30d7494882af1b 100644 (file)
@@ -138,6 +138,20 @@ csyn: csyn.cc client.o osdc.o msg/SimpleMessenger.o common.o
 cfuse: cfuse.cc client.o osdc.o client/fuse.o msg/SimpleMessenger.o common.o
        ${CC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@
 
+activemaster: active/activemaster.cc client.o osdc.o msg/SimpleMessenger.o common.o
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+activeslave: active/activeslave.cc client.o osdc.o msg/SimpleMessenger.o common.o
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+echotestclient: active/echotestclient.cc client.o osdc.o msg/SimpleMessenger.o common.o
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+msgtestclient: active/msgtestclient.cc client.o osdc.o msg/SimpleMessenger.o common.o
+       ${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+
+
 
 # misc
 gprof-helper.so: test/gprof-helper.c
index 3cbaade473603130f88bd109cca3abb4afb615d4..9bbf0a8b5e24a9f3ef0024b202223509d1baa380 100644 (file)
@@ -1,7 +1,40 @@
-sage
- mds diropen
 
-doc
+
+some smallish projects:
+
+- crush rewrite in C
+ - generalize any memory management etc. to allow use in kernel and userspace
+- userspace crush tools
+ - xml import/export?  
+ - ?
+
+- SimpleMessenger
+ - clean up/merge Messenger/Dispatcher interfaces
+ - auto close idle connections
+ - delivery ack and buffering, and then reconnect
+ - take a look at RDS?  http://oss.oracle.com/projects/rds/
+
+- generalize monitor client?
+ - throttle message resend attempts
+
+- paxos layer work
+ - integrate leasing into paxos framework
+ - carefully interface design...
+
+
+code cleanup
+- endian portability
+- word size
+  - clean up all encoded structures 
+
+general kernel planning
+- soft consistency on lookup?
+
+
+
+
+
+sage doc
 - mdsmonitor beacon semantics
 - cache expiration, cache invariants
  - including dual expire states, transition, vs subtree grouping of expire messages
@@ -12,7 +45,7 @@ doc
 
 
 
-mds
+sage mds
 - finish multistage rejoin 
 
 - more testing of failures + thrashing.
@@ -52,13 +85,6 @@ mds
   - in particular, i care about dirfragtree.. get it on rejoin?
   - and dir sizes, if i add that... also on rejoin?
 
-/- properly recover lock state on rejoin...
-/  - recovering mds rejoins replicas it pulled out of its journal
-/    - replicas will tell it when they hold an xlock
-/  - surviving mds rejoins replicas from a recovering mds
-/    - will tell auth if it holds an xlock
-- send_rejoin_acks
-
 - recovering open files
   - recovery will either have inode (from EOpen), or will provide path+cap to reassert open state.
     - path+cap window will require some fetching of metadata from disk before doing the rejoin
index a9b47f1270afbdb4553d6a7812ade33d6cc988e5..3540e1b2a14e85683518d0bc430551b42ca824b5 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a6621b7731c6387127fe5355032e682de6450f1c..77c054030b2d40d9aeae82e7c2e7293bf7b46966 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -2497,6 +2498,32 @@ off_t Client::lseek(fh_t fh, off_t offset, int whence)
 }
 
 
+
+void Client::lock_fh_pos(Fh *f)
+{
+  dout(10) << "lock_fh_pos " << f << endl;
+
+  if (f->pos_locked || !f->pos_waiters.empty()) {
+    Cond cond;
+    f->pos_waiters.push_back(&cond);
+    dout(10) << "lock_fh_pos BLOCKING on " << f << endl;
+    while (f->pos_locked || f->pos_waiters.front() != &cond)
+      cond.Wait(client_lock);
+    dout(10) << "lock_fh_pos UNBLOCKING on " << f << endl;
+    assert(f->pos_waiters.front() == &cond);
+    f->pos_waiters.pop_front();
+  }
+  
+  f->pos_locked = true;
+}
+
+void Client::unlock_fh_pos(Fh *f)
+{
+  dout(10) << "unlock_fh_pos " << f << endl;
+  f->pos_locked = false;
+}
+
+
 // blocking osd interface
 
 int Client::read(fh_t fh, char *buf, off_t size, off_t offset) 
@@ -2515,6 +2542,7 @@ int Client::read(fh_t fh, char *buf, off_t size, off_t offset)
 
   bool movepos = false;
   if (offset < 0) {
+    lock_fh_pos(f);
     offset = f->pos;
     movepos = true;
   }
@@ -2528,6 +2556,7 @@ int Client::read(fh_t fh, char *buf, off_t size, off_t offset)
     // we can trust size info bc we get accurate info when buffering/caching caps are issued.
     dout(10) << "file size: " << in->inode.size << endl;
     if (offset > 0 && offset >= in->inode.size) {
+      if (movepos) unlock_fh_pos(f);
       client_lock.Unlock();
       return 0;
     }
@@ -2535,7 +2564,8 @@ int Client::read(fh_t fh, char *buf, off_t size, off_t offset)
       size = (off_t)in->inode.size - offset;
     
     if (size == 0) {
-      dout(-10) << "read is size=0, returning 0" << endl;
+      dout(10) << "read is size=0, returning 0" << endl;
+      if (movepos) unlock_fh_pos(f);
       client_lock.Unlock();
       return 0;
     }
@@ -2587,6 +2617,7 @@ int Client::read(fh_t fh, char *buf, off_t size, off_t offset)
   if (movepos) {
     // adjust fd pos
     f->pos = offset+blist.length();
+    unlock_fh_pos(f);
   }
 
   // copy data into caller's char* buf
@@ -2643,10 +2674,12 @@ int Client::write(fh_t fh, const char *buf, off_t size, off_t offset)
   Fh *f = fh_map[fh];
   Inode *in = f->inode;
 
+  // use/adjust fd pos?
   if (offset < 0) {
+    lock_fh_pos(f);
     offset = f->pos;
-    // adjust fd pos
-    f->pos = offset+size;
+    f->pos = offset+size;    
+    unlock_fh_pos(f);
   }
 
   bool lazy = f->mode == FILE_MODE_LAZY;
@@ -2966,7 +2999,6 @@ int Client::enumerate_layout(int fh, list<ObjectExtent>& result,
 }
 
 
-
 void Client::ms_handle_failure(Message *m, const entity_inst_t& inst)
 {
   entity_name_t dest = inst.name;
index ad2953f71dbd8282628a0dd29a356ba24a4b066c..6b1eb75298c63db1ae2652c15d973a1bc589fc71 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -294,7 +295,10 @@ struct Fh {
 
   bool is_lazy() { return mode & O_LAZY; }
 
-  Fh() : inode(0), pos(0), mds(0), mode(0) {}
+  bool pos_locked;           // pos is currently in use
+  list<Cond*> pos_waiters;   // waiters for pos
+
+  Fh() : inode(0), pos(0), mds(0), mode(0), pos_locked(false) {}
 };
 
 
@@ -320,6 +324,11 @@ class Client : public Dispatcher {
   };
 
 
+  // cluster descriptors
+  MDSMap *mdsmap; 
+  OSDMap *osdmap;
+
+
  protected:
   Messenger *messenger;  
   int whoami;
@@ -366,11 +375,6 @@ class Client : public Dispatcher {
   void handle_client_request_forward(MClientRequestForward *reply);
   void handle_client_reply(MClientReply *reply);
 
-
-  // cluster descriptors
-  MDSMap *mdsmap; 
-  OSDMap *osdmap;
-
   bool   mounted;
   bool   unmounting;
   Cond   mount_cond;  
@@ -555,6 +559,9 @@ protected:
   void close_release(Inode *in);
   void close_safe(Inode *in);
 
+  void lock_fh_pos(Fh *f);
+  void unlock_fh_pos(Fh *f);
+  
   // metadata cache
   Inode* insert_inode(Dir *dir, InodeStat *in_info, const string& dn);
   void update_inode_dist(Inode *in, InodeStat *st);
index 6645bef09b6df842742bf230efadf6faa9f79ba7..0c5b6b1c9440aa3a4bed0f8c6c550203bac57953 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9ba82f92eb1ab94775845153fb871fd4f7b88775..fc4f715691b435d939260fd41bc6520253735c2a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7e7f95f71b1f39f1997e44797cf8cec1b1ac05da..38aa92023f70e63a4826f5725cd374bfabb1cbc3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -674,7 +675,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix)
 
   const char *p = prefix.c_str();
 
-  map<__int64_t, __int64_t> open_files;
+  map<int64_t, int64_t> open_files;
 
   while (!t.end()) {
     
@@ -696,7 +697,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix)
       client->rename(a,b);      
     } else if (strcmp(op, "mkdir") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
+      int64_t b = t.get_int();
       client->mkdir(a, b);
     } else if (strcmp(op, "rmdir") == 0) {
       const char *a = t.get_string(p);
@@ -715,24 +716,24 @@ int SyntheticClient::play_trace(Trace& t, string& prefix)
       client->lstat(a, &st);
     } else if (strcmp(op, "chmod") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
+      int64_t b = t.get_int();
       client->chmod(a, b);
     } else if (strcmp(op, "chown") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
-      __int64_t c = t.get_int();
+      int64_t b = t.get_int();
+      int64_t c = t.get_int();
       client->chown(a, b, c);
     } else if (strcmp(op, "utime") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
-      __int64_t c = t.get_int();
+      int64_t b = t.get_int();
+      int64_t c = t.get_int();
       struct utimbuf u;
       u.actime = b;
       u.modtime = c;
       client->utime(a, &u);
     } else if (strcmp(op, "mknod") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
+      int64_t b = t.get_int();
       client->mknod(a, b);
     } else if (strcmp(op, "getdir") == 0) {
       const char *a = t.get_string(p);
@@ -740,36 +741,36 @@ int SyntheticClient::play_trace(Trace& t, string& prefix)
       client->getdir(a, contents);
     } else if (strcmp(op, "open") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int(); 
-      __int64_t id = t.get_int();
-      __int64_t fh = client->open(a, b);
+      int64_t b = t.get_int(); 
+      int64_t id = t.get_int();
+      int64_t fh = client->open(a, b);
       open_files[id] = fh;
     } else if (strcmp(op, "close") == 0) {
-      __int64_t id = t.get_int();
-      __int64_t fh = open_files[id];
+      int64_t id = t.get_int();
+      int64_t fh = open_files[id];
       if (fh > 0) client->close(fh);
       open_files.erase(id);
     } else if (strcmp(op, "truncate") == 0) {
       const char *a = t.get_string(p);
-      __int64_t b = t.get_int();
+      int64_t b = t.get_int();
       client->truncate(a,b);
     } else if (strcmp(op, "read") == 0) {
-      __int64_t id = t.get_int();
-      __int64_t fh = open_files[id];
+      int64_t id = t.get_int();
+      int64_t fh = open_files[id];
       int size = t.get_int();
       int off = t.get_int();
       char *buf = new char[size];
       client->read(fh, buf, size, off);
       delete[] buf;
     } else if (strcmp(op, "lseek") == 0) {
-      __int64_t id = t.get_int();
-      __int64_t fh = open_files[id];
+      int64_t id = t.get_int();
+      int64_t fh = open_files[id];
       int off = t.get_int();
       int whence = t.get_int();
       client->lseek(fh, off, whence);
     } else if (strcmp(op, "write") == 0) {
-      __int64_t id = t.get_int();
-      __int64_t fh = open_files[id];
+      int64_t id = t.get_int();
+      int64_t fh = open_files[id];
       int size = t.get_int();
       int off = t.get_int();
       char *buf = new char[size];
@@ -783,7 +784,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix)
   }
 
   // close open files
-  for (map<__int64_t, __int64_t>::iterator fi = open_files.begin();
+  for (map<int64_t, int64_t>::iterator fi = open_files.begin();
        fi != open_files.end();
        fi++) {
     dout(1) << "leftover close " << fi->second << endl;
@@ -1080,10 +1081,10 @@ int SyntheticClient::open_shared(int num, int count)
 
 int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is in MB, wrsize in bytes
 {
-  //__uint64_t wrsize = 1024*256;
+  //uint64_t wrsize = 1024*256;
   char *buf = new char[wrsize+100];   // 1 MB
   memset(buf, 7, wrsize);
-  __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)wrsize;
+  uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)wrsize;
 
   int fd = client->open(fn.c_str(), O_RDWR|O_CREAT);
   dout(5) << "writing to " << fn << " fd " << fd << endl;
@@ -1100,7 +1101,7 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is i
     // 64 bits : file offset
     // 64 bits : client id
     // = 128 bits (16 bytes)
-    __uint64_t *p = (__uint64_t*)buf;
+    uint64_t *p = (uint64_t*)buf;
     while ((char*)p < buf + wrsize) {
       *p = i*wrsize + (char*)p - buf;      
       p++;
@@ -1131,7 +1132,7 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize)   // size is in
 {
   char *buf = new char[rdsize]; 
   memset(buf, 1, rdsize);
-  __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize;
+  uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)rdsize;
 
   int fd = client->open(fn.c_str(), O_RDONLY);
   dout(5) << "reading from " << fn << " fd " << fd << endl;
@@ -1148,11 +1149,11 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize)   // size is in
  
     // verify fingerprint
     int bad = 0;
-    __int64_t *p = (__int64_t*)buf;
-    __int64_t readoff, readclient;
+    int64_t *p = (int64_t*)buf;
+    int64_t readoff, readclient;
     while ((char*)p + 32 < buf + rdsize) {
       readoff = *p;
-      __int64_t wantoff = i*rdsize + (__int64_t)((char*)p - buf);
+      int64_t wantoff = i*rdsize + (int64_t)((char*)p - buf);
       p++;
       readclient = *p;
       p++;
index 7646b5e4281c2e4164a047331bc00765b63cc4b4..b3bebab9379b30dd0f76d24803b494216313be30 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 43459653011a1f8c6ac30114af107ca090d90394..06a64478230366b35647c2040a55c1f07e1d90a6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 08b1fa8ff272216e7b69ac9ec2282b603175e8be..bde9f2830cf5f24c03ae948d6a79a6b350538a97 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b142609ccda73e7e57ad8399ead5162131eb0df6..855a3eb4a676671428557908cf2f81a1bf97ac47 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d0b8dcb1154f576688ff2630bef61f2da80c0c16..dfacbaa4fdd85e5605b3fbd0f38782d9a012a033 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 64d6d76fe00e51b26c687f7ac1ee3b1a7fb94151..7aa8c133d370b2a9398a7bee200ae5b41979c93f 100644 (file)
@@ -12,7 +12,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1init
   (JNIEnv *, jobject)
 {
 
-  cout << "Initializing Ceph client:" << endl;
+  dout(3) << "CephFSInterface: Initializing Ceph client:" << endl;
 
   // parse args from CEPH_ARGS 
   vector<char*> args; 
@@ -26,10 +26,12 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1init
 
   // load monmap
   MonMap monmap;
-  int r = monmap.read(".ceph_monmap");
+  //  int r = monmap.read(".ceph_monmap");
+  int r = monmap.read("/cse/grads/eestolan/ceph/trunk/ceph/.ceph_monmap");
   if (r < 0) {
-    cout << "could not find .ceph_monmap" << endl; 
-    return 0;
+    dout(0) << "CephFSInterface: could not find .ceph_monmap" << endl; 
+    assert(0 && "could not find .ceph_monmap");
+    //    return 0;
   }
   assert(r >= 0);
 
@@ -58,8 +60,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1init
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1copyFromLocalFile
 (JNIEnv * env, jobject obj, jlong clientp, jstring j_local_path, jstring j_ceph_path) {
 
-  cout << "In copyFromLocalFile" << endl;
-  cout.flush();
+  dout(10) << "CephFSInterface: In copyFromLocalFile" << endl;
   Client* client;
   //client = (Client*) clientp;
    client = *(Client**)&clientp;
@@ -67,7 +68,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1c
   const char* c_local_path = env->GetStringUTFChars(j_local_path, 0);
   const char* c_ceph_path = env->GetStringUTFChars(j_ceph_path, 0);
 
-  cout << "Local source file is "<< c_local_path << " and Ceph destination file is " << c_ceph_path << endl;
+  dout(10) << "CephFSInterface: Local source file is "<< c_local_path << " and Ceph destination file is " << c_ceph_path << endl;
   struct stat st;
   int r = ::stat(c_local_path, &st);
   assert (r == 0);
@@ -77,7 +78,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1c
   int fh_ceph = client->open(c_ceph_path, O_WRONLY|O_CREAT|O_TRUNC);  
   assert (fh_local > -1);
   assert (fh_ceph > -1);
-  cout << "local fd is " << fh_local << " and Ceph fd is " << fh_ceph << endl;
+  dout(10) << "CephFSInterface: local fd is " << fh_local << " and Ceph fd is " << fh_ceph << endl;
 
   // get the source file size
   off_t remaining = st.st_size;
@@ -110,31 +111,29 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1c
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1copyToLocalFile
 (JNIEnv *env, jobject obj, jlong clientp, jstring j_ceph_path, jstring j_local_path) 
 {
-
-
   Client* client;
   client = *(Client**)&clientp;
   const char* c_ceph_path = env->GetStringUTFChars(j_ceph_path, 0);
   const char* c_local_path = env->GetStringUTFChars(j_local_path, 0);
 
-  cout << "In copyToLocalFile, copying from Ceph file " << c_ceph_path << 
+  dout(3) << "CephFSInterface: dout(3): In copyToLocalFile, copying from Ceph file " << c_ceph_path << 
+    " to local file " << c_local_path << endl;
+
+  cout << "CephFSInterface: cout: In copyToLocalFile, copying from Ceph file " << c_ceph_path << 
     " to local file " << c_local_path << endl;
-  cout.flush();
 
 
   // get source file size
   struct stat st;
-  cout << "Attempting lstat with file " << c_ceph_path << ":" << endl;
+  //dout(10) << "Attempting lstat with file " << c_ceph_path << ":" << endl;
   int r = client->lstat(c_ceph_path, &st);
   assert (r == 0);
 
-  cout << "Opening Ceph source file for read: " << endl;
-  cout.flush();
+  dout(10) << "CephFSInterface: Opening Ceph source file for read: " << endl;
   int fh_ceph = client->open(c_ceph_path, O_RDONLY);  
   assert (fh_ceph > -1);
 
-  cout << " Opened Ceph file! Opening local destination file: " << endl;
-  cout.flush();
+  dout(10) << "CephFSInterface: Opened Ceph file! Opening local destination file: " << endl;
   int fh_local = ::open(c_local_path, O_WRONLY|O_CREAT|O_TRUNC, 0644);
   assert (fh_local > -1);
 
@@ -168,8 +167,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1c
 JNIEXPORT jstring JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getcwd
   (JNIEnv *env, jobject obj, jlong clientp)
 {
-  //cout << "In getcwd" << endl;
-  //cout.flush();
+  dout(10) << "CephFSInterface: In getcwd" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -187,8 +185,7 @@ JNIEXPORT jstring JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1ge
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1setcwd
 (JNIEnv *env, jobject obj, jlong clientp, jstring j_path)
 {
-  //cout << "In setcwd" << endl;
-  //cout.flush();
+  dout(10) << "CephFSInterface: In setcwd" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -207,8 +204,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1s
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1rmdir
   (JNIEnv *env, jobject, jlong clientp, jstring j_path)
 {
-  cout << "In rmdir" << endl;
-  cout.flush();
+  dout(10) << "CephFSInterface: In rmdir" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -228,9 +224,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1r
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1mkdir
   (JNIEnv * env, jobject, jlong clientp, jstring j_path)
 {
-  //cout << "In mkdir" << endl;
-  //cout.flush();
-
+  dout(10) << "CephFSInterface: In mkdir" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -249,36 +243,34 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1m
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1unlink
   (JNIEnv * env, jobject, jlong clientp, jstring j_path)
 {
-  cout.flush();
-
   Client* client;
   client = *(Client**)&clientp;
 
   const char* c_path = env->GetStringUTFChars(j_path, 0);
-  cout << "In unlink for path " << c_path <<  ":" << endl;
+  dout(10) << "CephFSInterface: In unlink for path " << c_path <<  ":" << endl;
 
   // is it a file or a directory?
   struct stat stbuf;
   int stat_result = client->lstat(c_path, &stbuf);
   if (stat_result < 0) {// then the path doesn't even exist
-    cout << "ceph_unlink: path " << c_path << " does not exist" << endl;
+    dout(0) << "ceph_unlink: path " << c_path << " does not exist" << endl;
     return false;
   }  
   int result;
   if (0 != S_ISDIR(stbuf.st_mode)) { // it's a directory
-    cout << "ceph_unlink: path " << c_path << " is a directory. Calling client->rmdir()" << endl;
+    dout(10) << "ceph_unlink: path " << c_path << " is a directory. Calling client->rmdir()" << endl;
     result = client->rmdir(c_path);
   }
   else if (0 != S_ISREG(stbuf.st_mode)) { // it's a file
-    cout << "ceph_unlink: path " << c_path << " is a file. Calling client->unlink()" << endl;
+    dout(10) << "ceph_unlink: path " << c_path << " is a file. Calling client->unlink()" << endl;
     result = client->unlink(c_path);
   }
   else {
-    cout << "ceph_unlink: path " << c_path << " is not a file or a directory. Failing:" << endl;
+    dout(0) << "ceph_unlink: path " << c_path << " is not a file or a directory. Failing:" << endl;
     result = -1;
   }
     
-  cout << "In ceph_unlink for path " << c_path << 
+  dout(10) << "In ceph_unlink for path " << c_path << 
     ": got result " 
        << result << ". Returning..."<< endl;
 
@@ -295,9 +287,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1u
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1rename
   (JNIEnv *env, jobject, jlong clientp, jstring j_from, jstring j_to)
 {
-  cout << "In rename" << endl;
-  cout.flush();
-
+  dout(10) << "CephFSInterface: In rename" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -320,35 +310,25 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1e
 (JNIEnv *env, jobject, jlong clientp, jstring j_path)
 {
 
-  //cout << "In exists" << endl;
-  //cout.flush();
+  dout(10) << "CephFSInterface: In exists" << endl;
 
   Client* client;
   struct stat stbuf;
   client = *(Client**)&clientp;
 
   const char* c_path = env->GetStringUTFChars(j_path, 0);
-  cout << "Attempting lstat with file " << c_path << ":" ;
-  //int i = (int) (*c_path);
-  //cout << "First character value is " << i;
-  // cout.flush();
+  dout(10) << "Attempting lstat with file " << c_path << ":" ;
   int result = client->lstat(c_path, &stbuf);
-  cout << "result is " << result << endl;
-  //  cout << "Attempting to release string \"" << c_path << "\"" << endl;
-  //cout.flush();
+  dout(10) << "result is " << result << endl;
   env->ReleaseStringUTFChars(j_path, c_path);
-  //cout << "String released!" << endl;
   if (result < 0) {
-    //cout << "Returning false (file does not exist)" << endl;
-    //cout.flush();
+    dout(10) << "Returning false (file does not exist)" << endl;
     return JNI_FALSE;
   }
   else {
-    //cout << "Returning true (file exists)" << endl;
-    //cout.flush();
+    dout(10) << "Returning true (file exists)" << endl;
     return JNI_TRUE;
   }
-
 }
 
 /*
@@ -362,21 +342,34 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1e
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getblocksize
   (JNIEnv *env, jobject obj, jlong clientp, jstring j_path)
 {
-  cout << "In getblocksize" << endl;
-  cout.flush();
-
+  dout(10) << "In getblocksize" << endl;
 
   Client* client;
-  struct stat stbuf;
+  //struct stat stbuf;
   client = *(Client**)&clientp;
   
   jint result;
 
   const char* c_path = env->GetStringUTFChars(j_path, 0);
+
+  /*
   if (0 > client->lstat(c_path, &stbuf))
     result =  -1;
   else
     result = stbuf.st_blksize;
+  */
+
+  // we need to open the file to retrieve the stripe size
+  dout(10) << "CephFSInterface: getblocksize: opening file" << endl;
+  int fh = client->open(c_path, O_RDONLY);  
+  if (fh < 0)
+    return -1;
+
+  result = client->get_stripe_unit(fh);
+
+  int close_result = client->close(fh);
+  assert (close_result > -1);
+
 
   env->ReleaseStringUTFChars(j_path, c_path);
   return result;
@@ -391,8 +384,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getb
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getfilesize
   (JNIEnv *env, jobject, jlong clientp, jstring j_path)
 {
-  cout << "In getfilesize" << endl;
-  cout.flush();
+  dout(10) << "In getfilesize" << endl;
 
   Client* client;
   struct stat stbuf;
@@ -416,8 +408,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getf
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1isfile
   (JNIEnv *env, jobject obj, jlong clientp, jstring j_path)
 {
-  //cout << "In isfile" << endl;
-  //cout.flush();
+  dout(10) << "In isfile" << endl;
 
   Client* client;
   struct stat stbuf;
@@ -425,11 +416,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
 
 
   const char* c_path = env->GetStringUTFChars(j_path, 0);
-  //cout << "Attempting lstat with file " << c_path << ":" << endl;
-  //cout.flush();
   int result = client->lstat(c_path, &stbuf);
-  //cout << "Got through lstat without crashing: result is " << result << endl;
-  //cout.flush();
 
   env->ReleaseStringUTFChars(j_path, c_path);
 
@@ -437,7 +424,6 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
   if (0 > result) return JNI_FALSE; 
 
   // check the stat result
-  //cout << "Stat call succeeded: attempting to look inside stbuf for result" << endl;
   return (0 == S_ISREG(stbuf.st_mode)) ? JNI_FALSE : JNI_TRUE;
 }
 
@@ -451,8 +437,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1isdirectory
   (JNIEnv *env, jobject, jlong clientp, jstring j_path)
 {
-  //cout << "In isdirectory" << endl;
-  //cout.flush();
+  dout(10) << "In isdirectory" << endl;
 
   Client* client;
   struct stat stbuf;
@@ -461,8 +446,6 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
   const char* c_path = env->GetStringUTFChars(j_path, 0);
   int result = client->lstat(c_path, &stbuf);
   env->ReleaseStringUTFChars(j_path, c_path);
-  //cout << "String released!" << endl;
-  //cout.flush();
 
   // if the stat call failed, it's definitely not a directory...
   if (0 > result) return JNI_FALSE; 
@@ -480,9 +463,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
 JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getdir
 (JNIEnv *env, jobject obj, jlong clientp, jstring j_path) {
 
-  //cout << "In getdir" << endl;
-  //cout.flush();
-
+  dout(10) << "In getdir" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -491,16 +472,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_cep
   map<string, inode_t> contents;
   const char* c_path = env->GetStringUTFChars(j_path, 0);
   int result = client->getdir(c_path, contents);
-  //cout << "Releasing string" << endl;
   env->ReleaseStringUTFChars(j_path, c_path);
   
   if (result < 0) return NULL;
 
-  //cout << "checking for empty dir" << endl;
+  dout(10) << "checking for empty dir" << endl;
   jint dir_size = contents.size();
 
-  // Hadoop doesn't want . or .. in the listing, so we shrink the
-  // listing size by two, or by one if the directory's root
+  // Hadoop freaks out if the listing contains "." or "..".  Shrink
+  // the listing size by two, or by one if the directory is the root.
   if(('/' == c_path[0]) && (0 == c_path[1]))
     dir_size -= 1;
   else
@@ -511,7 +491,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_cep
   // jstring blankString = env->NewStringUTF("");
   jclass stringClass = env->FindClass("java/lang/String");
   if (NULL == stringClass) {
-    cout << "ERROR: java String class not found; dying a horrible, painful death" << endl;
+    dout(0) << "ERROR: java String class not found; dying a horrible, painful death" << endl;
     assert(0);
   }
   jobjectArray dirListingStringArray = (jobjectArray) env->NewObjectArray(dir_size, stringClass, NULL);
@@ -529,7 +509,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_cep
     if (it->first == dotdot) continue;
 
     if (0 == dir_size)
-      cout << "WARNING: adding stuff to an empty array" << endl;
+      dout(0) << "CephFSInterface: WARNING: adding stuff to an empty array." << endl;
     assert (i < dir_size);
     env->SetObjectArrayElement(dirListingStringArray, i, 
                               env->NewStringUTF(it->first.c_str()));
@@ -550,9 +530,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1open_
   (JNIEnv *env, jobject obj, jlong clientp, jstring j_path)
 
 {
-  //cout << "In open_for_read" << endl;
-  //cout.flush();
-
+  dout(10) << "In open_for_read" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -579,8 +557,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1open_
 JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1open_1for_1overwrite
   (JNIEnv *env, jobject obj, jlong clientp, jstring j_path)
 {
-  //cout << "In open_for_overwrite" << endl;
-  //cout.flush();
+  dout(10) << "In open_for_overwrite" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -630,8 +607,7 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1k
 JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1read
   (JNIEnv *env, jobject obj, jlong clientp, jint fh, jbyteArray j_buffer, jint buffer_offset, jint length)
 {
-  //cout << "In read" << endl;
-  //cout.flush();
+  dout(10) << "In read" << endl;
 
 
   // IMPORTANT NOTE: Hadoop read arguments are a bit different from POSIX so we
@@ -669,9 +645,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1read
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1seek_1from_1start
   (JNIEnv *env, jobject obj, jlong clientp, jint fh, jlong pos)
 {
-  //cout << "In CephInputStream::seek_from_start" << endl;
-  //cout.flush();
-
+  dout(10) << "In CephInputStream::seek_from_start" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -682,13 +656,10 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1see
   return result;
 }
 
-
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1getpos
   (JNIEnv *env, jobject obj, jlong clientp, jint fh)
 {
-  cout << "In CephInputStream::ceph_getpos" << endl;
-  cout.flush();
-
+  dout(10) << "In CephInputStream::ceph_getpos" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -710,8 +681,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1get
 JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1close
   (JNIEnv *env, jobject obj, jlong clientp, jint fh)
 {
-  cout << "In CephInputStream::ceph_close" << endl;
-  cout.flush();
+  dout(10) << "In CephInputStream::ceph_close" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -730,8 +700,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephInputStream_ceph_1clos
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1seek_1from_1start
   (JNIEnv *env, jobject obj, jlong clientp, jint fh, jlong pos)
 {
-  cout << "In CephOutputStream::ceph_seek_from_start" << endl;
-  cout.flush();
+  dout(10) << "In CephOutputStream::ceph_seek_from_start" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -751,8 +720,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1se
 JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1getpos
   (JNIEnv *env, jobject obj, jlong clientp, jint fh)
 {
-  cout << "In CephOutputStream::ceph_getpos" << endl;
-  cout.flush();
+  dout(10) << "In CephOutputStream::ceph_getpos" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -772,8 +740,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1ge
 JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1close
   (JNIEnv *env, jobject obj, jlong clientp, jint fh)
 {
-  cout << "In CephOutputStream::ceph_close" << endl;
-  cout.flush();
+  dout(10) << "In CephOutputStream::ceph_close" << endl;
 
   Client* client;
   client = *(Client**)&clientp;
@@ -794,9 +761,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1clo
 JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephOutputStream_ceph_1write
   (JNIEnv *env, jobject obj, jlong clientp, jint fh, jbyteArray j_buffer, jint buffer_offset, jint length)
 {
-  //cout << "In write" << endl;
-  //cout.flush();
-
+  dout(10) << "In write" << endl;
 
   // IMPORTANT NOTE: Hadoop write arguments are a bit different from POSIX so we
   // have to convert.  The write is *always* from the current position in the file,
index 0930ecb25b8f1d278e289360dadd89d11bab1eb5..549925aba6e6482024713f734f6e01cf17c76292 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /* DO NOT EDIT THIS FILE - it is machine generated */
 #include <jni.h>
 /* Header for class org_apache_hadoop_fs_ceph_CephFileSystem */
index 9706fd49cad995d4b707c5afa136db934e3169c5..54f8290216832512e6cbf26b87d09e5b05364f04 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 69d10be9f6a5607bbc3aeff141fc8d95bd62358f..1e1af025b0d57a3debbca247de6480c0e1b7c692 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index aeeb42e87488a24415a2fe19ed390bb3bb23bd46..5965dffb554501fe2226ce49d7d79bb606a8e838 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8fd627986a240627f627e3e2535589e54f5c3c6f..2ce646b44f4fcef78456621cf7a6939a1894611c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d6e9e04bdd9dbdbc4a9217e6f55a9f593d9f0b12..19148942acc76608aa6cda8867764ee25788266a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c970a337826b643b83230e918d6a5d5863fadb0a..8b07f6d9eb15f9622496cf49570e7b964169d52e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9f4e581cf2711a9e0eb56cc51e66497d425d602e..1ea7227adebd4d99f41e3894357bfa92cb2956c0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ed465ce3762d6583b6dcf86d5937e7012287fd77..4cb3d721b423f6dbb2bb701021cef13e32247aa6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b95ebea815b7ca305d81b8d3f5c1f55a78ec6514..37ce7bad07fa5c99c3256c65fb43c718dd19bf96 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3de17751ec2f8394799018c9c0fe70a707acbf4a..9c45448d4959016200d0943c0d0ac0369770e925 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -29,7 +30,7 @@ using namespace __gnu_cxx;
 
 class LogType {
  protected:
-  hash_map<__uint64_t, int> keymap;  
+  hash_map<intptr_t, int> keymap;  
   vector<const char*>   keys;
   set<int>              inc_keys;
 
@@ -38,7 +39,7 @@ class LogType {
   // HACK to avoid the hash table as often as possible...
   // cache recent key name lookups in a small ring buffer
   const static int cache_keys = 10;
-  __uint64_t kc_ptr[cache_keys];
+  intptr_t kc_ptr[cache_keys];
   int kc_val[cache_keys];
   int kc_pos;
 
@@ -59,11 +60,7 @@ class LogType {
     i = keys.size();
     keys.push_back(key);
 
-#ifdef __LP64__
-    __uint64_t p = (__uint64_t)key;
-#else
-    __uint64_t p = (__uint32_t)key;
-#endif
+    intptr_t p = (intptr_t)key;
     keymap[p] = i;
     if (is_inc) inc_keys.insert(i);
 
@@ -82,11 +79,7 @@ class LogType {
   }
 
   int lookup_key(const char* key) {
-#ifdef __LP64__
-    __uint64_t p = (__uint64_t)key;
-#else
-    __uint64_t p = (__uint32_t)key;
-#endif
+    intptr_t p = (intptr_t)key;
 
     if (keymap.count(p)) 
       return keymap[p];
index e789d64a6ce473f517348cd6ee3615faa132ef91..a5417ab18629d7e5395ce7eaa4879538e360914e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 85102acd90370f86dc850971f7721f624c0160f3..e1c2c37ed300635b2021b65d4c6674edc37938d4 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 325ba2a0e11fc93dfa7d23b9c715b78c92d8e0e2..724c4dbed2a761f29e86520194eb241484e3fad7 100755 (executable)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7526f5c1ec9c8196e8a7892e82024ced173d5f0a..bc0a9e60d7ffaab474cfc5ea4a1c370451edc124 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d1ae1e767416538a5beba3eafc11f2c1c1dff248..2fd81a621773309b404e9f5349caa5e217a81e48 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 674053bfe10873fdeb0b31cbaf1f6a32212c5dc1..5bc1a7fa57b5adbf54680146c6b21df586388bd7 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 522a623d5ebac14c9c07bd2d71c0a7a000360d7d..1ddf5d18e8bbfda7bd2ddb7488e7adf4a6d08b1a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 80470c361573735c10a3fbc656cf3389fb2dc265..46095d98312e17e6a9667bb3af25f43256c37141 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9b2118c101a14b0fd51323ed6a563a83a8bb67ac..64862f2b853170fb8403fcb51322c75fe043169c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 6e64f8c3f57d89c94aad67ac2050ea90918c0f0c..c252e138f9c4fde91cc0e1ae5434ef00c034f102 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ff1e24b63b9055d85b9bd32aa61f3edea533fe4c..800eacf5acd9a0151220cacf8eef3ca68a64a563 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f13f3f1e565ef69c411118e383b4ffd475d4f33d..c9b91e19db9703b173159fa93f7d20a287604e40 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 5b2d3259e09f8cf1e0d313e5e112d165f8860316..81a2576697bd7e95ae4280252242b7e8becf6118 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a321624925d957d25703be8a780b0d296c483870..2f0d9e4db918ba6afa5937cbc120d070ff80e28b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index aa93031beb51eba516e4ab890c75a481942d1844..4c03994ba82fecf5957cbe29bd236c513e7bfb84 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index afec2f81724b0b37680dfec4c67c961000070cb2..5ab9386eadc46a40ca1f1236194c9499cb220974 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8a3c51280461d345920039c1d80a4b45a4e9c590..bccdb81533b6fe4a8509b4299248e767844fb87f 100644 (file)
@@ -1,4 +1,5 @@
-// -*- mode:C++; tab-width:4; c-basic-offset:2; indent-tabs-mode:t -*- 
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
diff --git a/branches/sage/pgs/doc/modeline.txt b/branches/sage/pgs/doc/modeline.txt
new file mode 100644 (file)
index 0000000..1b3956f
--- /dev/null
@@ -0,0 +1,2 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
index 805957f779a11b8ad9f621fc09139ab687c0887a..70b641cfee14f1c0d767d293d430089961a0ad0e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c53ff2a69fba1eaa3d70c4a7f9c2dc36866b83f4..a7d7aebf75d003495fe32fdfce0ec07c7a29ca80 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7044e4ca38f27521f7b96ae7d6e22c03a7b194f4..29071fd5bd8daff04bff2ecd3e9fb061cac20f82 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -279,7 +280,7 @@ block_t BlockDevice::get_num_blocks()
       num_blocks = st.st_size;
     }
     
-    num_blocks /= (__uint64_t)EBOFS_BLOCK_SIZE;
+    num_blocks /= (uint64_t)EBOFS_BLOCK_SIZE;
 
     if (g_conf.bdev_fake_mb) {
       num_blocks = g_conf.bdev_fake_mb * 256;
@@ -699,7 +700,7 @@ int BlockDevice::open(kicker *idle)
   }
                
   // figure size
-  __uint64_t bsize = get_num_blocks();
+  uint64_t bsize = get_num_blocks();
   
   dout(2) << "open " << bsize << " bytes, " << num_blocks << " blocks" << endl;
   
index 18f639f7176b6d1c07f41e04a7f453e4030ef9d3..3f44699b1673b10627f0476d4a965c27fe4110ed 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 4ad22b3a5d0fbad1d480fb907fcb1dea5fef43c3..a83ce5cb480fdf967516800a800762dec6df2466 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 563b3e5791c217169fd4e36fc25a6943696f192b..62f6680a8460dbff48a1a144b8baaf585bfffafb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b906a6db24c5784e956b0c9ca3ab5deae76bb3d5..8415978893fb58129e02f205ee81bd84cee63322 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c4070d71d76cdd1ffd51dc85eafdfde599208335..7d03dc074c30e534a8b34905dd6c6d0d9d3daed8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -3185,7 +3186,7 @@ void Ebofs::_get_frag_stat(FragmentationStat& st)
   st.num_free_extent = 0;
   st.avg_free_extent = 0;
 /*
-  __uint64_t tfree = 0;
+  uint64_t tfree = 0;
   for (int b=0; b<=EBOFS_NUM_FREE_BUCKETS; b++) {
     Table<block_t,block_t> *tab;
     if (b < EBOFS_NUM_FREE_BUCKETS) {
index 29d2dfb0b025bf116b8ff0a3b755c1c47dda048f..91c5eb51b3cda6afb7837039120eb30bdff9e0ee 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
diff --git a/branches/sage/pgs/ebofs/FileJournal.cc b/branches/sage/pgs/ebofs/FileJournal.cc
new file mode 100644 (file)
index 0000000..87ea201
--- /dev/null
@@ -0,0 +1,200 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+
+#include "FileJournal.h"
+#include "Ebofs.h"
+
+#include "config.h"
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs(" << dev.get_device_name() << ").journal "
+#define derr(x) if (x <= g_conf.debug_ebofs) cerr << "ebofs(" << dev.get_device_name() << ").journal "
+
+
+
+void FileJournal::create()
+{
+  dout(1) << "create " << fn << endl;
+
+  // open/create
+  fd = ::open(fn.c_str(), O_CREAT|O_WRONLY);
+  assert(fd > 0);
+
+  ::ftruncate(fd);
+  ::fchmod(fd, 0644);
+
+  ::close(fd);
+}
+
+
+void FileJournal::open()
+{
+  dout(1) << "open " << fn << endl;
+
+  // open and file
+  assert(fd == 0);
+  fd = ::open(fn.c_str(), O_RDWR);
+  assert(fd > 0);
+
+  // read header?
+  // ***
+
+
+  start_writer();
+}
+
+void FileJournal::close()
+{
+  dout(1) << "close " << fn << endl;
+
+  // stop writer thread
+  stop_writer();
+
+  // close
+  assert(q.empty());
+  assert(fd > 0);
+  ::close(fd);
+  fd = 0;
+}
+
+void FileJournal::start_writer()
+{
+  write_stop = false;
+  write_thread.create();
+}
+
+void FileJournal::stop_writer()
+{
+  write_lock.Lock();
+  {
+    write_stop = true;
+    write_cond.Signal();
+  } 
+  write_lock.Unlock();
+  write_thread.join();
+}
+
+
+void FileJournal::write_header()
+{
+  dout(10) << "write_header" << endl;
+  
+  ::lseek(fd, 0, SEEK_SET);
+  ::write(fd, &header, sizeof(header));
+}
+
+
+void FileJournal::write_thread_entry()
+{
+  dout(10) << "write_thread_entry start" << endl;
+  write_lock.Lock();
+  
+  while (!write_stop) {
+    if (writeq.empty()) {
+      // sleep
+      dout(20) << "write_thread_entry going to sleep" << endl;
+      write_cond.Wait(write_lock);
+      dout(20) << "write_thread_entry woke up" << endl;
+      continue;
+    }
+    
+    // do queued writes
+    while (!writeq.empty()) {
+      // grab next item
+      epoch_t e = writeq.front().first;
+      bufferlist bl;
+      bl.claim(writeq.front().second);
+      writeq.pop_front();
+      Context *oncommit = commitq.front();
+      commitq.pop_front();
+      
+      dout(15) << "write_thread_entry writing " << bottom << " : " 
+              << bl.length() 
+              << " epoch " << e
+              << endl;
+      
+      // write epoch, len, data.
+      ::fseek(fd, bottom, SEEK_SET);
+      ::write(fd, &e, sizeof(e));
+      
+      uint32_t len = bl.length();
+      ::write(fd, &len, sizeof(len));
+      
+      for (list<bufferptr>::const_iterator it = bl.buffers().begin();
+          it != bl.buffers().end();
+          it++) {
+       if ((*it).length() == 0) continue;  // blank buffer.
+       ::write(fd, (char*)(*it).c_str(), (*it).length() );
+      }
+      
+      // move position pointer
+      bottom += sizeof(epoch_t) + sizeof(uint32_t) + e.length();
+      
+      // do commit callback
+      if (oncommit) {
+       oncommit->finish(0);
+       delete oncommit;
+      }
+    }
+  }
+  
+  write_lock.Unlock();
+  dout(10) << "write_thread_entry finish" << endl;
+}
+
+void FileJournal::submit_entry(bufferlist& e, Context *oncommit)
+{
+  dout(10) << "submit_entry " << bottom << " : " << e.length()
+          << " epoch " << ebofs->super_epoch
+          << " " << oncommit << endl;
+  
+  // dump on queue
+  writeq.push_back(pair<epoch_t,bufferlist>(ebofs->super_epoch, e));
+  commitq.push_back(oncommit);
+
+  // kick writer thread
+  write_cond.Signal();
+}
+
+
+void FileJournal::commit_epoch_start()
+{
+  dout(10) << "commit_epoch_start" << endl;
+
+  write_lock.Lock();
+  {
+    header.epoch2 = ebofs->super_epoch;
+    header.top2 = bottom;
+    write_header();
+  }
+  write_lock.Unlock();
+}
+
+void FileJournal::commit_epoch_finish()
+{
+  dout(10) << "commit_epoch_finish" << endl;
+
+  write_lock.Lock();
+  {
+    // update header
+    header.epoch1 = ebofs->super_epoch;
+    header.top1 = header.top2;
+    header.epoch2 = 0;
+    header.top2 = 0;
+    write_header();
+
+    // flush any unwritten items in previous epoch
+    while (!writeq.empty() &&
+          writeq.front().first < ebofs->super_epoch) {
+      dout(15) << " dropping uncommitted journal item from prior epoch" << endl;
+      writeq.pop_front();
+      Context *oncommit = commitq.front();
+      commitq.pop_front();
+         
+      if (oncommit) {
+       oncommit->finish(0);
+       delete oncommit;
+      }
+    }
+  }
+  write_lock.Unlock();
+  
+}
diff --git a/branches/sage/pgs/ebofs/FileJournal.h b/branches/sage/pgs/ebofs/FileJournal.h
new file mode 100644 (file)
index 0000000..6c34f24
--- /dev/null
@@ -0,0 +1,87 @@
+// -*- 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 __EBOFS_FILEJOURNAL_H
+#define __EBOFS_FILEJOURNAL_H
+
+
+#include "Journal.h"
+
+
+class FileJournal : public Journal {
+public:
+  struct header_t {
+    epoch_t epoch1;
+    off_t top1;
+    epoch_t epoch2;
+    off_t top2;
+  } header;
+
+private:
+  string fn;
+
+  off_t max_size;
+  off_t top;            // byte of first entry chronologically
+  off_t bottom;         // byte where next entry goes
+  off_t committing_to;  // offset of epoch boundary, if we are committing
+
+  int fd;
+
+  list<pair<epoch_t,bufferlist> > writeq;  // currently journaling
+  list<Context*> commitq; // currently journaling
+  
+  // write thread
+  Mutex write_lock;
+  Cond write_cond;
+  bool write_stop;
+
+  void write_header();
+  void start_writer();
+  void stop_writer();
+  void write_thread_entry();
+
+  class Writer : public Thread {
+    FileJournal *journal;
+  public:
+    Writer(FileJournal *fj) : journal(fj) {}
+    void *entry() {
+      journal->write_thread();
+      return 0;
+    }
+  } write_thread;
+
+ public:
+  FileJournal(Ebofs *e, char *f, off_t sz) : 
+    Journal(e),
+    fn(f), max_size(sz),
+    top(0), bottom(0), committing_to(0),
+    fd(0),
+    write_stop(false), write_thread(this)
+  { }
+  ~FileJournal() {}
+
+  void create();
+  void open();
+  void close();
+
+  // writes
+  void submit_entry(bufferlist& e, Context *oncommit);  // submit an item
+  void commit_epoch_start();  // mark epoch boundary
+  void commit_epoch_finish(); // mark prior epoch as committed (we can expire)
+
+  // reads
+};
+
+#endif
diff --git a/branches/sage/pgs/ebofs/Journal.h b/branches/sage/pgs/ebofs/Journal.h
new file mode 100644 (file)
index 0000000..c05bce5
--- /dev/null
@@ -0,0 +1,40 @@
+// -*- 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 __EBOFS_JOURNAL_H
+#define __EBOFS_JOURNAL_H
+
+
+class Journal {
+  Ebofs *ebofs;
+
+ public:
+  Journal(Ebofs *e) : ebofs(e) { }
+  virtual ~Journal() { }
+
+  virtual void create() = 0;
+  virtual void open() = 0;
+  virtual void close() = 0;
+
+  // writes
+  virtual void submit_entry(bufferlist& e, Context *oncommit) = 0;// submit an item
+  virtual void commit_epoch_start() = 0;  // mark epoch boundary
+  virtual void commit_epoch_finish(list<Context*>& ls) = 0; // mark prior epoch as committed (we can expire)
+
+  // reads/recovery
+  
+};
+
+#endif
index 233c97e7ae17297254cb05b3778ec4ca82012ccd..356796063b06f0257305d068013ce0e1aa5e8bd0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f16e506a9dd63269b60aaf61f26921fd71a21373..a3a084a46315aa8401bb54f7f20f45e25428a1e6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index af5f57842068a37ada0efbb366cfb8c0d7369807..1b432dd12da669f78a49725ce112ceab2db044a6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 01ad53848ca3d144086fc86c906c1704001731f2..230999733b2e1cf211f45d11c2e7f2d797d6cdff 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 0e6a7625c502a7fe5661a2711f605a5361fd266b..704ec1658182421fcf9497b6ca52fdce50704732 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1b85d138ec342ce69b11137feaa8188b05bfbafd..b03bb8a40d9c9a123cded4558aa4c2b778d3a60f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -61,7 +62,7 @@ namespace __gnu_cxx {
 
 
 // disk
-typedef __uint64_t block_t;        // disk location/sector/block
+typedef uint64_t block_t;        // disk location/sector/block
 
 static const int EBOFS_BLOCK_SIZE = 4096;
 static const int EBOFS_BLOCK_BITS = 12;    // 1<<12 == 4096
@@ -101,7 +102,7 @@ struct ebofs_nodepool {
 
 // objects
 
-typedef __uint64_t coll_t;
+typedef uint64_t coll_t;
 
 struct ebofs_onode {
   Extent     onode_loc;       /* this is actually the block we live in */
@@ -132,7 +133,7 @@ struct ebofs_table {
 
 
 // super
-typedef __uint64_t version_t;
+typedef uint64_t version_t;
 
 static const unsigned EBOFS_MAGIC = 0x000EB0F5;
 
index a9f98e9d5bb08e30b8eb52e7ba8abbd364402677..66e5d550c154388c0fdafad98203322c6f1c66b8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3d2092123201ca74627ca2c0d49ffe459ab3ffc7..236c881675ddb5a59d150d4bbbe108ff261c79ea 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -80,7 +81,10 @@ int main(int argc, char **argv)
 
   MonMap *monmap = new MonMap(g_conf.num_mon);
   entity_addr_t a;
-  monmap->mon_inst[0] = entity_inst_t(MSG_ADDR_MON(0), a);  // hack ; see FakeMessenger.cc
+  for (int i=0; i<g_conf.num_mon; i++) {
+    a.port = i;
+    monmap->mon_inst[i] = entity_inst_t(MSG_ADDR_MON(i), a);  // hack ; see FakeMessenger.cc
+  }
   
   char hostname[100];
   gethostname(hostname,100);
@@ -88,9 +92,8 @@ int main(int argc, char **argv)
 
   // create mon
   Monitor *mon[g_conf.num_mon];
-  for (int i=0; i<g_conf.num_mon; i++) {
+  for (int i=0; i<g_conf.num_mon; i++) 
     mon[i] = new Monitor(i, new FakeMessenger(MSG_ADDR_MON(i)), monmap);
-  }
 
   // create mds
   MDS *mds[g_conf.num_mds];
index c4c9bf508cf37c798e96cde8ca4c312687f47009..7f2f30104407b8b5e39cfd5ab81289ed5fb0bd3a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 00f352d59efab240ad41e13f223b36aef61fce01..efc0795a72fcb214e9f6a50a753655b1831fe87e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 111cb2a9816868442ec56bc6d9a0d862cab50ce1..1f401513f688c90a2bf726477083827ac8e1cca9 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -14,6 +15,8 @@
 #ifndef __BUFFER_H
 #define __BUFFER_H
 
+#include <stdint.h>
+
 #include "common/Mutex.h"
 
 #include <iostream>
@@ -772,7 +775,7 @@ inline void _decoderaw(T& t, bufferlist& bl, int& off)
 template<class T>
 inline void _encode(const std::list<T>& ls, bufferlist& bl)
 {
-  __uint32_t n = ls.size();
+  uint32_t n = ls.size();
   _encoderaw(n, bl);
   for (typename std::list<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
     _encode(*p, bl);
@@ -780,7 +783,7 @@ inline void _encode(const std::list<T>& ls, bufferlist& bl)
 template<class T>
 inline void _decode(std::list<T>& ls, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   ls.clear();
   while (n--) {
@@ -794,7 +797,7 @@ inline void _decode(std::list<T>& ls, bufferlist& bl, int& off)
 template<class T>
 inline void _encode(const std::deque<T>& ls, bufferlist& bl)
 {
-  __uint32_t n = ls.size();
+  uint32_t n = ls.size();
   _encoderaw(n, bl);
   for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
     _encode(*p, bl);
@@ -802,7 +805,7 @@ inline void _encode(const std::deque<T>& ls, bufferlist& bl)
 template<class T>
 inline void _decode(std::deque<T>& ls, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   ls.clear();
   while (n--) {
@@ -816,7 +819,7 @@ inline void _decode(std::deque<T>& ls, bufferlist& bl, int& off)
 template<class T>
 inline void _encode(const std::set<T>& s, bufferlist& bl)
 {
-  __uint32_t n = s.size();
+  uint32_t n = s.size();
   _encoderaw(n, bl);
   for (typename std::set<T>::const_iterator p = s.begin(); p != s.end(); ++p)
     _encode(*p, bl);
@@ -824,7 +827,7 @@ inline void _encode(const std::set<T>& s, bufferlist& bl)
 template<class T>
 inline void _decode(std::set<T>& s, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   s.clear();
   while (n--) {
@@ -838,7 +841,7 @@ inline void _decode(std::set<T>& s, bufferlist& bl, int& off)
 template<class T>
 inline void _encode(const std::vector<T>& v, bufferlist& bl)
 {
-  __uint32_t n = v.size();
+  uint32_t n = v.size();
   _encoderaw(n, bl);
   for (typename std::vector<T>::const_iterator p = v.begin(); p != v.end(); ++p)
     _encode(*p, bl);
@@ -846,10 +849,10 @@ inline void _encode(const std::vector<T>& v, bufferlist& bl)
 template<class T>
 inline void _decode(std::vector<T>& v, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   v.resize(n);
-  for (__uint32_t i=0; i<n; i++) 
+  for (uint32_t i=0; i<n; i++) 
     _decode(v[i], bl, off);
 }
 
@@ -857,7 +860,7 @@ inline void _decode(std::vector<T>& v, bufferlist& bl, int& off)
 template<class T, class U>
 inline void _encode(const std::map<T,U>& m, bufferlist& bl)
 {
-  __uint32_t n = m.size();
+  uint32_t n = m.size();
   _encoderaw(n, bl);
   for (typename std::map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
     _encode(p->first, bl);
@@ -867,7 +870,7 @@ inline void _encode(const std::map<T,U>& m, bufferlist& bl)
 template<class T, class U>
 inline void _decode(std::map<T,U>& m, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   m.clear();
   while (n--) {
@@ -881,7 +884,7 @@ inline void _decode(std::map<T,U>& m, bufferlist& bl, int& off)
 template<class T, class U>
 inline void _encode(const __gnu_cxx::hash_map<T,U>& m, bufferlist& bl)
 {
-  __uint32_t n = m.size();
+  uint32_t n = m.size();
   _encoderaw(n, bl);
   for (typename __gnu_cxx::hash_map<T,U>::const_iterator p = m.begin(); p != m.end(); ++p) {
     _encode(p->first, bl);
@@ -891,7 +894,7 @@ inline void _encode(const __gnu_cxx::hash_map<T,U>& m, bufferlist& bl)
 template<class T, class U>
 inline void _decode(__gnu_cxx::hash_map<T,U>& m, bufferlist& bl, int& off)
 {
-  __uint32_t n;
+  uint32_t n;
   _decoderaw(n, bl, off);
   m.clear();
   while (n--) {
@@ -904,13 +907,13 @@ inline void _decode(__gnu_cxx::hash_map<T,U>& m, bufferlist& bl, int& off)
 // string
 inline void _encode(const std::string& s, bufferlist& bl) 
 {
-  __uint32_t len = s.length();
+  uint32_t len = s.length();
   _encoderaw(len, bl);
   bl.append(s.c_str(), len+1);
 }
 inline void _decode(std::string& s, bufferlist& bl, int& off)
 {
-  __uint32_t len;
+  uint32_t len;
   _decoderaw(len, bl, off);
   s = bl.c_str() + off;    // FIXME someday to avoid a huge buffer copy?
   off += len+1;
@@ -919,13 +922,13 @@ inline void _decode(std::string& s, bufferlist& bl, int& off)
 // bufferptr (encapsulated)
 inline void _encode(bufferptr& bp, bufferlist& bl) 
 {
-  __uint32_t len = bp.length();
+  uint32_t len = bp.length();
   _encoderaw(len, bl);
   bl.append(bp);
 }
 inline void _decode(bufferptr& bp, bufferlist& bl, int& off)
 {
-  __uint32_t len;
+  uint32_t len;
   _decoderaw(len, bl, off);
 
   bufferlist s;
@@ -941,13 +944,13 @@ inline void _decode(bufferptr& bp, bufferlist& bl, int& off)
 // bufferlist (encapsulated)
 inline void _encode(const bufferlist& s, bufferlist& bl) 
 {
-  __uint32_t len = s.length();
+  uint32_t len = s.length();
   _encoderaw(len, bl);
   bl.append(s);
 }
 inline void _decode(bufferlist& s, bufferlist& bl, int& off)
 {
-  __uint32_t len;
+  uint32_t len;
   _decoderaw(len, bl, off);
   s.substr_of(bl, off, len);
   off += len;
index da469e5843d285d72c90a3b2190ac5b98741c1d6..a548d9756b9b80121debb579d882ef0b78b17a71 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 013f3b36704c3f6aed8581812430dd3e7a45ab99..4425e1d7c5b3a43149a691eb8426f68880b80297 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index edca78806e45a50dd15fb67d74ad19393259cc55..3dd2b6edf948f84ec0c425af09434c09cbfefed7 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -14,6 +15,7 @@
 #ifndef __FRAG_H
 #define __FRAG_H
 
+#include <stdint.h>
 #include <map>
 #include <list>
 #include "buffer.h"
@@ -51,7 +53,7 @@
  * we get 0/1 and 1/1.  quartering gives us 0/2, 1/2, 2/2, 3/2.  and so on.
  */
 
-typedef __uint32_t _frag_t;
+typedef uint32_t _frag_t;
 
 class frag_t {
   /* encoded value.
index 69cd798c8e2ce5d4b767312676bf5f588f435e1f..632fd6498c910609fe979d61f18f4f38526d8304 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 63096d0e3207980a9323d354abec7ea3ba112900..225204f151a0ab6e8451935ea97886d6b92b69a0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -16,6 +17,7 @@
 #ifndef __LRU_H
 #define __LRU_H
 
+#include <stdint.h>
 #include <assert.h>
 #include <iostream>
 using namespace std;
@@ -52,7 +54,7 @@ class LRUObject {
 class LRUList {
  private:
   LRUObject *head, *tail;
-  __uint32_t len;
+  uint32_t len;
 
  public:
   LRUList() {
@@ -60,7 +62,7 @@ class LRUList {
     len = 0;
   }
   
-  __uint32_t  get_length() { return len; }
+  uint32_t  get_length() { return len; }
 
   LRUObject *get_head() {
     return head;
@@ -116,8 +118,8 @@ class LRUList {
 class LRU {
  protected:
   LRUList lru_top, lru_bot, lru_pintail;
-  __uint32_t lru_num, lru_num_pinned;
-  __uint32_t lru_max;   // max items
+  uint32_t lru_num, lru_num_pinned;
+  uint32_t lru_max;   // max items
   double lru_midpoint;
 
   friend class LRUObject;
@@ -131,14 +133,14 @@ class LRU {
     lru_max = max;
   }
 
-  __uint32_t lru_get_size() { return lru_num; }
-  __uint32_t lru_get_top() { return lru_top.get_length(); }
-  __uint32_t lru_get_bot() { return lru_bot.get_length(); }
-  __uint32_t lru_get_pintail() { return lru_pintail.get_length(); }
-  __uint32_t lru_get_max() { return lru_max; }
-  __uint32_t lru_get_num_pinned() { return lru_num_pinned; }
+  uint32_t lru_get_size() { return lru_num; }
+  uint32_t lru_get_top() { return lru_top.get_length(); }
+  uint32_t lru_get_bot() { return lru_bot.get_length(); }
+  uint32_t lru_get_pintail() { return lru_pintail.get_length(); }
+  uint32_t lru_get_max() { return lru_max; }
+  uint32_t lru_get_num_pinned() { return lru_num_pinned; }
 
-  void lru_set_max(__uint32_t m) { lru_max = m; }
+  void lru_set_max(uint32_t m) { lru_max = m; }
   void lru_set_midpoint(float f) { lru_midpoint = f; }
   
 
index a225c8d245f62a7d0e8304872eebee46bd2bb5cf..955a024c0dea6c2426d4621abfc7f1ab18abb1f9 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -14,6 +15,8 @@
 #ifndef __OBJECT_H
 #define __OBJECT_H
 
+#include <stdint.h>
+
 #include <iostream>
 #include <iomanip>
 using namespace std;
@@ -22,18 +25,18 @@ using namespace std;
 using namespace __gnu_cxx;
 
 
-typedef __uint32_t objectrev_t;
+typedef uint32_t objectrev_t;
 
 struct object_t {
-  static const __uint32_t MAXREV = 0xffffffffU;
+  static const uint32_t MAXREV = 0xffffffffU;
 
-  __uint64_t ino;  // "file" identifier
-  __uint32_t bno;  // "block" in that "file"
+  uint64_t ino;  // "file" identifier
+  uint32_t bno;  // "block" in that "file"
   objectrev_t rev; // revision.  normally ctime (as epoch).
 
   object_t() : ino(0), bno(0), rev(0) {}
-  object_t(__uint64_t i, __uint32_t b) : ino(i), bno(b), rev(0) {}
-  object_t(__uint64_t i, __uint32_t b, __uint32_t r) : ino(i), bno(b), rev(r) {}
+  object_t(uint64_t i, uint32_t b) : ino(i), bno(b), rev(0) {}
+  object_t(uint64_t i, uint32_t b, uint32_t r) : ino(i), bno(b), rev(r) {}
 };
 
 
@@ -79,9 +82,9 @@ inline ostream& operator<<(ostream& out, const object_t o) {
 
 namespace __gnu_cxx {
 #ifndef __LP64__
-  template<> struct hash<__uint64_t> {
-    size_t operator()(__uint64_t __x) const { 
-      static hash<__uint32_t> H;
+  template<> struct hash<uint64_t> {
+    size_t operator()(uint64_t __x) const { 
+      static hash<uint32_t> H;
       return H((__x >> 32) ^ (__x & 0xffffffff)); 
     }
   };
@@ -89,8 +92,8 @@ namespace __gnu_cxx {
 
   template<> struct hash<object_t> {
     size_t operator()(const object_t &r) const { 
-      static hash<__uint64_t>  H;
-      static hash<__uint32_t> I;
+      static hash<uint64_t> H;
+      static hash<uint32_t> I;
       return H(r.ino) ^ I(r.bno);
     }
   };
index fda7336bc646143800c3fbf9f339c3e801d0aecf..12ddf688934bc7c47d816147235bdb4739409a37 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 466a5ead25d774b3f914635433a1bb25c7343565..d6447dd6f6d2057b44b71e818e06a6f17e4014a2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d166bbaf23bbf341983ba823be48c7b3902cf0cc..547ea3ab722748d810546d631dd3dd486e226eb5 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 60a977e49a499c4ba23e70e7e041e29c4f59fcc1..a9c0433e4a4e8e76f3ab171a056c7c6500359e3c 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef _STATLITE_H
 #define _STATLITE_H
 
index b3c67190414d05c8c67a00cba99475a9a439e439..eefa6690c4fe3b5196f9c7ed4173c77195f76e39 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -15,6 +16,7 @@
 #define __MDS_TYPES_H
 
 extern "C" {
+#include <stdint.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <assert.h>
@@ -28,6 +30,7 @@ extern "C" {
 #include <vector>
 #include <iostream>
 #include <iomanip>
+
 using namespace std;
 
 #include <ext/hash_map>
@@ -59,9 +62,9 @@ namespace __gnu_cxx {
   };
 
 #ifndef __LP64__
-  template<> struct hash<__int64_t> {
-    size_t operator()(__int64_t __x) const { 
-      static hash<__int32_t> H;
+  template<> struct hash<int64_t> {
+    size_t operator()(int64_t __x) const { 
+      static hash<int32_t> H;
       return H((__x >> 32) ^ (__x & 0xffffffff)); 
     }
   };
@@ -97,9 +100,9 @@ struct ltstr
 // ----------------------
 // some basic types
 
-typedef __uint64_t tid_t;
-typedef __uint64_t version_t;
-typedef __uint32_t epoch_t;       // map epoch  (32bits -> 13 epochs/second for 10 years)
+typedef uint64_t tid_t;         // transaction id
+typedef uint64_t version_t;
+typedef uint32_t epoch_t;       // map epoch  (32bits -> 13 epochs/second for 10 years)
 
 
 // object and pg layout
@@ -171,7 +174,8 @@ struct FileLayout {
 // --------------------------------------
 // inode
 
-typedef __uint64_t _inodeno_t;
+typedef uint64_t _inodeno_t;
+
 struct inodeno_t {
   _inodeno_t val;
   inodeno_t() : val(0) {}
@@ -189,7 +193,7 @@ namespace __gnu_cxx {
   {
     size_t operator()( const inodeno_t& x ) const
     {
-      static hash<__uint64_t> H;
+      static hash<uint64_t> H;
       return H(x.val);
     }
   };
index f93ef10bf218690e842745eb8788d6c65872d057..a4673aaa616eaafb9f08badd820ef14b5f7126c8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8bbd844c95eaac8f68b7e0b4388525aee8965581..c2d7b084c0ec37f379c9736faf71d1d10d1662f9 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ba0092d2c4611061b68a7a21b1b60c19a98b19a7..9ead7bb599c7f3d9902c8da0a0464eba00bc3318 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d7bfb655f06d807493083c75161e5dcea45af547..13182f1cadf958d29135ebce87daf96cb7c7fb2c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ae62608ce29822874de8d6ec6221ec6096499efa..6ec5603b0bc7e508e8e06955255b36d24d3851e8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 36644f86d9387fbaae1437fd3a7365ee468870c3..279d71175a8b5e91065e7583b1dc03191239f843 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 6ef4e9d47bc3262b01354de02ed2918c901a9d37..64a2002ba7c85d31129f8141e6ac16f3d60f092c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 40629f1c99f9ef9706c67feeac1aec761aca4be4..e8efed9749ac7692003e47c24d03155ffedcd869 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9480a320cddbe8b066d3d4bbe5e91f488d381900..e6bd7159dc4f3ce80b9b2d0ecd6b6f25327e60ab 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7491316237f5b36e7f0023f919ead3120129c8e0..4ef7d36c4cb97fa3b7b0912c2ef87c7c086da67f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7d538d2e8a5beefbb170f8b2cc4c41b93da98d24..38536c15f73bf86cad27a17a622bfd538c3bfc6d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -477,13 +478,13 @@ class CDirDiscover {
 class CDirExport {
   struct {
     dirfrag_t   dirfrag;
-    long        nden;   // num dentries (including null ones)
+    uint32_t    nden;   // num dentries (including null ones)
     version_t   version;
     version_t   committed_version;
-    unsigned    state;
+    uint32_t    state;
     meta_load_t popularity_justme;
     meta_load_t popularity_curdom;
-    int         dir_rep;
+    int32_t     dir_rep;
   } st;
   map<int,int> replicas;
   set<int>     rep_by;
@@ -512,7 +513,7 @@ class CDirExport {
   }
 
   dirfrag_t get_dirfrag() { return st.dirfrag; }
-  __uint64_t get_nden() { return st.nden; }
+  uint32_t get_nden() { return st.nden; }
 
   void update_dir(CDir *dir) {
     assert(dir->dirfrag() == st.dirfrag);
index 79555575482c91216b738917a92bf50cd42abf96..97150a53d9166a78e36b3430b5cfaeb06bbf2ba2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -218,12 +219,24 @@ CDir *CInode::add_dirfrag(CDir *dir)
 
 void CInode::close_dirfrag(frag_t fg)
 {
+  dout(14) << "close_dirfrag " << fg << endl;
   assert(dirfrags.count(fg));
   
-  dirfrags[fg]->remove_null_dentries();
+  CDir *dir = dirfrags[fg];
+  dir->remove_null_dentries();
   
-  assert(dirfrags[fg]->get_num_ref() == 0);
-  delete dirfrags[fg];
+  // clear dirty flag
+  if (dir->is_dirty())
+    dir->mark_clean();
+  
+  // dump any remaining dentries, for debugging purposes
+  for (map<string,CDentry*>::iterator p = dir->items.begin();
+       p != dir->items.end();
+       ++p) 
+    dout(14) << "close_dirfrag LEFTOVER dn " << *p->second << endl;
+
+  assert(dir->get_num_ref() == 0);
+  delete dir;
   dirfrags.erase(fg);
 }
 
index e743e5e0d581e54fceca4a3d33d0b09e34ff485d..bd3ef9f09b9ef93a8f37a5fd4c30719dff79d8fe 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 70b237ca863a4a91d222533df692cdc59e143d18..0a5ff8178558abb3b04bb324b0b6b307b8dbb36d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 6100b38beaffc769f7c111777e8072686b02ee97..aa23da1b7f44df2fa88e1673a7eba02e6f784fee 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8499280147e3eb832ecb63702aa77172b3e88f5a..e0acc3df279b47cc2c73a8ee5808aaefe996fb66 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -98,7 +99,7 @@ class FileLock : public SimpleLock {
  public:
   FileLock(MDSCacheObject *o, int t, int wo) : SimpleLock(o, t, wo) { }
   
-  char get_replica_state() {
+  int get_replica_state() {
     switch (state) {
     case LOCK_LOCK:
     case LOCK_GLOCKM:
index 08e0c7f21a7763788bde33318548c1798c75dbfe..308aaa0dc976c21a081e417f88cf6ba2242cef31 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 
 // =======================================================================
index 2d1773977641986f4c87a268ba41e71a91c03b29..23a5d65968ef2c7cd775a52a6957d98210a66b43 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c79266d3e71b6548ee261f76b115831db5423404..6d8937da3970d658ba0eb4f08d50b84c385b2317 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 475a323fcd80eb97dc2d0fe9cc6d2bae43c0d782..741d89d43e28fa497eb2f53cd3a50897e10c983c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -335,7 +336,7 @@ void Locker::xlock_finish(SimpleLock *lock, MDRequest *mdr)
 
 // file i/o -----------------------------------------
 
-__uint64_t Locker::issue_file_data_version(CInode *in)
+version_t Locker::issue_file_data_version(CInode *in)
 {
   dout(7) << "issue_file_data_version on " << *in << endl;
   return in->inode.file_data_version;
@@ -424,7 +425,7 @@ bool Locker::issue_caps(CInode *in)
   for (map<int, Capability>::iterator it = in->client_caps.begin();
        it != in->client_caps.end();
        it++) {
-    if (it->second.issued() != (it->second.wanted() & allowed)) {
+    if (it->second.pending() != (it->second.wanted() & allowed)) {
       // issue
       nissued++;
 
@@ -940,7 +941,7 @@ void Locker::simple_sync(SimpleLock *lock)
   lock->set_state(LOCK_SYNC);
   
   // waiters?
-  lock->finish_waiters(SimpleLock::WAIT_STABLE);
+  lock->finish_waiters(SimpleLock::WAIT_RD|SimpleLock::WAIT_STABLE);
 }
 
 void Locker::simple_lock(SimpleLock *lock)
@@ -997,9 +998,6 @@ bool Locker::simple_rdlock_start(SimpleLock *lock, MDRequest *mdr)
     return true;
   }
   
-  // can't read, and replicated.
-  assert(!lock->get_parent()->is_auth());
-
   // wait!
   dout(7) << "simple_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << endl;
   lock->add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
@@ -1715,8 +1713,10 @@ void Locker::file_eval(FileLock *lock)
   // stable.
   assert(lock->is_stable());
 
-  if (in->is_auth()) {
-    // [auth]
+  if (in->is_auth() &&
+      !lock->is_xlocked()) {
+    // [auth] 
+    // and not xlocked!
     int wanted = in->get_caps_wanted();
     bool loner = (in->client_caps.size() == 1) && in->mds_caps_wanted.empty();
     dout(7) << "file_eval wanted=" << cap_string(wanted)
@@ -1762,10 +1762,6 @@ void Locker::file_eval(FileLock *lock)
              lock->get_state() != LOCK_LOCK) {
       file_lock(lock);
     }
-    
-  } else {
-    // replica
-    // recall? check wiaters?  XXX
   }
 }
 
index fabf3fc5120426cf8fea154f16f4d43af383e1d2..6120c5c2466835803a736ffebb7b2389aa3b7671 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fa9c57c1a76a2c98beae46778948ad65999fefff..5534064dc2b84a0c50bcc1a46a7a5f0b1a1f15a2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index cb0febe07b567b7b1a85f428648fd8ecc69e0dd9..f16cb9ded97d2a0ead37592914e88d18808f0110 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9006a147f9609405a66eb425b2eaf4711dff6412..12ccc87147fef0ac869f876a52fba274c49412c4 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d84d6439dbcccefa778924973d096e02f3d1662d..e6a9488e04f7b98651bf357313a34728b5224119 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ae8a90edb4adb57862141b57e64dc019e9996eab..5bafe2cacb6887985a5d168fd1107de6a85b3a48 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 4d42ea6ea3634a9dac1f1d1a20a4f20effeb6f55..aa58ce7c45f8132f6a05ccb8d548c650409bdacd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 25c5b48753b3c816c4c108c03c3023207b7de93a..ff6c0fd29d115e920c8e47bc4ae6d1b178944147 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 114d6c630749f9eaab2a788a0b42140c8ab42d61..4ab9a91e0b53b15a11c46aab9338635533c070c0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fb62840da6830e10aa03d5f9dcb70e061ee82a9a..e0043087be590b3c285b4a629f930a78108bc785 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d7645c322a518d4b595e3a84c3e142e99c1ad3ff..dde751472f9bb9843da9e01761a0d443352d287a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1b7dcd7a95379ee6509b5ff2cc542cf32de7817e..8c47e9ed096818d5287995f4adcb6ffc23e123d3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9319b78dcd4bd85130eb58a10e21b08211c19915..57be41a031a1539feebb7e36678d4258b0ac6218 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 391ece980674f20233dceaad20609d7dac511f4a..8b6da5a90b26d5e07e8dbe8bfc1d727fec618bad 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index eadc26ea89a11ba9b5afb082c587f781fd3e2bed..534a608b8e6bd2bf3f7d8ccb688a85198f24b4a3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1005971df986f2aa134b2f5b5656e04e1e4b7c7e..f6f82c31ba9fc5dd5a11571af1cf48d0095da6e6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ec5301774efa3f0ecf29c2897dd8c77b438be305..564bc9155a6e36da83135c30339eb634784ed95f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -38,9 +39,10 @@ class ScatterLock : public SimpleLock {
   int num_wrlock;
   
 public:
-  ScatterLock(MDSCacheObject *o, int t, int wo) : SimpleLock(o, t, wo) {}
+  ScatterLock(MDSCacheObject *o, int t, int wo) : SimpleLock(o, t, wo),
+                                                 num_wrlock(0) {}
 
-  char get_replica_state() {
+  int get_replica_state() {
     switch (state) {
     case LOCK_SYNC: 
     case LOCK_GSYNCS:
index 72353f73d04360cc581204e4fade11a34f990c52..3435f3cbe491cf4d30abad3f1a9534a32a6d5a82 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -723,7 +724,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
   // lock the path
   set<SimpleLock*> rdlocks, empty;
 
-  for (unsigned i=0; i<trace.size(); i++) 
+  for (int i=0; i<(int)trace.size(); i++) 
     rdlocks.insert(&trace[i]->lock);
 
   if (!mds->locker->acquire_locks(mdr, rdlocks, empty, empty))
@@ -797,7 +798,7 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequest *mdr, bool okexist, bool mus
   // -- lock --
   set<SimpleLock*> rdlocks, wrlocks, xlocks;
 
-  for (unsigned i=0; i<trace.size(); i++) 
+  for (int i=0; i<(int)trace.size(); i++) 
     rdlocks.insert(&trace[i]->lock);
   if (dn->is_null()) {
     xlocks.insert(&dn->lock);                 // new dn, xlock
@@ -915,7 +916,8 @@ void Server::handle_client_stat(MDRequest *mdr)
   if (ref->is_dir() &&
       mask & INODE_MASK_MTIME) rdlocks.insert(&ref->dirlock);
 
-  mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks);
+  if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
+    return;
 
   // reply
   dout(10) << "reply to stat on " << *req << endl;
@@ -1459,11 +1461,11 @@ void Server::handle_client_link(MDRequest *mdr)
   // create lock lists
   set<SimpleLock*> rdlocks, wrlocks, xlocks;
 
-  for (unsigned i=0; i<linktrace.size(); i++)
+  for (int i=0; i<(int)linktrace.size(); i++)
     rdlocks.insert(&linktrace[i]->lock);
   xlocks.insert(&dn->lock);
   wrlocks.insert(&dn->dir->inode->dirlock);
-  for (unsigned i=0; i<targettrace.size(); i++)
+  for (int i=0; i<(int)targettrace.size(); i++)
     rdlocks.insert(&targettrace[i]->lock);
   xlocks.insert(&targeti->linklock);
 
@@ -1711,7 +1713,7 @@ void Server::handle_client_unlink(MDRequest *mdr)
   // lock
   set<SimpleLock*> rdlocks, wrlocks, xlocks;
 
-  for (unsigned i=0; i<trace.size()-1; i++)
+  for (int i=0; i<(int)trace.size()-1; i++)
     rdlocks.insert(&trace[i]->lock);
   xlocks.insert(&dn->lock);
   wrlocks.insert(&dn->dir->inode->dirlock);
@@ -2104,13 +2106,13 @@ void Server::handle_client_rename(MDRequest *mdr)
   set<SimpleLock*> rdlocks, wrlocks, xlocks;
 
   // rdlock sourcedir path, xlock src dentry
-  for (unsigned i=0; i<srctrace.size()-1; i++) 
+  for (int i=0; i<(int)srctrace.size()-1; i++) 
     rdlocks.insert(&srctrace[i]->lock);
   xlocks.insert(&srcdn->lock);
   wrlocks.insert(&srcdn->dir->inode->dirlock);
 
   // rdlock destdir path, xlock dest dentry
-  for (unsigned i=0; i<desttrace.size(); i++)
+  for (int i=0; i<(int)desttrace.size(); i++)
     rdlocks.insert(&desttrace[i]->lock);
   xlocks.insert(&destdn->lock);
   wrlocks.insert(&destdn->dir->inode->dirlock);
index 24a7d19d139228a71be1b9297dba9411e6d5be41..a132fc4501ad130ab640f32b66495b54fac1bece 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 70d65303f9d5be3bb8828c2391b73869b62c0b43..7df38a0a6bd1b56fd66f470f6e9c418b34fecc5c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -44,7 +45,7 @@ inline const char *get_lock_type_name(int t) {
 //                                auth   rep
 #define LOCK_SYNC     1  // AR   R .    R .
 #define LOCK_LOCK     2  // AR   R W    . .
-#define LOCK_GLOCKR   3  // AR   R .    . .
+#define LOCK_GLOCKR  -3  // AR   R .    . .
 
 inline const char *get_simplelock_state_name(int n) {
   switch (n) {
@@ -75,7 +76,7 @@ protected:
   int wait_offset;
 
   // lock state
-  char           state;
+  int           state;
   set<__int32_t> gather_set;  // auth
 
   // local state
@@ -108,20 +109,20 @@ public:
     parent->encode_lock_state(type, bl);
   }
   void finish_waiters(int mask, int r=0) {
-    parent->finish_waiting(mask < wait_offset, r);
+    parent->finish_waiting(mask << wait_offset, r);
   }
   void add_waiter(int mask, Context *c) {
-    parent->add_waiter(mask < wait_offset, c);
+    parent->add_waiter(mask << wait_offset, c);
   }
   bool is_waiter_for(int mask) {
-    return parent->is_waiter_for(mask < wait_offset);
+    return parent->is_waiter_for(mask << wait_offset);
   }
   
   
 
   // state
-  char get_state() { return state; }
-  char set_state(char s) { 
+  int get_state() { return state; }
+  int set_state(int s) { 
     state = s; 
     assert(!is_stable() || gather_set.size() == 0);  // gather should be empty in stable states.
     return s;
@@ -185,7 +186,7 @@ public:
 
   
   // simplelock specifics
-  char get_replica_state() {
+  int get_replica_state() {
     switch (state) {
     case LOCK_LOCK:
     case LOCK_GLOCKR: 
@@ -234,7 +235,8 @@ public:
   bool can_xlock(MDRequest *mdr) {
     if (!parent->is_auth()) return false;
     if (state != LOCK_LOCK) return false;
-    if (mdr && xlock_by == mdr) return true;
+    if (xlock_by == 0 || 
+       (mdr && xlock_by == mdr)) return true;
     return false;
   }
   bool can_xlock_soon() {
index 9360db4ab49bb6781326fb1241cbbcd9e21a9882..b2cd1b162f22c23134ced269a726517c1a0df410 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f65ebfb1f8ff4bb41ec228eb412ff84931ccd638..5980d40c17cd915209c2685f08caa32a4279a699 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 111a34152ff3f55851d44245daddf2f853cd5a22..7cd36453e17b998623c865430fd9b994b16dc861 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 83d4e32b767446957b659eb053c3f821f9e03b8e..d9b93f5c148724dc24c5747b6227d5227e473ef5 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index eaa6d8e4bcce7e3ad1c1a1093231a9318fbe345d..476d4fd9ffcae6b6e86ed8b1dd146eed5b704d2d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7d51c038f3fab2d5c5a6054c6e49e90f4de54d7a..8e26dfd035f20822761b52011afbfadcff21fb95 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 2bfaa0d2a21aa2747cd9f085dca29096a3803634..410e7467aecb145e00383660a1132996259bb6fb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 742de69860735398819059844f2314b315290598..aa1902576542d4d1b8c9cdc7928a309f66ee2a83 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f89456697b99647d27a5b06155d4207ea194b7a3..5a5fd2a14e1558b9b37649ae28db48d97309d038 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3ddfabf330f15a9d646150ec455f85c005cd98de..c0ce5218e7146ddfc863064ce0e4c6fb29e59a02 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e7714b4c3d05113fadf9ea14d48749e0caedac40..b0c727bff305b3783ed4797768a41a487c7dc50b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7713493c1f344b1e8d91a16c651ac32e8caa02af..953eff2d0e01cca85c4d25b190f6dd345c342489 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fc673d082d12f95c46ef68e3af59764e14eaea3c..ef2bb6c436682cd2c92ccda0575ea23663a6c8fd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 0ef75774064544109ea179d64f6802d85e26f447..bb414160ca6908f3384ac4d2bde409d83cc068dc 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 4a8dad5876a622d5167f13487cb1b378f2a5330b..02c5d3ece2569d42c476b6bd918df2259c9a0bcf 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a298ee8cb8520bfe6a4d8e0eecf756f4ed77458e..cc8e86b3816b1024031e3d9ac366ec618e308cdc 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 26a2dff75e6bd806c92e0cb4fbbc261300052ddd..8966ba7b79f08008e1ce2c1ebeb51b579b7b3c7b 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef __MDSTYPES_H
 #define __MDSTYPES_H
 
@@ -78,7 +80,7 @@ inline bool operator>=(const metareqid_t& l, const metareqid_t& r) { return !(l
 namespace __gnu_cxx {
   template<> struct hash<metareqid_t> {
     size_t operator()(const metareqid_t &r) const { 
-      hash<__uint64_t> H;
+      hash<uint64_t> H;
       return H(r.client) ^ H(r.tid);
     }
   };
index 1347aca5e697e4577964482ff314ae3ad447a88c..6ceb8981244faf918119449a9a9f9f0a43b495ef 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9a6b3f1497920d89b4894cf1a8152c45828f1e6c..015aa562038a74b3fc985a513fedd661a31e0f2d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8b1a88cd848f326463c491d417eea7493f55ebce..98fee6b29ef111c2d14fcf86794330f1ce026830 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e03ce7e97c1802be83f0c59ea9b82393070ebb7e..c3bc0009118357f162beb94280e841a5a76bfece 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 22f42660d2978d129a98bd2d78a866f60b49312a..7aa418fababae326a54f65c8c4d5811c2d345659 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 874cedbd8bb326a8a0d234e04486df31b0048e10..c7445b7476f20c53c26e9d48a9ab2f9f62028117 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -122,7 +123,7 @@ class MClientReply : public Message {
     int result;  // error code
     unsigned char file_caps;  // for open
     long          file_caps_seq;
-    __uint64_t file_data_version;  // for client buffercache consistency
+    uint64_t file_data_version;  // for client buffercache consistency
     
     int _num_trace_in;
     int _dir_size;
@@ -153,12 +154,12 @@ class MClientReply : public Message {
 
   unsigned char get_file_caps() { return st.file_caps; }
   long get_file_caps_seq() { return st.file_caps_seq; }
-  __uint64_t get_file_data_version() { return st.file_data_version; }
+  uint64_t get_file_data_version() { return st.file_data_version; }
   
   void set_result(int r) { st.result = r; }
   void set_file_caps(unsigned char c) { st.file_caps = c; }
   void set_file_caps_seq(long s) { st.file_caps_seq = s; }
-  void set_file_data_version(__uint64_t v) { st.file_data_version = v; }
+  void set_file_data_version(uint64_t v) { st.file_data_version = v; }
 
   MClientReply() {};
   MClientReply(MClientRequest *req, int result = 0) : 
index c26e78520fcf5227bcf99078aafbdf580d3559fc..f8f4ae986c564abb4ae1b7de4d8458b350b0edd7 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 69e2b889c6d22058fe30739dbe5acb160750751a..c81e3b3c06ce8edd887c22b0a61e22b5d1f2cb92 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index dbd05fa92fa2ed5888991bd23a6b48d2b7cf47a0..4965a6a479d0d3c2c8702d43912ae9d392ecd41f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8066caeea3d8b0f60035adb4f64338401a356756..e8acc50f190e0ae9b5b451cd1ec81ccecedca12a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b1a2580dba4af019b6b658dc585e7f0970a6dae0..9d1c4288b9055d5271a72f9e2d5b11f54c26f55d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f7a9c47c161cf7f5864a2e80b8a5617dc8d30d56..0db32208efd45603841d79af9060a258b0a2211d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8ba24c4cfa0ff42b6749ac74034979dda13cba6a..d5112ae0471334fde299a9ce4bdbf8b66cd954d2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 987be127c46d3ab4a8aee957dbbb1dca08e2a5e3..f8ce2f76c8683d6496cd4595cd55878d39d04bae 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d8bc40838e8d40dbac4045a639f176966dcba98b..8fafbe0312636258774537d71d3a6bae489bb71b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 5ae7b6e9642f7bb7ca22f5ff5754c1f44ec64950..1b9d683b4e36f1bdf54c1b0f9e793e2e10d86318 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 72afe2818a3ad287b22299014ce10c73755c4185..f13ee1a44fa215f8916caf9cf78a76cb93399616 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a4e609e70cd724ee1ae414c17fb8f1a561737611..7375fad6c50571ad139e0e845c43aa3ed698e4ff 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 44fa0872cf5dec714c3f8e9452faa7a2ffab71ac..5e1924bc57e3805f6d7c4d3b39b490b6af141903 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3ebe2ae759a3bafd701491bffaa411d2fb30a7ec..03f5e1fcc9ef30495d0a352c2214220d215e3a4b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 686d8052d396ad3ea04347377de4b971a93092b4..c7a79a64f93176d81024944bb3046dfa617cb1eb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f53100a2e053c79e1b8c8d58bacb7df5148691bf..6a41aee83b5f340fd3875ccf558a71f568e7ffcd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fce07df7958b75124c1d61d5fd48e680197cf619..8d54276f0bd835f604077b868c032eb8c2d39481 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 38735d263f3e80f7ae4bf6d824ccf41cb2689ac4..355541e9f1b5cc6180e84f04e97d65467bf8ef89 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 40303adf9a13959aa487714d491cbfb599d49111..b59e2eb12251c0aee82750865c65c050a9aab9be 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 2cefa478befdf056d47fa33d0c019d5d0595e1aa..7ee3078e61973ced49d7762c86b2ee3d9b3cff51 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b2f39534e6e233ac17926b9197e19555a259612e..fee4e014edaf826863d5c02004ad7b21e77cf17f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ddf7e3ac2bbcedc347a5f5073298ae3548fc911e..3ccef393d63089d5f7d9431f82c11aa74a355e6c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index cd6d4da8cf34f5bd8cae5f3dea548efd5e2aefad..d303f10b5362ff46ddb8b7e529abbd59938ec15b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 0ea1ff8b79990356087b33536e072bd561bbb76f..420b541e2b0827f5819b5ff49e2aafc89efa8f5a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 34734af0f97adca35e56651b893d3e44aba98b6e..6b47847ec2165f8b1bfe8352895f763c3e0e5323 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ececc3ec2cc6538e02707ae1c06374fa2397a8e7..787d9b225e3d0c49b288d0bdb871efacb641ac2c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 29a42217d6a4bf76879515cc964221e15919e695..6348a708ee38873d0e1cac9384b8c377d301093e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1d0db35c10f888040df76ce983c6311f80668b38..a43ac9461b3880a14b10c3d4764242bf4a508ad8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 864cb6944aedaab7382d5f89ff80bb9e96520609..08de349dadcee3060fe35ccbcab77cf2b665e143 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d9d73d8528f0075a73384ca2c2a085719256372e..4097ba211a8fa13c4bf1c79e98d2df19d6057b31 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 5af9d9dd2d0bf3508235798bde817d6a8c5a3a11..964f2a3bd49f23b693274ea4796ef0409cac06ce 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 397f7f86307ddc37979bf106a4c7027e4122b75d..05ade1094c9c8b75e039a83970955c9992686133 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3ca0ad6df54388714106ed9cf8cbaefb1e6c0439..8ee3107a2dad0f049c48c27e9f9da6a886768728 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f2b984e7b6249e06c0cbc516581befd92590d8c8..de0b36a353032cea688ddd3a9fe8e3d709a37ad8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 32eb4eb20e9ea9478a3c0a0be47d61abe5b0f205..a05f03efbb0f3fb00c1b22386687b3b9fd302cfd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 45371e61587029fa6f127adab6ba9baa4a9faf58..aa0d7e4e38c9eb4259140a8c2c1813f7c27f8fdb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 774e4ddf70b20412e4148c2ef2a5a07a0b6a0987..02229125cc521afac17cb22df878753821d2fb94 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 86eccc689d39652964f70634918229343dd3624b..4789c809572c4a4732169b6f76053efcab9df5f9 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c0c554152cc87a299c8af6028f809b9b411d0518..8529578e29d561977e632a975c2d4c495b5efe05 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index dc220aacece8494f46b35b07599724911124105e..4ec9e3a6c8179099169056114fc273c202b942d9 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -38,12 +39,12 @@ class MMDSCacheRejoin : public Message {
 
   // -- types --
   struct inode_strong { 
-    __int32_t caps_wanted;
-    __int32_t nonce;
-    __int32_t authlock;
-    __int32_t linklock;
-    __int32_t dirfragtreelock;
-    __int32_t filelock;
+    int32_t caps_wanted;
+    int32_t nonce;
+    int32_t authlock;
+    int32_t linklock;
+    int32_t dirfragtreelock;
+    int32_t filelock;
     inode_strong() {}
     inode_strong(int n, int cw=0, int a=0, int l=0, int dft=0, int f=0) : 
       caps_wanted(cw),
@@ -70,19 +71,19 @@ class MMDSCacheRejoin : public Message {
   };
 
   struct dirfrag_strong {
-    __int32_t nonce;
+    int32_t nonce;
     dirfrag_strong() {}
     dirfrag_strong(int n) : nonce(n) {}
   };
   struct dn_strong {
-    __int32_t nonce;
-    __int32_t lock;
+    int32_t nonce;
+    int32_t lock;
     dn_strong() {}
     dn_strong(int n, int l) : nonce(n), lock(l) {}
   };
 
   // -- data --
-  __int32_t op;
+  int32_t op;
 
   set<inodeno_t> weak_inodes;
   map<inodeno_t, inode_strong> strong_inodes;
@@ -146,7 +147,7 @@ class MMDSCacheRejoin : public Message {
     ::_encode(weak_inodes, payload);
     ::_encode(strong_inodes, payload);
 
-    __uint32_t nfull = full_inodes.size();
+    uint32_t nfull = full_inodes.size();
     ::_encode(nfull, payload);
     for (list<inode_full>::iterator p = full_inodes.begin(); p != full_inodes.end(); ++p)
       p->_encode(payload);
@@ -164,7 +165,7 @@ class MMDSCacheRejoin : public Message {
     ::_decode(weak_inodes, payload, off);
     ::_decode(strong_inodes, payload, off);
 
-    __uint32_t nfull;
+    uint32_t nfull;
     ::_decode(nfull, payload, off);
     for (unsigned i=0; i<nfull; i++) 
       full_inodes.push_back(inode_full(payload, off));
index 2fe60fbaf0702cbc1d2c1780a879ec4172ea6ecc..3db5dd12b821dd4b4cf56007c90da9e0f8d5e13a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 6bb6b92c00ccd6c6fe4baa2c96468dd8ab110090..eab9a3506a40b7e70f4b285ac1265b296a37e0f6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index abf728878e6c6c3d2e3bc14f1d75fd83158b89bd..0d06d390c6cfb3b42a677e88bc7a63a153778a6b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 7781d6cfd68b66b8cdfcdb6bd90749ca4fb308d0..164e547cc513a4ebe6d934b9d618fd34c26fc032 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f8a41b7b3e03bfe56b610e2083dab4226e1ba281..d5fd8ae64017a8fdfa5cc75681d47425ae59106d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index abbd3d35b482d55000e67a23df8ee505b82a9d3b..78dc8e6d44e57b05274717f24146cb117f245365 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 2399cca73d60c44f5193a3d0075880b00a7f6e86..14f8b7cb49b7bbe3bcea40dd54445f7355c5ae4f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d91870dfce5c6f2e13c23dea132166c9e64b70de..f9f0c12d1ac2e6c293ac04edb90c0eb7c21bd734 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d9310f222bc7b1fdfdad52ffd70667a35f2cc288..7ec54b67332b9e98551a085b56171200f04f6bbd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 497276f06b12f58dd31e817a8d4d7827a4816f22..bc0337b8720dcf3715f657406a5bdce802f58c86 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 071d0fcc82e0a5c6690d754e38ff8b9946863305..f91e42d64b1840d0f233fa14c26cc9d054da41ee 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8bdbf2f85a3aaa24be343412b982e69687dca30f..47211ae501db544f7a03b7e27012ae0590204066 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 182b36f0a57cf83f4a0860e127a2b0a9a3298a27..329c05e657d46f0f0d4ad927c5809b2689ff0d8b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c6112bd898cae96af905e5c4e0b7dffcaf7b0e2f..3f4ed8ea4db85cc24c76fe7316ab02dc6ddc893a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 85d5ea7c02809314b25638043893c021107c3e9a..449a0ac61a84fe6ee2945b7c33961ac66e8dd8f3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8673788f0632f81f538204e687adc8c49ba1ce31..9655548dfcb00d0bb9cfef434bf510832dd67559 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 6f12a8e3c784dd52049d3cdb8637e61c1f499b2f..8aa6929c2ed9a099401f5be3f5f9b52a57307007 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index bc962ea2b3eb22c21737d8fb46201103d3a933dd..8e908e2ed0664197772f4e37021b7178ed953651 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index b3f6e850a9c5d735abe40da1a0b58f599e41f199..40cdadc81c57d4cdd81dde69d3a38de0de3de24f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -22,58 +23,63 @@ class MMonPaxos : public Message {
   // op types
   const static int OP_COLLECT = 1;   // proposer: propose round
   const static int OP_LAST = 2;                 // voter:    accept proposed round
-  const static int OP_OLDROUND = 3;     // voter:    notify proposer he proposed an old round
   const static int OP_BEGIN = 4;        // proposer: value proposed for this round
   const static int OP_ACCEPT = 5;       // voter:    accept propsed value
-  const static int OP_SUCCESS = 7;   // proposer: notify learners of agreed value
-  const static int OP_ACK = 8;          // learner:  notify proposer that new value has been saved
+  const static int OP_COMMIT = 7;   // proposer: notify learners of agreed value
+  const static char *get_opname(int op) {
+    switch (op) {
+    case OP_COLLECT: return "collect";
+    case OP_LAST: return "last";
+    case OP_BEGIN: return "begin";
+    case OP_ACCEPT: return "accept";
+    case OP_COMMIT: return "commit";
+    default: assert(0); return 0;
+    }
+  }
 
+  // which state machine?
   int op;   
   int machine_id;
-  version_t proposal;
-  version_t n;
-  bufferlist value;
+  
+  version_t last_committed;  // i've committed to
+  version_t pn_from;         // i promise to accept after
+  version_t pn;              // with with proposal
+  version_t old_accepted_pn;     // previous pn, if we are a LAST with an uncommitted value
+
+  map<version_t,bufferlist> values;
 
   MMonPaxos() : Message(MSG_MON_PAXOS) {}
-  MMonPaxos(int o, int mid, 
-           version_t pn, version_t v) : Message(MSG_MON_PAXOS),
-                                            op(o), machine_id(mid), 
-                                            proposal(pn), n(v) {}
-  MMonPaxos(int o, int mid, 
-           version_t pn, version_t v, 
-           bufferlist& b) : Message(MSG_MON_PAXOS),
-                            op(o), machine_id(mid),
-                            proposal(pn), n(v), 
-                            value(b) {}
+  MMonPaxos(int o, int mid) : Message(MSG_MON_PAXOS),
+                             op(o), machine_id(mid),
+                             last_committed(0), pn_from(0), pn(0), old_accepted_pn(0) { }
   
   virtual char *get_type_name() { return "paxos"; }
   
   void print(ostream& out) {
-    out << "paxos(op " << op
-       << ", machine " << machine_id
-       << ", proposal " << proposal 
-       << ", state " << n 
-       << ", " << value.length() << " bytes)";
+    out << "paxos(m" << machine_id
+       << " " << get_opname(op) << " lc " << last_committed
+       << " pn " << pn << " opn " << old_accepted_pn
+       << ")";
   }
 
   void encode_payload() {
-    payload.append((char*)&op, sizeof(op));
-    payload.append((char*)&machine_id, sizeof(machine_id));
-    payload.append((char*)&proposal, sizeof(proposal));
-    payload.append((char*)&n, sizeof(n));
-    ::_encode(value, payload);
+    ::_encode(op, payload);
+    ::_encode(machine_id, payload);
+    ::_encode(last_committed, payload);
+    ::_encode(pn_from, payload);
+    ::_encode(pn, payload);
+    ::_encode(old_accepted_pn, payload);
+    ::_encode(values, payload);
   }
   void decode_payload() {
     int off = 0;
-    payload.copy(off, sizeof(op), (char*)&op);
-    off += sizeof(op);
-    payload.copy(off, sizeof(machine_id), (char*)&machine_id);
-    off += sizeof(machine_id);
-    payload.copy(off, sizeof(proposal), (char*)&proposal);
-    off += sizeof(proposal);
-    payload.copy(off, sizeof(n), (char*)&n);
-    off += sizeof(n);
-    ::_decode(value, payload, off);
+    ::_decode(op, payload, off);
+    ::_decode(machine_id, payload, off);
+    ::_decode(last_committed, payload, off);
+    ::_decode(pn_from, payload, off);   
+    ::_decode(pn, payload, off);   
+    ::_decode(old_accepted_pn, payload, off);
+    ::_decode(values, payload, off);
   }
 };
 
index cfff1869fbe51d5ebe0fbc53f966b34c5f1df646..9ae5a68d6c59afa8e40674f6ba538546de0594ac 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c4a557856594aaed5ab50d47478dd6de99792742..5bc7a5d5ee9f61a70fc19cd2773071236015fa87 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 58afd527bda93b24d9c85ee2ca4c956091fbc2d0..5158ce7d3ed83655cb876a2b0d62ca422599143a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 276a930d2e00b619dc84dd178936f7f9b3822c07..8f8cb4b7877ae681346c0edb1b9d584233b07dfb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index dd231a831d63d435ebdc3b2b2ddfef9eb56faff2..ee75f9bff9b69f5c2bc63427b271edae33ddf828 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 50896df1fb1bcaad27f64dda31654ac17b166b91..c1e514c67c250a58fc3ac6213f4efa014f4c8a85 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9db3f0c557670746b84687a4110f91a06b094c0e..e81f14d4558b1c98bac1d283ed25dc5e3c8eb0da 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 61a594de3294a9f37d67d4447db909696889cdea..798356f663f9e808f681c555165450666feef4b0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e4731c6037107ad10be9e6ba098cc2b9a4fe0777..b7ed19dd64d4b23de1847d8dfcffcc32cc342388 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f6fe8ee88c1705870410e2d19bae0f8d371e60ee..76a984276b66b0bd7b78c6ca7be03edd457239c2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ebe1cda485c4c30ed3ed6abce5bbff7ffbf06160..dd3164cdc112408f826e5a612a27a2ad29647262 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
 
 
 class MOSDPGPeer : public Message {
-  __uint64_t       map_version;
+  uint64_t       map_version;
   list<pg_t> pg_list;
 
   bool complete;
 
  public:
-  __uint64_t get_version() { return map_version; }
+  uint64_t get_version() { return map_version; }
   list<pg_t>& get_pg_list() { return pg_list; }
   bool get_complete() { return complete; }
 
   MOSDPGPeer() {}
-  MOSDPGPeer(__uint64_t v, list<pg_t>& l, bool c=false) :
+  MOSDPGPeer(uint64_t v, list<pg_t>& l, bool c=false) :
     Message(MSG_OSD_PG_PEER) {
     this->map_version = v;
     this->complete = c;
index e21a2607bb5733ef725b67a70d507fec57baf89c..dc4fac1a9436b563d727e08976b7091b4adec5fd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
 #include "osd/OSD.h"
 
 class MOSDPGPeerAck : public Message {
-  __uint64_t       map_version;
+  version_t       map_version;
 
  public:
   list<pg_t>                pg_dne;   // pg dne
   map<pg_t, PGReplicaInfo > pg_state; // state, lists, etc.
 
-  __uint64_t get_version() { return map_version; }
+  version_t get_version() { return map_version; }
 
   MOSDPGPeerAck() {}
-  MOSDPGPeerAck(__uint64_t v) :
+  MOSDPGPeerAck(version_t v) :
     Message(MSG_OSD_PG_PEERACK) {
     this->map_version = v;
   }
index a65d2ccc2168f8507779671997c6edea1d9d54a1..fab654237f4d7d160120dd6683fce7d87b2336e2 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
 
 
 class MOSDPGPeerRequest : public Message {
-  __uint64_t       map_version;
+  version_t       map_version;
   list<repgroup_t> pg_list;
 
  public:
-  __uint64_t get_version() { return map_version; }
+  version_t get_version() { return map_version; }
   list<repgroup_t>& get_pg_list() { return pg_list; }
 
   MOSDPGPeerRequest() {}
-  MOSDPGPeerRequest(__uint64_t v, list<repgroup_t>& l) :
+  MOSDPGPeerRequest(version_t v, list<repgroup_t>& l) :
     Message(MSG_OSD_PG_PEERREQUEST) {
     this->map_version = v;
     pg_list.splice(pg_list.begin(), l);
index 926acce81349d805fca3f6801f4f7141df8dea1d..70dbfdbb96fd7f4b90f921d5bd41ba0c3f77b10d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9629a3782764bd7ecd4f27cbf5fb0e38304d145b..17cb28a3c95a1cec09a359e4fcc9516d8a2663ce 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index dc4af837209bb5cc8acef2d33e5fb0bac9d243ac..f41c6954b4c2794d895773ce8f3350812dc8ea02 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 93809d6820d21386328d1601b35fb1e93c038c17..20453b3e73e2f45435733f876cb4cb1a55af5981 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index dd03aa495441542d063b23cafc810c67bd859330..739875479749d495e643b1510ad41ef15734edac 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a4e8d02ce19c73a5efa3e3b57f4a22161a8d1b28..6b569666ed377ba4628332bfbd26f12c9a42fe2a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 88472f16766a9bab2fb6678f52c8dd04c03417dd..f8f32aee43ee0e3bb969d795f058cbf41fda6551 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e648f3e652fc70e23be10edfe2bb2659943caffb..f7c803404f5637280b7d47789c67dddde80520bf 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d81e357d6bf6a0620d4b65ae53cde4a4c3692735..3f1fa74c86bfe1e21c70a075041ed115a6937edd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 600e43004869692e0d583fefa6afa9aa5eba886b..eec763fc89afd1e14a9603caeb6d53e03ca853f3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e03d6d16c3498ecdcad2829dc0ab2ae26c20d9e5..db3cdcfcdc3e54551e0012d0e1b2c56f30dbd531 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index acee82f3a757ac3e32ebe5b27a684770dec96f92..5a44399c6153d8da7b6c14d90aa90510c37fc6c0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 10d5f6135e43ac2358f50b78c57f848fa1aaa8b9..00cc77c6f55dddd14a151595d1bf75cd47b1be15 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3dc7ad8733332cceea93338f1c7cd522c20818d7..72e4c442a22116eecb951eca726bb5ecb0e4cf78 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 911a14d9c959225968df8783fe617048a0e49453..48b14765d9160b848d6e6bb8dbdcb9257c9107dd 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e052683e736c3085ea6556273f1a4a67e9cd8c6e..dd524e18fe7ada021ea3b829ea8030a44f8c51fb 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a9d6707a3aa25298a1880a79170928febff4a940..79c269adc95b59bbd1832f85518cdced81bada12 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ad4843676f0fbe097aade6a4780565990ed15322..7bfc6f22dc38555f0719b900a32bae2e9d7bf424 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c4dc2ea422cd987728d483986d17ae04e0c07d43..6cda2340a67126eb4afa8bd403a8253fbe12ec95 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index bd7e93981964b49caf47ea352ac8084b8c8a1fd3..7645782307e8b474d09f704bf91aad817ae208e1 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1ec4c808d6204b79ad587d86ce9520cd9cdbe80b..0b0813cb3cfea4285093af536817e162d8f503d5 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 08163ee540aa32e1ac715f9daafbbdac9659caf8..1b7e4f0f12ac3d4bd4681d4cf04c432642e94130 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 9ecd180b1fe74d70ffb2e27287fd9bfba6a55d06..1ae9401465c94a14ff239463fd52cbba0df9b35d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d3098ba065a470bddf04c6177abc3ffe8b350d5e..43341f1a4a32767b14a00363e4f2a2c7bff98cab 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -134,9 +135,14 @@ void Elector::handle_propose(MMonElectionPropose *m)
   int from = m->get_source().num();
 
   if (from > whoami) {
-    // wait, i should win!
-    if (!electing_me)
-      start();
+    if (leader_acked >= 0 &&  // we already acked someone
+       leader_acked < from) {  // who would win over them
+      dout(5) << "no, we already acked " << leader_acked << endl;
+    } else {
+      // wait, i should win!
+      if (!electing_me)
+       start();
+    }
   } else {
     // they would win over me
     if (leader_acked < 0 ||      // haven't acked anyone yet, or
index 67ed59945c46bc7b849c5ed12766de5b42be31e1..2a10dddf9241983ca2d1e51f60b50a0b1ecef7a4 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index bc65e0828916e3b9ea93fab03648396844fb52f3..c9a680d36a244191559f40ba70b81c506789abda 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 00df0da443788b25e5e7c1da46675fee4258a7a3..658ba50855b29d75083d6fa093ddbcadc0940f06 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d8e66c51b589e4e480312c0408aae0bdf36cdf70..cd77bbf3488e65fdcd57945d99c72b49a5c3a4b3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 418f330ddd7ac8ed211293608b4fcc3e69ce5190..402f7359552bb5a3bf8cab1299a5ac1c484ee387 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 34c30668613a052d4a5fc19c55128ae65ac8470a..526f63ab55fae221bd14a1e5c51846093a48ad63 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f5a10696c7adae2a23f7127a2e820be118883f4d..cbbfba0892898465494b591c13d39aa80429d578 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 122118f33f556b0bfd76fff44f39e33b9c6dc0d6..485bf972551c4524723b9506f39d514ea34b5c0a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 647c33b2d85e6e9a6ea71e2d3ad753f67045212e..9a9b677a4ac3fea8fd7d1063c6a56b3abf3fbabe 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d8350b4ee62b417a885ea24722dfd9b720082377..18dc9f3a7943e8f26f08faf34361205af9b7bed6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 67c4e2e99e179505ec39f86d0a25c7ac10519371..78d3d58287bbc4104e3a03dc574456edc03df611 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
 
 
 // ---------------------------------
+
+// PHASE 1
+
 // proposer
-void Paxos::propose(version_t v, bufferlist& value)
+  
+void Paxos::collect(version_t oldpn)
 {
-//todo high rf
+  // reset the number of lasts received
+  accepted_pn = get_new_proposal_number(MAX(accepted_pn, oldpn));
+  accepted_pn_from = last_committed;
+  num_last = 1;
+  old_accepted_pn = 0;
+  old_accepted_value.clear();
+
+  dout(10) << "collect with pn " << accepted_pn << endl;
+
+  // send collect
+  for (int i=0; i<mon->monmap->num_mon; ++i) {
+    if (i == whoami) continue;
+    
+    MMonPaxos *collect = new MMonPaxos(MMonPaxos::OP_COLLECT, machine_id);
+    collect->last_committed = last_committed;
+    collect->pn = accepted_pn;
+    mon->messenger->send_message(collect, mon->monmap->get_inst(i));
+  }
 }
+
+void Paxos::handle_collect(MMonPaxos *collect)
+{
+  dout(10) << "handle_collect " << *collect << endl;
+
+  // reply
+  MMonPaxos *last = new MMonPaxos(MMonPaxos::OP_LAST, machine_id);
+  last->last_committed = last_committed;
   
-void Paxos::handle_last(MMonPaxos *m)
+  // do we have an accepted but uncommitted value?
+  //  (it'll be at last_committed+1)
+  bufferlist bl;
+  if (mon->store->exists_bl_sn(machine_name, last_committed+1)) {
+    mon->store->get_bl_sn(bl, machine_name, last_committed+1);
+    assert(bl.length() > 0);
+    dout(10) << "sharing our accepted but uncommitted value for " << last_committed+1 << endl;
+    last->values[last_committed+1] = bl;
+    last->old_accepted_pn = accepted_pn;
+  }
+
+  // can we accept this pn?
+  if (collect->pn > accepted_pn) {
+    // ok, accept it
+    accepted_pn = collect->pn;
+    accepted_pn_from = collect->pn_from;
+    dout(10) << "accepting pn " << accepted_pn << " from " << accepted_pn_from << endl;
+  } else {
+    // don't accept!
+    dout(10) << "NOT accepting pn " << collect->pn << " from " << collect->pn_from 
+            << ", we already accepted " << accepted_pn << " from " << accepted_pn_from 
+            << endl;
+  }
+  last->pn = accepted_pn;
+  last->pn_from = accepted_pn_from;
+
+  // and share whatever data we have
+  for (version_t v = collect->last_committed;
+       v <= last_committed;
+       v++) {
+    if (mon->store->exists_bl_sn(machine_name, v)) {
+      mon->store->get_bl_sn(last->values[v], machine_name, v);
+      dout(10) << " sharing " << v << " " 
+              << last->values[v].length() << " bytes" << endl;
+    }
+  }
+
+  // send reply
+  mon->messenger->send_message(last, collect->get_source_inst());
+  delete collect;
+}
+
+
+void Paxos::handle_last(MMonPaxos *last)
+{
+  dout(10) << "handle_last " << *last << endl;
+
+  // share committed values?
+  if (last->last_committed < last_committed) {
+    // share committed values
+    dout(10) << "sending commit to " << last->get_source() << endl;
+    MMonPaxos *commit = new MMonPaxos(MMonPaxos::OP_COMMIT, machine_id);
+    for (version_t v = last->last_committed;
+        v <= last_committed;
+        v++) {
+      mon->store->get_bl_sn(commit->values[v], machine_name, v);
+      dout(10) << "sharing " << v << " " 
+              << commit->values[v].length() << " bytes" << endl;
+    }
+    mon->messenger->send_message(commit, last->get_source_inst());
+  }
+
+  // did we receive committed value?
+  if (last->last_committed > last_committed) {
+    for (version_t v = last_committed;
+        v <= last->last_committed;
+        v++) {
+      mon->store->put_bl_sn(last->values[v], machine_name, v);
+      dout(10) << "committing " << v << " " 
+              << last->values[v].length() << " bytes" << endl;
+    }
+    last_committed = last->last_committed;
+    mon->store->put_int(last_committed, machine_name, "last_commtted");
+    dout(10) << "last_committed now " << last_committed << endl;
+  }
+      
+  // do they accept your pn?
+  if (last->old_accepted_pn > accepted_pn) {
+    dout(10) << "uh oh, they have a higher pn than us.  pick a new one." << endl;
+    collect(last->old_accepted_pn);
+  } else {
+    // they accepted our pn.  great.
+    num_last++;
+    dout(10) << "great, they accepted our pn, we now have " << num_last << endl;
+
+    // did this person send back an accepted but uncommitted value?
+    if (last->old_accepted_pn &&
+       last->old_accepted_pn > old_accepted_pn) {
+      version_t v = last->last_committed+1;
+      dout(10) << "we learned an old value for " << v << " pn " << last->old_accepted_pn;
+      old_accepted_pn = last->old_accepted_pn;
+      old_accepted_value = last->values[v];
+    }
+    
+    // do we have a majority?
+    if (num_last == mon->monmap->num_mon/2+1) {
+      // do this once.
+
+      // did we learn an old value?
+      if (old_accepted_value.length()) {
+       dout(10) << "begin on old learned value" << endl;
+       begin(old_accepted_value);
+      }       
+    }
+  }
+
+  delete last;
+}
+
+
+void Paxos::begin(bufferlist& v)
 {
-//todo high rf
-  dout(10) << "handle_last " << *m << endl;
-  delete m;
+  dout(10) << "begin for " << last_committed+1 << " " 
+          << new_value.length() << " bytes"
+          << endl;
+
+  // we must already have a majority for this to work.
+  assert(num_last > mon->monmap->num_mon/2);
+
+  // and no value, yet.
+  assert(new_value.length() == 0);
+
+  // accept it ourselves
+  num_accepted = 1;
+  new_value = v;
+  mon->store->put_bl_sn(new_value, machine_name, last_committed+1);
+
+  // ask others to accept it to!
+  for (int i=0; i<mon->monmap->num_mon; ++i) {
+    if (i == whoami) continue;
+
+    dout(10) << " sending begin to mon" << i << endl;
+    MMonPaxos *begin = new MMonPaxos(MMonPaxos::OP_BEGIN, machine_id);
+    begin->values[last_committed+1] = new_value;
+    begin->pn = accepted_pn;
+    
+    mon->messenger->send_message(begin, mon->monmap->get_inst(i));
+  }
 }
 
-void Paxos::handle_accept(MMonPaxos *m)
+void Paxos::handle_begin(MMonPaxos *begin)
 {
-//todo high rf
-  dout(10) << "handle_accept " << *m << endl;
-  delete m;
+  dout(10) << "handle_begin " << *begin << endl;
+
+  // can we accept this?
+  if (begin->pn != accepted_pn) {
+    dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << endl;
+    delete begin;
+    return;
+  }
+  
+  // yes.
+  version_t v = last_committed+1;
+  dout(10) << "accepting value for " << v << " pn " << accepted_pn << endl;
+  mon->store->put_bl_sn(begin->values[v], machine_name, v);
   
+  // reply
+  MMonPaxos *accept = new MMonPaxos(MMonPaxos::OP_ACCEPT, machine_id);
+  accept->pn = accepted_pn;
+  accept->last_committed = last_committed;
+  mon->messenger->send_message(accept, begin->get_source_inst());
+  
+  delete begin;
 }
 
-void Paxos::handle_ack(MMonPaxos *m)
+
+void Paxos::handle_accept(MMonPaxos *accept)
 {
-//todo high rf
-  dout(10) << "handle_ack " << *m << endl;
-  delete m;
+  dout(10) << "handle_accept " << *accept << endl;
+  
+  if (accept->pn != accepted_pn) {
+    // we accepted a higher pn, from some other leader
+    dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << endl;
+    delete accept;
+    return;
+  }
+  if (accept->last_committed != last_committed) {
+    dout(10) << " this is from an old round that's already committed, ignoring" << endl;
+    delete accept;
+    return;
+  }
+
+  num_accepted++;
+  dout(10) << "now " << num_accepted << " have accepted" << endl;
+
+  // new majority?
+  if (num_accepted == mon->monmap->num_mon/2+1) {
+    // yay, commit!
+    dout(10) << "we got a majority, committing too" << endl;
+    commit();
+  }  
+
 }
 
-void Paxos::handle_old_round(MMonPaxos *m)
+void Paxos::commit()
 {
-//todo high rf
-  dout(10) << "handle_old_round " << *m << endl;
-  delete m;
+  dout(10) << "commit " << last_committed+1 << endl;
+
+  // commit locally
+  last_committed++;
+  mon->store->put_int(last_committed, machine_name, "last_committed");
+
+  // tell everyone
+  for (int i=0; i<mon->monmap->num_mon; ++i) {
+    if (i == whoami) continue;
+
+    dout(10) << " sending commit to mon" << i << endl;
+    MMonPaxos *commit = new MMonPaxos(MMonPaxos::OP_COMMIT, machine_id);
+    commit->values[last_committed] = new_value;
+    commit->pn = accepted_pn;
+    
+    mon->messenger->send_message(commit, mon->monmap->get_inst(i));
+  }
+
+  // get ready for a new round.
+  new_value.clear();
+
 }
+
+
+void Paxos::handle_commit(MMonPaxos *commit)
+{
+  dout(10) << "handle_commit on " << commit->last_committed << endl;
+
+  // commit locally.
+  last_committed = commit->last_committed;
+  mon->store->put_bl_sn(commit->values[last_committed], machine_name, last_committed);
+  mon->store->put_int(last_committed, machine_name, "last_committed");
   
+  delete commit;
+}  
+
+
 
 /*
  * return a globally unique, monotonically increasing proposal number
@@ -85,51 +319,13 @@ version_t Paxos::get_new_proposal_number(version_t gt)
 }
 
 
-// ---------------------------------
-// accepter
-void Paxos::handle_collect(MMonPaxos *m)
-{
-//todo high rf
-  // ...
-
-  delete m;
-}
-
-
-
-
-// ---------------------------------
-// learner
-void Paxos::handle_success(MMonPaxos *m)
-{
-  //todo high rf
-  delete m;
-}
-
-void Paxos::handle_begin(MMonPaxos *m)
-{
-  //todo high rf
-  delete m;
-}
-
-// ---------------------------------
-
 void Paxos::leader_start()
 {
-  dout(10) << "i am the leader" << endl;
-
-  // .. do something else too 
-  version_t pn = get_new_proposal_number();
-  for (int i=0; i<mon->monmap->num_mon; ++i) {
-    if (i == whoami) continue;
-    // todo high rf I pass the pn twice... what is the last parameter for?
-    mon->messenger->send_message(new MMonPaxos(MMonPaxos::OP_COLLECT, whoami, pn, pn),
-                                mon->monmap->get_inst(i));
-  }
+  dout(10) << "leader_start -- i am the leader, start paxos" << endl;
+  collect(0);
 }
 
 
-
 void Paxos::dispatch(Message *m)
 {
   switch (m->get_type()) {
@@ -149,10 +345,6 @@ void Paxos::dispatch(Message *m)
        handle_last(pm);
        break;
        
-      case MMonPaxos::OP_OLDROUND:
-       handle_old_round(pm);
-       break;
-       
       case MMonPaxos::OP_BEGIN:
        handle_begin(pm);
        break;
@@ -161,16 +353,12 @@ void Paxos::dispatch(Message *m)
        handle_accept(pm);
        break;          
        
-      case MMonPaxos::OP_SUCCESS:
-       handle_success(pm);
-       break;
-       
-      case MMonPaxos::OP_ACK:
-       handle_ack(pm);
+      case MMonPaxos::OP_COMMIT:
+       handle_commit(pm);
        break;
-       
-         default:
-           assert(0);
+
+      default:
+       assert(0);
       }
     }
     break;
index 52a509d25aa76f1073479c3bcd8c68403ddef60c..777d175685bc91eb3fabd66816b53e6885de8c18 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
  * 
  */
 
+/*
+time---->
+
+cccccccccccccccccca????????????????????????????????????????
+cccccccccccccccccca????????????????????????????????????????
+cccccccccccccccccca???????????????????????????????????????? leader
+cccccccccccccccccc????????????????????????????????????????? 
+ccccc?????????????????????????????????????????????????????? 
+
+last_committed
+
+pn_from
+pn
+
+a 12v 
+b 12v
+c 14v
+d
+e 12v
+
+
+*/
 
 #ifndef __MON_PAXOS_H
 #define __MON_PAXOS_H
@@ -34,27 +57,32 @@ class Paxos {
   // my state machine info
   int machine_id;
   const char *machine_name;
-  map<version_t, bufferlist> accepted_values;
-  map<version_t, int>        accepted_proposal_number;
 
-  // proposer
-  void propose(version_t v, bufferlist& value);
+  // phase 1
+  version_t last_committed;
+  version_t accepted_pn;
+  version_t accepted_pn_from;
   
+  // results from our last replies
+  int        num_last;
+  version_t  old_accepted_pn;
+  bufferlist old_accepted_value;
+
+  // phase 2
+  bufferlist new_value;
+  int        num_accepted;
+  void collect(version_t oldpn);
+  void handle_collect(MMonPaxos*);
   void handle_last(MMonPaxos*);
+  void begin(bufferlist& value);
+  void handle_begin(MMonPaxos*);
   void handle_accept(MMonPaxos*);
-  void handle_ack(MMonPaxos*);
-  void handle_old_round(MMonPaxos*);
-  
-  version_t get_new_proposal_number(version_t gt=0);
-  
-  // accepter
-  void handle_collect(MMonPaxos*);
+  void commit();
+  void handle_commit(MMonPaxos*);
 
-  // learner
-  void handle_success(MMonPaxos*);
-  void handle_begin(MMonPaxos*);
+  version_t get_new_proposal_number(version_t gt=0);
   
-
 public:
   Paxos(Monitor *m, int w,
        int mid,const char *mnm) : mon(m), whoami(w), 
index edee54a2c631f12c83a301884d4bca7ea86083fc..4fa04d7d4c92aadb01556348f200c901cc97b2b6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 8b6fe923814276671561fcb3d017b20f1d4129f1..0a77de3d203693da5f9132f8fd517f87aed04228 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e695859652738e622a5a4f9b0a788bc3e03ec71d..fa8ca2d05c455bc090dea2e1942deb0a9fbdbe58 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 13cd6f95326d162784fa8c5b66e3001347b33993..244e9177d104dc1031c1e436612115a8258ded2a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 44ab35a9fcc10347d827c781bae01eb2ab67f9bc..969edadd424d66e0d651a0de3a7dda14aa8605a8 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fffe798b714506058c376f99bf51660528fe1af7..35334b7f6a61f089760e5fdd7fc800369aefd4e7 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e96f076380459cbf6a93d05deb47b3504a3d3aa0..39510c47b9bd3f5dc7a93e98cebda6112a61115a 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include <cassert>
 #include <iostream>
index 42115808f5a2da8870e1301263819a04b5b1d11f..c7e76297553ed19362a2b4a1384c0cbc1c11638e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index a6133260e9b9eb93843e8ad156a8e48c972571fe..5af83462b29951c93dee64345d89d8fc6d9dddb0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 991e80c839112ab2db51bf3199933b3fb9c909ac..78caa815120549521eef2d4ea62a560e2d5f1835 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 83b84c6faf370935dba3bb5f1653e753ffa81b59..14e158a64ab9797cfd02dddd282b580771d02b55 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1c5c9e9c3961aa2daad13b919eb9117f245e7a70..c17553e2fb88d327305190e5a9cc2541b5d9077c 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 35b141c1dc0fbcdfad24309403c36e27269e25bc..44f0858a6e2428dd25df858638612e087e9695b0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -1158,13 +1159,17 @@ const entity_addr_t &Rank::EntityMessenger::get_myaddr()
 
 void Rank::EntityMessenger::reset_myname(entity_name_t newname)
 {
-  entity_name_t oldname = get_myname();
-  dout(10) << "reset_myname " << oldname << " to " << newname << endl;
-
-  rank.local.erase(oldname);
-  rank.local[newname] = this;
-
-  _set_myname(newname);
+  rank.lock.Lock();
+  {
+    entity_name_t oldname = get_myname();
+    dout(10) << "reset_myname " << oldname << " to " << newname << endl;
+    
+    rank.local.erase(oldname);
+    rank.local[newname] = this;
+   
+    _set_myname(newname);
+  }
+  rank.lock.Unlock();
 }
 
 
index d49b4118bec7376430ca3fffd51b7ad98c78c7ff..d314617f7ddedfdf007a7b8527349b82bef7a639 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 79391f78210d22e81bba0cb234c319b11da783c2..685c104d8d92d358815924660fd926970ae73812 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 34a03c74cd3c3713b99a03363c76a8b393d27dfe..f20ffe8ed372057a599bb1509243ad2513a54377 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -103,9 +104,9 @@ namespace __gnu_cxx {
  * ipv4 for now.
  */
 struct entity_addr_t {
-  __uint8_t  ipq[4];
-  __uint32_t port;
-  __uint32_t nonce;  // bind time, or pid, or something unique!
+  uint8_t  ipq[4];
+  uint32_t port;
+  uint32_t nonce;  // bind time, or pid, or something unique!
 
   entity_addr_t() : port(0), nonce(0) {
     ipq[0] = ipq[1] = ipq[2] = ipq[3] = 0;
index fc9da720f19ee8e861b096d508ea27251fe98bdf..72adcf90b52656cea98023e5dbbc613daa5905bf 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #include <mpi.h>
 #include "NewMessenger.h"
 
index 1a448a91cb2c6ca16ad9144cbbac1237f1ec6f8c..232ee03fa5d09043bbd6a3ff54cc931ec21dced8 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include "tcp.h"
 
index 65043cda8e2ace2607f663c0f5044f4b94f18d89..7a866af7f9d864afa4292f652b7579f1e55dac74 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef __TCP_H
 #define __TCP_H
 
index 9ec409c9c3e7c85340ff16d7798d3b9c8e058ca4..b7b8d43042191a906784a9f2487a2ed55d47f4f4 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index ace780967190f2173b3b9399847311fd8f74c373..6cb63fd4a09dab72f798cc164c436192d70f50e8 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /* OSBDB.cc -- ObjectStore on top of Berkeley DB.
    Copyright (C) 2007 Casey Marshall <csm@soe.ucsc.edu>
 
index f75bfc2c168ac802a6c636ff3c54e3be9806d0cd..8eb2004d3903fdaa3591de56a3081c4811e798a2 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /* OSBDB.h -- ObjectStore on Berkeley DB. -*- c++ -*-
    Copyright (C) 2007 Casey Marshall <csm@soe.ucsc.edu>
 
index 038688c5cdfd536ee48621d531f8054abe3b6e17..82f035c04d1da227651e2c3cdcd89a2675e286a9 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include "include/types.h"
 
@@ -49,13 +51,13 @@ ssize_t Ager::age_pick_size() {
 
 bool start_debug = false;
 
-__uint64_t Ager::age_fill(float pc, utime_t until) {
+uint64_t Ager::age_fill(float pc, utime_t until) {
   int max = 1024*1024;
   bufferptr bp(max);
   bp.zero();
   bufferlist bl;
   bl.push_back(bp);
-  __uint64_t wrote = 0;
+  uint64_t wrote = 0;
   while (1) {
     if (g_clock.now() > until) break;
     
@@ -162,7 +164,7 @@ void Ager::age_empty(float pc) {
   g_conf.ebofs_verify = false;
 }
 
-void pfrag(__uint64_t written, ObjectStore::FragmentationStat &st)
+void pfrag(uint64_t written, ObjectStore::FragmentationStat &st)
 {
   cout << "#gb wr\ttotal\tn x\tavg x\tavg per\tavg j\tfree\tn fr\tavg fr\tnum<2\tsum<2\tnum<4\tsum<4\t..." 
        << endl;
@@ -177,7 +179,7 @@ void pfrag(__uint64_t written, ObjectStore::FragmentationStat &st)
        << "\t" << st.avg_free_extent;
     
   int n = st.num_extent;
-  for (__uint64_t i=1; i <= 30; i += 1) {
+  for (uint64_t i=1; i <= 30; i += 1) {
     cout << "\t" << st.extent_dist[i];
     cout << "\t" << st.extent_dist_sum[i];
     //cout << "\ta " << (st.extent_dist[i] ? (st.extent_dist_sum[i] / st.extent_dist[i]):0);
@@ -244,7 +246,7 @@ void Ager::age(int time,
   
   ObjectStore::FragmentationStat st;
 
-  __uint64_t wrote = 0;
+  uint64_t wrote = 0;
 
   for (int c=1; c<=count; c++) {
     if (g_clock.now() > until) break;
@@ -252,7 +254,7 @@ void Ager::age(int time,
     //if (c == 7) start_debug = true;
     
     dout(1) << "#age " << c << "/" << count << " filling to " << high_water << endl;
-    __uint64_t w = age_fill(high_water, until);
+    uint64_t w = age_fill(high_water, until);
     //dout(1) << "age wrote " << w << endl;
     wrote += w;
     //store->sync();
index 864c23fce8e14742ece4369f172cfdaec1dd556e..ad160c0e9f9ff0c7bd80fb480d3c14c69827edae 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef __AGER_H
 #define __AGER_H
 
@@ -21,7 +23,7 @@ class Ager {
   bool         did_distn;
 
   void age_empty(float pc);
-  __uint64_t age_fill(float pc, utime_t until);
+  uint64_t age_fill(float pc, utime_t until);
   ssize_t age_pick_size();
   object_t age_get_oid();
 
index 203a4ca9dce8fb938bac1e6cf318736f87f4a9e2..a8e96a8a192f779ab3813bb79eea038ee9d96fe3 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 01fa4afcf3cb854723d57b3c4d1cacf1b19a03a3..2155c46de3673aa306082f888da57ebe8e60ee7a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 1360711f3b4179cc53efdd4addf19b887406f3eb..9e56e481dbdfd876e7d7d7dce3df3ca0b7c13c10 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -70,12 +71,12 @@ void FakeStore::get_oname(object_t oid, char *s)
   assert(sizeof(oid) == 16);
 #ifdef __LP64__
   sprintf(s, "%s/objects/%02lx/%016lx.%016lx", basedir.c_str(), H(oid) & HASH_MASK, 
-         *((__uint64_t*)&oid),
-         *(((__uint64_t*)&oid) + 1));
+         *((uint64_t*)&oid),
+         *(((uint64_t*)&oid) + 1));
 #else
   sprintf(s, "%s/objects/%02x/%016llx.%016llx", basedir.c_str(), H(oid) & HASH_MASK, 
-         *((__uint64_t*)&oid),
-         *(((__uint64_t*)&oid) + 1));
+         *((uint64_t*)&oid),
+         *(((uint64_t*)&oid) + 1));
 #endif
 }
 
@@ -96,12 +97,12 @@ void FakeStore::get_coname(coll_t cid, object_t oid, char *s)
   assert(sizeof(oid) == 16);
 #ifdef __LP64__
   sprintf(s, "%s/collections/%016lx/%016lx.%016lx", basedir.c_str(), cid, 
-         *((__uint64_t*)&oid),
-         *(((__uint64_t*)&oid) + 1));
+         *((uint64_t*)&oid),
+         *(((uint64_t*)&oid) + 1));
 #else
   sprintf(s, "%s/collections/%016llx/%016llx.%016llx", basedir.c_str(), cid, 
-         *((__uint64_t*)&oid),
-         *(((__uint64_t*)&oid) + 1));
+         *((uint64_t*)&oid),
+         *(((uint64_t*)&oid) + 1));
 #endif
 }
 
@@ -628,9 +629,9 @@ int FakeStore::collection_list(coll_t c, list<object_t>& ls)
     // parse
     object_t o;
     assert(sizeof(o) == 16);
-    *(((__uint64_t*)&o) + 0) = strtoll(de->d_name, 0, 16);
+    *(((uint64_t*)&o) + 0) = strtoll(de->d_name, 0, 16);
     assert(de->d_name[16] == '.');
-    *(((__uint64_t*)&o) + 1) = strtoll(de->d_name+17, 0, 16);
+    *(((uint64_t*)&o) + 1) = strtoll(de->d_name+17, 0, 16);
     dout(0) << " got " << o << " errno " << errno << " on " << de->d_name << endl;
     if (errno) continue;
     ls.push_back(o);
index 4ad2cb4a054e84a14a81907f35d3f0c7fb860122..95ecae3f68af442bc39d6cc2443c2ed387f7d22d 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 97316d2642674979287397356f996f92a3ed6cb8..a779a2a57972c8979f223ec42b319f43e16e6e6f 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index e82c6f804721d2402f88c9df4de5d92756d60fa8..e679c0aedf611907fb5f35df2bcc2a03797cbb17 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index cb4a6afc815d7858228edb2e5f2d721371dd43f7..aff7e96e7245bde081fbee0cda68ae53885f36c1 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index d943ee7f9ebbb5c768c57fc3165b0ce07b1dacd1..360b19d3e4ad46012677d0b79fd22f238ac37654 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3f0277ee089bd73e939c713824c4f2f0af2423e0..56b8f861687d5cac774392744f1931daf7f4c3ca 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index f4671ce266b0e061565589d6a91293df72861fcf..f03b0f235ee3d8ea84d93dc2bda56c17243ee5a4 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 82af869e93775dd4fd723104a20653aae4853793..ac81c6a3b4ea0ea06973f177a18dedcea8137e01 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include "ObjectStore.h"
 
index 89e672a10a10a3af23e10d933105a41d931ca043..d97652b5487781c66d51991faca128fd65cd936e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index fb2c323cc886eb6765f1027054a81fcb535fe0bc..ad93fb701ad5225338f1385842220153bbdf3c18 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index aed23c5236e560dc6afe2ea486a867f024846c5b..c94626a045c77cadf2553ec4e3663a89279a19bc 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 61900fe30d4d08ca888bcc09d776835ce4145ba2..7086eb7ea9643f39d4d39b83974dcb47a795dbcb 100644 (file)
@@ -388,7 +388,7 @@ void ReplicatedPG::prepare_op_transaction(ObjectStore::Transaction& t,
       struct stat st;
       int r = osd->store->stat(oid, &st);
       if (r >= 0) {
-       if (op->get_offset() + op->get_length() >= st.st_size) {
+       if (op->get_offset() + (off_t)op->get_length() >= (off_t)st.st_size) {
          if (op->get_offset()) 
            t.truncate(oid, op->get_length() + op->get_offset());
          else
index df8392975b049102cc3f1e88bc3fc89cf6d6f16c..5bd13902ab721c7ecb6361d566368c4092ec41c6 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -62,14 +63,14 @@ namespace __gnu_cxx {
 
 
 // osd types
-typedef __uint64_t coll_t;        // collection id
+typedef uint64_t coll_t;        // collection id
 
 // pg stuff
 
 #define PG_INO 1
 
-typedef __uint16_t ps_t;
-typedef __uint8_t pruleset_t;     // hmm what is this for?  -sage
+typedef uint16_t ps_t;
+typedef uint8_t pruleset_t;
 
 
 // crush rule ids
@@ -87,19 +88,12 @@ public:
 private:
   union {
     struct {
-      /*
-      int      preferred:32; // 32
-      unsigned type:3;       //  3
-      unsigned size:5;       //  5
-      unsigned ps:16;        // 16
-      unsigned ruleset:8;    //  8
-      */
-      __int32_t preferred;
-      __uint8_t type;
-      __uint8_t size;
-      __uint16_t ps;
+      int32_t preferred;
+      uint8_t type;
+      uint8_t size;
+      uint16_t ps;
     } fields;
-    __uint64_t val;          // 64
+    uint64_t val;          // 64
   } u;
 
 public:
@@ -113,7 +107,7 @@ public:
     //u.fields.ruleset = r;
     assert(sizeof(u.fields) == sizeof(u.val));
   }
-  pg_t(__uint64_t v) { u.val = v; }
+  pg_t(uint64_t v) { u.val = v; }
 
   int type()      { return u.fields.type; }
   bool is_rep()   { return type() == TYPE_REP; }
@@ -125,21 +119,19 @@ public:
   int preferred() { return u.fields.preferred; }   // hack: avoid negative.
   
   /*
-  pg_t operator=(__uint64_t v) { u.val = v; return *this; }
-  pg_t operator&=(__uint64_t v) { u.val &= v; return *this; }
+  pg_t operator=(uint64_t v) { u.val = v; return *this; }
+  pg_t operator&=(uint64_t v) { u.val &= v; return *this; }
   pg_t operator+=(pg_t o) { u.val += o.val; return *this; }
   pg_t operator-=(pg_t o) { u.val -= o.val; return *this; }
   pg_t operator++() { ++u.val; return *this; }
   */
-  operator __uint64_t() const { return u.val; }
+  operator uint64_t() const { return u.val; }
 
   object_t to_object() const { return object_t(PG_INO, u.val >> 32, u.val & 0xffffffff); }
 };
 
 inline ostream& operator<<(ostream& out, pg_t pg) 
 {
-  //return out << hex << pg.val << dec;
-
   if (pg.is_rep()) 
     out << pg.size() << 'x';
   else if (pg.is_raid4()) 
@@ -163,7 +155,7 @@ namespace __gnu_cxx {
   {
     size_t operator()( const pg_t& x ) const
     {
-      static hash<__uint64_t> H;
+      static hash<uint64_t> H;
       return H(x);
     }
   };
@@ -260,13 +252,13 @@ inline ostream& operator<<(ostream& out, ObjectExtent &ex)
 
 class OSDSuperblock {
 public:
-  const static __uint64_t MAGIC = 0xeb0f505dULL;
-  __uint64_t magic;
-  __uint64_t fsid;      // unique fs id (random number)
+  const static uint64_t MAGIC = 0xeb0f505dULL;
+  uint64_t magic;
+  uint64_t fsid;      // unique fs id (random number)
   int        whoami;    // my role in this fs.
   epoch_t    current_epoch;             // most recent epoch
   epoch_t    oldest_map, newest_map;    // oldest/newest maps we have.
-  OSDSuperblock(__uint64_t f=0, int w=0) : 
+  OSDSuperblock(uint64_t f=0, int w=0) : 
     magic(MAGIC), fsid(f), whoami(w), 
     current_epoch(0), oldest_map(0), newest_map(0) {}
 };
index aebca7ac1a351e78b14e621f05b958c59162bbff..733d71aa4b322f16dd3ca4e58c312f22e067703e 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 3d880a32415e0152052f4b0cc938c2f18da13a6e..4b43e1a9a11600776f92ef87cc87f3391e4684ac 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index c8171895beef086554a0d53a3e7f39bd9e356a28..b52e9a69df0506adcf7c354dad922e7dda2e9ca0 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 231fe47fb1e31a95e620900c4633b660bf2227c5..e59c9629725ceb3ab84177518e74626a16d0cf3a 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index bb62a0e1df1ea74f40a5285b6d19577f96f8cf15..85f09aa0e99b454533b24101c8853a85f425f76b 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -177,11 +178,11 @@ void Filer::file_to_extents(inode_t inode,
   off_t left = len;
   while (left > 0) {
     // layout into objects
-    off_t blockno = cur / inode.layout.stripe_unit;
-    off_t stripeno = blockno / inode.layout.stripe_count;
-    off_t stripepos = blockno % inode.layout.stripe_count;
-    off_t objectsetno = stripeno / stripes_per_object;
-    off_t objectno = objectsetno * inode.layout.stripe_count + stripepos;
+    off_t blockno = cur / inode.layout.stripe_unit;          // which block
+    off_t stripeno = blockno / inode.layout.stripe_count;    // which horizontal stripe        (Y)
+    off_t stripepos = blockno % inode.layout.stripe_count;   // which object in the object set (X)
+    off_t objectsetno = stripeno / stripes_per_object;       // which object set
+    off_t objectno = objectsetno * inode.layout.stripe_count + stripepos;  // object id
     
     // find oid, extent
     ObjectExtent *ex = 0;
index 6a052601a08afca15a6f853d9cbdec7f505eaf5e..bf9a2ec7dbbbed8dd801c13e507a2c6e8b2ca244 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
@@ -134,7 +135,7 @@ class Filer {
      (to be used on any osd in the proper replica group) */
   /*object_t file_to_object(inodeno_t ino,
                           size_t    _ono) {  
-    __uint64_t ono = _ono;
+    uint64_t ono = _ono;
     assert(ino < (1ULL<<OID_INO_BITS));       // legal ino can't be too big
     assert(ono < (1ULL<<OID_ONO_BITS));
     return ono + (ino << OID_ONO_BITS);
index 977f50b9c8ad47a50a76ac20d36f9cddf2bad4e0..12285442d56f6c989608ffef340b8e946e9e7847 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 0b8d7061330e8d4d477dbef3ddbd6ef712a363cf..094f740054d698fe87eec252f1b6b4d4588c6be1 100644 (file)
@@ -1,4 +1,5 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 /*
  * Ceph - scalable distributed file system
  *
index 67e0911c5187c291e333f0214c3a674f25b00e3b..f8d7d970c453e0f51c488ca51977f66421c4697e 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include "msg/Messenger.h"
 #include "ObjectCacher.h"
index 4c848afd68d4fda6de2582ac03bf6151781db496..15109ab782167b610c40bf6ec26a5dd8e3b3f300 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef __OBJECTCACHER_H_
 #define __OBJECTCACHER_H_
 
index 42dfe8f2f9a8f06af8d67cba8e510844e36ca2a1..3c29ae510977b3194fb28c042a78d4237312d6ef 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 
 #include "Objecter.h"
 #include "osd/OSDMap.h"
index ec53c3a873b24be54b9dae73276a9d66c4bd40f0..a870543420526713920dd55ee3647171cf8ea941 100644 (file)
@@ -1,3 +1,5 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
 #ifndef __OBJECTER_H
 #define __OBJECTER_H
 
index f5891cc668c45c3e5d6ab418c16ef268fc1c00fb..023c06e455fd11bc9441f3c8c81e951b4fae9b6a 100755 (executable)
@@ -2,28 +2,25 @@
 
 use strict;
 my $fn = shift @ARGV;
-my $f = `cat $fn`;
+my $old = `cat $fn`;
 
-my $header = '// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-/*
- * 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.
- * 
- */
+my $header = `cat doc/header.txt`;
 
-';
+# strip existing header
+my $new = $old;
+if ($new =~ /^(.*)\* Ceph - scalable distributed file system/s) {
+       my ($a,@b) = split(/\*\/\n/, $new);
+       $new = join("*/\n",@b);
+}
+$new = $header . $new;
 
-unless ($f =~ /Ceph - scalable distributed file system/) {
+if ($new ne $old) {
        open(O, ">$fn.new");
-       print O $header;
-       print O $f;
+       print O $new;
        close O;
+       system "diff $fn $fn.new";
        rename "$fn.new", $fn;
+       #unlink "$fn.new";
+
 }
 
diff --git a/branches/sage/pgs/script/fix_modeline.pl b/branches/sage/pgs/script/fix_modeline.pl
new file mode 100755 (executable)
index 0000000..8eadde9
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+my $fn = shift @ARGV;
+my $old = `cat $fn`;
+my $header = `cat doc/modeline.txt`;
+
+# strip existing modeline
+my $new = $old;
+$new =~ s/^\/\/ \-\*\- ([^\n]+) \-\*\-([^\n]*)\n//s; # emacs
+$new =~ s/^\/\/ vim: ([^\n]*)\n//s; # vim;
+$new =~ s/^\/\/ \-\*\- ([^\n]+) \-\*\-([^\n]*)\n//s; # emacs
+$new =~ s/^\/\/ vim: ([^\n]*)\n//s; # vim;
+$new =~ s/^\/\/ \-\*\- ([^\n]+) \-\*\-([^\n]*)\n//s; # emacs
+$new =~ s/^\/\/ vim: ([^\n]*)\n//s; # vim;
+
+# add correct header
+$new = $header . $new;
+
+if ($new ne $old) {
+       print "$fn\n";
+       open(O, ">$fn.new");
+       print O $new;
+       close O;
+       system "diff $fn $fn.new";
+       rename "$fn.new", $fn;
+       #unlink "$fn.new";
+}
+