]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
new debug output locking everywhere!
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 24 Aug 2007 21:13:21 +0000 (21:13 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 24 Aug 2007 21:13:21 +0000 (21:13 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1679 29311d96-e01e-0410-9327-a35deaab8ce9

73 files changed:
trunk/ceph/active/utility.h
trunk/ceph/client/Client.cc
trunk/ceph/client/FileCache.cc
trunk/ceph/client/SyntheticClient.cc
trunk/ceph/client/Trace.cc
trunk/ceph/cmds.cc
trunk/ceph/cmon.cc
trunk/ceph/cmonctl.cc
trunk/ceph/common/Thread.h
trunk/ceph/common/Timer.cc
trunk/ceph/config.cc
trunk/ceph/config.h
trunk/ceph/cosd.cc
trunk/ceph/debug.h [deleted file]
trunk/ceph/ebofs/Allocator.cc
trunk/ceph/ebofs/BlockDevice.cc
trunk/ceph/ebofs/BufferCache.cc
trunk/ceph/ebofs/Ebofs.cc
trunk/ceph/ebofs/FileJournal.cc
trunk/ceph/ebofs/mkfs.ebofs.cc
trunk/ceph/ebofs/nodes.h
trunk/ceph/include/Context.h
trunk/ceph/include/lru.h
trunk/ceph/mds/AnchorClient.cc
trunk/ceph/mds/AnchorTable.cc
trunk/ceph/mds/CDentry.cc
trunk/ceph/mds/CDir.cc
trunk/ceph/mds/CDir.h
trunk/ceph/mds/CInode.cc
trunk/ceph/mds/CInode.h
trunk/ceph/mds/Capability.h
trunk/ceph/mds/ClientMap.cc
trunk/ceph/mds/IdAllocator.cc
trunk/ceph/mds/Locker.cc
trunk/ceph/mds/LogEvent.cc
trunk/ceph/mds/MDBalancer.cc
trunk/ceph/mds/MDCache.cc
trunk/ceph/mds/MDLog.cc
trunk/ceph/mds/MDS.cc
trunk/ceph/mds/Migrator.cc
trunk/ceph/mds/Server.cc
trunk/ceph/mds/journal.cc
trunk/ceph/mds/mdstypes.h
trunk/ceph/messages/MDiscoverReply.h
trunk/ceph/messages/MPGStats.h
trunk/ceph/mon/ClientMonitor.cc
trunk/ceph/mon/Elector.cc
trunk/ceph/mon/MDSMonitor.cc
trunk/ceph/mon/Monitor.cc
trunk/ceph/mon/MonitorStore.cc
trunk/ceph/mon/OSDMonitor.cc
trunk/ceph/mon/PGMonitor.cc
trunk/ceph/mon/Paxos.cc
trunk/ceph/mon/PaxosService.cc
trunk/ceph/msg/FakeMessenger.cc
trunk/ceph/msg/Message.cc
trunk/ceph/msg/SimpleMessenger.cc
trunk/ceph/msg/tcp.cc
trunk/ceph/msg/tcp.h
trunk/ceph/newsyn.cc
trunk/ceph/osbdb/OSBDB.cc
trunk/ceph/osd/Ager.cc
trunk/ceph/osd/FakeStore.cc
trunk/ceph/osd/OSD.cc
trunk/ceph/osd/ObjectStore.cc
trunk/ceph/osd/PG.cc
trunk/ceph/osd/RAID4PG.cc
trunk/ceph/osd/ReplicatedPG.cc
trunk/ceph/osdc/Filer.cc
trunk/ceph/osdc/Journaler.cc
trunk/ceph/osdc/ObjectCacher.cc
trunk/ceph/osdc/Objecter.cc
trunk/ceph/script/study_hardlink_lifetimes.pl [new file with mode: 0755]

index a76371abe78b56c13a4b35ffb71dec3e0048fbdb..789398c0f45279eb6d857a44820bd7da216d9184 100644 (file)
@@ -27,7 +27,7 @@ int send_msg_footer(int fd);
 
 Client* startCephClient()
 {
-  dout(3) << "ActiveMaster: Initializing Ceph client:" << endl;
+  cout << "ActiveMaster: Initializing Ceph client:" << endl;
   
   // parse args from CEPH_ARGS, not command line 
   vector<char*> args; 
@@ -43,7 +43,7 @@ Client* startCephClient()
   MonMap* monmap = new MonMap();
   int r = monmap->read(".ceph_monmap");
   if (r < 0) {
-    dout(0) << "ActiveMaster: could not find .ceph_monmap" << endl; 
+    cout << "ActiveMaster: could not find .ceph_monmap" << endl; 
     return 0;
   }
   assert(r >= 0);
index 9f962caa12e3224caf23db1637f1146b37b7e46c..ebcb0633610b2b2f670aa4d4d58de88acf026ea9 100644 (file)
@@ -60,8 +60,8 @@ using namespace std;
 
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_client) cout << g_clock.now() << " client" << whoami /*<< "." << pthread_self() */ << " "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " client" << whoami /*<< "." << pthread_self() */ << " "
 
 #define  tout       if (g_conf.client_trace) traceout
 
@@ -163,7 +163,7 @@ void Client::tear_down_cache()
        it != fd_map.end();
        it++) {
     Fh *fh = it->second;
-    dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << endl;
+    dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << dendl;
     put_inode(fh->inode);
     delete fh;
   }
@@ -194,15 +194,15 @@ void Client::tear_down_cache()
 
 void Client::dump_inode(Inode *in, set<Inode*>& did)
 {
-  dout(1) << "dump_inode: inode " << in->ino() << " ref " << in->ref << " dir " << in->dir << endl;
+  dout(1) << "dump_inode: inode " << in->ino() << " ref " << in->ref << " dir " << in->dir << dendl;
 
   if (in->dir) {
-    dout(1) << "  dir size " << in->dir->dentries.size() << endl;
+    dout(1) << "  dir size " << in->dir->dentries.size() << dendl;
     //for (hash_map<const char*, Dentry*, hash<const char*>, eqstr>::iterator it = in->dir->dentries.begin();
     for (hash_map<string, Dentry*>::iterator it = in->dir->dentries.begin();
          it != in->dir->dentries.end();
          it++) {
-      dout(1) << "    dn " << it->first << " ref " << it->second->ref << endl;
+      dout(1) << "    dn " << it->first << " ref " << it->second->ref << dendl;
       dump_inode(it->second->inode, did);
     }
   }
@@ -221,9 +221,9 @@ void Client::dump_cache()
     
     dout(1) << "dump_cache: inode " << it->first
             << " ref " << it->second->ref 
-            << " dir " << it->second->dir << endl;
+            << " dir " << it->second->dir << dendl;
     if (it->second->dir) {
-      dout(1) << "  dir size " << it->second->dir->dentries.size() << endl;
+      dout(1) << "  dir size " << it->second->dir->dentries.size() << dendl;
     }
   }
  
@@ -237,7 +237,7 @@ void Client::init()
 }
 
 void Client::shutdown() {
-  dout(1) << "shutdown" << endl;
+  dout(1) << "shutdown" << dendl;
   messenger->shutdown();
 }
 
@@ -261,13 +261,13 @@ void Client::trim_cache()
     
     dout(15) << "trim_cache unlinking dn " << dn->name 
             << " in dir " << hex << dn->dir->parent_inode->inode.ino 
-            << endl;
+            << dendl;
     unlink(dn);
   }
 
   // hose root?
   if (lru.lru_get_size() == 0 && root && root->ref == 0 && inode_map.size() == 1) {
-    dout(15) << "trim_cache trimmed root " << root << endl;
+    dout(15) << "trim_cache trimmed root " << root << dendl;
     delete root;
     root = 0;
     inode_map.clear();
@@ -289,18 +289,18 @@ Inode* Client::insert_inode(Dir *dir, InodeStat *st, const string& dname)
            << "  mtime " << st->inode.mtime
           << "  mask " << st->mask
           << " in dir " << dir->parent_inode->inode.ino
-           << endl;
+           << dendl;
   
   if (dn) {
     if (dn->inode->inode.ino == st->inode.ino) {
       touch_dn(dn);
       dout(12) << " had dentry " << dname
                << " with correct ino " << dn->inode->inode.ino
-               << endl;
+               << dendl;
     } else {
       dout(12) << " had dentry " << dname
                << " with WRONG ino " << dn->inode->inode.ino
-               << endl;
+               << dendl;
       unlink(dn);
       dn = NULL;
     }
@@ -315,12 +315,12 @@ Inode* Client::insert_inode(Dir *dir, InodeStat *st, const string& dname)
       if (in->dn) {
         dout(12) << " had ino " << in->inode.ino
                  << " not linked or linked at the right position, relinking"
-                 << endl;
+                 << dendl;
         dn = relink(dir, dname, in);
       } else {
         // link
         dout(12) << " had ino " << in->inode.ino
-                 << " unlinked, linking" << endl;
+                 << " unlinked, linking" << dendl;
         dn = link(dir, dname, in);
       }
     }
@@ -330,10 +330,10 @@ Inode* Client::insert_inode(Dir *dir, InodeStat *st, const string& dname)
     Inode *in = new Inode(st->inode, objectcacher);
     inode_map[st->inode.ino] = in;
     dn = link(dir, dname, in);
-    dout(12) << " new dentry+node with ino " << st->inode.ino << endl;
+    dout(12) << " new dentry+node with ino " << st->inode.ino << dendl;
   } else {
     // actually update info
-    dout(12) << " stat inode mask is " << st->mask << endl;
+    dout(12) << " stat inode mask is " << st->mask << dendl;
     if (st->mask & STAT_MASK_BASE) {
       dn->inode->inode = st->inode;
       dn->inode->dirfragtree = st->dirfragtree;  // FIXME look at the mask!
@@ -396,10 +396,10 @@ void Client::update_inode_dist(Inode *in, InodeStat *st)
     set<int> dist = st->dirfrag_dist.begin()->second;
     if (dist.empty() && !in->dir_contacts.empty())
       dout(9) << "lost dist spec for " << in->inode.ino 
-              << " " << dist << endl;
+              << " " << dist << dendl;
     if (!dist.empty() && in->dir_contacts.empty()) 
       dout(9) << "got dist spec for " << in->inode.ino 
-              << " " << dist << endl;
+              << " " << dist << dendl;
     in->dir_contacts = dist;
   }
 }
@@ -414,7 +414,7 @@ Inode* Client::insert_trace(MClientReply *reply)
   Inode *cur = root;
   utime_t now = g_clock.real_now();
 
-  dout(10) << "insert_trace got " << reply->get_trace_in().size() << " inodes" << endl;
+  dout(10) << "insert_trace got " << reply->get_trace_in().size() << " inodes" << dendl;
 
   list<string>::const_iterator pdn = reply->get_trace_dn().begin();
 
@@ -424,18 +424,18 @@ Inode* Client::insert_trace(MClientReply *reply)
     
     if (pin == reply->get_trace_in().begin()) {
       // root
-      dout(10) << "insert_trace root" << endl;
+      dout(10) << "insert_trace root" << dendl;
       if (!root) {
         // create
         cur = root = new Inode((*pin)->inode, objectcacher);
-       dout(10) << "insert_trace new root is " << root << endl;
+       dout(10) << "insert_trace new root is " << root << dendl;
         inode_map[root->inode.ino] = root;
       }
     } else {
       // not root.
       Dir *dir = cur->open_dir();
       cur = this->insert_inode(dir, *pin, *pdn);
-      dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << " -> " << cur << endl;
+      dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << " -> " << cur << dendl;
       ++pdn;      
 
       // move to top of lru!
@@ -461,23 +461,23 @@ Inode* Client::insert_trace(MClientReply *reply)
 
 Dentry *Client::lookup(filepath& path)
 {
-  dout(14) << "lookup " << path << endl;
+  dout(14) << "lookup " << path << dendl;
 
   Inode *cur = root;
   if (!cur) return NULL;
 
   Dentry *dn = 0;
   for (unsigned i=0; i<path.depth(); i++) {
-    dout(14) << " seg " << i << " = " << path[i] << endl;
+    dout(14) << " seg " << i << " = " << path[i] << dendl;
     if (cur->inode.mode & INODE_MODE_DIR &&
         cur->dir) {
       // dir, we can descend
       Dir *dir = cur->dir;
       if (dir->dentries.count(path[i])) {
         dn = dir->dentries[path[i]];
-        dout(14) << " hit dentry " << path[i] << " inode is " << dn->inode << " valid_until " << dn->inode->valid_until << endl;
+        dout(14) << " hit dentry " << path[i] << " inode is " << dn->inode << " valid_until " << dn->inode->valid_until << dendl;
       } else {
-        dout(14) << " dentry " << path[i] << " dne" << endl;
+        dout(14) << " dentry " << path[i] << " dne" << dendl;
         return NULL;
       }
       cur = dn->inode;
@@ -488,7 +488,7 @@ Dentry *Client::lookup(filepath& path)
   }
   
   if (dn) {
-    dout(11) << "lookup '" << path << "' found " << dn->name << " inode " << dn->inode->inode.ino << " valid_until " << dn->inode->valid_until<< endl;
+    dout(11) << "lookup '" << path << "' found " << dn->name << " inode " << dn->inode->inode.ino << " valid_until " << dn->inode->valid_until<< dendl;
   }
 
   return dn;
@@ -517,7 +517,7 @@ int Client::choose_target_mds(MClientRequest *req)
        break;
       }
       
-      dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << diri->inode.ino << " " << req->get_filepath()[i] << endl;
+      dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << diri->inode.ino << " " << req->get_filepath()[i] << dendl;
       
       if (i == depth-1) {  // last one!
        item = dir->dentries[ req->get_filepath()[i] ]->inode;
@@ -541,7 +541,7 @@ int Client::choose_target_mds(MClientRequest *req)
 
     if (0) {
       mds = 0;
-      dout(0) << "hack: sending all requests to mds" << mds << endl;
+      dout(0) << "hack: sending all requests to mds" << mds << dendl;
     }
   } else {
     if (req->auth_is_best()) {
@@ -563,7 +563,7 @@ int Client::choose_target_mds(MClientRequest *req)
        mds = diri->pick_replica(mdsmap);
     }
   }
-  dout(20) << "mds is " << mds << endl;
+  dout(20) << "mds is " << mds << dendl;
   
   return mds;
 }
@@ -621,15 +621,15 @@ MClientReply *Client::make_request(MClientRequest *req,
     if (request.resend_mds >= 0) {
       mds = request.resend_mds;
       request.resend_mds = -1;
-      dout(10) << "target resend_mds specified as mds" << mds << endl;
+      dout(10) << "target resend_mds specified as mds" << mds << dendl;
     } else {
       mds = choose_target_mds(req);
       if (mds >= 0) {
-       dout(10) << "chose target mds" << mds << " based on hierarchy" << endl;
+       dout(10) << "chose target mds" << mds << " based on hierarchy" << dendl;
       } else {
        mds = mdsmap->get_random_in_mds();
        if (mds < 0) mds = 0;  // hrm.
-       dout(10) << "chose random target mds" << mds << " for lack of anything better" << endl;
+       dout(10) << "chose random target mds" << mds << " for lack of anything better" << dendl;
       }
     }
     
@@ -638,7 +638,7 @@ MClientReply *Client::make_request(MClientRequest *req,
       Cond cond;
 
       if (!mdsmap->have_inst(mds)) {
-       dout(10) << "no address for mds" << mds << ", requesting new mdsmap" << endl;
+       dout(10) << "no address for mds" << mds << ", requesting new mdsmap" << dendl;
        int mon = monmap->pick_mon();
        messenger->send_message(new MMDSGetMap(),
                                monmap->get_inst(mon));
@@ -646,14 +646,14 @@ MClientReply *Client::make_request(MClientRequest *req,
        cond.Wait(client_lock);
 
        if (!mdsmap->have_inst(mds)) {
-         dout(10) << "hmm, still have no address for mds" << mds << ", trying a random mds" << endl;
+         dout(10) << "hmm, still have no address for mds" << mds << ", trying a random mds" << dendl;
          request.resend_mds = mdsmap->get_random_in_mds();
          continue;
        }
       }        
       
       if (waiting_for_session.count(mds) == 0) {
-       dout(10) << "opening session to mds" << mds << endl;
+       dout(10) << "opening session to mds" << mds << dendl;
        messenger->send_message(new MClientSession(MClientSession::OP_REQUEST_OPEN),
                                mdsmap->get_inst(mds), MDS_PORT_SERVER);
       }
@@ -661,7 +661,7 @@ MClientReply *Client::make_request(MClientRequest *req,
       // wait
       waiting_for_session[mds].push_back(&cond);
       while (waiting_for_session.count(mds)) {
-       dout(10) << "waiting for session to mds" << mds << " to open" << endl;
+       dout(10) << "waiting for session to mds" << mds << " to open" << dendl;
        cond.Wait(client_lock);
       }
     }
@@ -670,7 +670,7 @@ MClientReply *Client::make_request(MClientRequest *req,
     send_request(&request, mds);
 
     // wait for signal
-    dout(20) << "awaiting kick on " << &cond << endl;
+    dout(20) << "awaiting kick on " << &cond << dendl;
     cond.Wait(client_lock);
     
     // did we get a reply?
@@ -684,7 +684,7 @@ MClientReply *Client::make_request(MClientRequest *req,
   // kick dispatcher (we've got it!)
   assert(request.dispatch_cond);
   request.dispatch_cond->Signal();
-  dout(20) << "sendrecv kickback on tid " << tid << " " << request.dispatch_cond << endl;
+  dout(20) << "sendrecv kickback on tid " << tid << " " << request.dispatch_cond << dendl;
   
   // clean up.
   mds_requests.erase(tid);
@@ -694,7 +694,7 @@ MClientReply *Client::make_request(MClientRequest *req,
   if (client_logger) {
     utime_t lat = g_clock.real_now();
     lat -= start;
-    dout(20) << "lat " << lat << endl;
+    dout(20) << "lat " << lat << dendl;
     client_logger->finc("lsum",(double)lat);
     client_logger->inc("lnum");
 
@@ -723,7 +723,7 @@ MClientReply *Client::make_request(MClientRequest *req,
 
 void Client::handle_client_session(MClientSession *m) 
 {
-  dout(10) << "handle_client_session " << *m << endl;
+  dout(10) << "handle_client_session " << *m << dendl;
   int from = m->get_source().num();
 
   switch (m->op) {
@@ -758,7 +758,7 @@ void Client::send_request(MetaRequest *request, int mds)
   if (!r) {
     // make a new one
     dout(10) << "send_request rebuilding request " << request->tid
-            << " for mds" << mds << endl;
+            << " for mds" << mds << dendl;
     r = new MClientRequest;
     r->copy_payload(request->request_payload);
     r->decode_payload();
@@ -766,7 +766,7 @@ void Client::send_request(MetaRequest *request, int mds)
   }
   request->request = 0;
 
-  dout(10) << "send_request " << *r << " to mds" << mds << endl;
+  dout(10) << "send_request " << *r << " to mds" << mds << dendl;
   messenger->send_message(r, mdsmap->get_inst(mds), MDS_PORT_SERVER);
   
   request->mds.insert(mds);
@@ -777,7 +777,7 @@ void Client::handle_client_request_forward(MClientRequestForward *fwd)
   tid_t tid = fwd->get_tid();
 
   if (mds_requests.count(tid) == 0) {
-    dout(10) << "handle_client_request_forward no pending request on tid " << tid << endl;
+    dout(10) << "handle_client_request_forward no pending request on tid " << tid << dendl;
     delete fwd;
     return;
   }
@@ -804,12 +804,12 @@ void Client::handle_client_request_forward(MClientRequestForward *fwd)
               << " fwd " << fwd->get_num_fwd() 
               << " to mds" << fwd->get_dest_mds() 
               << ", mds set now " << request->mds
-              << endl;
+              << dendl;
     } else {
       dout(10) << "handle_client_request tid " << tid
               << " previously forwarded to mds" << fwd->get_dest_mds() 
               << ", mds still " << request->mds
-                << endl;
+                << dendl;
     }
   } else {
     // request not forwarded, or dest mds has no session.
@@ -818,7 +818,7 @@ void Client::handle_client_request_forward(MClientRequestForward *fwd)
             << " fwd " << fwd->get_num_fwd() 
             << " to mds" << fwd->get_dest_mds() 
             << ", non-idempotent, resending to " << fwd->get_dest_mds()
-            << endl;
+            << dendl;
 
     request->mds.clear();
     request->num_fwd = fwd->get_num_fwd();
@@ -834,7 +834,7 @@ void Client::handle_client_reply(MClientReply *reply)
   tid_t tid = reply->get_tid();
 
   if (mds_requests.count(tid) == 0) {
-    dout(10) << "handle_client_reply no pending request on tid " << tid << endl;
+    dout(10) << "handle_client_reply no pending request on tid " << tid << dendl;
     delete reply;
     return;
   }
@@ -851,7 +851,7 @@ void Client::handle_client_reply(MClientReply *reply)
   Cond cond;
   request->dispatch_cond = &cond;
   while (mds_requests.count(tid)) {
-    dout(20) << "handle_client_reply awaiting kickback on tid " << tid << " " << &cond << endl;
+    dout(20) << "handle_client_reply awaiting kickback on tid " << tid << " " << &cond << dendl;
     cond.Wait(client_lock);
   }
 }
@@ -903,7 +903,7 @@ void Client::dispatch(Message *m)
     break;
 
   default:
-    cout << "dispatch doesn't recognize message type " << m->get_type() << endl;
+    dout(10) << "dispatch doesn't recognize message type " << m->get_type() << dendl;
     assert(0);  // fail loudly
     break;
   }
@@ -911,14 +911,14 @@ void Client::dispatch(Message *m)
   // unmounting?
   if (unmounting) {
     dout(10) << "unmounting: trim pass, size was " << lru.lru_get_size() 
-             << "+" << inode_map.size() << endl;
+             << "+" << inode_map.size() << dendl;
     trim_cache();
     if (lru.lru_get_size() == 0 && inode_map.empty()) {
-      dout(10) << "unmounting: trim pass, cache now empty, waking unmount()" << endl;
+      dout(10) << "unmounting: trim pass, cache now empty, waking unmount()" << dendl;
       mount_cond.Signal();
     } else {
       dout(10) << "unmounting: trim pass, size still " << lru.lru_get_size() 
-               << "+" << inode_map.size() << endl;
+               << "+" << inode_map.size() << dendl;
       dump_cache();      
     }
   }
@@ -938,13 +938,13 @@ void Client::handle_mds_map(MMDSMap* m)
 
     assert(m->get_source().is_mon());
     whoami = m->get_dest().num();
-    dout(1) << "handle_mds_map i am now " << m->get_dest() << endl;
+    dout(1) << "handle_mds_map i am now " << m->get_dest() << dendl;
     messenger->reset_myname(m->get_dest());
     
     mount_cond.Signal();  // mount might be waiting for this.
   } 
 
-  dout(1) << "handle_mds_map epoch " << m->get_epoch() << endl;
+  dout(1) << "handle_mds_map epoch " << m->get_epoch() << dendl;
   epoch_t was = mdsmap->get_epoch();
   mdsmap->decode(m->get_encoded());
   assert(mdsmap->get_epoch() >= was);
@@ -973,7 +973,7 @@ void Client::handle_mds_map(MMDSMap* m)
 
 void Client::send_reconnect(int mds)
 {
-  dout(10) << "send_reconnect to mds" << mds << endl;
+  dout(10) << "send_reconnect to mds" << mds << dendl;
 
   MClientReconnect *m = new MClientReconnect;
 
@@ -986,7 +986,7 @@ void Client::send_reconnect(int mds)
        dout(10) << " caps on " << p->first
                 << " " << cap_string(p->second->caps[mds].caps)
                 << " wants " << cap_string(p->second->file_caps_wanted())
-                << endl;
+                << dendl;
        p->second->caps[mds].seq = 0;  // reset seq.
        m->add_inode_caps(p->first,    // ino
                          p->second->file_caps_wanted(), // wanted
@@ -994,11 +994,11 @@ void Client::send_reconnect(int mds)
                          p->second->inode.size, p->second->inode.mtime, p->second->inode.atime);
        string path;
        p->second->make_path(path);
-       dout(10) << " path on " << p->first << " is " << path << endl;
+       dout(10) << " path on " << p->first << " is " << path << dendl;
        m->add_inode_path(p->first, path);
       }
       if (p->second->stale_caps.count(mds)) {
-       dout(10) << " clearing stale caps on " << p->first << endl;
+       dout(10) << " clearing stale caps on " << p->first << dendl;
        p->second->stale_caps.erase(mds);         // hrm, is this right?
       }
     }
@@ -1016,7 +1016,7 @@ void Client::send_reconnect(int mds)
 
 void Client::kick_requests(int mds)
 {
-  dout(10) << "kick_requests for mds" << mds << endl;
+  dout(10) << "kick_requests for mds" << mds << dendl;
 
   for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
        p != mds_requests.end();
@@ -1065,7 +1065,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
     int other = m->get_mds();
 
     if (in && in->stale_caps.count(other)) {
-      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " reap on mds" << other << endl;
+      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " reap on mds" << other << dendl;
 
       // fresh from new mds?
       if (!in->caps.count(mds)) {
@@ -1080,7 +1080,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
       
       // fall-thru!
     } else {
-      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " premature (!!) reap on mds" << other << endl;
+      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " premature (!!) reap on mds" << other << dendl;
       // delay!
       cap_reap_queue[in->ino()][other] = m;
       return;
@@ -1091,7 +1091,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
   
   // stale?
   if (m->get_op() == MClientFileCaps::OP_STALE) {
-    dout(5) << "handle_file_caps on ino " << m->get_ino() << " seq " << m->get_seq() << " from mds" << mds << " now stale" << endl;
+    dout(5) << "handle_file_caps on ino " << m->get_ino() << " seq " << m->get_seq() << " from mds" << mds << " now stale" << dendl;
     
     // move to stale list
     assert(in->caps.count(mds));
@@ -1105,7 +1105,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
     // delayed reap?
     if (cap_reap_queue.count(in->ino()) &&
         cap_reap_queue[in->ino()].count(mds)) {
-      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " delayed reap on mds" << m->get_mds() << endl;
+      dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " delayed reap on mds" << m->get_mds() << dendl;
       
       // process delayed reap
       handle_file_caps( cap_reap_queue[in->ino()][mds] );
@@ -1120,7 +1120,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
 
   // release?
   if (m->get_op() == MClientFileCaps::OP_RELEASE) {
-    dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " release" << endl;
+    dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " release" << dendl;
     assert(in->caps.count(mds));
     in->caps.erase(mds);
     for (map<int,InodeCap>::iterator p = in->caps.begin();
@@ -1128,19 +1128,19 @@ void Client::handle_file_caps(MClientFileCaps *m)
          p++)
       dout(20) << " left cap " << p->first << " " 
               << cap_string(p->second.caps) << " " 
-              << p->second.seq << endl;
+              << p->second.seq << dendl;
     for (map<int,InodeCap>::iterator p = in->stale_caps.begin();
          p != in->stale_caps.end();
          p++)
       dout(20) << " left stale cap " << p->first << " " 
               << cap_string(p->second.caps) << " " 
-              << p->second.seq << endl;
+              << p->second.seq << dendl;
 
     if (in->caps.empty()) {
-      //dout(0) << "did put_inode" << endl;
+      //dout(0) << "did put_inode" << dendl;
       put_inode(in);
     } else {
-      //dout(0) << "didn't put_inode" << endl;
+      //dout(0) << "didn't put_inode" << dendl;
     }
     delete m;
     return;
@@ -1152,7 +1152,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
     dout(5) << "handle_file_caps on ino " << m->get_ino() 
             << " seq " << m->get_seq() 
             << " " << cap_string(m->get_caps()) 
-            << ", which we don't want caps for, releasing." << endl;
+            << ", which we don't want caps for, releasing." << dendl;
     m->set_caps(0);
     m->set_wanted(0);
     messenger->send_message(m, m->get_source_inst(), MDS_PORT_LOCKER);
@@ -1169,13 +1169,13 @@ void Client::handle_file_caps(MClientFileCaps *m)
   dout(5) << "handle_file_caps on in " << m->get_ino() 
           << " mds" << mds << " seq " << m->get_seq() 
           << " caps now " << cap_string(new_caps) 
-          << " was " << cap_string(old_caps) << endl;
+          << " was " << cap_string(old_caps) << dendl;
   
   // did file size decrease?
   if ((old_caps & (CAP_FILE_RD|CAP_FILE_WR)) == 0 &&
       (new_caps & (CAP_FILE_RD|CAP_FILE_WR)) != 0 &&
       in->inode.size > m->get_inode().size) {
-    dout(10) << "*** file size decreased from " << in->inode.size << " to " << m->get_inode().size << endl;
+    dout(10) << "*** file size decreased from " << in->inode.size << " to " << m->get_inode().size << dendl;
     
     // trim filecache?
     if (g_conf.client_oc)
@@ -1214,7 +1214,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
       for (list<Cond*>::iterator it = in->waitfor_read.begin();
            it != in->waitfor_read.end();
            it++) {
-        dout(5) << "signaling read waiter " << *it << endl;
+        dout(5) << "signaling read waiter " << *it << dendl;
         (*it)->Signal();
       }
       in->waitfor_read.clear();
@@ -1223,7 +1223,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
       for (list<Cond*>::iterator it = in->waitfor_write.begin();
            it != in->waitfor_write.end();
            it++) {
-        dout(5) << "signaling write waiter " << *it << endl;
+        dout(5) << "signaling write waiter " << *it << dendl;
         (*it)->Signal();
       }
       in->waitfor_write.clear();
@@ -1232,7 +1232,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
       for (list<Cond*>::iterator it = in->waitfor_lazy.begin();
            it != in->waitfor_lazy.end();
            it++) {
-        dout(5) << "signaling lazy waiter " << *it << endl;
+        dout(5) << "signaling lazy waiter " << *it << dendl;
         (*it)->Signal();
       }
       in->waitfor_lazy.clear();
@@ -1242,7 +1242,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
     if (old_caps & ~new_caps) {
       if (in->sync_writes) {
         // wait for sync writes to finish
-        dout(5) << "sync writes in progress, will ack on finish" << endl;
+        dout(5) << "sync writes in progress, will ack on finish" << dendl;
         in->waitfor_no_write.push_back(new C_Client_ImplementedCaps(this, m, in));
       } else {
         // ok now
@@ -1258,7 +1258,7 @@ void Client::handle_file_caps(MClientFileCaps *m)
 void Client::implemented_caps(MClientFileCaps *m, Inode *in)
 {
   dout(5) << "implemented_caps " << cap_string(m->get_caps()) 
-          << ", acking to " << m->get_source() << endl;
+          << ", acking to " << m->get_source() << dendl;
 
   if (in->file_caps() == 0) {
     in->file_wr_mtime = utime_t();
@@ -1276,7 +1276,7 @@ void Client::release_caps(Inode *in,
           << " had " << cap_string(in->file_caps())
           << " retaining " << cap_string(retain) 
          << " want " << cap_string(in->file_caps_wanted())
-          << endl;
+          << dendl;
   
   for (map<int,InodeCap>::iterator it = in->caps.begin();
        it != in->caps.end();
@@ -1305,7 +1305,7 @@ void Client::update_caps_wanted(Inode *in)
 {
   dout(5) << "updating caps wanted on ino " << in->inode.ino 
           << " to " << cap_string(in->file_caps_wanted())
-          << endl;
+          << dendl;
   
   // FIXME: pick a single mds and let the others off the hook..
   for (map<int,InodeCap>::iterator it = in->caps.begin();
@@ -1328,9 +1328,9 @@ void Client::update_caps_wanted(Inode *in)
 
 void Client::_try_mount()
 {
-  dout(10) << "_try_mount" << endl;
+  dout(10) << "_try_mount" << dendl;
   int mon = monmap->pick_mon();
-  dout(2) << "sending client_mount to mon" << mon << endl;
+  dout(2) << "sending client_mount to mon" << mon << dendl;
   messenger->send_message(new MClientMount(messenger->get_myaddr(),
                                           client_instance_this_process), 
                          monmap->get_inst(mon));
@@ -1343,7 +1343,7 @@ void Client::_try_mount()
 
 void Client::_mount_timeout()
 {
-  dout(10) << "_mount_timeout" << endl;
+  dout(10) << "_mount_timeout" << dendl;
   mount_timeout_event = 0;
   _try_mount();
 }
@@ -1368,7 +1368,7 @@ int Client::mount()
 
   dout(2) << "mounted: have osdmap " << osdmap->get_epoch() 
          << " and mdsmap " << mdsmap->get_epoch() 
-         << endl;
+         << dendl;
 
   // hack: get+pin root inode.
   //  fuse assumes it's always there.
@@ -1380,23 +1380,23 @@ int Client::mount()
   if (g_conf.client_trace) {
     traceout.open(g_conf.client_trace);
     if (traceout.is_open()) {
-      dout(1) << "opened trace file '" << g_conf.client_trace << "'" << endl;
+      dout(1) << "opened trace file '" << g_conf.client_trace << "'" << dendl;
     } else {
-      dout(1) << "FAILED to open trace file '" << g_conf.client_trace << "'" << endl;
+      dout(1) << "FAILED to open trace file '" << g_conf.client_trace << "'" << dendl;
     }
   }
 
   client_lock.Unlock();
 
   /*
-  dout(3) << "op: // client trace data structs" << endl;
-  dout(3) << "op: struct stat st;" << endl;
-  dout(3) << "op: struct utimbuf utim;" << endl;
-  dout(3) << "op: int readlinkbuf_len = 1000;" << endl;
-  dout(3) << "op: char readlinkbuf[readlinkbuf_len];" << endl;
-  dout(3) << "op: map<string, inode_t*> dir_contents;" << endl;
-  dout(3) << "op: map<int, int> open_files;" << endl;
-  dout(3) << "op: int fd;" << endl;
+  dout(3) << "op: // client trace data structs" << dendl;
+  dout(3) << "op: struct stat st;" << dendl;
+  dout(3) << "op: struct utimbuf utim;" << dendl;
+  dout(3) << "op: int readlinkbuf_len = 1000;" << dendl;
+  dout(3) << "op: char readlinkbuf[readlinkbuf_len];" << dendl;
+  dout(3) << "op: map<string, inode_t*> dir_contents;" << dendl;
+  dout(3) << "op: map<int, int> open_files;" << dendl;
+  dout(3) << "op: int fd;" << dendl;
   */
   return 0;
 }
@@ -1411,17 +1411,17 @@ int Client::unmount()
 
   assert(mounted);  // caller is confused?
 
-  dout(2) << "unmounting" << endl;
+  dout(2) << "unmounting" << dendl;
   unmounting = true;
 
   // NOTE: i'm assuming all caches are already flushing (because all files are closed).
   assert(fd_map.empty());
 
-  dout(10) << "a" << endl;
+  dout(10) << "a" << dendl;
 
   _ll_drop_pins();
   
-  dout(10) << "b" << endl;
+  dout(10) << "b" << dendl;
 
   // empty lru cache
   lru.lru_set_max(0);
@@ -1436,10 +1436,10 @@ int Client::unmount()
       if (!in->caps.empty()) {
         in->fc.release_clean();
         if (in->fc.is_dirty()) {
-          dout(10) << "unmount residual caps on " << in->ino() << ", flushing" << endl;
+          dout(10) << "unmount residual caps on " << in->ino() << ", flushing" << dendl;
           in->fc.empty(new C_Client_CloseRelease(this, in));
         } else {
-          dout(10) << "unmount residual caps on " << in->ino()  << ", releasing" << endl;
+          dout(10) << "unmount residual caps on " << in->ino()  << ", releasing" << dendl;
           release_caps(in);
         }
       }
@@ -1451,7 +1451,7 @@ int Client::unmount()
     dout(2) << "cache still has " << lru.lru_get_size() 
             << "+" << inode_map.size() << " items" 
            << ", waiting (for caps to release?)"
-            << endl;
+            << dendl;
     dump_cache();
     mount_cond.Wait(client_lock);
   }
@@ -1462,14 +1462,14 @@ int Client::unmount()
   if (!g_conf.client_oc) {
     while (unsafe_sync_write > 0) {
       dout(0) << unsafe_sync_write << " unsafe_sync_writes, waiting" 
-              << endl;
+              << dendl;
       mount_cond.Wait(client_lock);
     }
   }
 
   // stop tracing
   if (g_conf.client_trace) {
-    dout(1) << "closing trace file '" << g_conf.client_trace << "'" << endl;
+    dout(1) << "closing trace file '" << g_conf.client_trace << "'" << dendl;
     traceout.close();
   }
 
@@ -1478,7 +1478,7 @@ int Client::unmount()
   for (map<int,version_t>::iterator p = mds_sessions.begin();
        p != mds_sessions.end();
        ++p) {
-    dout(2) << "sending client_session close to mds" << p->first << " seq " << p->second << endl;
+    dout(2) << "sending client_session close to mds" << p->first << " seq " << p->second << dendl;
     messenger->send_message(new MClientSession(MClientSession::OP_REQUEST_CLOSE,
                                               p->second),
                            mdsmap->get_inst(p->first), MDS_PORT_SERVER);
@@ -1486,14 +1486,14 @@ int Client::unmount()
 
   // send unmount!
   int mon = monmap->pick_mon();
-  dout(2) << "sending client_unmount to mon" << mon << endl;
+  dout(2) << "sending client_unmount to mon" << mon << dendl;
   messenger->send_message(new MClientUnmount(messenger->get_myinst()), 
                          monmap->get_inst(mon));
   
   while (mounted)
     mount_cond.Wait(client_lock);
 
-  dout(2) << "unmounted." << endl;
+  dout(2) << "unmounted." << dendl;
 
   client_lock.Unlock();
   return 0;
@@ -1501,7 +1501,7 @@ int Client::unmount()
 
 void Client::handle_unmount(Message* m)
 {
-  dout(1) << "handle_unmount got ack" << endl;
+  dout(1) << "handle_unmount got ack" << dendl;
 
   mounted = false;
 
@@ -1523,9 +1523,9 @@ void Client::handle_unmount(Message* m)
 int Client::link(const char *existing, const char *newname) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "link" << endl;
-  tout << existing << endl;
-  tout << newname << endl;
+  tout << "link" << dendl;
+  tout << existing << dendl;
+  tout << newname << dendl;
   return _link(existing, newname);
 }
 
@@ -1547,10 +1547,10 @@ int Client::_link(const char *existing, const char *newname)
   
   insert_trace(reply);
   delete reply;
-  dout(10) << "link result is " << res << endl;
+  dout(10) << "link result is " << res << dendl;
 
   trim_cache();
-  dout(3) << "link(\"" << existing << "\", \"" << newname << "\") = " << res << endl;
+  dout(3) << "link(\"" << existing << "\", \"" << newname << "\") = " << res << dendl;
   return res;
 }
 
@@ -1558,8 +1558,8 @@ int Client::_link(const char *existing, const char *newname)
 int Client::unlink(const char *relpath)
 {
   Mutex::Locker lock(client_lock);
-  tout << "unlink" << endl;
-  tout << relpath << endl;
+  tout << "unlink" << dendl;
+  tout << relpath << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1591,19 +1591,19 @@ int Client::_unlink(const char *path)
   }
   insert_trace(reply);
   delete reply;
-  dout(10) << "unlink result is " << res << endl;
+  dout(10) << "unlink result is " << res << dendl;
 
   trim_cache();
-  dout(3) << "unlink(\"" << path << "\") = " << res << endl;
+  dout(3) << "unlink(\"" << path << "\") = " << res << dendl;
   return res;
 }
 
 int Client::rename(const char *relfrom, const char *relto)
 {
   Mutex::Locker lock(client_lock);
-  tout << "rename" << endl;
-  tout << relfrom << endl;
-  tout << relto << endl;
+  tout << "rename" << dendl;
+  tout << relfrom << dendl;
+  tout << relto << dendl;
 
   string absfrom, absto;
   mkabspath(relfrom, absfrom);
@@ -1627,12 +1627,12 @@ int Client::_rename(const char *from, const char *to)
   int res = reply->get_result();
   insert_trace(reply);
   delete reply;
-  dout(10) << "rename result is " << res << endl;
+  dout(10) << "rename result is " << res << dendl;
 
   // renamed item from our cache
 
   trim_cache();
-  dout(3) << "rename(\"" << from << "\", \"" << to << "\") = " << res << endl;
+  dout(3) << "rename(\"" << from << "\", \"" << to << "\") = " << res << dendl;
   return res;
 }
 
@@ -1641,9 +1641,9 @@ int Client::_rename(const char *from, const char *to)
 int Client::mkdir(const char *relpath, mode_t mode)
 {
   Mutex::Locker lock(client_lock);
-  tout << "mkdir" << endl;
-  tout << relpath << endl;
-  tout << mode << endl;
+  tout << "mkdir" << dendl;
+  tout << relpath << dendl;
+  tout << mode << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1666,19 +1666,19 @@ int Client::_mkdir(const char *path, mode_t mode)
   int res = reply->get_result();
   insert_trace(reply);
   delete reply;
-  dout(10) << "mkdir result is " << res << endl;
+  dout(10) << "mkdir result is " << res << dendl;
 
   trim_cache();
 
-  dout(3) << "mkdir(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+  dout(3) << "mkdir(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
   return res;
 }
 
 int Client::rmdir(const char *relpath)
 {
   Mutex::Locker lock(client_lock);
-  tout << "rmdir" << endl;
-  tout << relpath << endl;
+  tout << "rmdir" << dendl;
+  tout << relpath << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1712,7 +1712,7 @@ int Client::_rmdir(const char *path)
   delete reply;
 
   trim_cache();
-  dout(3) << "rmdir(\"" << path << "\") = " << res << endl;
+  dout(3) << "rmdir(\"" << path << "\") = " << res << dendl;
   return res;
 }
 
@@ -1721,9 +1721,9 @@ int Client::_rmdir(const char *path)
 int Client::symlink(const char *reltarget, const char *rellink)
 {
   Mutex::Locker lock(client_lock);
-  tout << "symlink" << endl;
-  tout << reltarget << endl;
-  tout << rellink << endl;
+  tout << "symlink" << dendl;
+  tout << reltarget << dendl;
+  tout << rellink << dendl;
 
   string target, link;
   mkabspath(reltarget, target);
@@ -1749,15 +1749,15 @@ int Client::_symlink(const char *target, const char *link)
   delete reply;
 
   trim_cache();
-  dout(3) << "symlink(\"" << target << "\", \"" << link << "\") = " << res << endl;
+  dout(3) << "symlink(\"" << target << "\", \"" << link << "\") = " << res << dendl;
   return res;
 }
 
 int Client::readlink(const char *path, char *buf, off_t size) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "readlink" << endl;
-  tout << path << endl;
+  tout << "readlink" << dendl;
+  tout << path << dendl;
 
   string abspath;
   mkabspath(path, abspath);
@@ -1779,7 +1779,7 @@ int Client::_readlink(const char *path, char *buf, off_t size)
   }
   trim_cache();
 
-  dout(3) << "readlink(\"" << path << "\", \"" << buf << "\", " << size << ") = " << r << endl;
+  dout(3) << "readlink(\"" << path << "\", \"" << buf << "\", " << size << ") = " << r << dendl;
   return r;
 }
 
@@ -1801,13 +1801,13 @@ int Client::_do_lstat(const char *path, int mask, Inode **in)
 
   if (dn && 
       now <= dn->inode->valid_until)
-    dout(10) << "_lstat has inode " << path << " with mask " << dn->inode->mask << ", want " << mask << endl;
+    dout(10) << "_lstat has inode " << path << " with mask " << dn->inode->mask << ", want " << mask << dendl;
 
   if (dn && dn->inode &&
       ((mask & ~STAT_MASK_BASE) || now <= dn->inode->valid_until) &&
       ((dn->inode->mask & mask) == mask)) {
     inode = dn->inode->inode;
-    dout(10) << "lstat cache hit w/ sufficient mask, valid until " << dn->inode->valid_until << endl;
+    dout(10) << "lstat cache hit w/ sufficient mask, valid until " << dn->inode->valid_until << dendl;
     
     if (g_conf.client_cache_stat_ttl == 0)
       dn->inode->valid_until = utime_t();           // only one stat allowed after each readdir
@@ -1825,7 +1825,7 @@ int Client::_do_lstat(const char *path, int mask, Inode **in)
 
     MClientReply *reply = make_request(req);
     res = reply->get_result();
-    dout(10) << "lstat res is " << res << endl;
+    dout(10) << "lstat res is " << res << dendl;
     if (res == 0) {
       //Transfer information from reply to stbuf
       inode = reply->get_inode();
@@ -1847,7 +1847,7 @@ int Client::_do_lstat(const char *path, int mask, Inode **in)
 int Client::fill_stat(Inode *in, struct stat *st) 
 {
   dout(10) << "fill_stat on " << in->inode.ino << " mode 0" << oct << in->inode.mode << dec
-          << " mtime " << in->inode.mtime << " ctime " << in->inode.ctime << endl;
+          << " mtime " << in->inode.mtime << " ctime " << in->inode.ctime << dendl;
   memset(st, 0, sizeof(struct stat));
   st->st_ino = in->inode.ino;
   st->st_mode = in->inode.mode;
@@ -1879,8 +1879,8 @@ int Client::fill_stat(Inode *in, struct stat *st)
 int Client::lstat(const char *relpath, struct stat *stbuf)
 {
   Mutex::Locker lock(client_lock);
-  tout << "lstat" << endl;
-  tout << relpath << endl;
+  tout << "lstat" << dendl;
+  tout << relpath << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1894,11 +1894,11 @@ int Client::_lstat(const char *path, struct stat *stbuf)
   if (res == 0) {
     assert(in);
     fill_stat(in, stbuf);
-    dout(10) << "stat sez size = " << in->inode.size << " mode = 0" << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << endl;
+    dout(10) << "stat sez size = " << in->inode.size << " mode = 0" << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << dendl;
   }
 
   trim_cache();
-  dout(3) << "lstat(\"" << path << "\", " << stbuf << ") = " << res << endl;
+  dout(3) << "lstat(\"" << path << "\", " << stbuf << ") = " << res << dendl;
   return res;
 }
 
@@ -1912,9 +1912,9 @@ int Client::lstatlite(const char *relpath, struct statlite *stl)
   mkabspath(relpath, abspath);
   const char *path = abspath.c_str();
 
-  dout(3) << "op: client->lstatlite(\"" << path << "\", &st);" << endl;
-  tout << "lstatlite" << endl;
-  tout << path << endl;
+  dout(3) << "op: client->lstatlite(\"" << path << "\", &st);" << dendl;
+  tout << "lstatlite" << dendl;
+  tout << path << dendl;
 
   // make mask
   // FIXME.
@@ -1929,7 +1929,7 @@ int Client::lstatlite(const char *relpath, struct statlite *stl)
   
   if (res == 0) {
     fill_statlite(in->inode,stl);
-    dout(10) << "stat sez size = " << in->inode.size << " ino = " << in->inode.ino << endl;
+    dout(10) << "stat sez size = " << in->inode.size << " ino = " << in->inode.ino << dendl;
   }
 
   trim_cache();
@@ -1942,9 +1942,9 @@ int Client::lstatlite(const char *relpath, struct statlite *stl)
 int Client::chmod(const char *relpath, mode_t mode)
 {
   Mutex::Locker lock(client_lock);
-  tout << "chmod" << endl;
-  tout << relpath << endl;
-  tout << mode << endl;
+  tout << "chmod" << dendl;
+  tout << relpath << dendl;
+  tout << mode << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1953,7 +1953,7 @@ int Client::chmod(const char *relpath, mode_t mode)
 
 int Client::_chmod(const char *path, mode_t mode) 
 {
-  dout(3) << "_chmod(" << path << ", 0" << oct << mode << dec << ")" << endl;
+  dout(3) << "_chmod(" << path << ", 0" << oct << mode << dec << ")" << dendl;
   MClientRequest *req = new MClientRequest(MDS_OP_CHMOD, messenger->get_myinst());
   req->set_path(path); 
   req->args.chmod.mode = mode;
@@ -1968,17 +1968,17 @@ int Client::_chmod(const char *path, mode_t mode)
   delete reply;
 
   trim_cache();
-  dout(3) << "_chmod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+  dout(3) << "_chmod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
   return res;
 }
 
 int Client::chown(const char *relpath, uid_t uid, gid_t gid)
 {
   Mutex::Locker lock(client_lock);
-  tout << "chown" << endl;
-  tout << relpath << endl;
-  tout << uid << endl;
-  tout << gid << endl;
+  tout << "chown" << dendl;
+  tout << relpath << dendl;
+  tout << uid << dendl;
+  tout << gid << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -1987,7 +1987,7 @@ int Client::chown(const char *relpath, uid_t uid, gid_t gid)
 
 int Client::_chown(const char *path, uid_t uid, gid_t gid)
 {
-  dout(3) << "_chown(" << path << ", " << uid << ", " << gid << ")" << endl;
+  dout(3) << "_chown(" << path << ", " << uid << ", " << gid << ")" << dendl;
   MClientRequest *req = new MClientRequest(MDS_OP_CHOWN, messenger->get_myinst());
   req->set_path(path); 
   req->args.chown.uid = uid;
@@ -2003,20 +2003,20 @@ int Client::_chown(const char *path, uid_t uid, gid_t gid)
   int res = reply->get_result();
   insert_trace(reply);  
   delete reply;
-  dout(10) << "chown result is " << res << endl;
+  dout(10) << "chown result is " << res << dendl;
 
   trim_cache();
-  dout(3) << "chown(\"" << path << "\", " << uid << ", " << gid << ") = " << res << endl;
+  dout(3) << "chown(\"" << path << "\", " << uid << ", " << gid << ") = " << res << dendl;
   return res;
 }
 
 int Client::utime(const char *relpath, struct utimbuf *buf)
 {
   Mutex::Locker lock(client_lock);
-  tout << "utime" << endl;
-  tout << relpath << endl;
-  tout << buf->modtime << endl;
-  tout << buf->actime << endl;
+  tout << "utime" << dendl;
+  tout << relpath << dendl;
+  tout << buf->modtime << dendl;
+  tout << buf->actime << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -2025,7 +2025,7 @@ int Client::utime(const char *relpath, struct utimbuf *buf)
 
 int Client::_utimes(const char *path, utime_t mtime, utime_t atime)
 {
-  dout(3) << "_utimes(" << path << ", " << mtime << ", " << atime << ")" << endl;
+  dout(3) << "_utimes(" << path << ", " << mtime << ", " << atime << ")" << dendl;
   MClientRequest *req = new MClientRequest(MDS_OP_UTIME, messenger->get_myinst());
   req->set_path(path); 
   req->args.utime.mtime = mtime.tv_ref();
@@ -2040,7 +2040,7 @@ int Client::_utimes(const char *path, utime_t mtime, utime_t atime)
   insert_trace(reply);  
   delete reply;
 
-  dout(3) << "utimes(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << endl;
+  dout(3) << "utimes(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << dendl;
   trim_cache();
   return res;
 }
@@ -2050,10 +2050,10 @@ int Client::_utimes(const char *path, utime_t mtime, utime_t atime)
 int Client::mknod(const char *relpath, mode_t mode, dev_t rdev) 
 { 
   Mutex::Locker lock(client_lock);
-  tout << "mknod" << endl;
-  tout << relpath << endl;
-  tout << mode << endl;
-  tout << rdev << endl;
+  tout << "mknod" << dendl;
+  tout << relpath << dendl;
+  tout << mode << dendl;
+  tout << rdev << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -2062,7 +2062,7 @@ int Client::mknod(const char *relpath, mode_t mode, dev_t rdev)
 
 int Client::_mknod(const char *path, mode_t mode, dev_t rdev) 
 { 
-  dout(3) << "_mknod(" << path << ", 0" << oct << mode << dec << ", " << rdev << ")" << endl;
+  dout(3) << "_mknod(" << path << ", 0" << oct << mode << dec << ", " << rdev << ")" << dendl;
 
   MClientRequest *req = new MClientRequest(MDS_OP_MKNOD, messenger->get_myinst());
   req->set_path(path); 
@@ -2083,7 +2083,7 @@ int Client::_mknod(const char *path, mode_t mode, dev_t rdev)
 
   trim_cache();
 
-  dout(3) << "mknod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+  dout(3) << "mknod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
   return res;
 }
 
@@ -2092,11 +2092,11 @@ int Client::_mknod(const char *path, mode_t mode, dev_t rdev)
   
 int Client::getdir(const char *relpath, list<string>& contents)
 {
-  dout(3) << "getdir(" << relpath << ")" << endl;
+  dout(3) << "getdir(" << relpath << ")" << dendl;
   {
     Mutex::Locker lock(client_lock);
-    tout << "getdir" << endl;
-    tout << relpath << endl;
+    tout << "getdir" << dendl;
+    tout << relpath << dendl;
   }
 
   DIR *d;
@@ -2117,8 +2117,8 @@ int Client::getdir(const char *relpath, list<string>& contents)
 int Client::opendir(const char *name, DIR **dirpp) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "opendir" << endl;
-  tout << name << endl;
+  tout << "opendir" << dendl;
+  tout << name << dendl;
 
   int r = _opendir(name, (DirResult**)dirpp);
   tout << (unsigned long)*dirpp;
@@ -2136,9 +2136,9 @@ int Client::_opendir(const char *name, DirResult **dirpp)
   if (dn && dn->inode) {
     (*dirpp)->inode = dn->inode;
     (*dirpp)->inode->get();
-    dout(10) << "had inode " << dn->inode << " " << dn->inode->inode.ino << " ref now " << dn->inode->ref << endl;
+    dout(10) << "had inode " << dn->inode << " " << dn->inode->inode.ino << " ref now " << dn->inode->ref << dendl;
     (*dirpp)->set_frag(dn->inode->dirfragtree[0]);
-    dout(10) << "_opendir " << name << ", our cache says the first dirfrag is " << (*dirpp)->frag() << endl;
+    dout(10) << "_opendir " << name << ", our cache says the first dirfrag is " << (*dirpp)->frag() << dendl;
   }
 
   // get the first frag
@@ -2149,7 +2149,7 @@ int Client::_opendir(const char *name, DirResult **dirpp)
   } else {
     r = 0;
   }
-  dout(3) << "_opendir(" << name << ") = " << r << " (" << *dirpp << ")" << endl;
+  dout(3) << "_opendir(" << name << ") = " << r << " (" << *dirpp << ")" << dendl;
 
   return r;
 }
@@ -2161,7 +2161,7 @@ void Client::_readdir_add_dirent(DirResult *dirp, const string& name, Inode *in)
   frag_t fg = dirp->frag();
   dirp->buffer[fg].push_back(DirEntry(name, st, stmask));
   dout(10) << "_readdir_add_dirent " << dirp << " added '" << name << "' -> " << in->inode.ino
-          << ", size now " << dirp->buffer[fg].size() << endl;
+          << ", size now " << dirp->buffer[fg].size() << dendl;
 }
 
 //struct dirent {
@@ -2179,7 +2179,7 @@ void Client::_readdir_fill_dirent(struct dirent *de, DirEntry *entry, off_t off)
   de->d_type = MODE_TO_DT(entry->st.st_mode);
   strncpy(de->d_name, entry->d_name.c_str(), 256);
   dout(10) << "_readdir_fill_dirent '" << de->d_name << "' -> " << de->d_ino
-          << " type " << (int)de->d_type << " at off " << off << endl;
+          << " type " << (int)de->d_type << " at off " << off << dendl;
 }
 
 void Client::_readdir_next_frag(DirResult *dirp)
@@ -2193,9 +2193,9 @@ void Client::_readdir_next_frag(DirResult *dirp)
   // advance
   dirp->next_frag();
   if (dirp->at_end()) {
-    dout(10) << "_readdir_next_frag advance from " << fg << " to END" << endl;
+    dout(10) << "_readdir_next_frag advance from " << fg << " to END" << dendl;
   } else {
-    dout(10) << "_readdir_next_frag advance from " << fg << " to " << dirp->frag() << endl;
+    dout(10) << "_readdir_next_frag advance from " << fg << " to " << dirp->frag() << dendl;
     _readdir_rechoose_frag(dirp);
   }
 }
@@ -2206,7 +2206,7 @@ void Client::_readdir_rechoose_frag(DirResult *dirp)
   frag_t cur = dirp->frag();
   frag_t f = dirp->inode->dirfragtree[cur.value()];
   if (f != cur) {
-    dout(10) << "_readdir_rechoose_frag frag " << cur << " maps to " << f << endl;
+    dout(10) << "_readdir_rechoose_frag frag " << cur << " maps to " << f << dendl;
     dirp->set_frag(f);
   }
 }
@@ -2217,7 +2217,7 @@ int Client::_readdir_get_frag(DirResult *dirp)
   frag_t fg = dirp->frag();
   assert(dirp->buffer.count(fg) == 0);
   
-  dout(10) << "_readdir_get_frag " << dirp << " on " << dirp->path << " fg " << fg << endl;
+  dout(10) << "_readdir_get_frag " << dirp << " on " << dirp->path << " fg " << fg << dendl;
 
   MClientRequest *req = new MClientRequest(MDS_OP_READDIR, messenger->get_myinst());
   req->set_path(dirp->path); 
@@ -2237,19 +2237,19 @@ int Client::_readdir_get_frag(DirResult *dirp)
   if ((res == -EAGAIN || res == 0) &&
       inode_map.count(ino)) {
     diri = inode_map[ino];
-    dout(10) << "_readdir_get_frag got diri " << diri << " " << diri->inode.ino << endl;
+    dout(10) << "_readdir_get_frag got diri " << diri << " " << diri->inode.ino << dendl;
     assert(diri);
     assert(diri->inode.mode & INODE_MODE_DIR);
   }
   
   if (!dirp->inode && diri) {
-    dout(10) << "_readdir_get_frag attaching inode" << endl;
+    dout(10) << "_readdir_get_frag attaching inode" << dendl;
     dirp->inode = inode_map[ino];
     diri->get();
   }
 
   if (res == -EAGAIN) {
-    dout(10) << "_readdir_get_frag got EAGAIN, retrying" << endl;
+    dout(10) << "_readdir_get_frag got EAGAIN, retrying" << dendl;
     _readdir_rechoose_frag(dirp);
     return _readdir_get_frag(dirp);
   }
@@ -2299,7 +2299,7 @@ int Client::_readdir_get_frag(DirResult *dirp)
        }
        
        // contents to caller too!
-       dout(15) << "_readdir_get_frag got " << *pdn << " to " << in->inode.ino << endl;
+       dout(15) << "_readdir_get_frag got " << *pdn << " to " << in->inode.ino << dendl;
        _readdir_add_dirent(dirp, *pdn, in);
       }
 
@@ -2310,7 +2310,7 @@ int Client::_readdir_get_frag(DirResult *dirp)
     // FIXME: remove items in cache that weren't in my readdir?
     // ***
   } else {
-    dout(10) << "_readdir_get_frag got error " << res << ", setting end flag" << endl;
+    dout(10) << "_readdir_get_frag got error " << res << ", setting end flag" << dendl;
     dirp->set_end();
   }
 
@@ -2343,7 +2343,7 @@ int Client::readdirplus_r(DIR *d, struct dirent *de, struct stat *st, int *stmas
     vector<DirEntry> &ent = dirp->buffer[fg];
 
     if (ent.empty()) {
-      dout(10) << "empty frag " << fg << ", moving on to next" << endl;
+      dout(10) << "empty frag " << fg << ", moving on to next" << dendl;
       _readdir_next_frag(dirp);
       continue;
     }
@@ -2368,19 +2368,19 @@ int Client::readdirplus_r(DIR *d, struct dirent *de, struct stat *st, int *stmas
 int Client::closedir(DIR *dir) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "closedir" << endl;
-  tout << (unsigned long)dir << endl;
+  tout << "closedir" << dendl;
+  tout << (unsigned long)dir << dendl;
 
-  dout(3) << "closedir(" << dir << ") = 0" << endl;
+  dout(3) << "closedir(" << dir << ") = 0" << dendl;
   _closedir((DirResult*)dir);
   return 0;
 }
 
 void Client::_closedir(DirResult *dirp)
 {
-  dout(10) << "_closedir(" << dirp << ")" << endl;
+  dout(10) << "_closedir(" << dirp << ")" << dendl;
   if (dirp->inode) {
-    dout(10) << "_closedir detaching inode " << dirp->inode << endl;
+    dout(10) << "_closedir detaching inode " << dirp->inode << dendl;
     put_inode(dirp->inode);
     dirp->inode = 0;
   }
@@ -2389,7 +2389,7 @@ void Client::_closedir(DirResult *dirp)
 
 void Client::rewinddir(DIR *dirp)
 {
-  dout(3) << "rewinddir(" << dirp << ")" << endl;
+  dout(3) << "rewinddir(" << dirp << ")" << dendl;
   DirResult *d = (DirResult*)dirp;
   d->offset = 0;
   d->buffer.clear();
@@ -2398,13 +2398,13 @@ void Client::rewinddir(DIR *dirp)
 off_t Client::telldir(DIR *dirp)
 {
   DirResult *d = (DirResult*)dirp;
-  dout(3) << "telldir(" << dirp << ") = " << d->offset << endl;
+  dout(3) << "telldir(" << dirp << ") = " << d->offset << dendl;
   return d->offset;
 }
 
 void Client::seekdir(DIR *dirp, off_t offset)
 {
-  dout(3) << "seekdir(" << dirp << ", " << offset << ")" << endl;
+  dout(3) << "seekdir(" << dirp << ", " << offset << ")" << dendl;
   DirResult *d = (DirResult*)dirp;
   d->offset = offset;
 }
@@ -2420,9 +2420,9 @@ void Client::seekdir(DIR *dirp, off_t offset)
 int Client::open(const char *relpath, int flags, mode_t mode) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "open" << endl;
-  tout << relpath << endl;
-  tout << flags << endl;
+  tout << "open" << dendl;
+  tout << relpath << dendl;
+  tout << flags << dendl;
 
   string abspath;
   mkabspath(relpath, abspath);
@@ -2437,8 +2437,8 @@ int Client::open(const char *relpath, int flags, mode_t mode)
     fd_map[r] = fh;
   }
   
-  tout << r << endl;
-  dout(3) << "open(" << relpath << ", " << flags << ") = " << r << endl;
+  tout << r << dendl;
+  dout(3) << "open(" << relpath << ", " << flags << ") = " << r << dendl;
   return r;
 }
 
@@ -2491,7 +2491,7 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp)
     int mds = reply->get_source().num();
 
     if (in->caps.empty()) {// first caps?
-      dout(7) << " first caps on " << in->inode.ino << endl;
+      dout(7) << " first caps on " << in->inode.ino << dendl;
       in->get();
     }
 
@@ -2506,7 +2506,7 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp)
               << " for " << in->ino() 
               << " seq " << reply->get_file_caps_seq() 
               << " from mds" << mds 
-             << endl;
+             << dendl;
 
       in->caps[mds].caps = new_caps;
       in->caps[mds].seq = reply->get_file_caps_seq();
@@ -2523,10 +2523,10 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp)
               << " for " << in->ino() 
               << " seq " << reply->get_file_caps_seq() 
               << " from mds" << mds 
-             << endl;
+             << dendl;
     }
     
-    dout(5) << "open success, fh is " << f << " combined caps " << cap_string(in->file_caps()) << endl;
+    dout(5) << "open success, fh is " << f << " combined caps " << cap_string(in->file_caps()) << dendl;
   }
 
   delete reply;
@@ -2542,9 +2542,9 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp)
 
 void Client::close_release(Inode *in)
 {
-  dout(10) << "close_release on " << in->ino() << endl;
+  dout(10) << "close_release on " << in->ino() << dendl;
   dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd
-          << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << endl;
+          << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << dendl;
 
   if (!in->num_open_rd) 
     in->fc.release_clean();
@@ -2558,7 +2558,7 @@ void Client::close_release(Inode *in)
 
 void Client::close_safe(Inode *in)
 {
-  dout(10) << "close_safe on " << in->ino() << endl;
+  dout(10) << "close_safe on " << in->ino() << dendl;
   put_inode(in);
   if (unmounting) 
     mount_cond.Signal();
@@ -2568,10 +2568,10 @@ void Client::close_safe(Inode *in)
 int Client::close(int fd)
 {
   Mutex::Locker lock(client_lock);
-  tout << "close" << endl;
-  tout << fd << endl;
+  tout << "close" << dendl;
+  tout << fd << dendl;
 
-  dout(3) << "close(" << fd << ")" << endl;
+  dout(3) << "close(" << fd << ")" << dendl;
   assert(fd_map.count(fd));
   Fh *fh = fd_map[fd];
   _release(fh);
@@ -2581,9 +2581,9 @@ int Client::close(int fd)
 
 int Client::_release(Fh *f)
 {
-  //dout(3) << "op: client->close(open_files[ " << fh << " ]);" << endl;
-  //dout(3) << "op: open_files.erase( " << fh << " );" << endl;
-  dout(5) << "_release " << f << endl;
+  //dout(3) << "op: client->close(open_files[ " << fh << " ]);" << dendl;
+  //dout(3) << "op: open_files.erase( " << fh << " );" << dendl;
+  dout(5) << "_release " << f << dendl;
   Inode *in = f->inode;
 
   // update inode rd/wr counts
@@ -2596,7 +2596,7 @@ int Client::_release(Fh *f)
     update_caps_wanted(in);
 
   // release caps right away?
-  dout(10) << "num_open_rd " << in->num_open_rd << "  num_open_wr " << in->num_open_wr << endl;
+  dout(10) << "num_open_rd " << in->num_open_rd << "  num_open_wr " << in->num_open_wr << dendl;
 
   if (g_conf.client_oc) {
     // caching on.
@@ -2613,14 +2613,14 @@ int Client::_release(Fh *f)
 
     // pin until safe?
     if (in->num_open_wr == 0 && !in->fc.all_safe()) {
-      dout(10) << "pinning ino " << in->ino() << " until safe" << endl;
+      dout(10) << "pinning ino " << in->ino() << " until safe" << dendl;
       in->get();
       in->fc.add_safe_waiter(new C_Client_CloseSafe(this, in));
     }
   } else {
     // caching off.
     if (in->num_open_rd == 0 && in->num_open_wr == 0) {
-      dout(10) << "  releasing caps on " << in->ino() << endl;
+      dout(10) << "  releasing caps on " << in->ino() << dendl;
       release_caps(in);              // release caps now.
     }
   }
@@ -2638,10 +2638,10 @@ int Client::_release(Fh *f)
 off_t Client::lseek(int fd, off_t offset, int whence)
 {
   Mutex::Locker lock(client_lock);
-  tout << "lseek" << endl;
-  tout << fd << endl;
-  tout << offset << endl;
-  tout << whence << endl;
+  tout << "lseek" << dendl;
+  tout << fd << dendl;
+  tout << offset << dendl;
+  tout << whence << dendl;
 
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
@@ -2666,7 +2666,7 @@ off_t Client::lseek(int fd, off_t offset, int whence)
   
   off_t pos = f->pos;
 
-  dout(3) << "lseek(" << fd << ", " << offset << ", " << whence << ") = " << pos << endl;
+  dout(3) << "lseek(" << fd << ", " << offset << ", " << whence << ") = " << pos << dendl;
   return pos;
 }
 
@@ -2674,15 +2674,15 @@ off_t Client::lseek(int fd, off_t offset, int whence)
 
 void Client::lock_fh_pos(Fh *f)
 {
-  dout(10) << "lock_fh_pos " << f << endl;
+  dout(10) << "lock_fh_pos " << f << dendl;
 
   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;
+    dout(10) << "lock_fh_pos BLOCKING on " << f << dendl;
     while (f->pos_locked || f->pos_waiters.front() != &cond)
       cond.Wait(client_lock);
-    dout(10) << "lock_fh_pos UNBLOCKING on " << f << endl;
+    dout(10) << "lock_fh_pos UNBLOCKING on " << f << dendl;
     assert(f->pos_waiters.front() == &cond);
     f->pos_waiters.pop_front();
   }
@@ -2692,7 +2692,7 @@ void Client::lock_fh_pos(Fh *f)
 
 void Client::unlock_fh_pos(Fh *f)
 {
-  dout(10) << "unlock_fh_pos " << f << endl;
+  dout(10) << "unlock_fh_pos " << f << dendl;
   f->pos_locked = false;
 }
 
@@ -2706,16 +2706,16 @@ void Client::unlock_fh_pos(Fh *f)
 int Client::read(int fd, char *buf, off_t size, off_t offset) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "read" << endl;
-  tout << fd << endl;
-  tout << size << endl;
-  tout << offset << endl;
+  tout << "read" << dendl;
+  tout << fd << dendl;
+  tout << size << dendl;
+  tout << offset << dendl;
 
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
   bufferlist bl;
   int r = _read(f, offset, size, &bl);
-  dout(3) << "read(" << fd << ", " << buf << ", " << size << ", " << offset << ") = " << r << endl;
+  dout(3) << "read(" << fd << ", " << buf << ", " << size << ", " << offset << ") = " << r << dendl;
   if (r >= 0) {
     bl.copy(0, bl.length(), buf);
     r = bl.length();
@@ -2741,7 +2741,7 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
   if (!lazy && (in->file_caps() & (CAP_FILE_WRBUFFER|CAP_FILE_RDCACHE))) {
     // we're doing buffered i/o.  make sure we're inside the file.
     // we can trust size info bc we get accurate info when buffering/caching caps are issued.
-    dout(10) << "file size: " << in->inode.size << endl;
+    dout(10) << "file size: " << in->inode.size << dendl;
     if (offset > 0 && offset >= in->inode.size) {
       if (movepos) unlock_fh_pos(f);
       return 0;
@@ -2750,7 +2750,7 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
       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" << dendl;
       if (movepos) unlock_fh_pos(f);
       return 0;
     }
@@ -2775,7 +2775,7 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
        if (v[a] != hackbuf[offset+a]) 
          dout(1) << "** hackbuf differs from read value at offset " << a 
                  << " hackbuf[a] = " << (int)hackbuf[a] << ", read got " << (int)v[a]
-                 << endl;
+                 << dendl;
     }
     */
 
@@ -2784,14 +2784,14 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl)
 
     // do we have read file cap?
     while (!lazy && (in->file_caps() & CAP_FILE_RD) == 0) {
-      dout(7) << " don't have read cap, waiting" << endl;
+      dout(7) << " don't have read cap, waiting" << dendl;
       Cond cond;
       in->waitfor_read.push_back(&cond);
       cond.Wait(client_lock);
     }  
     // lazy cap?
     while (lazy && (in->file_caps() & CAP_FILE_LAZYIO) == 0) {
-      dout(7) << " don't have lazy cap, waiting" << endl;
+      dout(7) << " don't have lazy cap, waiting" << dendl;
       Cond cond;
       in->waitfor_lazy.push_back(&cond);
       cond.Wait(client_lock);
@@ -2846,7 +2846,7 @@ void Client::hack_sync_write_safe()
   assert(unsafe_sync_write > 0);
   unsafe_sync_write--;
   if (unsafe_sync_write == 0 && unmounting) {
-    dout(10) << "hack_sync_write_safe -- no more unsafe writes, unmount can proceed" << endl;
+    dout(10) << "hack_sync_write_safe -- no more unsafe writes, unmount can proceed" << dendl;
     mount_cond.Signal();
   }
   client_lock.Unlock();
@@ -2855,22 +2855,22 @@ void Client::hack_sync_write_safe()
 int Client::write(int fd, const char *buf, off_t size, off_t offset) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "write" << endl;
-  tout << fd << endl;
-  tout << size << endl;
-  tout << offset << endl;
+  tout << "write" << dendl;
+  tout << fd << dendl;
+  tout << size << dendl;
+  tout << offset << dendl;
 
   assert(fd_map.count(fd));
   Fh *fh = fd_map[fd];
   int r = _write(fh, offset, size, buf);
-  dout(3) << "write(" << fd << ", \"...\", " << size << ", " << offset << ") = " << r << endl;
+  dout(3) << "write(" << fd << ", \"...\", " << size << ", " << offset << ") = " << r << dendl;
   return r;
 }
 
 
 int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
 {
-  //dout(7) << "write fh " << fh << " size " << size << " offset " << offset << endl;
+  //dout(7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
   Inode *in = f->inode;
 
   // use/adjust fd pos?
@@ -2883,7 +2883,7 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
 
   bool lazy = f->mode == FILE_MODE_LAZY;
 
-  dout(10) << "cur file size is " << in->inode.size << "    wr size " << in->file_wr_size << endl;
+  dout(10) << "cur file size is " << in->inode.size << "    wr size " << in->file_wr_size << dendl;
 
   // time it.
   utime_t start = g_clock.real_now();
@@ -2900,14 +2900,14 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
     /*
     if (f->inode->inode.ino == 0x10000000075) {
       if (!hackbuf) {
-       dout(7) << "alloc and zero new hackbuf" << endl;
+       dout(7) << "alloc and zero new hackbuf" << dendl;
        hackbuf = new char[16384];
        memset(hackbuf, 0, 16384);
       }
-      dout(7) << "hackbuf copying " << offset << "~" << size << " first is " << (int)buf[0] << endl;
+      dout(7) << "hackbuf copying " << offset << "~" << size << " first is " << (int)buf[0] << dendl;
       memcpy(hackbuf+offset, buf, size);
       for (int a=0; a<size; a++) 
-       dout(10) << "hackbuf[" << (a+offset) << " = " << (int)hackbuf[a+offset] << " = " << (int)buf[a] << endl;
+       dout(10) << "hackbuf[" << (a+offset) << " = " << (int)hackbuf[a+offset] << " = " << (int)buf[a] << dendl;
     }
     */
 
@@ -2916,17 +2916,17 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
 
   } else {
     // legacy, inconsistent synchronous write.
-    dout(7) << "synchronous write" << endl;
+    dout(7) << "synchronous write" << dendl;
 
     // do we have write file cap?
     while (!lazy && (in->file_caps() & CAP_FILE_WR) == 0) {
-      dout(7) << " don't have write cap, waiting" << endl;
+      dout(7) << " don't have write cap, waiting" << dendl;
       Cond cond;
       in->waitfor_write.push_back(&cond);
       cond.Wait(client_lock);
     }
     while (lazy && (in->file_caps() & CAP_FILE_LAZYIO) == 0) {
-      dout(7) << " don't have lazy cap, waiting" << endl;
+      dout(7) << " don't have lazy cap, waiting" << dendl;
       Cond cond;
       in->waitfor_lazy.push_back(&cond);
       cond.Wait(client_lock);
@@ -2940,7 +2940,7 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
     unsafe_sync_write++;
     in->sync_writes++;
     
-    dout(20) << " sync write start " << onfinish << endl;
+    dout(20) << " sync write start " << onfinish << dendl;
     
     filer->write(in->inode, offset, size, blist, 0, 
                  onfinish, onsafe
@@ -2949,7 +2949,7 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
     
     while (!done) {
       cond.Wait(client_lock);
-      dout(20) << " sync write bump " << onfinish << endl;
+      dout(20) << " sync write bump " << onfinish << dendl;
     }
 
     in->sync_writes--;
@@ -2962,7 +2962,7 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
       in->waitfor_no_write.clear();
     }
 
-    dout(20) << " sync write done " << onfinish << endl;
+    dout(20) << " sync write done " << onfinish << dendl;
   }
 
   // time
@@ -2979,9 +2979,9 @@ int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
   // extend file?
   if (totalwritten + offset > in->inode.size) {
     in->inode.size = in->file_wr_size = totalwritten + offset;
-    dout(7) << "wrote to " << totalwritten+offset << ", extending file size" << endl;
+    dout(7) << "wrote to " << totalwritten+offset << ", extending file size" << dendl;
   } else {
-    dout(7) << "wrote to " << totalwritten+offset << ", leaving file size at " << in->inode.size << endl;
+    dout(7) << "wrote to " << totalwritten+offset << ", leaving file size at " << in->inode.size << dendl;
   }
 
   // mtime
@@ -3001,9 +3001,9 @@ int Client::_flush(Fh *f)
 int Client::truncate(const char *relpath, off_t length) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "truncate" << endl;
-  tout << relpath << endl;
-  tout << length << endl;
+  tout << "truncate" << dendl;
+  tout << relpath << dendl;
+  tout << length << dendl;
 
   string path;
   mkabspath(relpath, path);
@@ -3025,16 +3025,16 @@ int Client::_truncate(const char *file, off_t length)
   insert_trace(reply);  
   delete reply;
 
-  dout(3) << "truncate(\"" << file << "\", " << length << ") = " << res << endl;
+  dout(3) << "truncate(\"" << file << "\", " << length << ") = " << res << dendl;
   return res;
 }
 
 int Client::ftruncate(int fd, off_t length) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "ftruncate" << endl;
-  tout << fd << endl;
-  tout << length << endl;
+  tout << "ftruncate" << dendl;
+  tout << fd << dendl;
+  tout << length << dendl;
 
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
@@ -3056,7 +3056,7 @@ int Client::_ftruncate(Fh *fh, off_t length)
   insert_trace(reply);  
   delete reply;
 
-  dout(3) << "ftruncate(\"" << fh << "\", " << length << ") = " << res << endl;
+  dout(3) << "ftruncate(\"" << fh << "\", " << length << ") = " << res << dendl;
   return res;
 }
 
@@ -3064,14 +3064,14 @@ int Client::_ftruncate(Fh *fh, off_t length)
 int Client::fsync(int fd, bool syncdataonly) 
 {
   Mutex::Locker lock(client_lock);
-  tout << "fsync" << endl;
-  tout << fd << endl;
-  tout << syncdataonly << endl;
+  tout << "fsync" << dendl;
+  tout << fd << dendl;
+  tout << syncdataonly << dendl;
 
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
   int r = _fsync(f, syncdataonly);
-  dout(3) << "fsync(" << fd << ", " << syncdataonly << ") = " << r << endl;
+  dout(3) << "fsync(" << fd << ", " << syncdataonly << ") = " << r << dendl;
   return r;
 }
 
@@ -3083,7 +3083,7 @@ int Client::_fsync(Fh *f, bool syncdataonly)
 
   // metadata?
   if (!syncdataonly) {
-    dout(0) << "fsync - not syncing metadata yet.. implement me" << endl;
+    dout(0) << "fsync - not syncing metadata yet.. implement me" << dendl;
   }
 
   // data?
@@ -3103,13 +3103,13 @@ int Client::_fsync(Fh *f, bool syncdataonly)
 int Client::chdir(const char *path)
 {
   Mutex::Locker lock(client_lock);
-  tout << "chdir" << endl;
-  tout << path << endl;
+  tout << "chdir" << dendl;
+  tout << path << dendl;
   
   // fake it for now!
   string abs;
   mkabspath(path, abs);
-  dout(3) << "chdir " << path << " -> cwd now " << abs << endl;
+  dout(3) << "chdir " << path << " -> cwd now " << abs << dendl;
   cwd = abs;
   return 0;
 }
@@ -3117,20 +3117,20 @@ int Client::chdir(const char *path)
 int Client::statfs(const char *path, struct statvfs *stbuf)
 {
   Mutex::Locker lock(client_lock);
-  tout << "statfs" << endl;
+  tout << "statfs" << dendl;
   return _statfs(stbuf);
 }
 
 int Client::ll_statfs(inodeno_t ino, struct statvfs *stbuf)
 {
   Mutex::Locker lock(client_lock);
-  tout << "ll_statfs" << endl;
+  tout << "ll_statfs" << dendl;
   return _statfs(stbuf);
 }
 
 int Client::_statfs(struct statvfs *stbuf)
 {
-  dout(3) << "_statfs" << endl;
+  dout(3) << "_statfs" << dendl;
 
   Cond cond;
   tid_t tid = ++last_tid;
@@ -3151,7 +3151,7 @@ int Client::_statfs(struct statvfs *stbuf)
   delete req;
 
   int r = 0;
-  dout(3) << "_statfs = " << r << endl;
+  dout(3) << "_statfs = " << r << dendl;
   return r;
 }
 
@@ -3159,11 +3159,11 @@ void Client::handle_statfs_reply(MStatfsReply *reply)
 {
   if (statfs_requests.count(reply->tid) &&
       statfs_requests[reply->tid]->reply == 0) {
-    dout(10) << "handle_statfs_reply " << *reply << ", kicking waiter" << endl;
+    dout(10) << "handle_statfs_reply " << *reply << ", kicking waiter" << dendl;
     statfs_requests[reply->tid]->reply = reply;
     statfs_requests[reply->tid]->caller_cond->Signal();
   } else {
-    dout(10) << "handle_statfs_reply " << *reply << ", dup or old, dropping" << endl;
+    dout(10) << "handle_statfs_reply " << *reply << ", dup or old, dropping" << dendl;
     delete reply;
   }
 }
@@ -3173,7 +3173,7 @@ int Client::lazyio_propogate(int fd, off_t offset, size_t count)
 {
   client_lock.Lock();
   dout(3) << "op: client->lazyio_propogate(" << fd
-          << ", " << offset << ", " << count << ")" << endl;
+          << ", " << offset << ", " << count << ")" << dendl;
   
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
@@ -3182,7 +3182,7 @@ int Client::lazyio_propogate(int fd, off_t offset, size_t count)
   if (f->mode & FILE_MODE_LAZY) {
     // wait for lazy cap
     while ((in->file_caps() & CAP_FILE_LAZYIO) == 0) {
-      dout(7) << " don't have lazy cap, waiting" << endl;
+      dout(7) << " don't have lazy cap, waiting" << dendl;
       Cond cond;
       in->waitfor_lazy.push_back(&cond);
       cond.Wait(client_lock);
@@ -3209,7 +3209,7 @@ int Client::lazyio_synchronize(int fd, off_t offset, size_t count)
 {
   client_lock.Lock();
   dout(3) << "op: client->lazyio_synchronize(" << fd
-          << ", " << offset << ", " << count << ")" << endl;
+          << ", " << offset << ", " << count << ")" << dendl;
   
   assert(fd_map.count(fd));
   Fh *f = fd_map[fd];
@@ -3218,7 +3218,7 @@ int Client::lazyio_synchronize(int fd, off_t offset, size_t count)
   if (f->mode & FILE_MODE_LAZY) {
     // wait for lazy cap
     while ((in->file_caps() & CAP_FILE_LAZYIO) == 0) {
-      dout(7) << " don't have lazy cap, waiting" << endl;
+      dout(7) << " don't have lazy cap, waiting" << dendl;
       Cond cond;
       in->waitfor_lazy.push_back(&cond);
       cond.Wait(client_lock);
@@ -3253,10 +3253,10 @@ int Client::lazyio_synchronize(int fd, off_t offset, size_t count)
 int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_lookup " << parent << " " << name << endl;
-  tout << "ll_lookup" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
+  dout(3) << "ll_lookup " << parent << " " << name << dendl;
+  tout << "ll_lookup" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
 
   string dname = name;
   Inode *diri = 0;
@@ -3264,14 +3264,14 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
   int r = 0;
 
   if (inode_map.count(parent) == 0) {
-    dout(1) << "ll_lookup " << parent << " " << name << " -> ENOENT (parent DNE... WTF)" << endl;
+    dout(1) << "ll_lookup " << parent << " " << name << " -> ENOENT (parent DNE... WTF)" << dendl;
     r = -ENOENT;
     attr->st_ino = 0;
     goto out;
   }
   diri = inode_map[parent];
   if (!diri->inode.is_dir()) {
-    dout(1) << "ll_lookup " << parent << " " << name << " -> ENOTDIR (parent not a dir... WTF)" << endl;
+    dout(1) << "ll_lookup " << parent << " " << name << " -> ENOTDIR (parent not a dir... WTF)" << dendl;
     r = -ENOTDIR;
     attr->st_ino = 0;
     goto out;
@@ -3298,8 +3298,8 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
 
  out:
   dout(3) << "ll_lookup " << parent << " " << name
-         << " -> " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
-  tout << attr->st_ino << endl;
+         << " -> " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
+  tout << attr->st_ino << dendl;
   return r;
 }
 
@@ -3308,13 +3308,13 @@ void Client::_ll_get(Inode *in)
   if (in->ll_ref == 0) 
     in->get();
   in->ll_get();
-  dout(20) << "_ll_get " << in << " " << in->inode.ino << " -> " << in->ll_ref << endl;
+  dout(20) << "_ll_get " << in << " " << in->inode.ino << " -> " << in->ll_ref << dendl;
 }
 
 int Client::_ll_put(Inode *in, int num)
 {
   in->ll_put(num);
-  dout(20) << "_ll_put " << in << " " << in->inode.ino << " " << num << " -> " << in->ll_ref << endl;
+  dout(20) << "_ll_put " << in << " " << in->inode.ino << " " << num << " -> " << in->ll_ref << dendl;
   if (in->ll_ref == 0) {
     put_inode(in);
     return 0;
@@ -3325,7 +3325,7 @@ int Client::_ll_put(Inode *in, int num)
 
 void Client::_ll_drop_pins()
 {
-  dout(10) << "_ll_drop_pins" << endl;
+  dout(10) << "_ll_drop_pins" << dendl;
   hash_map<inodeno_t, Inode*>::iterator next;
   for (hash_map<inodeno_t, Inode*>::iterator it = inode_map.begin();
        it != inode_map.end();
@@ -3341,17 +3341,17 @@ void Client::_ll_drop_pins()
 bool Client::ll_forget(inodeno_t ino, int num)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_forget " << ino << " " << num << endl;
-  tout << "ll_forget" << endl;
-  tout << ino.val << endl;
-  tout << num << endl;
+  dout(3) << "ll_forget " << ino << " " << num << dendl;
+  tout << "ll_forget" << dendl;
+  tout << ino.val << dendl;
+  tout << num << dendl;
 
   if (ino == 1) return true;  // ignore forget on root.
 
   bool last = false;
   if (inode_map.count(ino) == 0) {
     dout(1) << "WARNING: ll_forget on " << ino << " " << num 
-           << ", which I don't have" << endl;
+           << ", which I don't have" << dendl;
   } else {
     Inode *in = inode_map[ino];
     assert(in);
@@ -3378,9 +3378,9 @@ Inode *Client::_ll_get_inode(inodeno_t ino)
 int Client::ll_getattr(inodeno_t ino, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_getattr " << ino << endl;
-  tout << "ll_getattr" << endl;
-  tout << ino.val << endl;
+  dout(3) << "ll_getattr " << ino << dendl;
+  tout << "ll_getattr" << dendl;
+  tout << ino.val << dendl;
 
   Inode *in = _ll_get_inode(ino);
   fill_stat(in, attr);
@@ -3390,16 +3390,16 @@ int Client::ll_getattr(inodeno_t ino, struct stat *attr)
 int Client::ll_setattr(inodeno_t ino, struct stat *attr, int mask)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_setattr " << ino << " mask " << hex << mask << dec << endl;
-  tout << "ll_setattr" << endl;
-  tout << ino.val << endl;
-  tout << attr->st_mode << endl;
-  tout << attr->st_uid << endl;
-  tout << attr->st_gid << endl;
-  tout << attr->st_size << endl;
-  tout << attr->st_mtime << endl;
-  tout << attr->st_atime << endl;
-  tout << mask << endl;
+  dout(3) << "ll_setattr " << ino << " mask " << hex << mask << dec << dendl;
+  tout << "ll_setattr" << dendl;
+  tout << ino.val << dendl;
+  tout << attr->st_mode << dendl;
+  tout << attr->st_uid << dendl;
+  tout << attr->st_gid << dendl;
+  tout << attr->st_size << dendl;
+  tout << attr->st_mtime << dendl;
+  tout << attr->st_atime << dendl;
+  tout << mask << dendl;
 
   Inode *in = _ll_get_inode(ino);
 
@@ -3429,16 +3429,16 @@ int Client::ll_setattr(inodeno_t ino, struct stat *attr, int mask)
   assert(r == 0);
   fill_stat(in, attr);
 
-  dout(3) << "ll_setattr " << ino << " = " << r << endl;
+  dout(3) << "ll_setattr " << ino << " = " << r << dendl;
   return 0;
 }
 
 int Client::ll_readlink(inodeno_t ino, const char **value)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_readlink " << ino << endl;
-  tout << "ll_readlink" << endl;
-  tout << ino.val << endl;
+  dout(3) << "ll_readlink " << ino << dendl;
+  tout << "ll_readlink" << dendl;
+  tout << ino.val << dendl;
 
   Inode *in = _ll_get_inode(ino);
   int r = 0;
@@ -3448,19 +3448,19 @@ int Client::ll_readlink(inodeno_t ino, const char **value)
     *value = "";
     r = -EINVAL;
   }
-  dout(3) << "ll_readlink " << ino << " = " << r << " (" << *value << ")" << endl;
+  dout(3) << "ll_readlink " << ino << " = " << r << " (" << *value << ")" << dendl;
   return r;
 }
 
 int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_mknod " << parent << " " << name << endl;
-  tout << "ll_mknod" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
-  tout << mode << endl;
-  tout << rdev << endl;
+  dout(3) << "ll_mknod " << parent << " " << name << dendl;
+  tout << "ll_mknod" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
+  tout << mode << dendl;
+  tout << rdev << dendl;
 
   Inode *diri = _ll_get_inode(parent);
 
@@ -3475,20 +3475,20 @@ int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev
     fill_stat(in, attr);
     _ll_get(in);
   }
-  tout << attr->st_ino << endl;
+  tout << attr->st_ino << dendl;
   dout(3) << "ll_mknod " << parent << " " << name
-         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
   return r;
 }
 
 int Client::ll_mkdir(inodeno_t parent, const char *name, mode_t mode, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_mkdir " << parent << " " << name << endl;
-  tout << "ll_mkdir" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
-  tout << mode << endl;
+  dout(3) << "ll_mkdir " << parent << " " << name << dendl;
+  tout << "ll_mkdir" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
+  tout << mode << dendl;
 
   Inode *diri = _ll_get_inode(parent);
 
@@ -3503,20 +3503,20 @@ int Client::ll_mkdir(inodeno_t parent, const char *name, mode_t mode, struct sta
     fill_stat(in, attr);
     _ll_get(in);
   }
-  tout << attr->st_ino << endl;
+  tout << attr->st_ino << dendl;
   dout(3) << "ll_mkdir " << parent << " " << name
-         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
   return r;
 }
 
 int Client::ll_symlink(inodeno_t parent, const char *name, const char *value, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_symlink " << parent << " " << name << " -> " << value << endl;
-  tout << "ll_symlink" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
-  tout << value << endl;
+  dout(3) << "ll_symlink " << parent << " " << name << " -> " << value << dendl;
+  tout << "ll_symlink" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
+  tout << value << dendl;
 
   Inode *diri = _ll_get_inode(parent);
 
@@ -3531,19 +3531,19 @@ int Client::ll_symlink(inodeno_t parent, const char *name, const char *value, st
     fill_stat(in, attr);
     _ll_get(in);
   }
-  tout << attr->st_ino << endl;
+  tout << attr->st_ino << dendl;
   dout(3) << "ll_symlink " << parent << " " << name
-         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+         << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
   return r;
 }
 
 int Client::ll_unlink(inodeno_t ino, const char *name)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_unlink " << ino << " " << name << endl;
-  tout << "ll_unlink" << endl;
-  tout << ino.val << endl;
-  tout << name << endl;
+  dout(3) << "ll_unlink " << ino << " " << name << dendl;
+  tout << "ll_unlink" << dendl;
+  tout << ino.val << dendl;
+  tout << name << dendl;
 
   Inode *diri = _ll_get_inode(ino);
 
@@ -3557,10 +3557,10 @@ int Client::ll_unlink(inodeno_t ino, const char *name)
 int Client::ll_rmdir(inodeno_t ino, const char *name)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_rmdir " << ino << " " << name << endl;
-  tout << "ll_rmdir" << endl;
-  tout << ino.val << endl;
-  tout << name << endl;
+  dout(3) << "ll_rmdir " << ino << " " << name << dendl;
+  tout << "ll_rmdir" << dendl;
+  tout << ino.val << dendl;
+  tout << name << dendl;
 
   Inode *diri = _ll_get_inode(ino);
 
@@ -3575,12 +3575,12 @@ int Client::ll_rename(inodeno_t parent, const char *name, inodeno_t newparent, c
 {
   Mutex::Locker lock(client_lock);
   dout(3) << "ll_rename " << parent << " " << name << " to "
-         << newparent << " " << newname << endl;
-  tout << "ll_rename" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
-  tout << newparent.val << endl;
-  tout << newname << endl;
+         << newparent << " " << newname << dendl;
+  tout << "ll_rename" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
+  tout << newparent.val << dendl;
+  tout << newname << dendl;
 
   Inode *diri = _ll_get_inode(parent);
   string path;
@@ -3600,11 +3600,11 @@ int Client::ll_rename(inodeno_t parent, const char *name, inodeno_t newparent, c
 int Client::ll_link(inodeno_t ino, inodeno_t newparent, const char *newname, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_link " << ino << " to " << newparent << " " << newname << endl;
-  tout << "ll_link" << endl;
-  tout << ino.val << endl;
-  tout << newparent << endl;
-  tout << newname << endl;
+  dout(3) << "ll_link " << ino << " to " << newparent << " " << newname << dendl;
+  tout << "ll_link" << dendl;
+  tout << ino.val << dendl;
+  tout << newparent << dendl;
+  tout << newname << dendl;
 
   Inode *old = _ll_get_inode(ino);
   Inode *diri = _ll_get_inode(newparent);
@@ -3630,9 +3630,9 @@ int Client::ll_link(inodeno_t ino, inodeno_t newparent, const char *newname, str
 int Client::ll_opendir(inodeno_t ino, void **dirpp)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_opendir " << ino << endl;
-  tout << "ll_opendir" << endl;
-  tout << ino.val << endl;
+  dout(3) << "ll_opendir " << ino << dendl;
+  tout << "ll_opendir" << dendl;
+  tout << ino.val << dendl;
   
   Inode *diri = inode_map[ino];
   assert(diri);
@@ -3641,28 +3641,28 @@ int Client::ll_opendir(inodeno_t ino, void **dirpp)
 
   int r = _opendir(path.c_str(), (DirResult**)dirpp);
 
-  tout << (unsigned long)*dirpp << endl;
+  tout << (unsigned long)*dirpp << dendl;
 
-  dout(3) << "ll_opendir " << ino << " = " << r << " (" << *dirpp << ")" << endl;
+  dout(3) << "ll_opendir " << ino << " = " << r << " (" << *dirpp << ")" << dendl;
   return r;
 }
 
 void Client::ll_releasedir(void *dirp)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_releasedir " << dirp << endl;
-  tout << "ll_releasedir" << endl;
-  tout << (unsigned long)dirp << endl;
+  dout(3) << "ll_releasedir " << dirp << dendl;
+  tout << "ll_releasedir" << dendl;
+  tout << (unsigned long)dirp << dendl;
   _closedir((DirResult*)dirp);
 }
 
 int Client::ll_open(inodeno_t ino, int flags, Fh **fhp)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_open " << ino << " " << flags << endl;
-  tout << "ll_open" << endl;
-  tout << ino.val << endl;
-  tout << flags << endl;
+  dout(3) << "ll_open " << ino << " " << flags << dendl;
+  tout << "ll_open" << dendl;
+  tout << ino.val << dendl;
+  tout << flags << dendl;
 
   Inode *in = _ll_get_inode(ino);
   string path;
@@ -3670,8 +3670,8 @@ int Client::ll_open(inodeno_t ino, int flags, Fh **fhp)
 
   int r = _open(path.c_str(), flags, 0, fhp);
 
-  tout << (unsigned long)*fhp << endl;
-  dout(3) << "ll_open " << ino << " " << flags << " = " << r << " (" << *fhp << ")" << endl;
+  tout << (unsigned long)*fhp << dendl;
+  dout(3) << "ll_open " << ino << " " << flags << " = " << r << " (" << *fhp << ")" << dendl;
   return r;
 }
 
@@ -3679,12 +3679,12 @@ int Client::ll_create(inodeno_t parent, const char *name, mode_t mode, int flags
                      struct stat *attr, Fh **fhp)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << endl;
-  tout << "ll_create" << endl;
-  tout << parent.val << endl;
-  tout << name << endl;
-  tout << mode << endl;
-  tout << flags << endl;
+  dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << dendl;
+  tout << "ll_create" << dendl;
+  tout << parent.val << dendl;
+  tout << name << dendl;
+  tout << mode << dendl;
+  tout << flags << dendl;
 
   Inode *pin = _ll_get_inode(parent);
   string path;
@@ -3700,21 +3700,21 @@ int Client::ll_create(inodeno_t parent, const char *name, mode_t mode, int flags
   } else {
     attr->st_ino = 0;
   }
-  tout << (unsigned long)*fhp << endl;
-  tout << attr->st_ino << endl;
+  tout << (unsigned long)*fhp << dendl;
+  tout << attr->st_ino << dendl;
   dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags
-         << " = " << r << " (" << *fhp << " " << hex << attr->st_ino << dec << ")" << endl;
+         << " = " << r << " (" << *fhp << " " << hex << attr->st_ino << dec << ")" << dendl;
   return 0;
 }
 
 int Client::ll_read(Fh *fh, off_t off, off_t len, bufferlist *bl)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_read " << fh << " " << off << "~" << len << endl;
-  tout << "ll_read" << endl;
-  tout << (unsigned long)fh << endl;
-  tout << off << endl;
-  tout << len << endl;
+  dout(3) << "ll_read " << fh << " " << off << "~" << len << dendl;
+  tout << "ll_read" << dendl;
+  tout << (unsigned long)fh << dendl;
+  tout << off << dendl;
+  tout << len << dendl;
 
   return _read(fh, off, len, bl);
 }
@@ -3722,11 +3722,11 @@ int Client::ll_read(Fh *fh, off_t off, off_t len, bufferlist *bl)
 int Client::ll_write(Fh *fh, off_t off, off_t len, const char *data)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_write " << fh << " " << off << "~" << len << endl;
-  tout << "ll_write" << endl;
-  tout << (unsigned long)fh << endl;
-  tout << off << endl;
-  tout << len << endl;
+  dout(3) << "ll_write " << fh << " " << off << "~" << len << dendl;
+  tout << "ll_write" << dendl;
+  tout << (unsigned long)fh << dendl;
+  tout << off << dendl;
+  tout << len << dendl;
 
   return _write(fh, off, len, data);
 }
@@ -3734,9 +3734,9 @@ int Client::ll_write(Fh *fh, off_t off, off_t len, const char *data)
 int Client::ll_flush(Fh *fh)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_flush " << fh << endl;
-  tout << "ll_flush" << endl;
-  tout << (unsigned long)fh << endl;
+  dout(3) << "ll_flush " << fh << dendl;
+  tout << "ll_flush" << dendl;
+  tout << (unsigned long)fh << dendl;
 
   return _flush(fh);
 }
@@ -3744,9 +3744,9 @@ int Client::ll_flush(Fh *fh)
 int Client::ll_release(Fh *fh)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_release " << fh << endl;
-  tout << "ll_release" << endl;
-  tout << (unsigned long)fh << endl;
+  dout(3) << "ll_release " << fh << dendl;
+  tout << "ll_release" << dendl;
+  tout << (unsigned long)fh << dendl;
 
   _release(fh);
   return 0;
@@ -3771,7 +3771,7 @@ int Client::describe_layout(int fd, FileLayout *lp)
 
   *lp = in->inode.layout;
 
-  dout(3) << "describe_layout(" << fd << ") = 0" << endl;
+  dout(3) << "describe_layout(" << fd << ") = 0" << dendl;
   return 0;
 }
 
@@ -3808,7 +3808,7 @@ int Client::enumerate_layout(int fd, list<ObjectExtent>& result,
   // map to a list of extents
   filer->file_to_extents(in->inode, offset, length, result);
 
-  dout(3) << "enumerate_layout(" << fd << ", " << length << ", " << offset << ") = 0" << endl;
+  dout(3) << "enumerate_layout(" << fd << ", " << length << ", " << offset << ") = 0" << dendl;
   return 0;
 }
 
@@ -3822,19 +3822,19 @@ void Client::ms_handle_failure(Message *m, const entity_inst_t& inst)
     int mon = monmap->pick_mon(true);
     dout(0) << "ms_handle_failure " << *m << " to " << inst 
             << ", resending to mon" << mon 
-            << endl;
+            << dendl;
     messenger->send_message(m, monmap->get_inst(mon));
   }
   else if (dest.is_osd()) {
     objecter->ms_handle_failure(m, dest, inst);
   } 
   else if (dest.is_mds()) {
-    dout(0) << "ms_handle_failure " << *m << " to " << inst << endl;
+    dout(0) << "ms_handle_failure " << *m << " to " << inst << dendl;
     //failed_mds.insert(dest.num());
   }
   else {
     // client?
-    dout(0) << "ms_handle_failure " << *m << " to " << inst << ", dropping" << endl;
+    dout(0) << "ms_handle_failure " << *m << " to " << inst << ", dropping" << dendl;
     delete m;
   }
 }
index 33f1cf4bfd0b838ab7ecfde0e81eb74a4a45c122..823acb4666191768de176bcf8f47bc85622b31cd 100644 (file)
@@ -12,7 +12,6 @@
  * 
  */
 
-#include "config.h"
 #include "include/types.h"
 
 #include "FileCache.h"
 
 #include "msg/Messenger.h"
 
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_client) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
-#define derr(x)  if (x <= g_conf.debug_client) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+#include "config.h"
+#define dout(x)  if (x <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+#define derr(x)  if (x <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+
 
 
 // flush/release/clean
@@ -67,7 +67,7 @@ void FileCache::tear_down()
 {
   off_t unclean = release_clean();
   if (unclean) {
-    dout(0) << "tear_down " << unclean << " unclean bytes, purging" << endl;
+    dout(0) << "tear_down " << unclean << " unclean bytes, purging" << dendl;
     oc->purge_set(inode.ino);
   }
 }
@@ -76,7 +76,7 @@ void FileCache::tear_down()
 
 void FileCache::truncate(off_t olds, off_t news)
 {
-  dout(5) << "truncate " << olds << " -> " << news << endl;
+  dout(5) << "truncate " << olds << " -> " << news << dendl;
 
   // map range to objects
   list<ObjectExtent> ls;
@@ -98,7 +98,7 @@ public:
 void FileCache::set_caps(int caps, Context *onimplement) 
 {
   if (onimplement) {
-    dout(10) << "set_caps setting onimplement context for " << cap_string(caps) << endl;
+    dout(10) << "set_caps setting onimplement context for " << cap_string(caps) << dendl;
     assert(latest_caps & ~caps);  // we should be losing caps.
     caps_callbacks[caps].push_back(onimplement);
   }
@@ -134,7 +134,7 @@ void FileCache::check_caps()
 {
   // calc used
   int used = get_used_caps();
-  dout(10) << "check_caps used was " << cap_string(used) << endl;
+  dout(10) << "check_caps used was " << cap_string(used) << dendl;
 
   // try to implement caps?
   // BUG? latest_caps, not least caps i've seen?
@@ -146,7 +146,7 @@ void FileCache::check_caps()
     flush_dirty(new C_FC_CheckCaps(this));
   
   used = get_used_caps();
-  dout(10) << "check_caps used now " << cap_string(used) << endl;
+  dout(10) << "check_caps used now " << cap_string(used) << dendl;
 
   // check callbacks
   map<int, list<Context*> >::iterator p = caps_callbacks.begin();
@@ -154,14 +154,14 @@ void FileCache::check_caps()
     if (used == 0 || (~(p->first) & used) == 0) {
       // implemented.
       dout(10) << "used is " << cap_string(used) 
-               << ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << endl;
+               << ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << dendl;
       finish_contexts(p->second);
       map<int, list<Context*> >::iterator o = p;
       p++;
       caps_callbacks.erase(o);
     } else {
       dout(10) << "used is " << cap_string(used) 
-               << ", caps " << cap_string(p->first) << " not yet implemented" << endl;
+               << ", caps " << cap_string(p->first) << " not yet implemented" << dendl;
       p++;
     }
   }
@@ -177,7 +177,7 @@ int FileCache::read(off_t offset, size_t size, bufferlist& blist, Mutex& client_
 
   // can i read?
   while ((latest_caps & CAP_FILE_RD) == 0) {
-    dout(10) << "read doesn't have RD cap, blocking" << endl;
+    dout(10) << "read doesn't have RD cap, blocking" << dendl;
     Cond c;
     waitfor_read.insert(&c);
     c.Wait(client_lock);
@@ -222,7 +222,7 @@ void FileCache::write(off_t offset, size_t size, bufferlist& blist, Mutex& clien
 {
   // can i write
   while ((latest_caps & CAP_FILE_WR) == 0) {
-    dout(10) << "write doesn't have WR cap, blocking" << endl;
+    dout(10) << "write doesn't have WR cap, blocking" << dendl;
     Cond c;
     waitfor_write.insert(&c);
     c.Wait(client_lock);
index 17960ec73142cef80a43e232ad0ae4ed89e2b563..e588b13c03296a4abbb8aeb35ade3d73de536af9 100644 (file)
@@ -33,8 +33,8 @@ using namespace std;
 #include <sys/statvfs.h>
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_client) cout << g_clock.now() << " synthetic" << client->get_nodeid() << " "
+
+#define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_client) cout << dbeginl << g_clock.now() << " synthetic" << client->get_nodeid() << " "
 
 // traces
 //void trace_include(SyntheticClient *syn, Client *cl, string& prefix);
@@ -180,7 +180,7 @@ void parse_syn_options(vector<char*>& args)
        syn_sargs.push_back(args[++i]);
        syn_iargs.push_back(atoi(args[++i]));
       } else {
-        cerr << "unknown syn arg " << args[i] << endl;
+        cerr << "unknown syn arg " << args[i] << dendl;
         assert(0);
       }
     }
@@ -235,7 +235,6 @@ string SyntheticClient::get_sarg(int seq)
     sprintf(s,"syn.%d.%d", client->whoami, seq);
     a = s;
   } 
-  //cout << "a is " << a << endl;
   return a;
 }
 
@@ -243,13 +242,13 @@ int SyntheticClient::run()
 { 
   //run_start = g_clock.now();
   run_until = utime_t(0,0);
-  dout(5) << "run" << endl;
+  dout(5) << "run" << dendl;
 
   for (list<int>::iterator it = modes.begin();
        it != modes.end();
        it++) {
     int mode = *it;
-    dout(3) << "mode " << mode << endl;
+    dout(3) << "mode " << mode << dendl;
 
     switch (mode) {
     case SYNCLIENT_MODE_FOO:
@@ -273,7 +272,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();
         iargs.pop_front();
         if (run_me()) {
-          dout(2) << "sleep " << iarg1 << endl;
+          dout(2) << "sleep " << iarg1 << dendl;
           sleep(iarg1);
         }
       }
@@ -284,7 +283,7 @@ int SyntheticClient::run()
         run_only = iargs.front();
         iargs.pop_front();
         if (run_only == client->get_nodeid())
-          dout(2) << "only " << run_only << endl;
+          dout(2) << "only " << run_only << dendl;
       }
       break;
     case SYNCLIENT_MODE_EXCLUDE:
@@ -292,7 +291,7 @@ int SyntheticClient::run()
         exclude = iargs.front();
         iargs.pop_front();
         if (exclude == client->get_nodeid())
-          dout(2) << "not running " << exclude << endl;
+          dout(2) << "not running " << exclude << dendl;
       }
       break;
 
@@ -302,11 +301,11 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();
         iargs.pop_front();
         if (iarg1) {
-          dout(2) << "until " << iarg1 << endl;
+          dout(2) << "until " << iarg1 << dendl;
           utime_t dur(iarg1,0);
           run_until = run_start + dur;
         } else {
-          dout(2) << "until " << iarg1 << " (no limit)" << endl;
+          dout(2) << "until " << iarg1 << " (no limit)" << dendl;
           run_until = utime_t(0,0);
         }
       }
@@ -317,7 +316,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();
         iargs.pop_front();
         if (iarg1) {
-          dout(2) << "sleepuntil " << iarg1 << endl;
+          dout(2) << "sleepuntil " << iarg1 << dendl;
           utime_t at = g_clock.now() - run_start;
           if (at.sec() < iarg1) 
             sleep(iarg1 - at.sec());
@@ -330,7 +329,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();
         iargs.pop_front();
         if (run_me()) {
-          dout(2) << "randomwalk " << iarg1 << endl;
+          dout(2) << "randomwalk " << iarg1 << dendl;
           random_walk(iarg1);
         }
       }
@@ -341,7 +340,7 @@ int SyntheticClient::run()
         string sarg1 = get_sarg(0);
         int iarg1 = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "makedirmess " << sarg1 << " " << iarg1 << endl;
+          dout(2) << "makedirmess " << sarg1 << " " << iarg1 << dendl;
           make_dir_mess(sarg1.c_str(), iarg1);
         }
       }
@@ -353,7 +352,7 @@ int SyntheticClient::run()
         int iarg2 = iargs.front();  iargs.pop_front();
         int iarg3 = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "makedirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+          dout(2) << "makedirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
           make_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
         }
       }
@@ -365,7 +364,7 @@ int SyntheticClient::run()
         int iarg2 = iargs.front();  iargs.pop_front();
         int iarg3 = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "statdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+          dout(2) << "statdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
           stat_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
         }
       }
@@ -377,7 +376,7 @@ int SyntheticClient::run()
         int iarg2 = iargs.front();  iargs.pop_front();
         int iarg3 = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "readdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+          dout(2) << "readdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
           read_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
         }
       }
@@ -392,7 +391,7 @@ int SyntheticClient::run()
         int iarg3 = iargs.front();  iargs.pop_front();
         int iarg4 = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "thrashlinks " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+          dout(2) << "thrashlinks " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
           thrash_links(sarg1.c_str(), iarg1, iarg2, iarg3, iarg4);
         }
       }
@@ -406,7 +405,7 @@ int SyntheticClient::run()
         int count = iargs.front();  iargs.pop_front();
         int priv = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "makefiles " << num << " " << count << " " << priv << endl;
+          dout(2) << "makefiles " << num << " " << count << " " << priv << dendl;
           make_files(num, count, priv, false);
         }
       }
@@ -417,7 +416,7 @@ int SyntheticClient::run()
         int count = iargs.front();  iargs.pop_front();
         int priv = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "makefiles2 " << num << " " << count << " " << priv << endl;
+          dout(2) << "makefiles2 " << num << " " << count << " " << priv << dendl;
           make_files(num, count, priv, true);
         }
       }
@@ -427,7 +426,7 @@ int SyntheticClient::run()
         string sarg1 = get_sarg(0);
         int num = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "createshared " << num << endl;
+          dout(2) << "createshared " << num << dendl;
           create_shared(num);
         }
       }
@@ -438,7 +437,7 @@ int SyntheticClient::run()
         int num = iargs.front();  iargs.pop_front();
         int count = iargs.front();  iargs.pop_front();
         if (run_me()) {
-          dout(2) << "openshared " << num << endl;
+          dout(2) << "openshared " << num << dendl;
           open_shared(num, count);
         }
       }
@@ -448,7 +447,7 @@ int SyntheticClient::run()
       {
         string sarg1;// = get_sarg(0);
         if (run_me()) {
-          dout(2) << "fullwalk" << sarg1 << endl;
+          dout(2) << "fullwalk" << sarg1 << dendl;
           full_walk(sarg1);
         }
       }
@@ -457,7 +456,7 @@ int SyntheticClient::run()
       {
         string sarg1 = get_sarg(0);
         if (run_me()) {
-          dout(2) << "repeatwalk " << sarg1 << endl;
+          dout(2) << "repeatwalk " << sarg1 << dendl;
           while (full_walk(sarg1) == 0) ;
         }
       }
@@ -468,7 +467,7 @@ int SyntheticClient::run()
         string sarg1 = get_sarg(0);
         int iarg1 = iargs.front();  iargs.pop_front();
         int iarg2 = iargs.front();  iargs.pop_front();
-        cout << "WRITING SYN CLIENT" << endl;
+        dout(1) << "WRITING SYN CLIENT" << dendl;
         if (run_me())
           write_file(sarg1, iarg1, iarg2);
       }
@@ -508,7 +507,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();  iargs.pop_front();
         int iarg2 = iargs.front();  iargs.pop_front();
 
-        cout << "READING SYN CLIENT" << endl;
+        dout(1) << "READING SYN CLIENT" << dendl;
         if (run_me())
           read_file(sarg1, iarg1, iarg2);
       }
@@ -520,7 +519,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();  iargs.pop_front();
         int iarg2 = iargs.front();  iargs.pop_front();
 
-        cout << "RANDOM READ WRITE SYN CLIENT" << endl;
+        dout(1) << "RANDOM READ WRITE SYN CLIENT" << dendl;
         if (run_me())
           read_random(sarg1, iarg1, iarg2);
       }
@@ -532,7 +531,7 @@ int SyntheticClient::run()
         int iarg1 = iargs.front();  iargs.pop_front();
         int iarg2 = iargs.front();  iargs.pop_front();
 
-        cout << "RANDOM READ WRITE SYN CLIENT" << endl;
+        dout(1) << "RANDOM READ WRITE SYN CLIENT" << dendl;
         if (run_me())
           read_random_ex(sarg1, iarg1, iarg2);
       }
@@ -545,7 +544,7 @@ int SyntheticClient::run()
         string prefix = get_sarg(0);
 
         if (run_me()) {
-          dout(2) << "trace " << tfile << " prefix " << prefix << " ... " << iarg1 << " times" << endl;
+          dout(2) << "trace " << tfile << " prefix " << prefix << " ... " << iarg1 << " times" << dendl;
           
           Trace t(tfile.c_str());
           
@@ -562,7 +561,7 @@ int SyntheticClient::run()
             utime_t lat = g_clock.now();
             lat -= start;
             
-            dout(1) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << endl;
+            dout(1) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << dendl;
             if (client_logger 
                 && i > 0
                 && i < iarg1-1
@@ -688,14 +687,14 @@ void SyntheticClient::init_op_dist()
 void SyntheticClient::up()
 {
   cwd = cwd.prefixpath(cwd.depth()-1);
-  dout(DBL) << "cd .. -> " << cwd << endl;
+  dout(DBL) << "cd .. -> " << cwd << dendl;
   clear_dir();
 }
 
 
 int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
 {
-  dout(4) << "play trace" << endl;
+  dout(4) << "play trace" << dendl;
   t.start();
 
   char buf[1024];
@@ -725,7 +724,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
       utime_t now = last_status;
       if (now - last_status > 1.0) {
        last_status = now;
-       dout(1) << "play_trace at line " << t.get_line() << endl;
+       dout(1) << "play_trace at line " << t.get_line() << dendl;
       }
     }
     
@@ -733,7 +732,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
     
     // op
     const char *op = t.get_string(buf, 0);
-    dout(4) << (t.get_line()-1) << ": trace op " << op << endl;
+    dout(4) << (t.get_line()-1) << ": trace op " << op << dendl;
     
     if (op[0] == '@') {
       // timestamp... ignore it!
@@ -935,7 +934,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
       if (client->ll_symlink(ll_inos[i], n, v, &attr) == 0)
        ll_inos[ri] = attr.st_ino;
       else
-       cout << "**** symlink returned an error ****" << endl;
+       dout(0) << "**** symlink returned an error ****" << dendl;
     } else if (strcmp(op, "ll_unlink") == 0) {
       int64_t i = t.get_int();
       const char *n = t.get_string(buf, p);
@@ -1022,7 +1021,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
     } 
 
     else {
-      cout << (t.get_line()-1) << ": *** trace hit unrecognized symbol '" << op << "' " << endl;
+      dout(0) << (t.get_line()-1) << ": *** trace hit unrecognized symbol '" << op << "' " << dendl;
       assert(0);
     }
   }
@@ -1031,25 +1030,25 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
   for (hash_map<int64_t, int64_t>::iterator fi = open_files.begin();
        fi != open_files.end();
        fi++) {
-    dout(1) << "leftover close " << fi->second << endl;
+    dout(1) << "leftover close " << fi->second << dendl;
     if (fi->second > 0) client->close(fi->second);
   }
   for (hash_map<int64_t, DIR*>::iterator fi = open_dirs.begin();
        fi != open_dirs.end();
        fi++) {
-    dout(1) << "leftover closedir " << fi->second << endl;
+    dout(1) << "leftover closedir " << fi->second << dendl;
     if (fi->second != 0) client->closedir(fi->second);
   }
   for (hash_map<int64_t,Fh*>::iterator fi = ll_files.begin();
        fi != ll_files.end();
        fi++) {
-    dout(1) << "leftover ll_release " << fi->second << endl;
+    dout(1) << "leftover ll_release " << fi->second << dendl;
     if (fi->second > 0) client->ll_release(fi->second);
   }
   for (hash_map<int64_t,void*>::iterator fi = ll_dirs.begin();
        fi != ll_dirs.end();
        fi++) {
-    dout(1) << "leftover ll_releasedir " << fi->second << endl;
+    dout(1) << "leftover ll_releasedir " << fi->second << dendl;
     if (fi->second > 0) client->ll_releasedir(fi->second);
   }
   
@@ -1064,7 +1063,7 @@ int SyntheticClient::clean_dir(string& basedir)
   list<string> contents;
   int r = client->getdir(basedir.c_str(), contents);
   if (r < 0) {
-    dout(1) << "readdir on " << basedir << " returns " << r << endl;
+    dout(1) << "readdir on " << basedir << " returns " << r << dendl;
     return r;
   }
 
@@ -1080,7 +1079,7 @@ int SyntheticClient::clean_dir(string& basedir)
     struct stat st;
     int r = client->lstat(file.c_str(), &st);
     if (r < 0) {
-      dout(1) << "stat error on " << file << " r=" << r << endl;
+      dout(1) << "stat error on " << file << " r=" << r << dendl;
       continue;
     }
 
@@ -1112,7 +1111,7 @@ int SyntheticClient::full_walk(string& basedir)
     list<string> contents;
     int r = client->getdir(dir.c_str(), contents);
     if (r < 0) {
-      dout(1) << "readdir on " << dir << " returns " << r << endl;
+      dout(1) << "readdir on " << dir << " returns " << r << dendl;
       continue;
     }
     
@@ -1127,7 +1126,7 @@ int SyntheticClient::full_walk(string& basedir)
       struct stat st;
       int r = client->lstat(file.c_str(), &st);
       if (r < 0) {
-       dout(1) << "stat error on " << file << " r=" << r << endl;
+       dout(1) << "stat error on " << file << " r=" << r << dendl;
        continue;
       }
       
@@ -1168,13 +1167,13 @@ int SyntheticClient::make_dirs(const char *basedir, int dirs, int files, int dep
   // make sure base dir exists
   int r = client->mkdir(basedir, 0755);
   if (r != 0) {
-    dout(1) << "can't make base dir? " << basedir << endl;
+    dout(1) << "can't make base dir? " << basedir << dendl;
     return -1;
   }
 
   // children
   char d[500];
-  dout(3) << "make_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+  dout(3) << "make_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
   for (int i=0; i<files; i++) {
     sprintf(d,"%s/file.%d", basedir, i);
     client->mknod(d, 0644);
@@ -1198,13 +1197,13 @@ int SyntheticClient::stat_dirs(const char *basedir, int dirs, int files, int dep
   struct stat st;
   int r = client->lstat(basedir, &st);
   if (r != 0) {
-    dout(1) << "can't make base dir? " << basedir << endl;
+    dout(1) << "can't make base dir? " << basedir << dendl;
     return -1;
   }
 
   // children
   char d[500];
-  dout(3) << "stat_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+  dout(3) << "stat_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
   for (int i=0; i<files; i++) {
     sprintf(d,"%s/file.%d", basedir, i);
     client->lstat(d, &st);
@@ -1227,7 +1226,7 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep
 
   // children
   char d[500];
-  dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+  dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
 
   list<string> contents;
   utime_t s = g_clock.now();
@@ -1236,7 +1235,7 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep
   e -= s;
   if (client_logger) client_logger->finc("readdir", e);
   if (r < 0) {
-    dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << endl;
+    dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << dendl;
     return -1;
   }
 
@@ -1244,7 +1243,7 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep
     sprintf(d,"%s/file.%d", basedir, i);
     utime_t s = g_clock.now();
     if (client->lstat(d, &st) < 0) {
-      dout(2) << "read_dirs failed stat on " << d << ", stopping" << endl;
+      dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
       return -1;
     }
     utime_t e = g_clock.now();
@@ -1351,15 +1350,15 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is i
   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;
+  dout(5) << "writing to " << fn << " fd " << fd << dendl;
   if (fd < 0) return fd;
 
   for (unsigned i=0; i<chunks; i++) {
     if (time_to_stop()) {
-      dout(0) << "stopping" << endl;
+      dout(0) << "stopping" << dendl;
       break;
     }
-    dout(2) << "writing block " << i << "/" << chunks << endl;
+    dout(2) << "writing block " << i << "/" << chunks << dendl;
     
     // fill buf with a 16 byte fingerprint
     // 64 bits : file offset
@@ -1386,7 +1385,7 @@ int SyntheticClient::write_batch(int nfile, int size, int wrsize)
 {
   for (int i=0; i<nfile; i++) {
       string sarg1 = get_sarg(i);
-    dout(0) << "Write file " << sarg1 << endl;
+    dout(0) << "Write file " << sarg1 << dendl;
     write_file(sarg1, size, wrsize);
   }
   return 0;
@@ -1399,15 +1398,15 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize, bool ignoreprin
   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;
+  dout(5) << "reading from " << fn << " fd " << fd << dendl;
   if (fd < 0) return fd;
 
   for (unsigned i=0; i<chunks; i++) {
     if (time_to_stop()) break;
-    dout(2) << "reading block " << i << "/" << chunks << endl;
+    dout(2) << "reading block " << i << "/" << chunks << dendl;
     int r = client->read(fd, buf, rdsize, i*rdsize);
     if (r < rdsize) {
-      dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+      dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
       break;
     }
  
@@ -1426,12 +1425,12 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize, bool ignoreprin
         if (!bad && !ignoreprint)
           dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
                  << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
-                 << endl;
+                 << dendl;
         bad++;
       }
     }
     if (bad && !ignoreprint) 
-      dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+      dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
   }
   
   client->close(fd);
@@ -1445,11 +1444,11 @@ int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is
   __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize;
 
   int fd = client->open(fn.c_str(), O_RDWR);
-  dout(5) << "reading from " << fn << " fd " << fd << endl;
+  dout(5) << "reading from " << fn << " fd " << fd << dendl;
    
- // cout << "READING FROM  " << fn << " fd " << fd << endl;
+ // dout(0) << "READING FROM  " << fn << " fd " << fd << dendl;
 
- // cout << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  endl;
+ // dout(0) << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  dendl;
 
   if (fd < 0) return fd;
   int offset;
@@ -1467,40 +1466,40 @@ int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is
     // use rand instead ??
     double x = drand48();
 
-    //cout << "RANDOM NUMBER RETURN |" << x << "|" << endl;
+    //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
 
     if ( x < 0.5) 
     {
-        //cout << "DECIDED TO READ " << x << endl;
+        //dout(0) << "DECIDED TO READ " << x << dendl;
         buf = new char[rdsize]; 
         memset(buf, 1, rdsize);
         read=true;
     }
     else
     {
-       // cout << "DECIDED TO WRITE " << x << endl;
+       // dout(0) << "DECIDED TO WRITE " << x << dendl;
         buf = new char[rdsize+100];   // 1 MB
         memset(buf, 7, rdsize);
     }
 
     //double  y  = drand48() ;
 
-    //cout << "OFFSET is |" << offset << "| chunks |" << chunks<<  endl;
+    //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<<  dendl;
     
     if ( read)
     {
         offset=(rand())%(chunks+1);
-        dout(2) << "reading block " << offset << "/" << chunks << endl;
+        dout(2) << "reading block " << offset << "/" << chunks << dendl;
 
         int r = client->read(fd, buf, rdsize,
                         offset*rdsize);
         if (r < rdsize) {
-                  dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+                  dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
     }
     }
     else
     {
-        dout(2) << "writing block " << offset << "/" << chunks << endl;
+        dout(2) << "writing block " << offset << "/" << chunks << dendl;
 
     // fill buf with a 16 byte fingerprint
     // 64 bits : file offset
@@ -1546,12 +1545,12 @@ int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is
         if (!bad)
           dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
                  << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
-                 << endl;
+                 << dendl;
         bad++;
       }
     }
     if (bad) 
-      dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+      dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
   }
   }
   
@@ -1613,11 +1612,11 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
   __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize;
   
   int fd = client->open(fn.c_str(), O_RDWR);
-  dout(5) << "reading from " << fn << " fd " << fd << endl;
+  dout(5) << "reading from " << fn << " fd " << fd << dendl;
   
-  // cout << "READING FROM  " << fn << " fd " << fd << endl;
+  // dout(0) << "READING FROM  " << fn << " fd " << fd << dendl;
   
-  // cout << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  endl;
+  // dout(0) << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  dendl;
   
   if (fd < 0) return fd;
   int offset;
@@ -1635,25 +1634,25 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
     // use rand instead ??
     double x = drand48();
     
-    //cout << "RANDOM NUMBER RETURN |" << x << "|" << endl;
+    //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
     
     if ( x < 0.5) 
       {
-        //cout << "DECIDED TO READ " << x << endl;
+        //dout(0) << "DECIDED TO READ " << x << dendl;
         buf = new char[rdsize]; 
         memset(buf, 1, rdsize);
         read=true;
       }
     else
       {
-       // cout << "DECIDED TO WRITE " << x << endl;
+       // dout(0) << "DECIDED TO WRITE " << x << dendl;
         buf = new char[rdsize+100];   // 1 MB
         memset(buf, 7, rdsize);
       }
     
     //double  y  = drand48() ;
     
-    //cout << "OFFSET is |" << offset << "| chunks |" << chunks<<  endl;
+    //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<<  dendl;
     
     if ( read)
       {
@@ -1667,17 +1666,17 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
              offset= normdist( 0 , chunks/20 , 5  )*20;*/
        
        
-        dout(2) << "reading block " << offset << "/" << chunks << endl;
+        dout(2) << "reading block " << offset << "/" << chunks << dendl;
        
         int r = client->read(fd, buf, rdsize,
                             offset*rdsize);
         if (r < rdsize) {
-         dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+         dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
        }
       }
     else
       {
-        dout(2) << "writing block " << offset << "/" << chunks << endl;
+        dout(2) << "writing block " << offset << "/" << chunks << dendl;
        
        // fill buf with a 16 byte fingerprint
        // 64 bits : file offset
@@ -1723,12 +1722,12 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
            if (!bad)
              dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
                      << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
-                     << endl;
+                     << dendl;
            bad++;
          }
        }
        if (bad) 
-         dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+         dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
       }
   }
   
@@ -1743,7 +1742,7 @@ int SyntheticClient::random_walk(int num_req)
 {
   int left = num_req;
 
-  //dout(1) << "random_walk() will do " << left << " ops" << endl;
+  //dout(1) << "random_walk() will do " << left << " ops" << dendl;
 
   init_op_dist();  // set up metadata op distribution
  
@@ -1754,7 +1753,7 @@ int SyntheticClient::random_walk(int num_req)
 
     // ascend?
     if (cwd.depth() && !roll_die(::pow((double).9, (double)cwd.depth()))) {
-      dout(DBL) << "die says up" << endl;
+      dout(DBL) << "die says up" << dendl;
       up();
       continue;
     }
@@ -1763,7 +1762,7 @@ int SyntheticClient::random_walk(int num_req)
     if (.9*roll_die(::pow((double).9,(double)cwd.depth())) && subdirs.size()) {
       string s = get_random_subdir();
       cwd.push_dentry( s );
-      dout(DBL) << "cd " << s << " -> " << cwd << endl;
+      dout(DBL) << "cd " << s << " -> " << cwd << dendl;
       clear_dir();
       continue;
     }
@@ -1773,14 +1772,14 @@ int SyntheticClient::random_walk(int num_req)
 
     if (contents.empty() && roll_die(.3)) {
       if (did_readdir) {
-        dout(DBL) << "empty dir, up" << endl;
+        dout(DBL) << "empty dir, up" << dendl;
         up();
       } else
         op = MDS_OP_READDIR;
     } else {
       op = op_dist.sample();
     }
-    //dout(DBL) << "op is " << op << endl;
+    //dout(DBL) << "op is " << op << dendl;
 
     int r = 0;
 
@@ -1870,7 +1869,7 @@ int SyntheticClient::random_walk(int num_req)
       if (contents.empty()) {
         if (did_readdir) {
           if (roll_die(.1)) {
-            dout(DBL) << "stat in empty dir, up" << endl;
+            dout(DBL) << "stat in empty dir, up" << dendl;
             up();
           } else {
             op = MDS_OP_MKNOD;
@@ -1890,7 +1889,7 @@ int SyntheticClient::random_walk(int num_req)
       for (list<string>::iterator it = c.begin();
            it != c.end();
            it++) {
-        //dout(DBL) << " got " << *it << endl;
+        //dout(DBL) << " got " << *it << dendl;
        assert(0);
        /*contents[*it] = it->second;
         if (it->second &&
@@ -1908,22 +1907,22 @@ int SyntheticClient::random_walk(int num_req)
       //while (cwd.depth()) {
       //if (client->lookup(cwd)) break;   // it's in the cache
         
-      //dout(DBL) << "r = " << r << ", client doesn't have " << cwd << ", cd .." << endl;
-      dout(DBL) << "r = " << r << ", client may not have " << cwd << ", cd .." << endl;
+      //dout(DBL) << "r = " << r << ", client doesn't have " << cwd << ", cd .." << dendl;
+      dout(DBL) << "r = " << r << ", client may not have " << cwd << ", cd .." << dendl;
       up();
       //}      
     }
   }
 
   // close files
-  dout(DBL) << "closing files" << endl;
+  dout(DBL) << "closing files" << dendl;
   while (!open_files.empty()) {
     int fh = get_random_fh();
     int r = client->close( fh );
     if (r == 0) open_files.erase(fh);
   }
 
-  dout(DBL) << "done" << endl;
+  dout(DBL) << "done" << dendl;
   return 0;
 }
 
@@ -2106,7 +2105,7 @@ int SyntheticClient::thrash_links(const char *basedir, int dirs, int files, int
 {
   dout(1) << "thrash_links " << basedir << " " << dirs << " " << files << " " << depth
          << " links " << n
-         << endl;
+         << dendl;
 
   if (time_to_stop()) return 0;
 
@@ -2228,7 +2227,7 @@ int SyntheticClient::thrash_links(const char *basedir, int dirs, int files, int
 
 void SyntheticClient::import_find(const char *base, const char *find, bool data)
 {
-  dout(1) << "import_find " << base << " from " << find << " data=" << data << endl;
+  dout(1) << "import_find " << base << " from " << find << " data=" << data << dendl;
 
   /* use this to gather the static trace:
    *
@@ -2286,7 +2285,7 @@ void SyntheticClient::import_find(const char *base, const char *find, bool data)
     if (modestring[8] == 'w') mode |= 02;
     if (modestring[9] == 'x') mode |= 01;
 
-    dout(20) << " mode " << modestring << " to " << oct << mode << dec << endl;
+    dout(20) << " mode " << modestring << " to " << oct << mode << dec << dendl;
 
     if (S_ISLNK(mode)) {
       // target vs destination
@@ -2302,7 +2301,7 @@ void SyntheticClient::import_find(const char *base, const char *find, bool data)
       } else {
        target = filename.substr(pos + 4);
       }
-      dout(10) << "symlink from '" << link << "' -> '" << target << "'" << endl;
+      dout(10) << "symlink from '" << link << "' -> '" << target << "'" << dendl;
       client->symlink(target.c_str(), link.c_str());
     } else {
       string f = base;
@@ -2311,12 +2310,12 @@ void SyntheticClient::import_find(const char *base, const char *find, bool data)
       if (S_ISDIR(mode)) {
        client->mkdir(f.c_str(), mode);
       } else {
-       int fd = client->open(f.c_str(), O_WRONLY|O_CREAT);
+       int fd = client->open(f.c_str(), O_WRONLY|O_CREAT, mode & 0777);
        assert(fd > 0); 
        client->write(fd, "", 0, size);
        client->close(fd);
 
-       client->chmod(f.c_str(), mode & 0777);
+       //client->chmod(f.c_str(), mode & 0777);
        client->chown(f.c_str(), uid, gid);
 
        struct utimbuf ut;
index f6d244f4307df5574a398425f42cb1c54b16e4cc..6cb8088d858f0a022cb3462a4c2f16d63d203446 100644 (file)
@@ -32,15 +32,16 @@ using namespace __gnu_cxx;
 
 
 
+
 //
 Trace::Trace(const char* f)
 {
   fs.open(f);
   if (!fs.is_open()) {
-    dout(0) << "** unable to open trace file " << f << endl;
+    generic_dout(0) << "** unable to open trace file " << f << dendl;
     assert(0);
   }
-  dout(2) << "opened traced file '" << f << "'" << endl;
+  generic_dout(2) << "opened traced file '" << f << "'" << dendl;
 }
 
 Trace::~Trace()
index 7c743f945bfc7cbed6376fd31721067edbc142f9..743f551c4c7a38fd6b40f84d1b859bca9bdbb084 100644 (file)
@@ -44,7 +44,7 @@ class C_Debug : public Context {
   void finish(int) {
     int size = &g_conf.debug_after - &g_conf.debug;
     memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
-    dout(0) << "debug_after flipping debug settings" << endl;
+    generic_dout(0) << "debug_after flipping debug settings" << dendl;
   }
 };
 
index 2ce646b44f4fcef78456621cf7a6939a1894611c..5224400269ecde7542466dcec834c564dd7125a4 100644 (file)
@@ -44,7 +44,7 @@ class C_Debug : public Context {
   void finish(int) {
     int size = &g_conf.debug_after - &g_conf.debug;
     memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
-    dout(0) << "debug_after flipping debug settings" << endl;
+    generic_dout(0) << "debug_after flipping debug settings" << dendl;
   }
 };
 
index 34bd80f9a4d8f065efab34381e98b45f252712cf..212e2cd378a12e9dbd8296be7499911ba6c53b34 100644 (file)
@@ -41,9 +41,9 @@ class Admin : public Dispatcher {
   void dispatch(Message *m) {
     switch (m->get_type()) {
     case MSG_MON_COMMAND_ACK:
-      dout(0) << m->get_source() << " -> '"
-             << ((MMonCommandAck*)m)->rs << "' (" << ((MMonCommandAck*)m)->r << ")"
-             << endl;
+      generc_dout(0) << m->get_source() << " -> '"
+                    << ((MMonCommandAck*)m)->rs << "' (" << ((MMonCommandAck*)m)->r << ")"
+                    << dendl;
       messenger->shutdown();
       break;      
     }
@@ -79,7 +79,7 @@ int main(int argc, char **argv, char *envp[]) {
   }
   int mon = monmap.pick_mon();
 
-  dout(0) << "mon" << mon << " <- '" << cmd << "'" << endl;
+  generic_dout(0) << "mon" << mon << " <- '" << cmd << "'" << dendl;
 
   // send it
   messenger->send_message(m, monmap.get_inst(mon));
index 2a4226bd0ef7c0a7787ecfe67b736838dcf5632a..06e20047da57f0c1e31452e449c80c0045338301 100644 (file)
@@ -49,7 +49,7 @@ class Thread {
   }
   int join(void **prval = 0) {
     if (thread_id == 0) {
-      cerr << "WARNING: join on thread that was never started" << endl;
+      generic_derr(0) << "WARNING: join on thread that was never started" << dendl;
       //assert(0);
       return -EINVAL;   // never started.
     }
@@ -58,17 +58,17 @@ class Thread {
     if (status != 0) {
       switch (status) {
       case -EINVAL:
-       cerr << "thread " << thread_id << " join status = EINVAL" << endl;
+       generic_derr(0) << "thread " << thread_id << " join status = EINVAL" << dendl;
        break;
       case -ESRCH:
-       cerr << "thread " << thread_id << " join status = ESRCH" << endl;
+       generic_derr(0) << "thread " << thread_id << " join status = ESRCH" << dendl;
        assert(0);
        break;
       case -EDEADLK:
-       cerr << "thread " << thread_id << " join status = EDEADLK" << endl;
+       generic_derr(0) << "thread " << thread_id << " join status = EDEADLK" << dendl;
        break;
       default:
-       cerr << "thread " << thread_id << " join status = " << status << endl;
+       generic_derr(0) << "thread " << thread_id << " join status = " << status << dendl;
       }
       assert(0); // none of these should happen.
     }
index 0681e4f4f1324b611afac211378972202a4ba2ae..eff5956812e69f729db94896a0cad0415e6454fa 100644 (file)
@@ -21,9 +21,8 @@
 #include "config.h"
 #include "include/Context.h"
 
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_timer) cout << g_clock.now() << " TIMER "
-#define derr(x)  if (x <= g_conf.debug_timer) cerr << g_clock.now() << " TIMER "
+#define dout(x)  if (x <= g_conf.debug_timer) cout << dbeginl << g_clock.now() << " TIMER "
+#define derr(x)  if (x <= g_conf.debug_timer) cerr << dbeginl << g_clock.now() << " TIMER "
 
 #define DBL 10
 
@@ -41,12 +40,12 @@ Timer      g_timer;
 bool Timer::get_next_due(utime_t& when)
 {
   if (scheduled.empty()) {
-    dout(10) << "get_next_due - nothing scheduled" << endl;
+    dout(10) << "get_next_due - nothing scheduled" << dendl;
     return false;
   } else {
     map< utime_t, set<Context*> >::iterator it = scheduled.begin();
     when = it->first;
-    dout(10) << "get_next_due - " << when << endl;
+    dout(10) << "get_next_due - " << when << dendl;
     return true;
   }
 }
@@ -74,7 +73,7 @@ void Timer::timer_entry()
         if (it->first > now) break;
 
         utime_t t = it->first;
-        dout(DBL) << "queueing event(s) scheduled at " << t << endl;
+        dout(DBL) << "queueing event(s) scheduled at " << t << dendl;
 
         for (set<Context*>::iterator cit = it->second.begin();
              cit != it->second.end();
@@ -98,9 +97,9 @@ void Timer::timer_entry()
           for (list<Context*>::iterator cit = pending.begin();
                cit != pending.end();
                cit++) {
-            dout(DBL) << "start callback " << *cit << endl;
+            dout(DBL) << "start callback " << *cit << dendl;
             (*cit)->finish(0);
-            dout(DBL) << "finish callback " << *cit << endl;
+            dout(DBL) << "finish callback " << *cit << dendl;
            delete *cit;
           }
           pending.clear();
@@ -113,19 +112,19 @@ void Timer::timer_entry()
     else {
       // sleep
       if (next_due) {
-        dout(DBL) << "sleeping until " << next << endl;
+        dout(DBL) << "sleeping until " << next << dendl;
         timed_sleep = true;
         sleeping = true;
         timeout_cond.WaitUntil(lock, next);  // wait for waker or time
         utime_t now = g_clock.now();
-        dout(DBL) << "kicked or timed out at " << now << endl;
+        dout(DBL) << "kicked or timed out at " << now << dendl;
       } else {
-        dout(DBL) << "sleeping" << endl;
+        dout(DBL) << "sleeping" << dendl;
         timed_sleep = false;
         sleeping = true;
         sleep_cond.Wait(lock);         // wait for waker
         utime_t now = g_clock.now();
-        dout(DBL) << "kicked at " << now << endl;
+        dout(DBL) << "kicked at " << now << dendl;
       }
     }
   }
@@ -143,17 +142,17 @@ void Timer::register_timer()
 {
   if (timer_thread.is_started()) {
     if (sleeping) {
-      dout(DBL) << "register_timer kicking thread" << endl;
+      dout(DBL) << "register_timer kicking thread" << dendl;
       if (timed_sleep)
         timeout_cond.SignalAll();
       else
         sleep_cond.SignalAll();
     } else {
-      dout(DBL) << "register_timer doing nothing; thread is awake" << endl;
+      dout(DBL) << "register_timer doing nothing; thread is awake" << dendl;
       // it's probably doing callbacks.
     }
   } else {
-    dout(DBL) << "register_timer starting thread" << endl;
+    dout(DBL) << "register_timer starting thread" << dendl;
     timer_thread.create();
   }
 }
@@ -162,7 +161,7 @@ void Timer::cancel_timer()
 {
   // clear my callback pointers
   if (timer_thread.is_started()) {
-    dout(10) << "setting thread_stop flag" << endl;
+    dout(10) << "setting thread_stop flag" << dendl;
     lock.Lock();
     thread_stop = true;
     if (timed_sleep)
@@ -171,11 +170,11 @@ void Timer::cancel_timer()
       sleep_cond.SignalAll();
     lock.Unlock();
     
-    dout(10) << "waiting for thread to finish" << endl;
+    dout(10) << "waiting for thread to finish" << dendl;
     void *ptr;
     timer_thread.join(&ptr);
     
-    dout(10) << "thread finished, exit code " << ptr << endl;
+    dout(10) << "thread finished, exit code " << ptr << dendl;
   }
 }
 
@@ -198,7 +197,7 @@ void Timer::add_event_at(utime_t when,
 {
   lock.Lock();
 
-  dout(DBL) << "add_event " << callback << " at " << when << endl;
+  dout(DBL) << "add_event " << callback << " at " << when << dendl;
 
   // insert
   scheduled[when].insert(callback);
@@ -217,10 +216,10 @@ bool Timer::cancel_event(Context *callback)
 {
   lock.Lock();
   
-  dout(DBL) << "cancel_event " << callback << endl;
+  dout(DBL) << "cancel_event " << callback << dendl;
 
   if (!event_times.count(callback)) {
-    dout(DBL) << "cancel_event " << callback << " isn't scheduled (probably executing)" << endl;
+    dout(DBL) << "cancel_event " << callback << " isn't scheduled (probably executing)" << dendl;
     lock.Unlock();
     return false;     // wasn't scheduled.
   }
@@ -249,7 +248,7 @@ void SafeTimer::add_event_after(float seconds, Context *c)
 {
   assert(lock.is_locked());
   Context *w = new EventWrapper(this, c);
-  dout(DBL) << "SafeTimer.add_event_after wrapping " << c << " with " << w << endl;
+  dout(DBL) << "SafeTimer.add_event_after wrapping " << c << " with " << w << dendl;
   scheduled[c] = w;
   g_timer.add_event_after(seconds, w);
 }
@@ -258,7 +257,7 @@ void SafeTimer::add_event_at(utime_t when, Context *c)
 {
   assert(lock.is_locked());
   Context *w = new EventWrapper(this, c);
-  dout(DBL) << "SafeTimer.add_event_at wrapping " << c << " with " << w << endl;
+  dout(DBL) << "SafeTimer.add_event_at wrapping " << c << " with " << w << dendl;
   scheduled[c] = w;
   g_timer.add_event_at(when, w);
 }
@@ -318,8 +317,8 @@ void SafeTimer::join()
 
   while (!canceled.empty()) {
     // wait
-    dout(-10) << "SafeTimer.join waiting for " << canceled.size() << " to join" << endl;
-    dout(-10) << canceled << endl;
+    dout(-10) << "SafeTimer.join waiting for " << canceled.size() << " to join" << dendl;
+    dout(-10) << canceled << dendl;
     cond.Wait(lock);
   }
 }
@@ -329,6 +328,6 @@ SafeTimer::~SafeTimer()
   if (!scheduled.empty() && !canceled.empty()) {
     derr(0) << "SafeTimer.~SafeTimer " << scheduled.size() << " events scheduled, " 
            << canceled.size() << " canceled but unflushed" 
-           << endl;
+           << dendl;
   }
 }
index 8620c97ec5eaa1d40e4820237d076a991129e210..2c36b908215d5cd3a216c1037a27c32545139095 100644 (file)
@@ -33,6 +33,8 @@ long buffer_total_alloc = 0;
 Mutex bufferlock;
 
 #include "osd/osd_types.h"
+
+// debug output lock
 Mutex _dout_lock;
 
 FileLayout g_OSD_FileLayout( 1<<23, 1, 1<<23, pg_t::TYPE_REP, 2 );   // 8M objects, 2x replication
index 30dfab203fcd48240caef9c70d7f62d99196f10a..5d7eff5d232042e63bea8ecb8f6719a7913f4a04 100644 (file)
@@ -339,15 +339,6 @@ extern md_config_t g_conf;
 extern md_config_t g_debug_after_conf;     
 
 
-/**
- * debug output framework
- */
-#define dout(x)  if ((x) <= g_conf.debug) std::cout
-#define dout2(x) if ((x) <= g_conf.debug) std::cout
-
-#define pdout(x,p)  if ((x) <= (p)) std::cout
-
-
 /**
  * command line / environment argument parsing
  */
@@ -362,5 +353,34 @@ void parse_config_options(std::vector<char*>& args);
 extern bool parse_ip_port(const char *s, entity_addr_t& addr);
 
 
+/**
+ * for cleaner output, bracket each line with
+ * dbeginl (in the dout macro) and dendl (in place of endl).
+ */
+extern Mutex _dout_lock;
+struct _dbeginl_t {
+  _dbeginl_t(int) {}
+};
+struct _dendl_t {
+  _dendl_t(int) {}
+};
+static const _dbeginl_t dbeginl = 0;
+static const _dendl_t dendl = 0;
+
+inline ostream& operator<<(ostream& out, _dbeginl_t) {
+  _dout_lock.Lock();
+  return out;
+}
+inline ostream& operator<<(ostream& out, _dendl_t) {
+  out << endl;
+  _dout_lock.Unlock();
+  return out;
+}
+
+// generic macros
+#define generic_dout(x) if ((x) <= g_conf.debug) std::cout << dbeginl
+#define generic_derr(x) if ((x) <= g_conf.debug) std::cerr << dbeginl
+
+#define pdout(x,p) if ((x) <= (p)) std::cout << dbeginl
 
 #endif
index 4f3c8ab71a19f667572db9141abd5c7441fcdfd7..958959d090b0d93511b163041da7e4fd810d7a6c 100644 (file)
@@ -46,7 +46,7 @@ class C_Debug : public Context {
   void finish(int) {
     int size = &g_conf.debug_after - &g_conf.debug;
     memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
-    dout(0) << "debug_after flipping debug settings" << endl;
+    cout << "debug_after flipping debug settings" << endl;
   }
 };
 
diff --git a/trunk/ceph/debug.h b/trunk/ceph/debug.h
deleted file mode 100644 (file)
index 93d484d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-#ifndef __DEBUG_H
-#define __DEBUG_H
-
-#include "config.h"
-
-#undef dout
-
-/**
- * for cleaner output, bracket each line with
- * dbeginl (in the dout macro) and dendl (in place of endl).
- */
-extern Mutex _dout_lock;
-struct _dbeginl_t {
-  _dbeginl_t(int) {}
-};
-struct _dendl_t {
-  _dendl_t(int) {}
-};
-static const _dbeginl_t dbeginl = 0;
-static const _dendl_t dendl = 0;
-
-inline ostream& operator<<(ostream& out, _dbeginl_t) {
-  _dout_lock.Lock();
-  return out;
-}
-inline ostream& operator<<(ostream& out, _dendl_t) {
-  out << endl;
-  _dout_lock.Unlock();
-  return out;
-}
-
-#endif
index 7d6ed57d05acf3dc6d9ea9ea21bc248871bfe4aa..e1e5ff3fc311b0846cd015c208955c538786b082 100644 (file)
@@ -17,7 +17,6 @@
 #include "Allocator.h"
 #include "Ebofs.h"
 
-#include "debug.h"
 
 #undef dout
 #define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << fs->dev.get_device_name() << ").allocator."
@@ -56,7 +55,7 @@ void Allocator::dump_freelist()
           if (cursor.move_right() <= 0) break;
         }
       } else {
-        //cout << "  empty" << dendl;
+        //dout(0) << "  empty" << dendl;
       }
     }
     
index bd65ea8cd2179e0a2718bd8abfd2c0491a30f650..447927695a7794e8be54455b9a966defac920554 100644 (file)
@@ -38,7 +38,6 @@
 #endif
 #endif
 
-#include "debug.h"
 
 
 /*******************************************
index ee3cf52cd379a2c2d6498634697d611319ddf816..399d561891d0491f0272fe341eac74256394e1cc 100644 (file)
@@ -17,7 +17,6 @@
 #include "BufferCache.h"
 #include "Onode.h"
 
-#include "debug.h"
 
 /*********** BufferHead **************/
 
index 3050ce8d0e3b69efe9e0d699c2ed73948fab52ac..9b46ae9e87612ca4aa9708164d44a6423bbae07c 100644 (file)
@@ -29,7 +29,6 @@
 
 // *******************
 
-#include "debug.h"
 #define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
 #define derr(x) if (x <= g_conf.debug_ebofs) cerr << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
 
@@ -673,7 +672,7 @@ Onode* Ebofs::get_onode(object_t oid)
       // yay
       Onode *on = onode_map[oid];
       on->get();
-      //cout << "get_onode " << *on << dendl;
+      //dout(0) << "get_onode " << *on << dendl;
       return on;   
     }
     
@@ -771,7 +770,7 @@ Onode* Ebofs::get_onode(object_t oid)
     waitfor_onode.erase(oid);   // remove Cond list
     
     on->get();
-    //cout << "get_onode " << *on << " (loaded)" << dendl;
+    //dout(0) << "get_onode " << *on << " (loaded)" << dendl;
     return on;
   }
 }
@@ -925,10 +924,10 @@ void Ebofs::remove_onode(Onode *on)
 void Ebofs::put_onode(Onode *on)
 {
   on->put();
-  //cout << "put_onode " << *on << dendl;
+  //dout(0) << "put_onode " << *on << dendl;
   
   if (on->get_ref_count() == 0 && on->dangling) {
-    //cout << " *** hosing on " << *on << dendl;
+    //dot(0) << " *** hosing on " << *on << dendl;
     delete on;
   }
 }
@@ -1507,12 +1506,12 @@ void Ebofs::alloc_write(Onode *on,
     // verify
     interval_set<block_t> ta;
     ta.intersection_of(on->uncommitted, alloc);
-    cout << " ta " << ta << dendl;
+    dout(0) << " ta " << ta << dendl;
     assert(alloc == ta);
 
     interval_set<block_t> tb;
     tb.intersection_of(on->uncommitted, old);
-    cout << " tb " << tb << dendl;
+    dout(0) << " tb " << tb << dendl;
     assert(old == tb);
   }
 
index 1050724459d74c8c8c27f9fd80203ec240015e66..1a23256d4f97ec189de58c9f6a665b25d65a899a 100644 (file)
@@ -22,9 +22,7 @@
 
 
 #include "config.h"
-#include "debug.h"
 
-#undef dout
 #define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
 #define derr(x) if (x <= g_conf.debug_ebofs) cerr << dbeginl << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
 
index 8a10eed44cbad287ce58647690bcf3d0d3e4b7cc..5fbddba89b82c4d701f6b6f9e29289a08cd3cd72 100644 (file)
@@ -200,10 +200,10 @@ int main(int argc, char **argv)
       utime_t end = g_clock.now();
       end -= start;
 
-      dout(1) << "elapsed " << end << endl;
+      cout << "elapsed " << end << endl;
       
       float mbs = (float)megs / (float)end;
-      dout(1) << "mb/s " << mbs << endl;
+      cout << "mb/s " << mbs << endl;
     }
     
     if (0) {  // test
index 0efbecd123b3f1753342333392f25a4d420340bc..765a3fe546900dd0017855c6976dd889918e352d 100644 (file)
@@ -403,13 +403,13 @@ class NodePool {
 
  public:
   void commit_start(BlockDevice& dev, version_t version) {
-    dout(20) << "ebofs.nodepool.commit_start start" << endl;
+    generic_dout(20) << "ebofs.nodepool.commit_start start" << dendl;
 
     assert(flushing == 0);
     /*if (0)
       for (unsigned i=0; i<region_loc.size(); i++) {
         int c = dev.count_io(region_loc[i].start, region_loc[i].length);
-        dout(20) << "ebofs.nodepool.commit_start  region " << region_loc[i] << " has " << c << " ios" << endl;
+        generic_dout(20) << "ebofs.nodepool.commit_start  region " << region_loc[i] << " has " << c << " ios" << dendl;
         assert(c == 0);
       }
     */
@@ -457,13 +457,13 @@ class NodePool {
     }
     limbo.clear();
 
-    dout(20) << "ebofs.nodepool.commit_start finish" << endl;
+    generic_dout(20) << "ebofs.nodepool.commit_start finish" << dendl;
   }
 
   void commit_wait() {
     while (flushing > 0) 
       commit_cond.Wait(ebofs_lock);
-    dout(20) << "ebofs.nodepool.commit_wait finish" << endl;
+    generic_dout(20) << "ebofs.nodepool.commit_wait finish" << dendl;
   }
 
 
index edc5f410491df081b8456f1f15d11e4c3b77974f..231683bc2fe70b4168dae0c1ca716583e849f0c5 100644 (file)
@@ -49,12 +49,12 @@ inline void finish_contexts(std::list<Context*>& finished,
 
   ls.swap(finished); // swap out of place to avoid weird loops
 
-  dout(10) << ls.size() << " contexts to finish with " << result << endl;
+  generic_dout(10) << ls.size() << " contexts to finish with " << result << dendl;
   for (std::list<Context*>::iterator it = ls.begin(); 
        it != ls.end(); 
        it++) {
     Context *c = *it;
-    dout(10) << "---- " << c << endl;
+    generic_dout(10) << "---- " << c << dendl;
     c->finish(result);
     delete c;
   }
index cb8d08c58ae9c5f064bbb3959f446b53a50c06f8..677193908c21b8aa8b46767d710670783956c12d 100644 (file)
@@ -307,7 +307,7 @@ class LRU {
 
 
   void lru_status() {
-    dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << endl;
+    generic_dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << dendl;
   }
 
 };
index 13182f1cadf958d29135ebce87daf96cb7c7fb2c..f2f1f17e37a4f7ac5b6581ef3f5c3b20b8c03a37 100644 (file)
@@ -31,9 +31,9 @@ using std::endl;
 #include "messages/MAnchor.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
-#define derr(x)  if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
+
+#define dout(x)  if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
+#define derr(x)  if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
 
 
 void AnchorClient::dispatch(Message *m)
@@ -53,7 +53,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
   inodeno_t ino = m->get_ino();
   version_t atid = m->get_atid();
 
-  dout(10) << "handle_anchor_reply " << *m << endl;
+  dout(10) << "handle_anchor_reply " << *m << dendl;
 
   switch (m->get_op()) {
 
@@ -75,7 +75,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
     // prepare -> agree
   case ANCHOR_OP_CREATE_AGREE:
     if (pending_create_prepare.count(ino)) {
-      dout(10) << "got create_agree on " << ino << " atid " << atid << endl;
+      dout(10) << "got create_agree on " << ino << " atid " << atid << dendl;
       Context *onfinish = pending_create_prepare[ino].onfinish;
       *pending_create_prepare[ino].patid = atid;
       pending_create_prepare.erase(ino);
@@ -91,7 +91,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray create_agree on " << ino
               << " atid " << atid
               << ", already committing, resending COMMIT"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -101,7 +101,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray create_agree on " << ino
               << " atid " << atid
               << ", sending ROLLBACK"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -111,7 +111,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
 
   case ANCHOR_OP_DESTROY_AGREE:
     if (pending_destroy_prepare.count(ino)) {
-      dout(10) << "got destroy_agree on " << ino << " atid " << atid << endl;
+      dout(10) << "got destroy_agree on " << ino << " atid " << atid << dendl;
       Context *onfinish = pending_destroy_prepare[ino].onfinish;
       *pending_destroy_prepare[ino].patid = atid;
       pending_destroy_prepare.erase(ino);
@@ -127,7 +127,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray destroy_agree on " << ino
               << " atid " << atid
               << ", already committing, resending COMMIT"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -137,7 +137,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray destroy_agree on " << ino
               << " atid " << atid
               << ", sending ROLLBACK"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -147,7 +147,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
 
   case ANCHOR_OP_UPDATE_AGREE:
     if (pending_update_prepare.count(ino)) {
-      dout(10) << "got update_agree on " << ino << " atid " << atid << endl;
+      dout(10) << "got update_agree on " << ino << " atid " << atid << dendl;
       Context *onfinish = pending_update_prepare[ino].onfinish;
       *pending_update_prepare[ino].patid = atid;
       pending_update_prepare.erase(ino);
@@ -163,7 +163,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray update_agree on " << ino
               << " atid " << atid
               << ", already committing, resending COMMIT"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -173,7 +173,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
       dout(10) << "stray update_agree on " << ino
               << " atid " << atid
               << ", sending ROLLBACK"
-              << endl;      
+              << dendl;      
       MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
       mds->messenger->send_message(req, 
                                   mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
@@ -184,7 +184,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
     // commit -> ack
   case ANCHOR_OP_ACK:
     {
-      dout(10) << "got ack on atid " << atid << ", logging" << endl;
+      dout(10) << "got ack on atid " << atid << ", logging" << dendl;
 
       // remove from committing list
       assert(pending_commit.count(atid));
@@ -195,7 +195,7 @@ void AnchorClient::handle_anchor_reply(class MAnchor *m)
 
       // kick any waiters
       if (ack_waiters.count(atid)) {
-       dout(15) << "kicking waiters on atid " << atid << endl;
+       dout(15) << "kicking waiters on atid " << atid << dendl;
        mds->queue_waiters(ack_waiters[atid]);
        ack_waiters.erase(atid);
       }
@@ -241,7 +241,7 @@ void AnchorClient::lookup(inodeno_t ino, vector<Anchor>& trace, Context *onfinis
 void AnchorClient::prepare_create(inodeno_t ino, vector<Anchor>& trace, 
                                  version_t *patid, Context *onfinish)
 {
-  dout(10) << "prepare_create " << ino << " " << trace << endl;
+  dout(10) << "prepare_create " << ino << " " << trace << dendl;
 
   // send message
   MAnchor *req = new MAnchor(ANCHOR_OP_CREATE_PREPARE, ino);
@@ -259,7 +259,7 @@ void AnchorClient::prepare_create(inodeno_t ino, vector<Anchor>& trace,
 void AnchorClient::prepare_destroy(inodeno_t ino, 
                                  version_t *patid, Context *onfinish)
 {
-  dout(10) << "prepare_destroy " << ino << endl;
+  dout(10) << "prepare_destroy " << ino << dendl;
 
   // send message
   MAnchor *req = new MAnchor(ANCHOR_OP_DESTROY_PREPARE, ino);
@@ -274,7 +274,7 @@ void AnchorClient::prepare_destroy(inodeno_t ino,
 void AnchorClient::prepare_update(inodeno_t ino, vector<Anchor>& trace, 
                                  version_t *patid, Context *onfinish)
 {
-  dout(10) << "prepare_update " << ino << " " << trace << endl;
+  dout(10) << "prepare_update " << ino << " " << trace << dendl;
 
   // send message
   MAnchor *req = new MAnchor(ANCHOR_OP_UPDATE_PREPARE, ino);
@@ -294,7 +294,7 @@ void AnchorClient::prepare_update(inodeno_t ino, vector<Anchor>& trace,
 
 void AnchorClient::commit(version_t atid)
 {
-  dout(10) << "commit " << atid << endl;
+  dout(10) << "commit " << atid << dendl;
 
   assert(pending_commit.count(atid));
   pending_commit.insert(atid);
@@ -312,7 +312,7 @@ void AnchorClient::commit(version_t atid)
 
 void AnchorClient::finish_recovery()
 {
-  dout(7) << "finish_recovery" << endl;
+  dout(7) << "finish_recovery" << dendl;
 
   resend_commits();
 }
@@ -322,7 +322,7 @@ void AnchorClient::resend_commits()
   for (set<version_t>::iterator p = pending_commit.begin();
        p != pending_commit.end();
        ++p) {
-    dout(10) << "resending commit on " << *p << endl;
+    dout(10) << "resending commit on " << *p << dendl;
     MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, *p);
     mds->send_message_mds(req, 
                          mds->mdsmap->get_anchortable(),
@@ -335,7 +335,7 @@ void AnchorClient::resend_prepares(hash_map<inodeno_t, _pending_prepare>& prepar
   for (hash_map<inodeno_t, _pending_prepare>::iterator p = prepares.begin();
        p != prepares.end();
        p++) {
-    dout(10) << "resending " << get_anchor_opname(op) << " on " << p->first << endl;
+    dout(10) << "resending " << get_anchor_opname(op) << " on " << p->first << dendl;
     MAnchor *req = new MAnchor(op, p->first);
     req->set_trace(p->second.trace);
     mds->send_message_mds(req, 
@@ -347,7 +347,7 @@ void AnchorClient::resend_prepares(hash_map<inodeno_t, _pending_prepare>& prepar
 
 void AnchorClient::handle_mds_recovery(int who)
 {
-  dout(7) << "handle_mds_recovery mds" << who << endl;
+  dout(7) << "handle_mds_recovery mds" << who << dendl;
 
   if (who != mds->mdsmap->get_anchortable()) 
     return; // do nothing.
@@ -356,7 +356,7 @@ void AnchorClient::handle_mds_recovery(int who)
   for (hash_map<inodeno_t, _pending_lookup>::iterator p = pending_lookup.begin();
        p != pending_lookup.end();
        p++) {
-    dout(10) << "resending lookup on " << p->first << endl;
+    dout(10) << "resending lookup on " << p->first << dendl;
     mds->send_message_mds(new MAnchor(ANCHOR_OP_LOOKUP, p->first),
                          mds->mdsmap->get_anchortable(),
                          MDS_PORT_ANCHORTABLE, MDS_PORT_ANCHORCLIENT);
index fbf866e5a7aa1dfc62e2bf7b7583197e996523c0..fb062375ce12e50bb61fc0af69a39cc0edfd5be0 100644 (file)
 #include "events/EAnchor.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
-#define derr(x)  if (x <= g_conf.debug_mds) cerr << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
+
+#define dout(x)  if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
+#define derr(x)  if (x <= g_conf.debug_mds) cerr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
 
 
 void AnchorTable::dump()
 {
-  dout(7) << "dump v " << version << endl;
+  dout(7) << "dump v " << version << dendl;
   for (hash_map<inodeno_t, Anchor>::iterator it = anchor_map.begin();
        it != anchor_map.end();
        it++) 
-    dout(15) << "dump " << it->second << endl;
+    dout(15) << "dump " << it->second << dendl;
 }
 
 
@@ -47,7 +47,7 @@ void AnchorTable::dump()
 
 bool AnchorTable::add(inodeno_t ino, dirfrag_t dirfrag) 
 {
-  //dout(17) << "add " << ino << " dirfrag " << dirfrag << endl;
+  //dout(17) << "add " << ino << " dirfrag " << dirfrag << dendl;
   
   // parent should be there
   assert(dirfrag.ino < MDS_INO_BASE ||     // system dirino
@@ -56,17 +56,17 @@ bool AnchorTable::add(inodeno_t ino, dirfrag_t dirfrag)
   if (anchor_map.count(ino) == 0) {
     // new item
     anchor_map[ino] = Anchor(ino, dirfrag);
-    dout(7) << "add added " << anchor_map[ino] << endl;
+    dout(7) << "add added " << anchor_map[ino] << dendl;
     return true;
   } else {
-    dout(7) << "add had " << anchor_map[ino] << endl;
+    dout(7) << "add had " << anchor_map[ino] << dendl;
     return false;
   }
 }
 
 void AnchorTable::inc(inodeno_t ino)
 {
-  dout(7) << "inc " << ino << endl;
+  dout(7) << "inc " << ino << dendl;
 
   assert(anchor_map.count(ino));
 
@@ -74,7 +74,7 @@ void AnchorTable::inc(inodeno_t ino)
     Anchor &anchor = anchor_map[ino];
     anchor.nref++;
       
-    dout(10) << "inc now " << anchor << endl;
+    dout(10) << "inc now " << anchor << dendl;
     ino = anchor.dirfrag.ino;
     
     if (ino == 0) break;
@@ -84,7 +84,7 @@ void AnchorTable::inc(inodeno_t ino)
 
 void AnchorTable::dec(inodeno_t ino) 
 {
-  dout(7) << "dec " << ino << endl;
+  dout(7) << "dec " << ino << dendl;
   assert(anchor_map.count(ino));
 
   while (true) {
@@ -92,12 +92,12 @@ void AnchorTable::dec(inodeno_t ino)
     anchor.nref--;
       
     if (anchor.nref == 0) {
-      dout(10) << "dec removing " << anchor << endl;
+      dout(10) << "dec removing " << anchor << dendl;
       dirfrag_t dirfrag = anchor.dirfrag;
       anchor_map.erase(ino);
       ino = dirfrag.ino;
     } else {
-      dout(10) << "dec now " << anchor << endl;
+      dout(10) << "dec now " << anchor << dendl;
       ino = anchor.dirfrag.ino;
     }
     
@@ -117,14 +117,14 @@ void AnchorTable::dec(inodeno_t ino)
 void AnchorTable::handle_lookup(MAnchor *req)
 {
   inodeno_t ino = req->get_ino();
-  dout(7) << "handle_lookup " << ino << endl;
+  dout(7) << "handle_lookup " << ino << dendl;
 
   assert(anchor_map.count(ino) == 1);
   Anchor &anchor = anchor_map[ino];
 
   vector<Anchor> trace;
   while (true) {
-    dout(10) << "handle_lookup  adding " << anchor << endl;
+    dout(10) << "handle_lookup  adding " << anchor << dendl;
     trace.insert(trace.begin(), anchor);  // lame FIXME
 
     if (anchor.dirfrag.ino < MDS_INO_BASE) break;
@@ -177,13 +177,13 @@ void AnchorTable::update_prepare(inodeno_t ino, vector<Anchor>& trace, int reqmd
 void AnchorTable::commit(version_t atid) 
 {
   if (pending_create.count(atid)) {
-    dout(7) << "commit " << atid << " create " << pending_create[atid] << endl;
+    dout(7) << "commit " << atid << " create " << pending_create[atid] << dendl;
     pending_create.erase(atid);
   } 
 
   else if (pending_destroy.count(atid)) {
     inodeno_t ino = pending_destroy[atid];
-    dout(7) << "commit " << atid << " destroy " << ino << endl;
+    dout(7) << "commit " << atid << " destroy " << ino << dendl;
     
     dec(ino);  // destroy
     
@@ -194,7 +194,7 @@ void AnchorTable::commit(version_t atid)
     inodeno_t ino = pending_update[atid].first;
     vector<Anchor> &trace = pending_update[atid].second;
     
-    dout(7) << "commit " << atid << " update " << ino << endl;
+    dout(7) << "commit " << atid << " update " << ino << dendl;
 
     // remove old
     dec(ino);
@@ -220,20 +220,20 @@ void AnchorTable::rollback(version_t atid)
 {
   if (pending_create.count(atid)) {
     inodeno_t ino = pending_create[atid];
-    dout(7) << "rollback " << atid << " create " << ino << endl;
+    dout(7) << "rollback " << atid << " create " << ino << dendl;
     dec(ino);
     pending_create.erase(atid);
   } 
 
   else if (pending_destroy.count(atid)) {
     inodeno_t ino = pending_destroy[atid];
-    dout(7) << "rollback " << atid << " destroy " << ino << endl;
+    dout(7) << "rollback " << atid << " destroy " << ino << dendl;
     pending_destroy.erase(atid);
   }
 
   else if (pending_update.count(atid)) {
     inodeno_t ino = pending_update[atid].first;
-    dout(7) << "rollback " << atid << " update " << ino << endl;
+    dout(7) << "rollback " << atid << " update " << ino << dendl;
     pending_update.erase(atid);
   }
   else
@@ -268,7 +268,7 @@ void AnchorTable::handle_create_prepare(MAnchor *req)
   inodeno_t ino = req->get_ino();
   vector<Anchor>& trace = req->get_trace();
 
-  dout(7) << "handle_create_prepare " << ino << endl;
+  dout(7) << "handle_create_prepare " << ino << dendl;
   
   create_prepare(ino, trace, req->get_source().num());
 
@@ -282,7 +282,7 @@ void AnchorTable::handle_create_prepare(MAnchor *req)
 void AnchorTable::_create_prepare_logged(MAnchor *req, version_t atid)
 {
   inodeno_t ino = req->get_ino();
-  dout(7) << "_create_prepare_logged " << ino << " atid " << atid << endl;
+  dout(7) << "_create_prepare_logged " << ino << " atid " << atid << dendl;
 
   // reply
   MAnchor *reply = new MAnchor(ANCHOR_OP_CREATE_AGREE, ino, atid);
@@ -311,7 +311,7 @@ public:
 void AnchorTable::handle_destroy_prepare(MAnchor *req)
 {
   inodeno_t ino = req->get_ino();
-  dout(7) << "handle_destroy_prepare " << ino << endl;
+  dout(7) << "handle_destroy_prepare " << ino << dendl;
 
   destroy_prepare(ino, req->get_source().num());
 
@@ -322,7 +322,7 @@ void AnchorTable::handle_destroy_prepare(MAnchor *req)
 void AnchorTable::_destroy_prepare_logged(MAnchor *req, version_t atid)
 {
   inodeno_t ino = req->get_ino();
-  dout(7) << "_destroy_prepare_logged " << ino << " atid " << atid << endl;
+  dout(7) << "_destroy_prepare_logged " << ino << " atid " << atid << dendl;
 
   // reply
   MAnchor *reply = new MAnchor(ANCHOR_OP_DESTROY_AGREE, ino, atid);
@@ -351,7 +351,7 @@ void AnchorTable::handle_update_prepare(MAnchor *req)
   inodeno_t ino = req->get_ino();
   vector<Anchor>& trace = req->get_trace();
 
-  dout(7) << "handle_update_prepare " << ino << endl;
+  dout(7) << "handle_update_prepare " << ino << dendl;
   
   update_prepare(ino, trace, req->get_source().num());
 
@@ -365,7 +365,7 @@ void AnchorTable::handle_update_prepare(MAnchor *req)
 void AnchorTable::_update_prepare_logged(MAnchor *req, version_t atid)
 {
   inodeno_t ino = req->get_ino();
-  dout(7) << "_update_prepare_logged " << ino << " atid " << atid << endl;
+  dout(7) << "_update_prepare_logged " << ino << " atid " << atid << dendl;
 
   // reply
   MAnchor *reply = new MAnchor(ANCHOR_OP_UPDATE_AGREE, ino, atid);
@@ -391,7 +391,7 @@ public:
 void AnchorTable::handle_commit(MAnchor *req)
 {
   version_t atid = req->get_atid();
-  dout(7) << "handle_commit " << atid << endl;
+  dout(7) << "handle_commit " << atid << dendl;
   
   if (pending_create.count(atid) ||
       pending_destroy.count(atid) ||
@@ -402,7 +402,7 @@ void AnchorTable::handle_commit(MAnchor *req)
   else if (atid <= version) {
     dout(0) << "got commit for atid " << atid << " <= " << version 
            << ", already committed, sending ack." 
-           << endl;
+           << dendl;
     MAnchor *reply = new MAnchor(ANCHOR_OP_ACK, 0, atid);
     mds->messenger->send_message(reply, req->get_source_inst(), req->get_source_port());
     delete req;
@@ -410,7 +410,7 @@ void AnchorTable::handle_commit(MAnchor *req)
   } 
   else {
     // wtf.
-    dout(0) << "got commit for atid " << atid << " > " << version << endl;
+    dout(0) << "got commit for atid " << atid << " > " << version << dendl;
     assert(atid <= version);
   }
   
@@ -421,7 +421,7 @@ void AnchorTable::handle_commit(MAnchor *req)
 
 void AnchorTable::_commit_logged(MAnchor *req)
 {
-  dout(7) << "_commit_logged, sending ACK" << endl;
+  dout(7) << "_commit_logged, sending ACK" << dendl;
   MAnchor *reply = new MAnchor(ANCHOR_OP_ACK, req->get_ino(), req->get_atid());
   mds->messenger->send_message(reply, req->get_source_inst(), req->get_source_port());
   delete req;
@@ -434,7 +434,7 @@ void AnchorTable::_commit_logged(MAnchor *req)
 void AnchorTable::handle_rollback(MAnchor *req)
 {
   version_t atid = req->get_atid();
-  dout(7) << "handle_rollback " << atid << endl;
+  dout(7) << "handle_rollback " << atid << dendl;
   rollback(atid);
   delete req;
 }
@@ -462,7 +462,7 @@ void AnchorTable::handle_anchor_request(class MAnchor *req)
 {
   // make sure i'm open!
   if (!opened) {
-    dout(7) << "not open yet" << endl;
+    dout(7) << "not open yet" << dendl;
     
     waiting_for_open.push_back(new C_MDS_RetryMessage(mds, req));
     
@@ -473,7 +473,7 @@ void AnchorTable::handle_anchor_request(class MAnchor *req)
     return;
   }
 
-  dout(10) << "handle_anchor_request " << *req << endl;
+  dout(10) << "handle_anchor_request " << *req << dendl;
 
   // go
   switch (req->get_op()) {
@@ -525,7 +525,7 @@ public:
 
 void AnchorTable::save(Context *onfinish)
 {
-  dout(7) << "save v " << version << endl;
+  dout(7) << "save v " << version << dendl;
   if (!opened) {
     assert(!onfinish);
     return;
@@ -535,7 +535,7 @@ void AnchorTable::save(Context *onfinish)
     waiting_for_save[version].push_back(onfinish);
 
   if (committing_version == version) {
-    dout(7) << "save already committing v " << version << endl;
+    dout(7) << "save already committing v " << version << dendl;
     return;
   }
   committing_version = version;
@@ -555,7 +555,7 @@ void AnchorTable::save(Context *onfinish)
        it != anchor_map.end();
        it++) {
     it->second._encode(bl);
-    dout(15) << "save encoded " << it->second << endl;
+    dout(15) << "save encoded " << it->second << dendl;
   }
 
   // pending
@@ -584,7 +584,7 @@ void AnchorTable::save(Context *onfinish)
 
 void AnchorTable::_saved(version_t v)
 {
-  dout(7) << "_saved v " << v << endl;
+  dout(7) << "_saved v " << v << dendl;
 
   assert(v <= committing_version);
   assert(committed_version < v);
@@ -609,7 +609,7 @@ public:
 
 void AnchorTable::load(Context *onfinish)
 {
-  dout(7) << "load" << endl;
+  dout(7) << "load" << dendl;
   assert(!opened);
 
   waiting_for_open.push_back(onfinish);
@@ -624,7 +624,7 @@ void AnchorTable::load(Context *onfinish)
 
 void AnchorTable::_loaded(bufferlist& bl)
 {
-  dout(10) << "_loaded got " << bl.length() << " bytes" << endl;
+  dout(10) << "_loaded got " << bl.length() << " bytes" << dendl;
 
   int off = 0;
   bl.copy(off, sizeof(version), (char*)&version);
@@ -638,7 +638,7 @@ void AnchorTable::_loaded(bufferlist& bl)
     Anchor a;
     a._decode(bl, off);
     anchor_map[a.ino] = a;   
-    dout(15) << "load_2 decoded " << a << endl;
+    dout(15) << "load_2 decoded " << a << dendl;
   }
 
   ::_decode(pending_reqmds, bl, off);
@@ -674,7 +674,7 @@ void AnchorTable::_loaded(bufferlist& bl)
 
 void AnchorTable::finish_recovery()
 {
-  dout(7) << "finish_recovery" << endl;
+  dout(7) << "finish_recovery" << dendl;
   
   // resend agrees for everyone.
   for (map<version_t,int>::iterator p = pending_reqmds.begin();
@@ -703,7 +703,7 @@ void AnchorTable::resend_agree(version_t v, int who)
 
 void AnchorTable::handle_mds_recovery(int who)
 {
-  dout(7) << "handle_mds_recovery mds" << who << endl;
+  dout(7) << "handle_mds_recovery mds" << who << dendl;
   
   // resend agrees for recovered mds
   for (map<version_t,int>::iterator p = pending_reqmds.begin();
index 4e499c484e06f7ccf4666a2128b3913e35ed7351..79faf69802762ab35b87886b625221b0306ed5bf 100644 (file)
@@ -26,8 +26,9 @@
 
 #include <cassert>
 
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
+
+
 
 ostream& CDentry::print_db_line_prefix(ostream& out) 
 {
@@ -129,7 +130,7 @@ void CDentry::add_waiter(int tag, Context *c)
 version_t CDentry::pre_dirty(version_t min)
 {
   projected_version = dir->pre_dirty(min);
-  dout(10) << " pre_dirty " << *this << endl;
+  dout(10) << " pre_dirty " << *this << dendl;
   return projected_version;
 }
 
@@ -146,7 +147,7 @@ void CDentry::_mark_dirty()
 
 void CDentry::mark_dirty(version_t pv) 
 {
-  dout(10) << " mark_dirty " << *this << endl;
+  dout(10) << " mark_dirty " << *this << dendl;
 
   // i now live in this new dir version
   assert(pv <= projected_version);
@@ -160,7 +161,7 @@ void CDentry::mark_dirty(version_t pv)
 
 void CDentry::mark_clean() 
 {
-  dout(10) << " mark_clean " << *this << endl;
+  dout(10) << " mark_clean " << *this << dendl;
   assert(is_dirty());
   assert(version <= dir->get_version());
 
@@ -175,7 +176,7 @@ void CDentry::mark_clean()
 
 void CDentry::mark_new() 
 {
-  dout(10) << " mark_new " << *this << endl;
+  dout(10) << " mark_new " << *this << dendl;
   state_set(STATE_NEW);
 }
 
@@ -216,7 +217,7 @@ void CDentry::make_anchor_trace(vector<Anchor>& trace, CInode *in)
 
   // add this inode (in my dirfrag) to the end
   trace.push_back(Anchor(in->ino(), dir->dirfrag()));
-  dout(10) << "make_anchor_trace added " << trace.back() << endl;
+  dout(10) << "make_anchor_trace added " << trace.back() << dendl;
 }
 
 
@@ -328,7 +329,7 @@ void CDentry::decode_lock_state(int type, bufferlist& bl)
     // newly linked?
     if (is_null() && !is_auth()) {
       // force trim from cache!
-      dout(10) << "decode_lock_state replica dentry null -> non-null, must trim" << endl;
+      dout(10) << "decode_lock_state replica dentry null -> non-null, must trim" << dendl;
       //assert(get_num_ref() == 0);
     } else {
       // verify?
index 8bdb45378036601051beb7ce506b7b3bf928277e..d6bf3d1bcddf2eca5ec110429b5bea4f85e4cc97 100644 (file)
 
 #include <cassert>
 
+#include "config.h"
+
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
+//#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache." << *this << " "
+
+
+
 
 // PINS
 //int cdir_pins[CDIR_NUM_PINS] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
@@ -98,10 +105,6 @@ void CDir::print(ostream& out)
 }
 
 
-#include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
-//#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache." << *this << " "
 
 
 ostream& CDir::print_db_line_prefix(ostream& out) 
@@ -174,7 +177,7 @@ CDentry* CDir::add_null_dentry(const string& dname)
   items[dn->name] = dn;
   nnull++;
 
-  dout(12) << "add_null_dentry " << *dn << endl;
+  dout(12) << "add_null_dentry " << *dn << dendl;
 
   // pin?
   if (nnull + nitems == 1) get(PIN_CHILD);
@@ -206,7 +209,7 @@ CDentry* CDir::add_primary_dentry(const string& dname, CInode *in)
   items[dn->name] = dn;
   link_inode_work( dn, in );
 
-  dout(12) << "add_primary_dentry " << *dn << endl;
+  dout(12) << "add_primary_dentry " << *dn << dendl;
 
   // pin?
   if (nnull + nitems == 1) get(PIN_CHILD);
@@ -237,7 +240,7 @@ CDentry* CDir::add_remote_dentry(const string& dname, inodeno_t ino, unsigned ch
   items[dn->name] = dn;
   nitems++;
 
-  dout(12) << "add_remote_dentry " << *dn << endl;
+  dout(12) << "add_remote_dentry " << *dn << dendl;
 
   // pin?
   if (nnull + nitems == 1) get(PIN_CHILD);
@@ -251,7 +254,7 @@ CDentry* CDir::add_remote_dentry(const string& dname, inodeno_t ino, unsigned ch
 
 void CDir::remove_dentry(CDentry *dn) 
 {
-  dout(12) << "remove_dentry " << *dn << endl;
+  dout(12) << "remove_dentry " << *dn << dendl;
 
   if (dn->inode) {
     // detach inode and dentry
@@ -283,7 +286,7 @@ void CDir::remove_dentry(CDentry *dn)
 
 void CDir::link_remote_inode(CDentry *dn, inodeno_t ino, unsigned char d_type)
 {
-  dout(12) << "link_inode " << *dn << " remote " << ino << endl;
+  dout(12) << "link_inode " << *dn << " remote " << ino << dendl;
 
   assert(dn->is_null());
   dn->set_remote(ino, d_type);
@@ -298,7 +301,7 @@ void CDir::link_remote_inode(CDentry *dn, inodeno_t ino, unsigned char d_type)
 
 void CDir::link_primary_inode(CDentry *dn, CInode *in)
 {
-  dout(12) << "link_primary_inode " << *dn << " " << *in << endl;
+  dout(12) << "link_primary_inode " << *dn << " " << *in << dendl;
   assert(!dn->is_remote());
 
   link_inode_work(dn,in);
@@ -335,9 +338,9 @@ void CDir::link_inode_work( CDentry *dn, CInode *in)
 void CDir::unlink_inode( CDentry *dn )
 {
   if (dn->is_remote()) {
-    dout(12) << "unlink_inode " << *dn << endl;
+    dout(12) << "unlink_inode " << *dn << dendl;
   } else {
-    dout(12) << "unlink_inode " << *dn << " " << *dn->inode << endl;
+    dout(12) << "unlink_inode " << *dn << " " << *dn->inode << dendl;
   }
 
   dn->clear_dir_offset();
@@ -364,7 +367,7 @@ void CDir::try_remove_unlinked_dn(CDentry *dn)
 
   // was the dn new?  or is the dir complete (i.e. we don't need negatives)? 
   if (dn->is_new() || is_complete()) {
-    dout(10) << "try_remove_unlinked_dn " << *dn << " in " << *this << endl;
+    dout(10) << "try_remove_unlinked_dn " << *dn << " in " << *this << dendl;
     dn->mark_clean();
     remove_dentry(dn);
 
@@ -373,7 +376,7 @@ void CDir::try_remove_unlinked_dn(CDentry *dn)
        num_dirty == 0) {
       dout(10) << "try_remove_unlinked_dn committed_equivalent now " << version 
               << " vs committed " << committed_version
-              << endl;
+              << dendl;
       committed_version_equivalent = committed_version;    
     }
   }
@@ -412,7 +415,7 @@ void CDir::unlink_inode_work( CDentry *dn )
 }
 
 void CDir::remove_null_dentries() {
-  dout(12) << "remove_null_dentries " << *this << endl;
+  dout(12) << "remove_null_dentries " << *this << dendl;
 
   list<CDentry*> dns;
   for (CDir_map_t::iterator it = items.begin();
@@ -441,7 +444,7 @@ void CDir::remove_null_dentries() {
  */
 void CDir::steal_dentry(CDentry *dn)
 {
-  dout(15) << "steal_dentry " << *dn << endl;
+  dout(15) << "steal_dentry " << *dn << dendl;
 
   items[dn->name] = dn;
 
@@ -498,7 +501,7 @@ void CDir::init_fragment_pins()
 
 void CDir::split(int bits, list<CDir*>& subs, list<Context*>& waiters)
 {
-  dout(10) << "split by " << bits << " bits on " << *this << endl;
+  dout(10) << "split by " << bits << " bits on " << *this << dendl;
 
   if (cache->mds->logger) cache->mds->logger->inc("dir_sp");
 
@@ -519,7 +522,7 @@ void CDir::split(int bits, list<CDir*>& subs, list<Context*>& waiters)
     f->init_fragment_pins();
     f->version = version;
     f->projected_version = projected_version;
-    dout(10) << " subfrag " << *p << " " << *f << endl;
+    dout(10) << " subfrag " << *p << " " << *f << dendl;
     subfrags[n++] = f;
     subs.push_back(f);
     inode->add_dirfrag(f);
@@ -532,7 +535,7 @@ void CDir::split(int bits, list<CDir*>& subs, list<Context*>& waiters)
     CDentry *dn = p->second;
     frag_t subfrag = inode->pick_dirfrag(p->first);
     int n = subfrag.value() >> frag.bits();
-    dout(15) << " subfrag " << subfrag << " n=" << n << " for " << p->first << endl;
+    dout(15) << " subfrag " << subfrag << " n=" << n << " for " << p->first << dendl;
     CDir *f = subfrags[n];
     f->steal_dentry(dn);
   }
@@ -543,7 +546,7 @@ void CDir::split(int bits, list<CDir*>& subs, list<Context*>& waiters)
 
 void CDir::merge(int bits, list<Context*>& waiters)
 {
-  dout(10) << "merge by " << bits << " bits" << endl;
+  dout(10) << "merge by " << bits << " bits" << dendl;
 
   list<frag_t> frags;
   frag.split(bits, frags);
@@ -551,7 +554,7 @@ void CDir::merge(int bits, list<Context*>& waiters)
   for (list<frag_t>::iterator p = frags.begin(); p != frags.end(); ++p) {
     CDir *dir = inode->get_or_open_dirfrag(cache, *p);
     assert(dir->is_complete());
-    dout(10) << " subfrag " << *p << " " << *dir << endl;
+    dout(10) << " subfrag " << *p << " " << *dir << dendl;
     
     // steal dentries
     while (!dir->items.empty()) 
@@ -599,7 +602,7 @@ void CDir::add_dentry_waiter(const string& dname, Context *c)
   if (waiting_on_dentry.empty())
     get(PIN_DNWAITER);
   waiting_on_dentry[dname].push_back(c);
-  dout(10) << "add_dentry_waiter dentry " << dname << " " << c << " on " << *this << endl;
+  dout(10) << "add_dentry_waiter dentry " << dname << " " << c << " on " << *this << dendl;
 }
 
 void CDir::take_dentry_waiting(const string& dname, list<Context*>& ls)
@@ -608,7 +611,7 @@ void CDir::take_dentry_waiting(const string& dname, list<Context*>& ls)
   if (waiting_on_dentry.count(dname) == 0) return;
   dout(10) << "take_dentry_waiting dentry " << dname
           << " x " << waiting_on_dentry[dname].size() 
-          << " on " << *this << endl;
+          << " on " << *this << dendl;
   ls.splice(ls.end(), waiting_on_dentry[dname]);
   waiting_on_dentry.erase(dname);
   if (waiting_on_dentry.empty())
@@ -625,7 +628,7 @@ void CDir::add_waiter(int tag, Context *c)
     if (!(is_freezing_tree_root() || is_frozen_tree_root() ||
          is_freezing_dir() || is_frozen_dir())) {
       // try parent
-      dout(10) << "add_waiter " << tag << " " << c << " should be ATFREEZEROOT, " << *this << " is not root, trying parent" << endl;
+      dout(10) << "add_waiter " << tag << " " << c << " should be ATFREEZEROOT, " << *this << " is not root, trying parent" << dendl;
       inode->parent->dir->add_waiter(tag, c);
       return;
     }
@@ -635,7 +638,7 @@ void CDir::add_waiter(int tag, Context *c)
   if (tag & WAIT_ATSUBTREEROOT) {
     if (!is_subtree_root()) {
       // try parent
-      dout(10) << "add_waiter " << tag << " " << c << " should be ATSUBTREEROOT, " << *this << " is not root, trying parent" << endl;
+      dout(10) << "add_waiter " << tag << " " << c << " should be ATSUBTREEROOT, " << *this << " is not root, trying parent" << dendl;
       inode->parent->dir->add_waiter(tag, c);
       return;
     }
@@ -665,7 +668,7 @@ void CDir::take_waiting(int mask, list<Context*>& ls)
 
 void CDir::finish_waiting(int mask, int result) 
 {
-  dout(11) << "finish_waiting mask " << hex << mask << dec << " result " << result << " on " << *this << endl;
+  dout(11) << "finish_waiting mask " << hex << mask << dec << " result " << result << " on " << *this << dendl;
 
   list<Context*> finished;
   take_waiting(mask, finished);
@@ -682,7 +685,7 @@ version_t CDir::pre_dirty(version_t min)
   if (min > projected_version) 
     projected_version = min;
   ++projected_version;
-  dout(10) << "pre_dirty " << projected_version << endl;
+  dout(10) << "pre_dirty " << projected_version << dendl;
   return projected_version;
 }
 
@@ -690,10 +693,10 @@ void CDir::_mark_dirty()
 {
   if (!state_test(STATE_DIRTY)) {
     state_set(STATE_DIRTY);
-    dout(10) << "mark_dirty (was clean) " << *this << " version " << version << endl;
+    dout(10) << "mark_dirty (was clean) " << *this << " version " << version << dendl;
     get(PIN_DIRTY);
   } else {
-    dout(10) << "mark_dirty (already dirty) " << *this << " version " << version << endl;
+    dout(10) << "mark_dirty (already dirty) " << *this << " version " << version << dendl;
   }
 }
 
@@ -706,7 +709,7 @@ void CDir::mark_dirty(version_t pv)
 
 void CDir::mark_clean()
 {
-  dout(10) << "mark_clean " << *this << " version " << version << endl;
+  dout(10) << "mark_clean " << *this << " version " << version << dendl;
   if (state_test(STATE_DIRTY)) {
     state_clear(STATE_DIRTY);
     put(PIN_DIRTY);
@@ -749,13 +752,13 @@ class C_Dir_Fetch : public Context {
 
 void CDir::fetch(Context *c, bool ignore_authpinnability)
 {
-  dout(10) << "fetch on " << *this << endl;
+  dout(10) << "fetch on " << *this << dendl;
   
   assert(is_auth());
   assert(!is_complete());
 
   if (!can_auth_pin() && !ignore_authpinnability) {
-    dout(7) << "fetch waiting for authpinnable" << endl;
+    dout(7) << "fetch waiting for authpinnable" << dendl;
     add_waiter(WAIT_AUTHPINNABLE, c);
     return;
   }
@@ -764,7 +767,7 @@ void CDir::fetch(Context *c, bool ignore_authpinnability)
   
   // already fetching?
   if (state_test(CDir::STATE_FETCHING)) {
-    dout(7) << "already fetching; waiting" << endl;
+    dout(7) << "already fetching; waiting" << dendl;
     return;
   }
 
@@ -787,7 +790,7 @@ void CDir::_fetched(bufferlist &bl)
 {
   dout(10) << "_fetched " << bl.length() 
           << " bytes for " << *this
-          << endl;
+          << dendl;
   
   assert(is_auth());
   assert(!is_frozen());
@@ -801,7 +804,7 @@ void CDir::_fetched(bufferlist &bl)
 
   dout(10) << "_fetched version " << got_version
           << ", " << len << " bytes"
-          << endl;
+          << dendl;
   
   int32_t n;
   ::_decode(n, bl, off);
@@ -816,7 +819,7 @@ void CDir::_fetched(bufferlist &bl)
     // dname
     string dname;
     ::_decode(dname, bl, off);
-    dout(24) << "_fetched parsed marker '" << type << "' dname '" << dname << endl;
+    dout(24) << "_fetched parsed marker '" << type << "' dname '" << dname << dendl;
     
     CDentry *dn = lookup(dname);  // existing dentry?
 
@@ -829,9 +832,9 @@ void CDir::_fetched(bufferlist &bl)
 
       if (dn) {
         if (dn->get_inode() == 0) {
-          dout(12) << "_fetched  had NEG dentry " << *dn << endl;
+          dout(12) << "_fetched  had NEG dentry " << *dn << dendl;
         } else {
-          dout(12) << "_fetched  had dentry " << *dn << endl;
+          dout(12) << "_fetched  had dentry " << *dn << dendl;
         }
       } else {
        // (remote) link
@@ -841,9 +844,9 @@ void CDir::_fetched(bufferlist &bl)
        CInode *in = cache->get_inode(ino);   // we may or may not have it.
        if (in) {
          dn->link_remote(in);
-         dout(12) << "_fetched  got remote link " << ino << " which we have " << *in << endl;
+         dout(12) << "_fetched  got remote link " << ino << " which we have " << *in << dendl;
        } else {
-         dout(12) << "_fetched  got remote link " << ino << " (dont' have it)" << endl;
+         dout(12) << "_fetched  got remote link " << ino << " (dont' have it)" << dendl;
        }
       }
     } 
@@ -863,9 +866,9 @@ void CDir::_fetched(bufferlist &bl)
       
       if (dn) {
         if (dn->get_inode() == 0) {
-          dout(12) << "_fetched  had NEG dentry " << *dn << endl;
+          dout(12) << "_fetched  had NEG dentry " << *dn << dendl;
         } else {
-          dout(12) << "_fetched  had dentry " << *dn << endl;
+          dout(12) << "_fetched  had dentry " << *dn << dendl;
         }
       } else {
        // add inode
@@ -874,7 +877,7 @@ void CDir::_fetched(bufferlist &bl)
          in = cache->get_inode(inode.ino);
          dout(12) << "_fetched  got (but i already had) " << *in 
                   << " mode " << in->inode.mode 
-                  << " mtime " << in->inode.mtime << endl;
+                  << " mtime " << in->inode.mtime << dendl;
          assert(0);  // this shouldn't happen!! 
        } else {
          // inode
@@ -893,12 +896,12 @@ void CDir::_fetched(bufferlist &bl)
        
          // link
          dn = add_primary_dentry(dname, in);
-         dout(12) << "_fetched  got " << *dn << " " << *in << endl;
+         dout(12) << "_fetched  got " << *dn << " " << *in << dendl;
        }
       }
     } else {
       dout(1) << "corrupt directory, i got tag char '" << type << "' val " << (int)(type) 
-             << " at pos " << off << endl;
+             << " at pos " << off << dendl;
       assert(0);
     }
     
@@ -921,12 +924,12 @@ void CDir::_fetched(bufferlist &bl)
        dn &&
        dn->get_version() <= got_version &&
        dn->is_dirty()) {
-      dout(10) << "_fetched  had underwater dentry " << *dn << ", marking clean" << endl;
+      dout(10) << "_fetched  had underwater dentry " << *dn << ", marking clean" << dendl;
       dn->mark_clean();
 
       if (dn->get_inode()) {
        assert(dn->get_inode()->get_version() <= got_version);
-       dout(10) << "_fetched  had underwater inode " << *dn->get_inode() << ", marking clean" << endl;
+       dout(10) << "_fetched  had underwater inode " << *dn->get_inode() << ", marking clean" << dendl;
        dn->get_inode()->mark_clean();
       }
     }
@@ -968,7 +971,7 @@ void CDir::_fetched(bufferlist &bl)
  */
 void CDir::commit(version_t want, Context *c)
 {
-  dout(10) << "commit want " << want << " on " << *this << endl;
+  dout(10) << "commit want " << want << " on " << *this << dendl;
   if (want == 0) want = version;
 
   // preconditions
@@ -1015,7 +1018,7 @@ public:
 
 void CDir::_commit(version_t want)
 {
-  dout(10) << "_commit want " << want << " on " << *this << endl;
+  dout(10) << "_commit want " << want << " on " << *this << dendl;
 
   // we can't commit things in the future.
   // (even the projected future.)
@@ -1026,19 +1029,19 @@ void CDir::_commit(version_t want)
 
   // already committed?
   if (committed_version >= want) {
-    dout(10) << "already committed " << committed_version << " >= " << want << endl;
+    dout(10) << "already committed " << committed_version << " >= " << want << dendl;
     return;
   }
   // already committing >= want?
   if (committing_version >= want) {
-    dout(10) << "already committing " << committing_version << " >= " << want << endl;
+    dout(10) << "already committing " << committing_version << " >= " << want << dendl;
     assert(state_test(STATE_COMMITTING));
     return;
   }
   
   // complete?
   if (!is_complete()) {
-    dout(7) << "commit not complete, fetching first" << endl;
+    dout(7) << "commit not complete, fetching first" << dendl;
     if (cache->mds->logger) cache->mds->logger->inc("dir_ffc");
     fetch(new C_Dir_RetryCommit(this, want));
     return;
@@ -1049,7 +1052,7 @@ void CDir::_commit(version_t want)
 
   // mark committing (if not already)
   if (!state_test(STATE_COMMITTING)) {
-    dout(10) << "marking committing" << endl;
+    dout(10) << "marking committing" << dendl;
     state_set(STATE_COMMITTING);
   }
   
@@ -1075,7 +1078,7 @@ void CDir::_commit(version_t want)
     // primary or remote?
     if (dn->is_remote()) {
       inodeno_t ino = dn->get_remote_ino();
-      dout(14) << " pos " << bl.length() << " dn '" << it->first << "' remote ino " << ino << endl;
+      dout(14) << " pos " << bl.length() << " dn '" << it->first << "' remote ino " << ino << dendl;
       
       // marker, name, ino
       bl.append( "L", 1 );         // remote link
@@ -1086,7 +1089,7 @@ void CDir::_commit(version_t want)
       CInode *in = dn->get_inode();
       assert(in);
 
-      dout(14) << " pos " << bl.length() << " dn '" << it->first << "' inode " << *in << endl;
+      dout(14) << " pos " << bl.length() << " dn '" << it->first << "' inode " << *in << dendl;
   
       // marker, name, inode, [symlink string]
       bl.append( "I", 1 );         // inode
@@ -1095,7 +1098,7 @@ void CDir::_commit(version_t want)
       
       if (in->is_symlink()) {
         // include symlink destination!
-        dout(18) << "    inlcuding symlink ptr " << in->symlink << endl;
+        dout(18) << "    inlcuding symlink ptr " << in->symlink << dendl;
        ::_encode(in->symlink, bl);
       }
 
@@ -1121,7 +1124,7 @@ void CDir::_commit(version_t want)
  */
 void CDir::_committed(version_t v)
 {
-  dout(10) << "_committed v " << v << " on " << *this << endl;
+  dout(10) << "_committed v " << v << " on " << *this << dendl;
   assert(is_auth());
   
   // take note.
@@ -1146,11 +1149,11 @@ void CDir::_committed(version_t v)
     // dentry
     if (committed_version >= dn->get_version()) {
       if (dn->is_dirty()) {
-       dout(15) << " dir " << committed_version << " >= dn " << dn->get_version() << " now clean " << *dn << endl;
+       dout(15) << " dir " << committed_version << " >= dn " << dn->get_version() << " now clean " << *dn << dendl;
        dn->mark_clean();
       } 
     } else {
-      dout(15) << " dir " << committed_version << " < dn " << dn->get_version() << " still dirty " << *dn << endl;
+      dout(15) << " dir " << committed_version << " < dn " << dn->get_version() << " still dirty " << *dn << dendl;
     }
 
     // inode?
@@ -1161,11 +1164,11 @@ void CDir::_committed(version_t v)
       
       if (committed_version >= in->get_version()) {
        if (in->is_dirty()) {
-         dout(15) << " dir " << committed_version << " >= inode " << in->get_version() << " now clean " << *in << endl;
+         dout(15) << " dir " << committed_version << " >= inode " << in->get_version() << " now clean " << *in << dendl;
          in->mark_clean();
        }
       } else {
-       dout(15) << " dir " << committed_version << " < inode " << in->get_version() << " still dirty " << *in << endl;
+       dout(15) << " dir " << committed_version << " < inode " << in->get_version() << " still dirty " << *in << dendl;
        assert(in->is_dirty());
       }
     }
@@ -1225,11 +1228,11 @@ bool CDir::is_subtree_root()
 {
   if (dir_auth == CDIR_AUTH_DEFAULT) {
     //dout(10) << "is_subtree_root false " << dir_auth << " != " << CDIR_AUTH_DEFAULT
-    //<< " on " << ino() << endl;
+    //<< " on " << ino() << dendl;
     return false;
   } else {
     //dout(10) << "is_subtree_root true " << dir_auth << " != " << CDIR_AUTH_DEFAULT
-    //<< " on " << ino() << endl;
+    //<< " on " << ino() << dendl;
     return true;
   }
 }
@@ -1254,7 +1257,7 @@ void CDir::set_dir_auth(pair<int,int> a)
 { 
   dout(10) << "setting dir_auth=" << a
           << " from " << dir_auth
-          << " on " << *this << endl;
+          << " on " << *this << dendl;
   
   bool was_subtree = is_subtree_root();
   bool was_ambiguous = dir_auth.second >= 0;
@@ -1264,7 +1267,7 @@ void CDir::set_dir_auth(pair<int,int> a)
 
   // new subtree root?
   if (!was_subtree && is_subtree_root()) {
-    dout(10) << " new subtree root, adjusting auth_pins" << endl;
+    dout(10) << " new subtree root, adjusting auth_pins" << dendl;
     
     // adjust nested auth pins
     inode->adjust_nested_auth_pins(-get_cum_auth_pins());
@@ -1274,7 +1277,7 @@ void CDir::set_dir_auth(pair<int,int> a)
       inode->auth_unpin();
   } 
   if (was_subtree && !is_subtree_root()) {
-    dout(10) << " old subtree root, adjusting auth_pins" << endl;
+    dout(10) << " old subtree root, adjusting auth_pins" << dendl;
     
     // adjust nested auth pins
     inode->adjust_nested_auth_pins(get_cum_auth_pins());
@@ -1315,7 +1318,7 @@ void CDir::auth_pin()
     get(PIN_AUTHPIN);
   auth_pins++;
 
-  dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+  dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
 
   // nest pins?
   if (is_subtree_root()) return;  // no.
@@ -1330,7 +1333,7 @@ void CDir::auth_unpin()
   if (auth_pins == 0)
     put(PIN_AUTHPIN);
 
-  dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+  dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
   assert(auth_pins >= 0);
   
   // pending freeze?
@@ -1351,7 +1354,7 @@ void CDir::adjust_nested_auth_pins(int inc)
   nested_auth_pins += inc;
   
   dout(10) << "adjust_nested_auth_pins " << inc << " on " << *this
-          << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+          << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
   assert(nested_auth_pins >= 0);
   
   // pending freeze?
@@ -1405,14 +1408,14 @@ void CDir::freeze_tree(Context *c)
     }
   } else {
     state_set(STATE_FREEZINGTREE);
-    dout(10) << "freeze_tree waiting " << *this << endl;
+    dout(10) << "freeze_tree waiting " << *this << dendl;
     add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeTree(this, c));
   } 
 }
 
 void CDir::_freeze_tree()
 {
-  dout(10) << "_freeze_tree " << *this << endl;
+  dout(10) << "_freeze_tree " << *this << dendl;
 
   // there shouldn't be any conflicting auth_pins (except the 'freezing' one)
   assert(is_freezeable(true));
@@ -1431,7 +1434,7 @@ void CDir::freeze_tree_finish(Context *c)
 {
   // still freezing?  (we may have been canceled)
   if (!is_freezing()) {
-    dout(10) << "freeze_tree_finish no longer freezing, done on " << *this << endl;
+    dout(10) << "freeze_tree_finish no longer freezing, done on " << *this << dendl;
     c->finish(-1);
     delete c;
     return;
@@ -1439,13 +1442,13 @@ void CDir::freeze_tree_finish(Context *c)
 
   // freezeable now?
   if (!is_freezeable(true)) {
-    dout(10) << "freeze_tree_finish still waiting " << *this << endl;
+    dout(10) << "freeze_tree_finish still waiting " << *this << dendl;
     assert(state_test(STATE_FREEZINGTREE));
     add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeTree(this, c));
     return;
   }
 
-  dout(10) << "freeze_tree_finish " << *this << endl;
+  dout(10) << "freeze_tree_finish " << *this << dendl;
   _freeze_tree();
   auth_unpin();
   if (c) {
@@ -1456,7 +1459,7 @@ void CDir::freeze_tree_finish(Context *c)
 
 void CDir::unfreeze_tree()
 {
-  dout(10) << "unfreeze_tree " << *this << endl;
+  dout(10) << "unfreeze_tree " << *this << dendl;
 
   if (state_test(STATE_FROZENTREE)) {
     // frozen.  unfreeze.
@@ -1553,14 +1556,14 @@ void CDir::freeze_dir(Context *c)
     }
   } else {
     state_set(STATE_FREEZINGDIR);
-    dout(10) << "freeze_dir + wait " << *this << endl;
+    dout(10) << "freeze_dir + wait " << *this << dendl;
     add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeDir(this, c));
   } 
 }
 
 void CDir::_freeze_dir()
 {  
-  dout(10) << "_freeze_dir " << *this << endl;
+  dout(10) << "_freeze_dir " << *this << dendl;
 
   assert(is_freezeable_dir(true));
 
@@ -1576,7 +1579,7 @@ void CDir::freeze_dir_finish(Context *c)
 {
   // still freezing?  (we may have been canceled)
   if (!is_freezing()) {
-    dout(10) << "freeze_dir_finish no longer freezing, done on " << *this << endl;
+    dout(10) << "freeze_dir_finish no longer freezing, done on " << *this << dendl;
     c->finish(-1);
     delete c;
     return;
@@ -1584,14 +1587,14 @@ void CDir::freeze_dir_finish(Context *c)
 
   // freezeable now?
   if (!is_freezeable_dir(true)) {
-    dout(10) << "freeze_dir_finish still waiting " << *this << endl;
+    dout(10) << "freeze_dir_finish still waiting " << *this << dendl;
     state_set(STATE_FREEZINGDIR);
     add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeDir(this, c));
     return;
   }
 
   // freeze now
-  dout(10) << "freeze_dir_finish " << *this << endl;
+  dout(10) << "freeze_dir_finish " << *this << dendl;
   _freeze_dir();
   auth_unpin();
   if (c) {
@@ -1602,7 +1605,7 @@ void CDir::freeze_dir_finish(Context *c)
 
 void CDir::unfreeze_dir()
 {
-  dout(10) << "unfreeze_dir " << *this << endl;
+  dout(10) << "unfreeze_dir " << *this << dendl;
 
   if (state_test(STATE_FROZENDIR)) {
     state_clear(STATE_FROZENDIR);
index 4fb97e2055011febc3018745d66927b7e897ce21..20686cab02c0726dfb11b3243448353d85d66107 100644 (file)
@@ -300,7 +300,7 @@ private:
   void get_dist_spec(set<int>& ls, int auth) {
     if (( pop_auth_subtree.get(META_POP_IRD).get() > 
          g_conf.mds_bal_replicate_threshold)) {
-      //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << endl;
+      //if (!cached_by.empty() && inode.ino > 1) generic_dout(1) << "distributed spec for " << *this << endl;
       for (map<int,int>::iterator p = replicas_begin();
           p != replicas_end(); 
           ++p)
@@ -564,11 +564,11 @@ class CDirExport {
     dir->replica_nonce = 0;  // no longer defined
 
     if (!dir->replica_map.empty())
-      dout(0) << "replicas not empty non import, " << *dir << ", " << dir->replica_map << endl;
+      generic_dout(0) << "replicas not empty non import, " << *dir << ", " << dir->replica_map << dendl;
 
     dir->dir_rep_by = rep_by;
     dir->replica_map = replicas;
-    dout(12) << "replicas in export is " << replicas << ", dir now " << dir->replica_map << endl;
+    generic_dout(12) << "replicas in export is " << replicas << ", dir now " << dir->replica_map << dendl;
     if (!replicas.empty())
       dir->get(CDir::PIN_REPLICATED);
     if (dir->is_dirty()) {
index 45d3f6ecbf4ca51f72e055440ad8e9b99e941450..cea6babfdd7c4befbd19b49e65411d38bd39befa 100644 (file)
@@ -30,8 +30,8 @@
 #include <stdio.h>
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
+
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
 
 
 //int cinode_pins[CINODE_NUM_PINS];  // counts
@@ -105,7 +105,7 @@ inode_t *CInode::project_inode()
   } else {
     projected_inode.push_back(new inode_t(*projected_inode.back()));
   }
-  dout(15) << "project_inode " << projected_inode.back() << endl;
+  dout(15) << "project_inode " << projected_inode.back() << dendl;
   return projected_inode.back();
 }
   
@@ -113,7 +113,7 @@ void CInode::pop_and_dirty_projected_inode()
 {
   assert(!projected_inode.empty());
   dout(15) << "pop_and_dirty_projected_inode " << projected_inode.front()
-          << " v" << projected_inode.front()->version << endl;
+          << " v" << projected_inode.front()->version << dendl;
   mark_dirty(projected_inode.front()->version);
   inode = *projected_inode.front();
   delete projected_inode.front();
@@ -222,7 +222,7 @@ CDir *CInode::add_dirfrag(CDir *dir)
 
 void CInode::close_dirfrag(frag_t fg)
 {
-  dout(14) << "close_dirfrag " << fg << endl;
+  dout(14) << "close_dirfrag " << fg << dendl;
   assert(dirfrags.count(fg));
   
   CDir *dir = dirfrags[fg];
@@ -241,7 +241,7 @@ void CInode::close_dirfrag(frag_t fg)
   for (map<string,CDentry*>::iterator p = dir->items.begin();
        p != dir->items.end();
        ++p) 
-    dout(14) << "close_dirfrag LEFTOVER dn " << *p->second << endl;
+    dout(14) << "close_dirfrag LEFTOVER dn " << *p->second << dendl;
 
   assert(dir->get_num_ref() == 0);
   delete dir;
@@ -369,7 +369,7 @@ void CInode::make_anchor_trace(vector<Anchor>& trace)
   if (parent) {
     parent->dir->inode->make_anchor_trace(trace);
     trace.push_back(Anchor(ino(), parent->dir->dirfrag()));
-    dout(10) << "make_anchor_trace added " << trace.back() << endl;
+    dout(10) << "make_anchor_trace added " << trace.back() << dendl;
   }
   else 
     assert(is_root() || is_stray());
@@ -403,7 +403,7 @@ void CInode::_mark_dirty()
 
 void CInode::mark_dirty(version_t pv) {
   
-  dout(10) << "mark_dirty " << *this << endl;
+  dout(10) << "mark_dirty " << *this << dendl;
 
   assert(parent);
 
@@ -429,7 +429,7 @@ void CInode::mark_dirty(version_t pv) {
 
 void CInode::mark_clean()
 {
-  dout(10) << " mark_clean " << *this << endl;
+  dout(10) << " mark_clean " << *this << dendl;
   if (state_test(STATE_DIRTY)) {
     state_clear(STATE_DIRTY);
     put(PIN_DIRTY);
@@ -615,7 +615,7 @@ void CInode::auth_pin()
     get(PIN_AUTHPIN);
   auth_pins++;
 
-  dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+  dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
   
   if (parent)
     parent->adjust_nested_auth_pins( 1 );
@@ -627,7 +627,7 @@ void CInode::auth_unpin()
   if (auth_pins == 0)
     put(PIN_AUTHPIN);
   
-  dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+  dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
   
   assert(auth_pins >= 0);
   
index 6cd1e69c512412ccc49b3fda4e56bfa077d4601b..50feea0fe924590eae7683ef02655bf20cd559d0 100644 (file)
@@ -392,7 +392,7 @@ public:
 
 
   void replicate_relax_locks() {
-    dout(10) << " relaxing locks on " << *this << endl;
+    //dout(10) << " relaxing locks on " << *this << dendl;
     assert(is_auth());
     assert(!is_replicated());
 
@@ -429,12 +429,12 @@ public:
 
   // -- reference counting --
   void bad_put(int by) {
-    dout(7) << " bad put " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << endl;
+    generic_dout(7) << " bad put " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << dendl;
     assert(ref_set.count(by) == 1);
     assert(ref > 0);
   }
   void bad_get(int by) {
-    dout(7) << " bad get " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << endl;
+    generic_dout(7) << " bad get " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << dendl;
     assert(ref_set.count(by) == 0);
   }
   void first_get();
@@ -463,7 +463,7 @@ public:
   void get_dist_spec(set<int>& ls, int auth, timepair_t& now) {
     if (( is_dir() && popularity[MDS_POP_CURDOM].get(now) > g_conf.mds_bal_replicate_threshold) ||
         (!is_dir() && popularity[MDS_POP_JUSTME].get(now) > g_conf.mds_bal_replicate_threshold)) {
-      //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << endl;
+      //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << dendl;
       ls = cached_by;
     }
   }
index 2c2241870650a6aa1bbece3e4c219df319363458..d7619d13ca156f3d69fbf536d85d89c3e1045bd2 100644 (file)
@@ -111,7 +111,7 @@ public:
     for (capseq_t seq = last_recv; seq <= last_sent; seq++) {
       if (cap_history.count(seq)) {
         c |= cap_history[seq];
-        dout(10) << " cap issued: seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(c) << endl;
+        generic_dout(10) << " cap issued: seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(c) << dendl;
       }
     }
     return c;
@@ -192,7 +192,7 @@ public:
 
     // old seqs
     while (last_recv < seq) {
-      dout(10) << " cap.confirm_receipt forgetting seq " << last_recv << " " << cap_string(cap_history[last_recv]) << endl;
+      generic_dout(10) << " cap.confirm_receipt forgetting seq " << last_recv << " " << cap_string(cap_history[last_recv]) << dendl;
       r |= cap_history[last_recv];
       cap_history.erase(last_recv);
       ++last_recv;
@@ -201,7 +201,7 @@ public:
     // release current?
     if (cap_history.count(seq) &&
         cap_history[seq] != caps) {
-      dout(10) << " cap.confirm_receipt revising seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(caps) << endl;
+      generic_dout(10) << " cap.confirm_receipt revising seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(caps) << dendl;
       // note what we're releasing..
       assert(cap_history[seq] & ~caps);
       r |= cap_history[seq] & ~caps; 
index f2a791d7d5f0bec28bbde7774e741276335dbbac..db977615354d1074f3723697d983df28ccfd34bd 100644 (file)
@@ -24,8 +24,8 @@
 #include "osdc/Filer.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".clientmap "
+
+#define dout(x)  if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".clientmap "
 
 
 
@@ -52,7 +52,7 @@ public:
 
 void ClientMap::load(Context *onload)
 {
-  dout(10) << "load" << endl;
+  dout(10) << "load" << dendl;
 
   init_inode();
 
@@ -74,7 +74,7 @@ void ClientMap::_load_finish(bufferlist &bl)
   dout(10) << "_load_finish v " << version 
                   << ", " << client_inst.size() << " clients, "
                   << bl.length() << " bytes"
-                  << endl;
+                  << dendl;
   projected = committing = committed = version;
   finish_contexts(waiting_for_load);
 }
@@ -95,7 +95,7 @@ public:
 
 void ClientMap::save(Context *onsave, version_t needv)
 {
-  dout(10) << "save needv " << needv << ", v " << version << endl;
+  dout(10) << "save needv " << needv << ", v " << version << dendl;
   commit_waiters[version].push_back(onsave);
   
   if (needv && committing >= needv) return;
@@ -113,7 +113,7 @@ void ClientMap::save(Context *onsave, version_t needv)
 
 void ClientMap::_save_finish(version_t v)
 {
-  dout(10) << "_save_finish v" << v << endl;
+  dout(10) << "_save_finish v" << v << dendl;
   committed = v;
 
   finish_contexts(commit_waiters[v]);
index 5fa09339b0acd9e66c577d46b8ca0ecf798b3ab1..6377bce17285f305ad994c3c84a5b8067bcc5a3a 100644 (file)
@@ -25,8 +25,8 @@
 #include "include/types.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".idalloc: "
+
+#define dout(x)  if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".idalloc: "
 
 
 void IdAllocator::init_inode()
@@ -44,7 +44,7 @@ inodeno_t IdAllocator::alloc_id()
   // pick one
   inodeno_t id = free.start();
   free.erase(id);
-  dout(10) << "idalloc " << this << ": alloc id " << id << endl;
+  dout(10) << "idalloc " << this << ": alloc id " << id << dendl;
 
   version++;
   
@@ -61,7 +61,7 @@ void IdAllocator::reclaim_id(inodeno_t id)
 {
   assert(is_active());
   
-  dout(10) << "idalloc " << this << ": reclaim id " << id << endl;
+  dout(10) << "idalloc " << this << ": reclaim id " << id << dendl;
   free.insert(id);
 
   version++;
@@ -88,12 +88,12 @@ void IdAllocator::save(Context *onfinish, version_t v)
 {
   if (v > 0 && v <= committing_version) {
     dout(10) << "save v " << version << " - already saving "
-            << committing_version << " >= needed " << v << endl;
+            << committing_version << " >= needed " << v << dendl;
     waitfor_save[v].push_back(onfinish);
     return;
   }
   
-  dout(10) << "save v " << version << endl;
+  dout(10) << "save v " << version << dendl;
   assert(is_active());
   
   bufferlist bl;
@@ -115,7 +115,7 @@ void IdAllocator::save(Context *onfinish, version_t v)
 
 void IdAllocator::save_2(version_t v)
 {
-  dout(10) << "save_2 v " << v << endl;
+  dout(10) << "save_2 v " << v << dendl;
   
   committed_version = v;
   
@@ -165,7 +165,7 @@ public:
 
 void IdAllocator::load(Context *onfinish)
 { 
-  dout(10) << "load" << endl;
+  dout(10) << "load" << dendl;
 
   init_inode();
 
@@ -185,7 +185,7 @@ void IdAllocator::load_2(int r, bufferlist& bl, Context *onfinish)
   state = STATE_ACTIVE;
 
   if (r > 0) {
-    dout(10) << "load_2 got " << bl.length() << " bytes" << endl;
+    dout(10) << "load_2 got " << bl.length() << " bytes" << dendl;
     int off = 0;
     bl.copy(off, sizeof(version), (char*)&version);
     off += sizeof(version);
@@ -193,7 +193,7 @@ void IdAllocator::load_2(int r, bufferlist& bl, Context *onfinish)
     committed_version = version;
   }
   else {
-    dout(10) << "load_2 found no alloc file" << endl;
+    dout(10) << "load_2 found no alloc file" << dendl;
     assert(0); // this shouldn't happen if mkfs finished.
     reset();   
   }
index ca330a7a5f825ed56c114b000cb1614d5e687553..25859409cfaf8d9f874eb1bba76362c6ed0d245d 100644 (file)
@@ -50,8 +50,8 @@
 #include <assert.h>
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".locker "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".locker "
 
 
 
@@ -123,17 +123,17 @@ bool Locker::acquire_locks(MDRequest *mdr,
                           set<SimpleLock*> &xlocks)
 {
   if (mdr->done_locking) {
-    dout(10) << "acquire_locks " << *mdr << " -- done locking" << endl;    
+    dout(10) << "acquire_locks " << *mdr << " -- done locking" << dendl;    
     return true;  // at least we had better be!
   }
-  dout(10) << "acquire_locks " << *mdr << endl;
+  dout(10) << "acquire_locks " << *mdr << dendl;
 
   set<SimpleLock*, SimpleLock::ptr_lt> sorted;  // sort everything we will lock
   set<SimpleLock*> mustpin = xlocks;            // items to authpin
 
   // xlocks
   for (set<SimpleLock*>::iterator p = xlocks.begin(); p != xlocks.end(); ++p) {
-    dout(20) << " must xlock " << **p << " " << *(*p)->get_parent() << endl;
+    dout(20) << " must xlock " << **p << " " << *(*p)->get_parent() << dendl;
     sorted.insert(*p);
 
     // augment xlock with a versionlock?
@@ -153,13 +153,13 @@ bool Locker::acquire_locks(MDRequest *mdr,
 
   // wrlocks
   for (set<SimpleLock*>::iterator p = wrlocks.begin(); p != wrlocks.end(); ++p) {
-    dout(20) << " must wrlock " << **p << " " << *(*p)->get_parent() << endl;
+    dout(20) << " must wrlock " << **p << " " << *(*p)->get_parent() << dendl;
     sorted.insert(*p);
     if ((*p)->get_parent()->is_auth())
       mustpin.insert(*p);
     else if ((*p)->get_type() == LOCK_OTYPE_IDIR &&
             !(*p)->get_parent()->is_auth() && !((ScatterLock*)(*p))->can_wrlock()) { // we might have to request a scatter
-      dout(15) << " will also auth_pin " << *(*p)->get_parent() << " in case we need to request a scatter" << endl;
+      dout(15) << " will also auth_pin " << *(*p)->get_parent() << " in case we need to request a scatter" << dendl;
       mustpin.insert(*p);
     }
   }
@@ -168,7 +168,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
   for (set<SimpleLock*>::iterator p = rdlocks.begin();
         p != rdlocks.end();
        ++p) {
-    dout(20) << " must rdlock " << **p << " " << *(*p)->get_parent() << endl;
+    dout(20) << " must rdlock " << **p << " " << *(*p)->get_parent() << dendl;
     sorted.insert(*p);
   }
 
@@ -182,7 +182,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
        ++p) {
     MDSCacheObject *object = (*p)->get_parent();
 
-    dout(10) << " must authpin " << *object << endl;
+    dout(10) << " must authpin " << *object << dendl;
 
     if (mdr->is_auth_pinned(object)) 
       continue;
@@ -190,7 +190,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
     if (!object->is_auth()) {
       if (object->is_ambiguous_auth()) {
        // wait
-       dout(10) << " ambiguous auth, waiting to authpin " << *object << endl;
+       dout(10) << " ambiguous auth, waiting to authpin " << *object << dendl;
        object->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
        mds->locker->drop_locks(mdr);
        mdr->drop_local_auth_pins();
@@ -201,7 +201,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
     }
     if (!object->can_auth_pin()) {
       // wait
-      dout(10) << " can't auth_pin (freezing?), waiting to authpin " << *object << endl;
+      dout(10) << " can't auth_pin (freezing?), waiting to authpin " << *object << dendl;
       object->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
       mds->locker->drop_locks(mdr);
       mdr->drop_local_auth_pins();
@@ -215,9 +215,9 @@ bool Locker::acquire_locks(MDRequest *mdr,
        ++p) {
     MDSCacheObject *object = (*p)->get_parent();
     if (mdr->is_auth_pinned(object)) {
-      dout(10) << " already auth_pinned " << *object << endl;
+      dout(10) << " already auth_pinned " << *object << dendl;
     } else if (object->is_auth()) {
-      dout(10) << " auth_pinning " << *object << endl;
+      dout(10) << " auth_pinning " << *object << dendl;
       mdr->auth_pin(object);
     }
   }
@@ -227,13 +227,13 @@ bool Locker::acquire_locks(MDRequest *mdr,
     for (map<int, set<MDSCacheObject*> >::iterator p = mustpin_remote.begin();
         p != mustpin_remote.end();
         ++p) {
-      dout(10) << "requesting remote auth_pins from mds" << p->first << endl;
+      dout(10) << "requesting remote auth_pins from mds" << p->first << dendl;
       
       MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_AUTHPIN);
       for (set<MDSCacheObject*>::iterator q = p->second.begin();
           q != p->second.end();
           ++q) {
-       dout(10) << " req remote auth_pin of " << **q << endl;
+       dout(10) << " req remote auth_pin of " << **q << dendl;
        MDSCacheObjectInfo info;
        (*q)->set_object_info(info);
        req->get_authpins().push_back(info);      
@@ -260,13 +260,13 @@ bool Locker::acquire_locks(MDRequest *mdr,
       SimpleLock *have = *existing;
       existing++;
       if (xlocks.count(*p) && mdr->xlocks.count(*p)) {
-       dout(10) << " already xlocked " << *have << " " << *have->get_parent() << endl;
+       dout(10) << " already xlocked " << *have << " " << *have->get_parent() << dendl;
       }
       else if (wrlocks.count(*p) && mdr->wrlocks.count(*p)) {
-       dout(10) << " already wrlocked " << *have << " " << *have->get_parent() << endl;
+       dout(10) << " already wrlocked " << *have << " " << *have->get_parent() << dendl;
       }
       else if (rdlocks.count(*p) && mdr->rdlocks.count(*p)) {
-       dout(10) << " already rdlocked " << *have << " " << *have->get_parent() << endl;
+       dout(10) << " already rdlocked " << *have << " " << *have->get_parent() << dendl;
       }
       else assert(0);
       continue;
@@ -276,7 +276,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
     while (existing != mdr->locks.end()) {
       SimpleLock *stray = *existing;
       existing++;
-      dout(10) << " unlocking out-of-order " << *stray << " " << *stray->get_parent() << endl;
+      dout(10) << " unlocking out-of-order " << *stray << " " << *stray->get_parent() << dendl;
       if (mdr->xlocks.count(stray)) 
        xlock_finish(stray, mdr);
       else if (mdr->wrlocks.count(stray))
@@ -289,15 +289,15 @@ bool Locker::acquire_locks(MDRequest *mdr,
     if (xlocks.count(*p)) {
       if (!xlock_start(*p, mdr)) 
        return false;
-      dout(10) << " got xlock on " << **p << " " << *(*p)->get_parent() << endl;
+      dout(10) << " got xlock on " << **p << " " << *(*p)->get_parent() << dendl;
     } else if (wrlocks.count(*p)) {
       if (!wrlock_start(*p, mdr)) 
        return false;
-      dout(10) << " got wrlock on " << **p << " " << *(*p)->get_parent() << endl;
+      dout(10) << " got wrlock on " << **p << " " << *(*p)->get_parent() << dendl;
     } else {
       if (!rdlock_start(*p, mdr)) 
        return false;
-      dout(10) << " got rdlock on " << **p << " " << *(*p)->get_parent() << endl;
+      dout(10) << " got rdlock on " << **p << " " << *(*p)->get_parent() << dendl;
     }
   }
     
@@ -305,7 +305,7 @@ bool Locker::acquire_locks(MDRequest *mdr,
   while (existing != mdr->locks.end()) {
     SimpleLock *stray = *existing;
     existing++;
-    dout(10) << " unlocking extra " << *stray << " " << *stray->get_parent() << endl;
+    dout(10) << " unlocking extra " << *stray << " " << *stray->get_parent() << dendl;
     if (mdr->xlocks.count(stray))
       xlock_finish(stray, mdr);
     else if (mdr->wrlocks.count(stray))
@@ -440,7 +440,7 @@ void Locker::rejoin_set_state(SimpleLock *lock, int s, list<Context*>& waiters)
 
 version_t Locker::issue_file_data_version(CInode *in)
 {
-  dout(7) << "issue_file_data_version on " << *in << endl;
+  dout(7) << "issue_file_data_version on " << *in << dendl;
   return in->inode.file_data_version;
 }
 
@@ -449,7 +449,7 @@ Capability* Locker::issue_new_caps(CInode *in,
                                     int mode,
                                     MClientRequest *req)
 {
-  dout(7) << "issue_new_caps for mode " << mode << " on " << *in << endl;
+  dout(7) << "issue_new_caps for mode " << mode << " on " << *in << dendl;
   
   // my needs
   int my_client = req->get_client();
@@ -506,7 +506,7 @@ Capability* Locker::issue_new_caps(CInode *in,
   if ((before & CAP_FILE_WRBUFFER) == 0 &&
       (now & CAP_FILE_WRBUFFER)) {
     in->inode.file_data_version++;
-    dout(7) << " incrementing file_data_version, now " << in->inode.file_data_version << " for " << *in << endl;
+    dout(7) << " incrementing file_data_version, now " << in->inode.file_data_version << " for " << *in << dendl;
   }
 
   return cap;
@@ -519,7 +519,7 @@ bool Locker::issue_caps(CInode *in)
   // allowed caps are determined by the lock mode.
   int allowed = in->filelock.caps_allowed();
   dout(7) << "issue_caps filelock allows=" << cap_string(allowed) 
-          << " on " << *in << endl;
+          << " on " << *in << dendl;
 
   // count conflicts with
   int nissued = 0;        
@@ -539,13 +539,13 @@ bool Locker::issue_caps(CInode *in)
       // twiddle file_data_version?
       if (!(before & CAP_FILE_WRBUFFER) &&
           (after & CAP_FILE_WRBUFFER)) {
-        dout(7) << "   incrementing file_data_version for " << *in << endl;
+        dout(7) << "   incrementing file_data_version for " << *in << dendl;
         in->inode.file_data_version++;
       }
 
       if (seq > 0 && 
           !it->second.is_suppress()) {
-        dout(7) << "   sending MClientFileCaps to client" << it->first << " seq " << it->second.get_last_seq() << " new pending " << cap_string(it->second.pending()) << " was " << cap_string(before) << endl;
+        dout(7) << "   sending MClientFileCaps to client" << it->first << " seq " << it->second.get_last_seq() << " new pending " << cap_string(it->second.pending()) << " was " << cap_string(before) << dendl;
         mds->send_message_client(new MClientFileCaps(MClientFileCaps::OP_GRANT,
                                                     in->inode,
                                                     it->second.get_last_seq(),
@@ -574,7 +574,7 @@ void Locker::request_inode_file_caps(CInode *in)
                  << " was " << cap_string(in->replica_caps_wanted) 
                  << " no keeping anymore " 
                  << " on " << *in 
-                 << endl;
+                 << dendl;
       }
       else if (in->replica_caps_wanted_keep_until.sec() == 0) {
         in->replica_caps_wanted_keep_until = g_clock.recent_now();
@@ -584,7 +584,7 @@ void Locker::request_inode_file_caps(CInode *in)
                  << " was " << cap_string(in->replica_caps_wanted) 
                  << " keeping until " << in->replica_caps_wanted_keep_until
                  << " on " << *in 
-                 << endl;
+                 << dendl;
         return;
       } else {
         // wait longer
@@ -598,7 +598,7 @@ void Locker::request_inode_file_caps(CInode *in)
     int auth = in->authority().first;
     dout(7) << "request_inode_file_caps " << cap_string(wanted)
             << " was " << cap_string(in->replica_caps_wanted) 
-            << " on " << *in << " to mds" << auth << endl;
+            << " on " << *in << " to mds" << auth << dendl;
     assert(!in->is_auth());
 
     in->replica_caps_wanted = wanted;
@@ -624,13 +624,13 @@ void Locker::handle_inode_file_caps(MInodeFileCaps *m)
 
   if (mds->is_rejoin() &&
       in->is_rejoining()) {
-    dout(7) << "handle_inode_file_caps still rejoining " << *in << ", dropping " << *m << endl;
+    dout(7) << "handle_inode_file_caps still rejoining " << *in << ", dropping " << *m << dendl;
     delete m;
     return;
   }
 
   
-  dout(7) << "handle_inode_file_caps replica mds" << m->get_from() << " wants caps " << cap_string(m->get_caps()) << " on " << *in << endl;
+  dout(7) << "handle_inode_file_caps replica mds" << m->get_from() << " wants caps " << cap_string(m->get_caps()) << " on " << *in << dendl;
 
   if (m->get_caps())
     in->mds_caps_wanted[m->get_from()] = m->get_caps();
@@ -658,9 +658,9 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
 
   if (!in || !cap) {
     if (!in) {
-      dout(7) << "handle_client_file_caps on unknown ino " << m->get_ino() << ", dropping" << endl;
+      dout(7) << "handle_client_file_caps on unknown ino " << m->get_ino() << ", dropping" << dendl;
     } else {
-      dout(7) << "handle_client_file_caps no cap for client" << client << " on " << *in << endl;
+      dout(7) << "handle_client_file_caps no cap for client" << client << " on " << *in << dendl;
     }
     delete m;
     return;
@@ -676,7 +676,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
           << " wants " << cap_string(wanted)
           << " from client" << client
           << " on " << *in 
-          << endl;  
+          << dendl;  
   
   // update wanted
   if (cap->wanted() != wanted) {
@@ -689,7 +689,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
         sure the client has seen all the latest caps.
       */
       dout(10) << "handle_client_file_caps ignoring wanted " << cap_string(m->get_wanted())
-               << " bc seq " << m->get_seq() << " < " << cap->get_last_seq() << endl;
+               << " bc seq " << m->get_seq() << " < " << cap->get_last_seq() << dendl;
     } else {
       cap->set_wanted(wanted);
     }
@@ -699,7 +699,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
   int had = cap->confirm_receipt(m->get_seq(), m->get_caps());
   int has = cap->confirmed();
   if (cap->is_null()) {
-    dout(7) << " cap for client" << client << " is now null, removing from " << *in << endl;
+    dout(7) << " cap for client" << client << " is now null, removing from " << *in << dendl;
     in->remove_client_cap(client);
     if (!in->is_auth())
       request_inode_file_caps(in);
@@ -714,7 +714,7 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
   // merge in atime?
   if (m->get_inode().atime > in->inode.atime) {
       dout(7) << "  taking atime " << m->get_inode().atime << " > " 
-              << in->inode.atime << " for " << *in << endl;
+              << in->inode.atime << " for " << *in << dendl;
     in->inode.atime = m->get_inode().atime;
   }
   
@@ -724,14 +724,14 @@ void Locker::handle_client_file_caps(MClientFileCaps *m)
     // mtime
     if (m->get_inode().mtime > in->inode.mtime) {
       dout(7) << "  taking mtime " << m->get_inode().mtime << " > " 
-              << in->inode.mtime << " for " << *in << endl;
+              << in->inode.mtime << " for " << *in << dendl;
       in->inode.mtime = m->get_inode().mtime;
       dirty = true;
     }
     // size
     if (m->get_inode().size > in->inode.size) {
       dout(7) << "  taking size " << m->get_inode().size << " > " 
-              << in->inode.size << " for " << *in << endl;
+              << in->inode.size << " for " << *in << dendl;
       in->inode.size = m->get_inode().size;
       dirty = true;
     }
@@ -779,7 +779,7 @@ SimpleLock *Locker::get_lock(int lock_type, MDSCacheObjectInfo &info)
          dn = dir->lookup(info.dname);
       }
       if (!dn) {
-       dout(7) << "get_lock don't have dn " << info.dirfrag.ino << " " << info.dname << endl;
+       dout(7) << "get_lock don't have dn " << info.dirfrag.ino << " " << info.dname << dendl;
        return 0;
       }
       return &dn->lock;
@@ -793,7 +793,7 @@ SimpleLock *Locker::get_lock(int lock_type, MDSCacheObjectInfo &info)
     {
       CInode *in = mdcache->get_inode(info.ino);
       if (!in) {
-       dout(7) << "get_lock don't have ino " << info.ino << endl;
+       dout(7) << "get_lock don't have ino " << info.ino << dendl;
        return 0;
       }
       switch (lock_type) {
@@ -806,7 +806,7 @@ SimpleLock *Locker::get_lock(int lock_type, MDSCacheObjectInfo &info)
     }
 
   default:
-    dout(7) << "get_lock don't know lock_type " << lock_type << endl;
+    dout(7) << "get_lock don't know lock_type " << lock_type << dendl;
     assert(0);
     break;
   }
@@ -822,7 +822,7 @@ void Locker::handle_lock(MLock *m)
 
   SimpleLock *lock = get_lock(m->get_lock_type(), m->get_object_info());
   if (!lock) {
-    dout(10) << "don't have object " << m->get_object_info() << ", must have trimmed, dropping" << endl;
+    dout(10) << "don't have object " << m->get_object_info() << ", must have trimmed, dropping" << dendl;
     delete m;
     return;
   }
@@ -844,7 +844,7 @@ void Locker::handle_lock(MLock *m)
     break;
 
   default:
-    dout(7) << "handle_lock got otype " << m->get_lock_type() << endl;
+    dout(7) << "handle_lock got otype " << m->get_lock_type() << dendl;
     assert(0);
     break;
   }
@@ -864,7 +864,7 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
   if (mds->is_rejoin()) {
     if (lock->get_parent()->is_rejoining()) {
       dout(7) << "handle_simple_lock still rejoining " << *lock->get_parent()
-             << ", dropping " << *m << endl;
+             << ", dropping " << *m << dendl;
       delete m;
       return;
     }
@@ -883,7 +883,7 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
       CDentry *dn = (CDentry*)lock->get_parent();
       if (dn->is_null() && m->get_data().length() > 0) {
        dout(10) << "handle_simple_lock replica dentry null -> non-null, must trim " 
-                << *dn << endl;
+                << *dn << dendl;
        assert(dn->get_num_ref() == 0);
        map<int, MCacheExpire*> expiremap;
        mdcache->trim_dentry(dn, expiremap);
@@ -899,7 +899,7 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
     // wait for readers to finish?
     if (lock->is_rdlocked()) {
       dout(7) << "handle_simple_lock has reader, waiting before ack on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       lock->set_state(LOCK_GLOCKR);
     } else {
       // update lock and reply
@@ -918,10 +918,10 @@ void Locker::handle_simple_lock(SimpleLock *lock, MLock *m)
     
     if (lock->is_gathering()) {
       dout(7) << "handle_simple_lock " << *lock << " on " << *lock->get_parent() << " from " << from
-             << ", still gathering " << lock->get_gather_set() << endl;
+             << ", still gathering " << lock->get_gather_set() << dendl;
     } else {
       dout(7) << "handle_simple_lock " << *lock << " on " << *lock->get_parent() << " from " << from
-             << ", last one" << endl;
+             << ", last one" << dendl;
       simple_eval_gather(lock);
     }
     break;
@@ -948,19 +948,19 @@ void Locker::try_simple_eval(SimpleLock *lock)
   // unstable and ambiguous auth?
   if (!lock->is_stable() &&
       lock->get_parent()->is_ambiguous_auth()) {
-    dout(7) << "simple_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
+    dout(7) << "simple_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_SimpleEval(this, lock));
     return;
   }
 
   if (!lock->get_parent()->is_auth()) {
-    dout(7) << "try_simple_eval not auth for " << *lock->get_parent() << endl;
+    dout(7) << "try_simple_eval not auth for " << *lock->get_parent() << dendl;
     return;
   }
 
   if (!lock->get_parent()->can_auth_pin()) {
-    dout(7) << "try_simple_eval can't auth_pin, waiting on " << *lock->get_parent() << endl;
+    dout(7) << "try_simple_eval can't auth_pin, waiting on " << *lock->get_parent() << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     lock->get_parent()->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_Locker_SimpleEval(this, lock));
     return;
@@ -973,13 +973,13 @@ void Locker::try_simple_eval(SimpleLock *lock)
 
 void Locker::simple_eval_gather(SimpleLock *lock)
 {
-  dout(10) << "simple_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
+  dout(10) << "simple_eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
 
   // finished gathering?
   if (lock->get_state() == LOCK_GLOCKR &&
       !lock->is_gathering() &&
       !lock->is_rdlocked()) {
-    dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << dendl;
 
     // replica: tell auth
     if (!lock->get_parent()->is_auth()) {
@@ -1003,7 +1003,7 @@ void Locker::simple_eval_gather(SimpleLock *lock)
 
 void Locker::simple_eval(SimpleLock *lock)
 {
-  dout(10) << "simple_eval " << *lock << " on " << *lock->get_parent() << endl;
+  dout(10) << "simple_eval " << *lock << " on " << *lock->get_parent() << dendl;
 
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
@@ -1013,7 +1013,7 @@ void Locker::simple_eval(SimpleLock *lock)
       lock->get_state() != LOCK_SYNC &&
       !lock->is_waiter_for(SimpleLock::WAIT_WR)) {
     dout(7) << "simple_eval stable, syncing " << *lock 
-           << " on " << *lock->get_parent() << endl;
+           << " on " << *lock->get_parent() << dendl;
     simple_sync(lock);
   }
   
@@ -1024,7 +1024,7 @@ void Locker::simple_eval(SimpleLock *lock)
 
 void Locker::simple_sync(SimpleLock *lock)
 {
-  dout(7) << "simple_sync on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_sync on " << *lock << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
   
@@ -1052,7 +1052,7 @@ void Locker::simple_sync(SimpleLock *lock)
 
 void Locker::simple_lock(SimpleLock *lock)
 {
-  dout(7) << "simple_lock on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_lock on " << *lock << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
   
@@ -1078,7 +1078,7 @@ void Locker::simple_lock(SimpleLock *lock)
 
 bool Locker::simple_rdlock_try(SimpleLock *lock, Context *con)
 {
-  dout(7) << "simple_rdlock_try on " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "simple_rdlock_try on " << *lock << " on " << *lock->get_parent() << dendl;  
 
   // can read?  grab ref.
   if (lock->can_rdlock(0)) 
@@ -1087,14 +1087,14 @@ bool Locker::simple_rdlock_try(SimpleLock *lock, Context *con)
   assert(!lock->get_parent()->is_auth());
 
   // wait!
-  dout(7) << "simple_rdlock_try waiting on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_rdlock_try waiting on " << *lock << " on " << *lock->get_parent() << dendl;
   lock->add_waiter(SimpleLock::WAIT_RD, con);
   return false;
 }
 
 bool Locker::simple_rdlock_start(SimpleLock *lock, MDRequest *mdr)
 {
-  dout(7) << "simple_rdlock_start  on " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "simple_rdlock_start  on " << *lock << " on " << *lock->get_parent() << dendl;  
 
   // can read?  grab ref.
   if (lock->can_rdlock(mdr)) {
@@ -1105,7 +1105,7 @@ bool Locker::simple_rdlock_start(SimpleLock *lock, MDRequest *mdr)
   }
   
   // wait!
-  dout(7) << "simple_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << dendl;
   lock->add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
   return false;
 }
@@ -1119,7 +1119,7 @@ void Locker::simple_rdlock_finish(SimpleLock *lock, MDRequest *mdr)
     mdr->locks.erase(lock);
   }
 
-  dout(7) << "simple_rdlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_rdlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
   
   // last one?
   if (!lock->is_rdlocked())
@@ -1128,7 +1128,7 @@ void Locker::simple_rdlock_finish(SimpleLock *lock, MDRequest *mdr)
 
 bool Locker::simple_xlock_start(SimpleLock *lock, MDRequest *mdr)
 {
-  dout(7) << "simple_xlock_start  on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_xlock_start  on " << *lock << " on " << *lock->get_parent() << dendl;
 
   // xlock by me?
   if (lock->is_xlocked() &&
@@ -1190,7 +1190,7 @@ bool Locker::simple_xlock_start(SimpleLock *lock, MDRequest *mdr)
 
 void Locker::simple_xlock_finish(SimpleLock *lock, MDRequest *mdr)
 {
-  dout(7) << "simple_xlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "simple_xlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
 
   // drop ref
   assert(lock->can_xlock(mdr));
@@ -1202,7 +1202,7 @@ void Locker::simple_xlock_finish(SimpleLock *lock, MDRequest *mdr)
   // remote xlock?
   if (!lock->get_parent()->is_auth()) {
     // tell auth
-    dout(7) << "simple_xlock_finish releasing remote xlock on " << *lock->get_parent()  << endl;
+    dout(7) << "simple_xlock_finish releasing remote xlock on " << *lock->get_parent()  << dendl;
     int auth = lock->get_parent()->authority().first;
     if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
       MMDSSlaveRequest *slavereq = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_UNXLOCK);
@@ -1239,7 +1239,7 @@ bool Locker::dentry_can_rdlock_trace(vector<CDentry*>& trace)
        it++) {
     CDentry *dn = *it;
     if (!dn->lock.can_rdlock(0)) {
-      dout(10) << "can_rdlock_trace can't rdlock " << *dn << endl;
+      dout(10) << "can_rdlock_trace can't rdlock " << *dn << dendl;
       return false;
     }
   }
@@ -1252,7 +1252,7 @@ void Locker::dentry_anon_rdlock_trace_start(vector<CDentry*>& trace)
   for (vector<CDentry*>::iterator it = trace.begin();
        it != trace.end();
        it++) {
-    dout(10) << "dentry_anon_rdlock_trace_start rdlocking " << (*it)->lock << " " << **it << endl;
+    dout(10) << "dentry_anon_rdlock_trace_start rdlocking " << (*it)->lock << " " << **it << dendl;
     (*it)->lock.get_rdlock();
   }
 }
@@ -1274,12 +1274,12 @@ void Locker::dentry_anon_rdlock_trace_finish(vector<CDentry*>& trace)
 bool Locker::scatter_rdlock_start(ScatterLock *lock, MDRequest *mdr)
 {
   dout(7) << "scatter_rdlock_start  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
 
   // read on stable scattered replica?  
   if (lock->get_state() == LOCK_SCATTER &&
       !lock->get_parent()->is_auth()) {
-    dout(7) << "scatter_rdlock_start  scatterlock read on a stable scattered replica, fw to auth" << endl;
+    dout(7) << "scatter_rdlock_start  scatterlock read on a stable scattered replica, fw to auth" << dendl;
     mdcache->request_forward(mdr, lock->get_parent()->authority().first);
     return false;
   }
@@ -1317,7 +1317,7 @@ bool Locker::scatter_rdlock_start(ScatterLock *lock, MDRequest *mdr)
 void Locker::scatter_rdlock_finish(ScatterLock *lock, MDRequest *mdr)
 {
   dout(7) << "scatter_rdlock_finish  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   lock->put_rdlock();
   if (mdr) {
     mdr->rdlocks.erase(lock);
@@ -1331,7 +1331,7 @@ void Locker::scatter_rdlock_finish(ScatterLock *lock, MDRequest *mdr)
 bool Locker::scatter_wrlock_start(ScatterLock *lock, MDRequest *mdr)
 {
   dout(7) << "scatter_wrlock_start  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   
   // pre-twiddle?
   if (lock->get_parent()->is_auth() &&
@@ -1367,7 +1367,7 @@ bool Locker::scatter_wrlock_start(ScatterLock *lock, MDRequest *mdr)
       // auth should be auth_pinned (see acquire_locks wrlock weird mustpin case).
       int auth = lock->get_parent()->authority().first;
       dout(10) << "requesting scatter from auth on " 
-              << *lock << " on " << *lock->get_parent() << endl;
+              << *lock << " on " << *lock->get_parent() << dendl;
       mds->send_message_mds(new MLock(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()),
                            auth, MDS_PORT_LOCKER);
     }
@@ -1379,7 +1379,7 @@ bool Locker::scatter_wrlock_start(ScatterLock *lock, MDRequest *mdr)
 void Locker::scatter_wrlock_finish(ScatterLock *lock, MDRequest *mdr)
 {
   dout(7) << "scatter_wrlock_finish  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   lock->put_wrlock();
   if (mdr) {
     mdr->wrlocks.erase(lock);
@@ -1406,19 +1406,19 @@ void Locker::try_scatter_eval(ScatterLock *lock)
   // unstable and ambiguous auth?
   if (!lock->is_stable() &&
       lock->get_parent()->is_ambiguous_auth()) {
-    dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
+    dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_ScatterEval(this, lock));
     return;
   }
 
   if (!lock->get_parent()->is_auth()) {
-    dout(7) << "try_scatter_eval not auth for " << *lock->get_parent() << endl;
+    dout(7) << "try_scatter_eval not auth for " << *lock->get_parent() << dendl;
     return;
   }
 
   if (!lock->get_parent()->can_auth_pin()) {
-    dout(7) << "try_scatter_eval can't auth_pin, waiting on " << *lock->get_parent() << endl;
+    dout(7) << "try_scatter_eval can't auth_pin, waiting on " << *lock->get_parent() << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     lock->get_parent()->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_Locker_ScatterEval(this, lock));
     return;
@@ -1431,14 +1431,14 @@ void Locker::try_scatter_eval(ScatterLock *lock)
 
 void Locker::scatter_eval_gather(ScatterLock *lock)
 {
-  dout(10) << "scatter_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
+  dout(10) << "scatter_eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
 
   if (!lock->get_parent()->is_auth()) {
     // REPLICA
 
     if (lock->get_state() == LOCK_GLOCKC &&
        !lock->is_wrlocked()) {
-      dout(10) << "scatter_eval no wrlocks, acking lock" << endl;
+      dout(10) << "scatter_eval no wrlocks, acking lock" << dendl;
       int auth = lock->get_parent()->authority().first;
       if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
        bufferlist data;
@@ -1459,7 +1459,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
        !lock->is_gathering() &&
        !lock->is_rdlocked()) {
       dout(7) << "scatter_eval finished lock gather/un-rdlock on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       lock->set_state(LOCK_LOCK);
       lock->finish_waiters(ScatterLock::WAIT_XLOCK|ScatterLock::WAIT_STABLE);
       lock->get_parent()->auth_unpin();
@@ -1473,7 +1473,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
        scatter_writebehind(lock);
       } else {
        dout(7) << "scatter_eval finished lock gather/un-wrlock on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
        lock->set_state(LOCK_LOCK);
        //lock->get_parent()->put(CInode::PIN_SCATTERED);
        lock->finish_waiters(ScatterLock::WAIT_XLOCK|ScatterLock::WAIT_STABLE);
@@ -1485,7 +1485,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
     else if (lock->get_state() == LOCK_GSYNCL &&
             !lock->is_wrlocked()) {
       dout(7) << "scatter_eval finished sync un-wrlock on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       if (lock->get_parent()->is_replicated()) {
        // encode and bcast
        bufferlist data;
@@ -1503,7 +1503,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
             !lock->is_gathering() &&
             !lock->is_rdlocked()) {
       dout(7) << "scatter_eval finished scatter un-rdlock(/gather) on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       if (lock->get_parent()->is_replicated()) {
        // encode and bcast
        bufferlist data;
@@ -1525,7 +1525,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
        scatter_writebehind(lock);
       } else {
        dout(7) << "scatter_eval finished tempsync gather/un-wrlock on " << *lock
-               << " on " << *lock->get_parent() << endl;
+               << " on " << *lock->get_parent() << dendl;
        lock->set_state(LOCK_TEMPSYNC);
        lock->finish_waiters(ScatterLock::WAIT_RD|ScatterLock::WAIT_STABLE);
        lock->get_parent()->auth_unpin();
@@ -1542,7 +1542,7 @@ void Locker::scatter_eval_gather(ScatterLock *lock)
 void Locker::scatter_writebehind(ScatterLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
-  dout(10) << "scatter_writebehind on " << *lock << " on " << *in << endl;
+  dout(10) << "scatter_writebehind on " << *lock << " on " << *in << dendl;
 
   // journal write-behind.
   inode_t *pi = in->project_inode();
@@ -1559,7 +1559,7 @@ void Locker::scatter_writebehind(ScatterLock *lock)
 void Locker::scatter_writebehind_finish(ScatterLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
-  dout(10) << "scatter_writebehind_finish on " << *lock << " on " << *in << endl;
+  dout(10) << "scatter_writebehind_finish on " << *lock << " on " << *in << dendl;
   in->pop_and_dirty_projected_inode();
   lock->clear_updated();
   scatter_eval_gather(lock);
@@ -1567,7 +1567,7 @@ void Locker::scatter_writebehind_finish(ScatterLock *lock)
 
 void Locker::scatter_eval(ScatterLock *lock)
 {
-  dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << endl;
+  dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << dendl;
 
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
@@ -1576,14 +1576,14 @@ void Locker::scatter_eval(ScatterLock *lock)
     // i _should_ be scattered.
     if (!lock->is_rdlocked() &&
        !lock->is_xlocked()) {
-      dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << endl;
+      dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << dendl;
       scatter_scatter(lock);
     }
   } else {
     // i _should_ be sync.
     if (!lock->is_wrlocked() &&
        !lock->is_xlocked()) {
-      dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << endl;
+      dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << dendl;
       scatter_sync(lock);
     }
   }
@@ -1593,7 +1593,7 @@ void Locker::scatter_eval(ScatterLock *lock)
 void Locker::scatter_sync(ScatterLock *lock)
 {
   dout(10) << "scatter_sync " << *lock
-          << " on " << *lock->get_parent() << endl;
+          << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
 
@@ -1646,7 +1646,7 @@ void Locker::scatter_sync(ScatterLock *lock)
 void Locker::scatter_scatter(ScatterLock *lock)
 {
   dout(10) << "scatter_scatter " << *lock
-          << " on " << *lock->get_parent() << endl;
+          << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
   
@@ -1698,7 +1698,7 @@ void Locker::scatter_scatter(ScatterLock *lock)
 void Locker::scatter_lock(ScatterLock *lock)
 {
   dout(10) << "scatter_lock " << *lock
-          << " on " << *lock->get_parent() << endl;
+          << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
 
@@ -1751,7 +1751,7 @@ void Locker::scatter_lock(ScatterLock *lock)
 void Locker::scatter_tempsync(ScatterLock *lock)
 {
   dout(10) << "scatter_tempsync " << *lock
-          << " on " << *lock->get_parent() << endl;
+          << " on " << *lock->get_parent() << dendl;
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
 
@@ -1800,12 +1800,12 @@ void Locker::scatter_tempsync(ScatterLock *lock)
 void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
 {
   int from = m->get_asker();
-  dout(10) << "handle_scatter_lock " << *m << " on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(10) << "handle_scatter_lock " << *m << " on " << *lock << " on " << *lock->get_parent() << dendl;
   
   if (mds->is_rejoin()) {
     if (lock->get_parent()->is_rejoining()) {
       dout(7) << "handle_scatter_lock still rejoining " << *lock->get_parent()
-             << ", dropping " << *m << endl;
+             << ", dropping " << *m << dendl;
       delete m;
       return;
     }
@@ -1830,12 +1830,12 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
     if (lock->is_wrlocked()) {
       assert(lock->get_state() == LOCK_SCATTER);
       dout(7) << "handle_scatter_lock has wrlocks, waiting on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       lock->set_state(LOCK_GLOCKC);
     } else if (lock->is_rdlocked()) {
       assert(lock->get_state() == LOCK_SYNC);
       dout(7) << "handle_scatter_lock has rdlocks, waiting on " << *lock
-             << " on " << *lock->get_parent() << endl;
+             << " on " << *lock->get_parent() << dendl;
       lock->set_state(LOCK_GLOCKS);
     } else {
       //if (lock->get_state() == LOCK_SCATTER) 
@@ -1872,11 +1872,11 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
     if (lock->is_gathering()) {
       dout(7) << "handle_scatter_lock " << *lock << " on " << *lock->get_parent()
              << " from " << from << ", still gathering " << lock->get_gather_set()
-             << endl;
+             << dendl;
     } else {
       dout(7) << "handle_scatter_lock " << *lock << " on " << *lock->get_parent()
              << " from " << from << ", last one" 
-             << endl;
+             << dendl;
       scatter_eval_gather(lock);
     }
     break;
@@ -1884,11 +1884,11 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
   case LOCK_AC_REQSCATTER:
     if (lock->is_stable()) {
       dout(7) << "handle_scatter_lock got scatter request on " << *lock << " on " << *lock->get_parent()
-             << endl;
+             << dendl;
       scatter_scatter(lock);
     } else {
       dout(7) << "handle_scatter_lock ignoring scatter request on " << *lock << " on " << *lock->get_parent()
-             << endl;
+             << dendl;
     }
     break;
 
@@ -1908,7 +1908,7 @@ void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
 bool Locker::local_wrlock_start(LocalLock *lock, MDRequest *mdr)
 {
   dout(7) << "local_wrlock_start  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   
   if (lock->can_wrlock()) {
     lock->get_wrlock();
@@ -1924,7 +1924,7 @@ bool Locker::local_wrlock_start(LocalLock *lock, MDRequest *mdr)
 void Locker::local_wrlock_finish(LocalLock *lock, MDRequest *mdr)
 {
   dout(7) << "local_wrlock_finish  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   lock->put_wrlock();
   mdr->wrlocks.erase(lock);
   mdr->locks.erase(lock);
@@ -1933,7 +1933,7 @@ void Locker::local_wrlock_finish(LocalLock *lock, MDRequest *mdr)
 bool Locker::local_xlock_start(LocalLock *lock, MDRequest *mdr)
 {
   dout(7) << "local_xlock_start  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   
   if (lock->is_xlocked_by_other(mdr)) {
     lock->add_waiter(SimpleLock::WAIT_WR|SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
@@ -1949,7 +1949,7 @@ bool Locker::local_xlock_start(LocalLock *lock, MDRequest *mdr)
 void Locker::local_xlock_finish(LocalLock *lock, MDRequest *mdr)
 {
   dout(7) << "local_xlock_finish  on " << *lock
-         << " on " << *lock->get_parent() << endl;  
+         << " on " << *lock->get_parent() << dendl;  
   lock->put_xlock();
   mdr->xlocks.erase(lock);
   mdr->locks.erase(lock);
@@ -1965,7 +1965,7 @@ void Locker::local_xlock_finish(LocalLock *lock, MDRequest *mdr)
 
 bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
 {
-  dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << dendl;
 
   // can read?  grab ref.
   if (lock->can_rdlock(mdr)) {
@@ -1978,7 +1978,7 @@ bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
   // can't read, and replicated.
   if (lock->can_rdlock_soon()) {
     // wait
-    dout(7) << "file_rdlock_start can_rdlock_soon " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "file_rdlock_start can_rdlock_soon " << *lock << " on " << *lock->get_parent() << dendl;
   } else {    
     if (lock->get_parent()->is_auth()) {
       // auth
@@ -1997,7 +1997,7 @@ bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
           return true;
         }
       } else {
-        dout(7) << "file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << endl;
+        dout(7) << "file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << dendl;
         lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
         return false;
       }
@@ -2008,14 +2008,14 @@ bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
         // fw to auth
        CInode *in = (CInode*)lock->get_parent();
         int auth = in->authority().first;
-        dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << " on replica and async, fw to auth " << auth << endl;
+        dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << " on replica and async, fw to auth " << auth << dendl;
         assert(auth != mds->get_nodeid());
         mdcache->request_forward(mdr, auth);
         return false;
         
       } else {
         // wait until stable
-        dout(7) << "inode_file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << endl;
+        dout(7) << "inode_file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << dendl;
         lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
         return false;
       }
@@ -2023,7 +2023,7 @@ bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
   }
   
   // wait
-  dout(7) << "file_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "file_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << dendl;
   lock->add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
         
   return false;
@@ -2033,7 +2033,7 @@ bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
 
 void Locker::file_rdlock_finish(FileLock *lock, MDRequest *mdr)
 {
-  dout(7) << "rdlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "rdlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
 
   // drop ref
   lock->put_rdlock();
@@ -2047,7 +2047,7 @@ void Locker::file_rdlock_finish(FileLock *lock, MDRequest *mdr)
 
 bool Locker::file_xlock_start(FileLock *lock, MDRequest *mdr)
 {
-  dout(7) << "file_xlock_start on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "file_xlock_start on " << *lock << " on " << *lock->get_parent() << dendl;
 
   assert(lock->get_parent()->is_auth());  // remote file xlock not implemented
 
@@ -2061,7 +2061,7 @@ bool Locker::file_xlock_start(FileLock *lock, MDRequest *mdr)
     // auth
     if (!lock->can_xlock_soon()) {
       if (!lock->is_stable()) {
-       dout(7) << "file_xlock_start on auth, waiting for stable on " << *lock << " on " << *lock->get_parent() << endl;
+       dout(7) << "file_xlock_start on auth, waiting for stable on " << *lock << " on " << *lock->get_parent() << dendl;
        lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
        return false;
       }
@@ -2081,7 +2081,7 @@ bool Locker::file_xlock_start(FileLock *lock, MDRequest *mdr)
     mdr->xlocks.insert(lock);
     return true;
   } else {
-    dout(7) << "file_xlock_start on auth, waiting for write on " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "file_xlock_start on auth, waiting for write on " << *lock << " on " << *lock->get_parent() << dendl;
     lock->add_waiter(SimpleLock::WAIT_WR, new C_MDS_RetryRequest(mdcache, mdr));
     return false;
   }
@@ -2090,7 +2090,7 @@ bool Locker::file_xlock_start(FileLock *lock, MDRequest *mdr)
 
 void Locker::file_xlock_finish(FileLock *lock, MDRequest *mdr)
 {
-  dout(7) << "file_xlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+  dout(7) << "file_xlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
 
   // drop ref
   assert(lock->can_xlock(mdr));
@@ -2132,19 +2132,19 @@ void Locker::try_file_eval(FileLock *lock)
   // unstable and ambiguous auth?
   if (!lock->is_stable() &&
       in->is_ambiguous_auth()) {
-    dout(7) << "try_file_eval not stable and ambiguous auth, waiting on " << *in << endl;
+    dout(7) << "try_file_eval not stable and ambiguous auth, waiting on " << *in << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     in->add_waiter(CInode::WAIT_SINGLEAUTH, new C_Locker_FileEval(this, lock));
     return;
   }
 
   if (!lock->get_parent()->is_auth()) {
-    dout(7) << "try_file_eval not auth for " << *lock->get_parent() << endl;
+    dout(7) << "try_file_eval not auth for " << *lock->get_parent() << dendl;
     return;
   }
 
   if (!lock->get_parent()->can_auth_pin()) {
-    dout(7) << "try_file_eval can't auth_pin, waiting on " << *in << endl;
+    dout(7) << "try_file_eval can't auth_pin, waiting on " << *in << dendl;
     //if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
     in->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_Locker_FileEval(this, lock));
     return;
@@ -2164,7 +2164,7 @@ void Locker::file_eval_gather(FileLock *lock)
   dout(7) << "file_eval_gather issued " << cap_string(issued)
          << " vs " << cap_string(lock->caps_allowed())
          << " on " << *lock << " on " << *lock->get_parent()
-         << endl;
+         << dendl;
 
   if (lock->is_stable())
     return;  // nothing for us to do here!
@@ -2173,7 +2173,7 @@ void Locker::file_eval_gather(FileLock *lock)
   if (in->is_auth() &&
       !lock->is_gathering() &&
       ((issued & ~lock->caps_allowed()) == 0)) {
-    dout(7) << "file_eval_gather finished gather" << endl;
+    dout(7) << "file_eval_gather finished gather" << dendl;
     
     switch (lock->get_state()) {
       // to lock
@@ -2306,7 +2306,7 @@ void Locker::file_eval(FileLock *lock)
   dout(7) << "file_eval wanted=" << cap_string(wanted)
          << "  filelock=" << *lock << " on " << *lock->get_parent()
          << "  loner=" << loner
-         << endl;
+         << dendl;
 
   assert(lock->get_parent()->is_auth());
   assert(lock->is_stable());
@@ -2320,7 +2320,7 @@ void Locker::file_eval(FileLock *lock)
       (wanted & CAP_FILE_WR) &&
       loner &&
       lock->get_state() != LOCK_LONER) {
-    dout(7) << "file_eval stable, bump to loner " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "file_eval stable, bump to loner " << *lock << " on " << *lock->get_parent() << dendl;
     file_loner(lock);
   }
 
@@ -2331,7 +2331,7 @@ void Locker::file_eval(FileLock *lock)
           (wanted & CAP_FILE_WR) &&
           !(loner && lock->get_state() == LOCK_LONER) &&
           lock->get_state() != LOCK_MIXED) {
-    dout(7) << "file_eval stable, bump to mixed " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "file_eval stable, bump to mixed " << *lock << " on " << *lock->get_parent() << dendl;
     file_mixed(lock);
   }
   
@@ -2342,7 +2342,7 @@ void Locker::file_eval(FileLock *lock)
            in->is_replicated() || 
            (!loner && lock->get_state() == LOCK_LONER)) &&
           lock->get_state() != LOCK_SYNC) {
-    dout(7) << "file_eval stable, bump to sync " << *lock << " on " << *lock->get_parent() << endl;
+    dout(7) << "file_eval stable, bump to sync " << *lock << " on " << *lock->get_parent() << dendl;
     file_sync(lock);
   }
   
@@ -2360,7 +2360,7 @@ void Locker::file_eval(FileLock *lock)
 bool Locker::file_sync(FileLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
-  dout(7) << "file_sync " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "file_sync " << *lock << " on " << *lock->get_parent() << dendl;  
 
   assert(in->is_auth());
   assert(lock->is_stable());
@@ -2435,7 +2435,7 @@ bool Locker::file_sync(FileLock *lock)
 void Locker::file_lock(FileLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
-  dout(7) << "inode_file_lock " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "inode_file_lock " << *lock << " on " << *lock->get_parent() << dendl;  
 
   assert(in->is_auth());
   assert(lock->is_stable());
@@ -2513,7 +2513,7 @@ void Locker::file_lock(FileLock *lock)
 
 void Locker::file_mixed(FileLock *lock)
 {
-  dout(7) << "file_mixed " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "file_mixed " << *lock << " on " << *lock->get_parent() << dendl;  
 
   CInode *in = (CInode*)lock->get_parent();
   assert(in->is_auth());
@@ -2583,7 +2583,7 @@ void Locker::file_mixed(FileLock *lock)
 void Locker::file_loner(FileLock *lock)
 {
   CInode *in = (CInode*)lock->get_parent();
-  dout(7) << "inode_file_loner " << *lock << " on " << *lock->get_parent() << endl;  
+  dout(7) << "inode_file_loner " << *lock << " on " << *lock->get_parent() << dendl;  
 
   assert(in->is_auth());
   assert(lock->is_stable());
@@ -2643,7 +2643,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
   if (mds->is_rejoin()) {
     if (in->is_rejoining()) {
       dout(7) << "handle_file_lock still rejoining " << *in
-             << ", dropping " << *m << endl;
+             << ", dropping " << *m << dendl;
       delete m;
       return;
     }
@@ -2651,7 +2651,7 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
 
 
   dout(7) << "handle_file_lock a=" << m->get_action() << " from " << from << " " 
-         << *in << " filelock=" << *lock << endl;  
+         << *in << " filelock=" << *lock << dendl;  
   
   int issued = in->get_caps_issued();
 
@@ -2681,12 +2681,12 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     
     // call back caps?
     if (issued & CAP_FILE_RD) {
-      dout(7) << "handle_file_lock client readers, gathering caps on " << *in << endl;
+      dout(7) << "handle_file_lock client readers, gathering caps on " << *in << dendl;
       issue_caps(in);
       break;
     }
     else if (lock->is_rdlocked()) {
-      dout(7) << "handle_file_lock rdlocked, waiting before ack on " << *in << endl;
+      dout(7) << "handle_file_lock rdlocked, waiting before ack on " << *in << dendl;
       break;
     } 
     
@@ -2746,10 +2746,10 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
 
     if (lock->is_gathering()) {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", still gathering " << lock->get_gather_set() << endl;
+             << ", still gathering " << lock->get_gather_set() << dendl;
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", last one" << endl;
+             << ", last one" << dendl;
       file_eval_gather(lock);
     }
     break;
@@ -2769,10 +2769,10 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
 
     if (lock->is_gathering()) {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", still gathering " << lock->get_gather_set() << endl;
+             << ", still gathering " << lock->get_gather_set() << dendl;
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", last one" << endl;
+             << ", last one" << dendl;
       file_eval_gather(lock);
     }
     break;
@@ -2784,10 +2784,10 @@ void Locker::handle_file_lock(FileLock *lock, MLock *m)
     
     if (lock->is_gathering()) {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", still gathering " << lock->get_gather_set() << endl;
+             << ", still gathering " << lock->get_gather_set() << dendl;
     } else {
       dout(7) << "handle_lock_inode_file " << *in << " from " << from
-             << ", last one" << endl;
+             << ", last one" << dendl;
       file_eval_gather(lock);
     }
     break;
index f91888b9ec394d9ba706d6e0a3713ec814fa64f4..05b4336c52f05dd0fba7a75d3a122b54c6eb4fe6 100644 (file)
@@ -36,6 +36,7 @@
 #include "events/EAnchorClient.h"
 
 
+
 LogEvent *LogEvent::decode(bufferlist& bl)
 {
   // parse type, length
@@ -45,7 +46,7 @@ LogEvent *LogEvent::decode(bufferlist& bl)
   off += sizeof(type);
 
   int length = bl.length() - off;
-  dout(15) << "decode_log_event type " << type << ", size " << length << endl;
+  generic_dout(15) << "decode_log_event type " << type << ", size " << length << dendl;
   
   assert(type > 0);
   
@@ -70,7 +71,7 @@ LogEvent *LogEvent::decode(bufferlist& bl)
   case EVENT_ANCHOR: le = new EAnchor; break;
   case EVENT_ANCHORCLIENT: le = new EAnchorClient; break;
   default:
-    dout(1) << "uh oh, unknown log event type " << type << endl;
+    generic_dout(1) << "uh oh, unknown log event type " << type << dendl;
     assert(0);
   }
 
index a227886f23ba1f7cc55d4dd87ab3810ac3d8b86a..4f1709e218d96aa86ff832b24c9f58ee5cc18f7a 100644 (file)
@@ -31,8 +31,8 @@
 using namespace std;
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug_mds || l<=g_conf.debug_mds_balancer) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".bal "
+
+#define  dout(l)    if (l<=g_conf.debug_mds || l<=g_conf.debug_mds_balancer) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".bal "
 
 #define MIN_LOAD    50   //  ??
 #define MIN_REEXPORT 5  // will automatically reexport
@@ -49,7 +49,7 @@ int MDBalancer::proc_message(Message *m)
     break;
     
   default:
-    dout(1) << " balancer unknown message " << m->get_type() << endl;
+    dout(1) << " balancer unknown message " << m->get_type() << dendl;
     assert(0);
     break;
   }
@@ -70,7 +70,7 @@ void MDBalancer::tick()
 
   // sample?
   if ((double)now - (double)last_sample > g_conf.mds_bal_sample_interval) {
-    dout(15) << "tick last_sample now " << now << endl;
+    dout(15) << "tick last_sample now " << now << dendl;
     last_sample = now;
   }
 
@@ -134,7 +134,7 @@ void MDBalancer::send_heartbeat()
 {
   utime_t now = g_clock.now();
   if (!mds->mdcache->get_root()) {
-    dout(5) << "no root on send_heartbeat" << endl;
+    dout(5) << "no root on send_heartbeat" << dendl;
     mds->mdcache->open_root(new C_Bal_SendHeartbeat(mds));
     return;
   }
@@ -163,11 +163,11 @@ void MDBalancer::send_heartbeat()
   mds_import_map[ mds->get_nodeid() ] = import_map;
   
   
-  dout(5) << "mds" << mds->get_nodeid() << " sending heartbeat " << beat_epoch << " " << load << endl;
+  dout(5) << "mds" << mds->get_nodeid() << " sending heartbeat " << beat_epoch << " " << load << dendl;
   for (map<int, float>::iterator it = import_map.begin();
        it != import_map.end();
        it++) {
-    dout(5) << "  import_map from " << it->first << " -> " << it->second << endl;
+    dout(5) << "  import_map from " << it->first << " -> " << it->second << dendl;
   }
 
   
@@ -185,10 +185,10 @@ void MDBalancer::send_heartbeat()
 
 void MDBalancer::handle_heartbeat(MHeartbeat *m)
 {
-  dout(25) << "=== got heartbeat " << m->get_beat() << " from " << m->get_source().num() << " " << m->get_load() << endl;
+  dout(25) << "=== got heartbeat " << m->get_beat() << " from " << m->get_source().num() << " " << m->get_load() << dendl;
   
   if (!mds->mdcache->get_root()) {
-    dout(10) << "opening root on handle_heartbeat" << endl;
+    dout(10) << "opening root on handle_heartbeat" << dendl;
     mds->mdcache->open_root(new C_MDS_RetryMessage(mds, m));
     return;
   }
@@ -196,7 +196,7 @@ void MDBalancer::handle_heartbeat(MHeartbeat *m)
   int who = m->get_source().num();
   
   if (who == 0) {
-    dout(20) << " from mds0, new epoch" << endl;
+    dout(20) << " from mds0, new epoch" << dendl;
     beat_epoch = m->get_beat();
     send_heartbeat();
 
@@ -206,7 +206,7 @@ void MDBalancer::handle_heartbeat(MHeartbeat *m)
   mds_load[ who ] = m->get_load();
   mds_import_map[ who ] = m->get_import_map();
 
-  //cout << "  load is " << load << " have " << mds_load.size() << endl;
+  //dout(0) << "  load is " << load << " have " << mds_load.size() << dendl;
   
   unsigned cluster_size = mds->get_mds_map()->get_num_mds();
   if (mds_load.size() == cluster_size) {
@@ -222,7 +222,7 @@ void MDBalancer::handle_heartbeat(MHeartbeat *m)
 
 void MDBalancer::export_empties() 
 {
-  dout(5) << "export_empties checking for empty imports" << endl;
+  dout(5) << "export_empties checking for empty imports" << dendl;
 
   for (map<CDir*,set<CDir*> >::iterator it = mds->mdcache->subtrees.begin();
        it != mds->mdcache->subtrees.end();
@@ -249,7 +249,7 @@ double MDBalancer::try_match(int ex, double& maxex,
   double howmuch = MIN(maxex, maxim);
   if (howmuch <= 0) return 0.0;
   
-  dout(5) << "   - mds" << ex << " exports " << howmuch << " to mds" << im << endl;
+  dout(5) << "   - mds" << ex << " exports " << howmuch << " to mds" << im << dendl;
   
   if (ex == mds->get_nodeid())
     my_targets[im] += howmuch;
@@ -268,11 +268,11 @@ double MDBalancer::try_match(int ex, double& maxex,
 void MDBalancer::do_fragmenting()
 {
   if (split_queue.empty()) {
-    dout(20) << "do_fragmenting has nothing to do" << endl;
+    dout(20) << "do_fragmenting has nothing to do" << dendl;
     return;
   }
 
-  dout(0) << "do_fragmenting " << split_queue.size() << " dirs marked for possible splitting" << endl;
+  dout(0) << "do_fragmenting " << split_queue.size() << " dirs marked for possible splitting" << dendl;
   
   for (set<dirfrag_t>::iterator i = split_queue.begin();
        i != split_queue.end();
@@ -281,7 +281,7 @@ void MDBalancer::do_fragmenting()
     if (!dir) continue;
     if (!dir->is_auth()) continue;
 
-    dout(0) << "do_fragmenting splitting " << *dir << endl;
+    dout(0) << "do_fragmenting splitting " << *dir << dendl;
     mds->mdcache->split_dir(dir, 3);
   }
   split_queue.clear();
@@ -302,7 +302,7 @@ void MDBalancer::do_rebalance(int beat)
   imported.clear();
   exported.clear();
 
-  dout(5) << " do_rebalance: cluster loads are" << endl;
+  dout(5) << " do_rebalance: cluster loads are" << dendl;
 
   // rescale!  turn my mds_load back into meta_load units
   double load_fac = 1.0;
@@ -311,7 +311,7 @@ void MDBalancer::do_rebalance(int beat)
     dout(7) << " load_fac is " << load_fac 
            << " <- " << mds_load[whoami].auth.meta_load(now)
            << " / " << mds_load[whoami].mds_load(now)
-           << endl;
+           << dendl;
   }
   
   double total_load = 0;
@@ -324,7 +324,7 @@ void MDBalancer::do_rebalance(int beat)
       dout(-5) << "  mds" << i 
                << " " << mds_load[i] 
                << " = " << mds_load[i].mds_load(now) 
-               << " ~ " << l << endl;
+               << " ~ " << l << dendl;
 
     if (whoami == i) my_load = l;
     total_load += l;
@@ -337,16 +337,16 @@ void MDBalancer::do_rebalance(int beat)
   dout(5) << "do_rebalance:  my load " << my_load 
           << "   target " << target_load 
           << "   total " << total_load 
-          << endl;
+          << dendl;
   
   // under or over?
   if (my_load < target_load * (1.0 + g_conf.mds_bal_min_rebalance)) {
-    dout(5) << "  i am underloaded or barely overloaded, doing nothing." << endl;
+    dout(5) << "  i am underloaded or barely overloaded, doing nothing." << dendl;
     show_imports();
     return;
   }  
 
-  dout(5) << "  i am sufficiently overloaded" << endl;
+  dout(5) << "  i am sufficiently overloaded" << dendl;
 
 
   // first separate exporters and importers
@@ -359,11 +359,11 @@ void MDBalancer::do_rebalance(int beat)
        it != load_map.end();
        it++) {
     if (it->first < target_load) {
-      dout(15) << "   mds" << it->second << " is importer" << endl;
+      dout(15) << "   mds" << it->second << " is importer" << dendl;
       importers.insert(pair<double,int>(it->first,it->second));
       importer_set.insert(it->second);
     } else {
-      dout(15) << "   mds" << it->second << " is exporter" << endl;
+      dout(15) << "   mds" << it->second << " is exporter" << dendl;
       exporters.insert(pair<double,int>(it->first,it->second));
       exporter_set.insert(it->second);
     }
@@ -375,7 +375,7 @@ void MDBalancer::do_rebalance(int beat)
   if (true) {
     // analyze import_map; do any matches i can
 
-    dout(15) << "  matching exporters to import sources" << endl;
+    dout(15) << "  matching exporters to import sources" << dendl;
 
     // big -> small exporters
     for (multimap<double,int>::reverse_iterator ex = exporters.rbegin();
@@ -401,7 +401,7 @@ void MDBalancer::do_rebalance(int beat)
   if (1) {
     if (beat % 2 == 1) {
       // old way
-      dout(15) << "  matching big exporters to big importers" << endl;
+      dout(15) << "  matching big exporters to big importers" << dendl;
       // big exporters to big importers
       multimap<double,int>::reverse_iterator ex = exporters.rbegin();
       multimap<double,int>::iterator im = importers.begin();
@@ -417,7 +417,7 @@ void MDBalancer::do_rebalance(int beat)
       }
     } else {
       // new way
-      dout(15) << "  matching small exporters to big importers" << endl;
+      dout(15) << "  matching small exporters to big importers" << dendl;
       // small exporters to big importers
       multimap<double,int>::iterator ex = exporters.begin();
       multimap<double,int>::iterator im = importers.begin();
@@ -454,14 +454,14 @@ void MDBalancer::do_rebalance(int beat)
        im->inode->authority().first != mds->get_nodeid()) {
       dout(-5) << " exporting idle import " << *im
                << " back to mds" << im->inode->authority().first
-               << endl;
+               << dendl;
       mds->mdcache->migrator->export_dir(im, im->inode->authority().first);
       continue;
     }
 
     import_pop_map[ pop ] = im;
     int from = im->inode->authority().first;
-    dout(15) << "  map: i imported " << *im << " from " << from << endl;
+    dout(15) << "  map: i imported " << *im << " from " << from << dendl;
     import_from_map.insert(pair<int,CDir*>(from, im));
   }
   
@@ -480,7 +480,7 @@ void MDBalancer::do_rebalance(int beat)
     double fac = 1.0;
     if (false && total_goal > 0 && total_sent > 0) {
       fac = total_goal / total_sent;
-      dout(-5) << " total sent is " << total_sent << " / " << total_goal << " -> fac 1/ " << fac << endl;
+      dout(-5) << " total sent is " << total_sent << " / " << total_goal << " -> fac 1/ " << fac << dendl;
       if (fac > 1.0) fac = 1.0;
     }
     fac = .9 - .4 * ((float)g_conf.num_mds / 128.0);  // hack magic fixme
@@ -495,19 +495,19 @@ void MDBalancer::do_rebalance(int beat)
     dout(5) << "want to send " << amount << " to mds" << target 
       //<< " .. " << (*it).second << " * " << load_fac 
             << " -> " << amount
-            << endl;//" .. fudge is " << fudge << endl;
+            << dendl;//" .. fudge is " << fudge << dendl;
     double have = 0;
     
     show_imports();
 
     // search imports from target
     if (import_from_map.count(target)) {
-      dout(5) << " aha, looking through imports from target mds" << target << endl;
+      dout(5) << " aha, looking through imports from target mds" << target << dendl;
       pair<multimap<int,CDir*>::iterator, multimap<int,CDir*>::iterator> p =
         import_from_map.equal_range(target);
       while (p.first != p.second) {
         CDir *dir = (*p.first).second;
-        dout(5) << "considering " << *dir << " from " << (*p.first).first << endl;
+        dout(5) << "considering " << *dir << " from " << (*p.first).first << dendl;
         multimap<int,CDir*>::iterator plast = p.first++;
         
         if (dir->inode->is_root()) continue;
@@ -518,13 +518,13 @@ void MDBalancer::do_rebalance(int beat)
         if (pop <= amount-have) {
           dout(-5) << "reexporting " << *dir 
                    << " pop " << pop 
-                   << " back to mds" << target << endl;
+                   << " back to mds" << target << dendl;
           mds->mdcache->migrator->export_dir(dir, target);
           have += pop;
           import_from_map.erase(plast);
           import_pop_map.erase(pop);
         } else {
-          dout(5) << "can't reexport " << *dir << ", too big " << pop << endl;
+          dout(5) << "can't reexport " << *dir << ", too big " << pop << dendl;
         }
         if (amount-have < MIN_OFFLOAD) break;
       }
@@ -547,7 +547,7 @@ void MDBalancer::do_rebalance(int beat)
         dout(-5) << "reexporting " << *imp 
                  << " pop " << pop 
                  << " back to mds" << imp->inode->authority()
-                 << endl;
+                 << dendl;
         have += pop;
         mds->mdcache->migrator->export_dir(imp, imp->inode->authority().first);
       }
@@ -581,12 +581,12 @@ void MDBalancer::do_rebalance(int beat)
               << (*it)->pop_auth_subtree.meta_load(now) 
               << " to mds" << target 
                << " " << **it 
-               << endl;
+               << dendl;
       mds->mdcache->migrator->export_dir(*it, target);
     }
   }
 
-  dout(5) << "rebalance done" << endl;
+  dout(5) << "rebalance done" << dendl;
   show_imports();
   
 }
@@ -612,7 +612,7 @@ void MDBalancer::find_exports(CDir *dir,
   multimap<double, CDir*> smaller;
 
   double dir_pop = dir->pop_auth_subtree.meta_load(now);
-  dout(7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << endl;
+  dout(7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << dendl;
 
   double subdir_sum = 0;
   for (CDir_map_t::iterator it = dir->begin();
@@ -636,7 +636,7 @@ void MDBalancer::find_exports(CDir *dir,
       // how popular?
       double pop = subdir->pop_auth_subtree.meta_load(now);
       subdir_sum += pop;
-      dout(15) << "   subdir pop " << pop << " " << *subdir << endl;
+      dout(15) << "   subdir pop " << pop << " " << *subdir << dendl;
 
       if (pop < minchunk) continue;
       
@@ -657,7 +657,7 @@ void MDBalancer::find_exports(CDir *dir,
        smaller.insert(pair<double,CDir*>(pop, subdir));
     }
   }
-  dout(15) << "   sum " << subdir_sum << " / " << dir_pop << endl;
+  dout(15) << "   sum " << subdir_sum << " / " << dir_pop << dendl;
 
   // grab some sufficiently big small items
   multimap<double,CDir*>::reverse_iterator it;
@@ -668,7 +668,7 @@ void MDBalancer::find_exports(CDir *dir,
     if ((*it).first < midchunk)
       break;  // try later
     
-    dout(7) << "   taking smaller " << *(*it).second << endl;
+    dout(7) << "   taking smaller " << *(*it).second << dendl;
     
     exports.push_back((*it).second);
     already_exporting.insert((*it).second);
@@ -681,7 +681,7 @@ void MDBalancer::find_exports(CDir *dir,
   for (list<CDir*>::iterator it = bigger_unrep.begin();
        it != bigger_unrep.end();
        it++) {
-    dout(15) << "   descending into " << **it << endl;
+    dout(15) << "   descending into " << **it << dendl;
     find_exports(*it, amount, exports, have, already_exporting, now);
     if (have > needmin)
       return;
@@ -691,7 +691,7 @@ void MDBalancer::find_exports(CDir *dir,
   for (;
        it != smaller.rend();
        it++) {
-    dout(7) << "   taking (much) smaller " << it->first << " " << *(*it).second << endl;
+    dout(7) << "   taking (much) smaller " << it->first << " " << *(*it).second << dendl;
 
     exports.push_back((*it).second);
     already_exporting.insert((*it).second);
@@ -704,7 +704,7 @@ void MDBalancer::find_exports(CDir *dir,
   for (list<CDir*>::iterator it = bigger_rep.begin();
        it != bigger_rep.end();
        it++) {
-    dout(7) << "   descending into replicated " << **it << endl;
+    dout(7) << "   descending into replicated " << **it << dendl;
     find_exports(*it, amount, exports, have, already_exporting, now);
     if (have > needmin)
       return;
@@ -737,13 +737,13 @@ void MDBalancer::hit_inode(utime_t now, CInode *in, int type)
             << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " curdom, " 
             << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " anydom" 
             << " on " << *in
-            << endl;
+            << dendl;
   } else {
     dout(20) << "hit_inode " << type << " pop "
             << in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
             << in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
             << " on " << *in
-            << endl;
+            << dendl;
   }
 
   // hit auth up to import
@@ -767,7 +767,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, double amount)
     float v = dir->popularity[MDS_POP_JUSTME].pop[type].get();    
 
     dout(20) << "hit_dir " << type << " pop " << v << " me "
-             << *dir << endl;
+             << *dir << dendl;
 
     // fragment this dir?  (later?)
     if (((g_conf.mds_bal_split_size > 0 &&
@@ -776,7 +776,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, double amount)
          //(v > g_conf.mds_bal_split_wr && type == META_POP_IWR) ||
          (v > g_conf.mds_bal_split_wr && type == META_POP_DWR)) &&
         split_queue.count(dir->dirfrag()) == 0) {
-      dout(0) << "hit_dir " << type << " pop is " << v << ", putting in split_queue: " << *dir << endl;
+      dout(0) << "hit_dir " << type << " pop is " << v << ", putting in split_queue: " << *dir << dendl;
       split_queue.insert(dir->dirfrag());
     }
 
@@ -790,7 +790,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, double amount)
     float dir_pop = dir->pop_auth_subtree.get(type).get(now);    // hmm??
     dir->last_popularity_sample = last_sample;
 
-    dout(20) << "hit_dir " << type << " pop " << dir_pop << " in " << *dir << endl;
+    dout(20) << "hit_dir " << type << " pop " << dir_pop << " in " << *dir << dendl;
     
     if (dir->is_auth()) {
       if (!dir->is_rep() &&
@@ -800,7 +800,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, double amount)
        rd_adj = rdp / mds->get_mds_map()->get_num_mds() - rdp; 
        rd_adj /= 2.0;  // temper somewhat
        
-       dout(2) << "replicating dir " << *dir << " pop " << dir_pop << " .. rdp " << rdp << " adj " << rd_adj << endl;
+       dout(2) << "replicating dir " << *dir << " pop " << dir_pop << " .. rdp " << rdp << " adj " << rd_adj << dendl;
        
        dir->dir_rep = CDir::REP_ALL;
        mds->mdcache->send_dir_updates(dir, true);
@@ -813,7 +813,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, double amount)
          dir->is_rep() &&
          dir_pop < g_conf.mds_bal_unreplicate_threshold) {
        // unreplicate
-       dout(2) << "unreplicating dir " << *dir << " pop " << dir_pop << endl;
+       dout(2) << "unreplicating dir " << *dir << " pop " << dir_pop << dendl;
        
        dir->dir_rep = CDir::REP_NONE;
        mds->mdcache->send_dir_updates(dir);
@@ -900,7 +900,7 @@ void MDBalancer::dump_pop_map()
   char fn[20];
   sprintf(fn, "popdump.%d.mds%d", beat_epoch, mds->get_nodeid());
 
-  dout(1) << "dump_pop_map to " << fn << endl;
+  dout(1) << "dump_pop_map to " << fn << dendl;
 
   ofstream myfile;
   myfile.open(fn);
@@ -941,7 +941,7 @@ void MDBalancer::dump_pop_map()
        myfile << "." << p;
        if (dir->get_frag() != frag_t()) 
          myfile << "___" << (unsigned)dir->get_frag();
-       myfile << endl; //"/" << dir->get_frag() << endl;
+       myfile << dendl; //"/" << dir->get_frag() << dendl;
        
        // add contents
        for (map<string,CDentry*>::iterator q = dir->items.begin();
@@ -967,7 +967,7 @@ void MDBalancer::dump_pop_map()
         if (!dir->is_rep() &&
             dir_pop >= g_conf.mds_bal_replicate_threshold) {
           // replicate
-          dout(5) << "replicating dir " << *in << " pop " << dir_pop << endl;
+          dout(5) << "replicating dir " << *in << " pop " << dir_pop << dendl;
           
           dir->dir_rep = CDIR_REP_ALL;
           mds->mdcache->send_dir_updates(dir);
@@ -976,7 +976,7 @@ void MDBalancer::dump_pop_map()
         if (dir->is_rep() &&
             dir_pop < g_conf.mds_bal_unreplicate_threshold) {
           // unreplicate
-          dout(5) << "unreplicating dir " << *in << " pop " << dir_pop << endl;
+          dout(5) << "unreplicating dir " << *in << " pop " << dir_pop << dendl;
           
           dir->dir_rep = CDIR_REP_NONE;
           mds->mdcache->send_dir_updates(dir);
index dc8521f46de10897f02433cec21f6f5446989a22..07af9d0c8e99c45dcecefcc6e5ae103b9b2d03ad 100644 (file)
@@ -83,8 +83,8 @@
 using namespace std;
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".cache "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".cache "
 
 
 
@@ -131,7 +131,7 @@ void MDCache::log_stat(Logger *logger)
 bool MDCache::shutdown()
 {
   if (lru.lru_get_size() > 0) {
-    dout(7) << "WARNING: mdcache shutodwn with non-empty cache" << endl;
+    dout(7) << "WARNING: mdcache shutodwn with non-empty cache" << dendl;
     //show_cache();
     show_subtrees();
     //dump();
@@ -171,7 +171,7 @@ void MDCache::add_inode(CInode *in)
 
 void MDCache::remove_inode(CInode *o) 
 { 
-  dout(14) << "remove_inode " << *o << endl;
+  dout(14) << "remove_inode " << *o << dendl;
 
   if (o->get_parent_dn()) {
     // FIXME: multiple parents?
@@ -239,7 +239,7 @@ void MDCache::open_root(Context *c)
   } else {
     // request inode from root mds
     if (waiting_for_root.empty()) {
-      dout(7) << "discovering root" << endl;
+      dout(7) << "discovering root" << dendl;
 
       filepath want;
       MDiscover *req = new MDiscover(whoami,
@@ -248,7 +248,7 @@ void MDCache::open_root(Context *c)
                                      false);  // there _is_ no base dir for the root inode
       mds->send_message_mds(req, 0, MDS_PORT_CACHE);
     } else {
-      dout(7) << "waiting for root" << endl;
+      dout(7) << "waiting for root" << dendl;
     }    
 
     // wait
@@ -288,7 +288,7 @@ void MDCache::open_local_stray()
 void MDCache::open_foreign_stray(int who, Context *c)
 {
   inodeno_t ino = MDS_INO_STRAY(who);
-  dout(10) << "open_foreign_stray mds" << who << " " << ino << endl;
+  dout(10) << "open_foreign_stray mds" << who << " " << ino << dendl;
   assert(!have_inode(ino));
 
   // discover
@@ -359,7 +359,7 @@ void MDCache::list_subtrees(list<CDir*>& ls)
 void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> auth)
 {
   dout(7) << "adjust_subtree_auth " << dir->get_dir_auth() << " -> " << auth
-         << " on " << *dir << endl;
+         << " on " << *dir << dendl;
 
   show_subtrees();
 
@@ -373,14 +373,14 @@ void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> auth)
   }
   assert(root);
   assert(subtrees.count(root));
-  dout(7) << " current root is " << *root << endl;
+  dout(7) << " current root is " << *root << dendl;
 
   if (root == dir) {
     // i am already a subtree.
     dir->set_dir_auth(auth);
   } else {
     // i am a new subtree.
-    dout(10) << "  new subtree at " << *dir << endl;
+    dout(10) << "  new subtree at " << *dir << dendl;
     assert(subtrees.count(dir) == 0);
     subtrees[dir].clear();      // create empty subtree bounds list for me.
 
@@ -394,7 +394,7 @@ void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> auth)
       next++;
       if (get_subtree_root((*p)->get_parent_dir()) == dir) {
        // move under me
-       dout(10) << "  claiming child bound " << **p << endl;
+       dout(10) << "  claiming child bound " << **p << dendl;
        subtrees[dir].insert(*p); 
        subtrees[root].erase(p);
       }
@@ -448,7 +448,7 @@ void MDCache::adjust_export_state(CDir *dir)
       dir->inode->authority().first == mds->get_nodeid()) {
     // export.
     if (!dir->state_test(CDir::STATE_EXPORT)) {
-      dout(10) << "adjust_export_state pinning new export " << *dir << endl;
+      dout(10) << "adjust_export_state pinning new export " << *dir << dendl;
       dir->state_set(CDir::STATE_EXPORT);
       dir->get(CDir::PIN_EXPORT);
     }
@@ -456,7 +456,7 @@ void MDCache::adjust_export_state(CDir *dir)
   else {
     // not export.
     if (dir->state_test(CDir::STATE_EXPORT)) {
-      dout(10) << "adjust_export_state unpinning old export " << *dir << endl;
+      dout(10) << "adjust_export_state unpinning old export " << *dir << dendl;
       dir->state_clear(CDir::STATE_EXPORT);
       dir->put(CDir::PIN_EXPORT);
     }
@@ -465,7 +465,7 @@ void MDCache::adjust_export_state(CDir *dir)
 
 void MDCache::try_subtree_merge(CDir *dir)
 {
-  dout(7) << "try_subtree_merge " << *dir << endl;
+  dout(7) << "try_subtree_merge " << *dir << dendl;
   assert(subtrees.count(dir));
   set<CDir*> oldbounds = subtrees[dir];
 
@@ -491,7 +491,7 @@ public:
 
 void MDCache::try_subtree_merge_at(CDir *dir)
 {
-  dout(10) << "try_subtree_merge_at " << *dir << endl;
+  dout(10) << "try_subtree_merge_at " << *dir << dendl;
   assert(subtrees.count(dir));
 
   // merge with parent?
@@ -504,7 +504,7 @@ void MDCache::try_subtree_merge_at(CDir *dir)
       dir->dir_auth.second == CDIR_AUTH_UNKNOWN &&  // auth is unambiguous,
       !dir->state_test(CDir::STATE_EXPORTBOUND)) {  // not an exportbound,
     // merge with parent.
-    dout(10) << "  subtree merge at " << *dir << endl;
+    dout(10) << "  subtree merge at " << *dir << dendl;
     dir->set_dir_auth(CDIR_AUTH_DEFAULT);
     
     // move our bounds under the parent
@@ -536,7 +536,7 @@ void MDCache::try_subtree_merge_at(CDir *dir)
        dir->inode->can_auth_pin() &&
        (mds->is_active() || mds->is_stopping())) {
       CInode *in = dir->inode;
-      dout(10) << "try_subtree_merge_at journaling merged bound " << *in << endl;
+      dout(10) << "try_subtree_merge_at journaling merged bound " << *in << dendl;
       
       in->auth_pin();
 
@@ -558,7 +558,7 @@ void MDCache::try_subtree_merge_at(CDir *dir)
 
 void MDCache::subtree_merge_writebehind_finish(CInode *in)
 {
-  dout(10) << "subtree_merge_writebehind_finish on " << in << endl;
+  dout(10) << "subtree_merge_writebehind_finish on " << in << dendl;
   in->pop_and_dirty_projected_inode();
   in->auth_unpin();
 }
@@ -584,7 +584,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
   dout(7) << "adjust_bounded_subtree_auth " << dir->get_dir_auth() << " -> " << auth
          << " on " << *dir
          << " bounds " << bounds
-         << endl;
+         << dendl;
 
   show_subtrees();
 
@@ -598,7 +598,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
   }
   assert(root);
   assert(subtrees.count(root));
-  dout(7) << " current root is " << *root << endl;
+  dout(7) << " current root is " << *root << dendl;
 
   pair<int,int> oldauth = dir->authority();
 
@@ -607,7 +607,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
     dir->set_dir_auth(auth);
   } else {
     // i am a new subtree.
-    dout(10) << "  new subtree at " << *dir << endl;
+    dout(10) << "  new subtree at " << *dir << dendl;
     assert(subtrees.count(dir) == 0);
     subtrees[dir].clear();      // create empty subtree bounds list for me.
     
@@ -621,7 +621,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
       next++;
       if (get_subtree_root((*p)->get_parent_dir()) == dir) {
        // move under me
-       dout(10) << "  claiming child bound " << **p << endl;
+       dout(10) << "  claiming child bound " << **p << dendl;
        subtrees[dir].insert(*p); 
        subtrees[root].erase(p);
       }
@@ -647,25 +647,25 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
     // new bound?
     if (subtrees[dir].count(bound) == 0) {
       if (get_subtree_root(bound) == dir) {
-       dout(10) << "  new bound " << *bound << ", adjusting auth back to old " << oldauth << endl;
+       dout(10) << "  new bound " << *bound << ", adjusting auth back to old " << oldauth << dendl;
        adjust_subtree_auth(bound, oldauth);       // otherwise, adjust at bound.
       }
       else {
-       dout(10) << "  want bound " << *bound << endl;
+       dout(10) << "  want bound " << *bound << dendl;
        // make sure it's nested beneath ambiguous subtree(s)
        while (1) {
          CDir *t = get_subtree_root(bound->get_parent_dir());
          if (t == dir) break;
          while (subtrees[dir].count(t) == 0)
            t = get_subtree_root(t->get_parent_dir());
-         dout(10) << "  swallowing intervening subtree at " << *t << endl;
+         dout(10) << "  swallowing intervening subtree at " << *t << dendl;
          adjust_subtree_auth(t, auth);
          try_subtree_merge_at(t);
        }
       }
     }
     else {
-      dout(10) << "  already have bound " << *bound << endl;
+      dout(10) << "  already have bound " << *bound << dendl;
     }
   }
   // merge stray bounds?
@@ -675,7 +675,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
     n++;
     if (bounds.count(*p) == 0) {
       CDir *stray = *p;
-      dout(10) << "  swallowing extra subtree at " << *stray << endl;
+      dout(10) << "  swallowing extra subtree at " << *stray << dendl;
       adjust_subtree_auth(stray, auth);
       try_subtree_merge_at(stray);
     }
@@ -701,7 +701,7 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, list<dirfrag_t>& bound_dfs,
   dout(7) << "adjust_bounded_subtree_auth " << dir->get_dir_auth() << " -> " << auth
          << " on " << *dir 
          << " bound_dfs " << bound_dfs
-         << endl;
+         << dendl;
   
   // make bounds list
   set<CDir*> bounds;
@@ -735,7 +735,7 @@ void MDCache::map_dirfrag_set(list<dirfrag_t>& dfs, set<CDir*>& result)
       in->dirfragtree.get_leaves_under(*q, fglist);
 
     dout(15) << "map_dirfrag_set " << p->second << " -> " << fglist
-            << " on " << *in << endl;
+            << " on " << *in << dendl;
 
     for (list<frag_t>::iterator q = fglist.begin(); q != fglist.end(); ++q) {
       CDir *dir = in->get_dirfrag(*q);
@@ -760,7 +760,7 @@ CDir *MDCache::get_subtree_root(CDir *dir)
 
 void MDCache::remove_subtree(CDir *dir)
 {
-  dout(10) << "remove_subtree " << *dir << endl;
+  dout(10) << "remove_subtree " << *dir << dendl;
   assert(subtrees.count(dir));
   assert(subtrees[dir].empty());
   subtrees.erase(dir);
@@ -806,7 +806,7 @@ void MDCache::verify_subtree_bounds(CDir *dir, const set<CDir*>& bounds)
   // for debugging only.
   assert(subtrees.count(dir));
   if (bounds != subtrees[dir]) {
-    dout(0) << "verify_subtree_bounds failed" << endl;
+    dout(0) << "verify_subtree_bounds failed" << dendl;
     set<CDir*> b = bounds;
     for (set<CDir*>::iterator p = subtrees[dir].begin();
         p != subtrees[dir].end();
@@ -815,12 +815,12 @@ void MDCache::verify_subtree_bounds(CDir *dir, const set<CDir*>& bounds)
        b.erase(*p);
        continue;
       }
-      dout(0) << "  missing bound " << **p << endl;
+      dout(0) << "  missing bound " << **p << dendl;
     }
     for (set<CDir*>::iterator p = b.begin();
         p != b.end();
         ++p) 
-      dout(0) << "    extra bound " << **p << endl;
+      dout(0) << "    extra bound " << **p << dendl;
   }
   assert(bounds == subtrees[dir]);
 }
@@ -838,7 +838,7 @@ void MDCache::verify_subtree_bounds(CDir *dir, const list<dirfrag_t>& bounds)
     CDir *bd = get_dirfrag(*p);
     if (!bd) continue;
     if (subtrees[dir].count(bd) == 0) {
-      dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << endl;
+      dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << dendl;
       failed++;
     }
   }
@@ -847,7 +847,7 @@ void MDCache::verify_subtree_bounds(CDir *dir, const list<dirfrag_t>& bounds)
 
 void MDCache::adjust_subtree_after_rename(CInode *diri, CDir *olddir)
 {
-  dout(10) << "adjust_subtree_after_rename " << *diri << " from " << *olddir << endl;
+  dout(10) << "adjust_subtree_after_rename " << *diri << " from " << *olddir << dendl;
 
   //show_subtrees();
 
@@ -856,20 +856,20 @@ void MDCache::adjust_subtree_after_rename(CInode *diri, CDir *olddir)
   for (list<CDir*>::iterator p = dfls.begin(); p != dfls.end(); ++p) {
     CDir *dir = *p;
 
-    dout(10) << "dirfrag " << *dir << endl;
+    dout(10) << "dirfrag " << *dir << dendl;
     CDir *oldparent = get_subtree_root(olddir);
-    dout(10) << " old parent " << *oldparent << endl;
+    dout(10) << " old parent " << *oldparent << dendl;
     CDir *newparent = get_subtree_root(diri->get_parent_dir());
-    dout(10) << " new parent " << *newparent << endl;
+    dout(10) << " new parent " << *newparent << dendl;
 
     if (oldparent == newparent) {
-      dout(10) << "parent unchanged for " << *dir << " at " << *oldparent << endl;
+      dout(10) << "parent unchanged for " << *dir << " at " << *oldparent << dendl;
       continue;
     }
 
     if (dir->is_subtree_root()) {
       // children are fine.  change parent.
-      dout(10) << "moving " << *dir << " from " << *oldparent << " to " << *newparent << endl;
+      dout(10) << "moving " << *dir << " from " << *oldparent << " to " << *newparent << dendl;
       assert(subtrees[oldparent].count(dir));
       subtrees[oldparent].erase(dir);
       assert(subtrees.count(newparent));
@@ -891,7 +891,7 @@ void MDCache::adjust_subtree_after_rename(CInode *diri, CDir *olddir)
       }
       for (list<CDir*>::iterator p = tomove.begin(); p != tomove.end(); ++p) {
        CDir *bound = *p;
-       dout(10) << "moving bound " << *bound << " from " << *oldparent << " to " << *newparent << endl;
+       dout(10) << "moving bound " << *bound << " from " << *oldparent << " to " << *newparent << dendl;
        subtrees[oldparent].erase(bound);
        subtrees[newparent].insert(bound);
       }           
@@ -997,7 +997,7 @@ void MDCache::log_subtree_map(Context *onsync)
 {
   dout(10) << "log_subtree_map " << num_subtrees() << " subtrees, " 
           << num_subtrees_fullauth() << " fullauth"
-          << endl;
+          << dendl;
   
   ESubtreeMap *le = new ESubtreeMap();
   
@@ -1009,7 +1009,7 @@ void MDCache::log_subtree_map(Context *onsync)
     CDir *dir = p->first;
     if (!dir->is_auth()) continue;
 
-    dout(15) << " subtree " << *dir << endl;
+    dout(15) << " subtree " << *dir << dendl;
     le->subtrees[dir->dirfrag()].clear();
     le->metablob.add_dir_context(dir, EMetaBlob::TO_ROOT);
     le->metablob.add_dir(dir, false);
@@ -1019,7 +1019,7 @@ void MDCache::log_subtree_map(Context *onsync)
         q != p->second.end();
         ++q) {
       CDir *bound = *q;
-      dout(15) << " subtree bound " << *bound << endl;
+      dout(15) << " subtree bound " << *bound << dendl;
       le->subtrees[dir->dirfrag()].push_back(bound->dirfrag());
       le->metablob.add_dir_context(bound, EMetaBlob::TO_ROOT);
       le->metablob.add_dir(bound, false);
@@ -1038,7 +1038,7 @@ void MDCache::log_subtree_map(Context *onsync)
 
 void MDCache::_logged_subtree_map(off_t off)
 {
-  dout(10) << "_logged_subtree_map at " << off << endl;
+  dout(10) << "_logged_subtree_map at " << off << dendl;
   mds->mdlog->last_subtree_map = off;
   mds->mdlog->writing_subtree_map = false;
 
@@ -1059,7 +1059,7 @@ void MDCache::send_resolve(int who)
 
 void MDCache::send_resolve_later(int who)
 {
-  dout(10) << "send_resolve_later to mds" << who << endl;
+  dout(10) << "send_resolve_later to mds" << who << dendl;
   wants_resolve.insert(who);
 }
 
@@ -1071,7 +1071,7 @@ void MDCache::maybe_send_pending_resolves()
   // only if it's appropriate!
   if (migrator->is_exporting() ||
       migrator->is_importing()) {
-    dout(7) << "maybe_send_pending_resolves waiting, imports/exports still in progress" << endl;
+    dout(7) << "maybe_send_pending_resolves waiting, imports/exports still in progress" << dendl;
     migrator->show_importing();
     migrator->show_exporting();
     return;  // not now
@@ -1098,7 +1098,7 @@ public:
 
 void MDCache::send_resolve_now(int who)
 {
-  dout(10) << "send_resolve_now to mds" << who << endl;
+  dout(10) << "send_resolve_now to mds" << who << dendl;
   MMDSResolve *m = new MMDSResolve;
 
   show_subtrees();
@@ -1150,7 +1150,7 @@ void MDCache::send_resolve_now(int who)
        p != active_requests.end();
        ++p) {
     if (p->second->is_slave() && p->second->slave_to_mds == who) {
-      dout(10) << " including uncommitted " << *p->second << endl;
+      dout(10) << " including uncommitted " << *p->second << dendl;
       m->add_slave_request(p->first);
     }
   }
@@ -1159,7 +1159,7 @@ void MDCache::send_resolve_now(int who)
     for (map<metareqid_t, EMetaBlob>::iterator p = uncommitted_slave_updates[who].begin();
         p != uncommitted_slave_updates[who].end();
         ++p) {
-      dout(10) << " including uncommitted " << p->first << endl;
+      dout(10) << " including uncommitted " << p->first << dendl;
       m->add_slave_request(p->first);
     }
     need_resolve_ack.insert(who);
@@ -1173,12 +1173,12 @@ void MDCache::send_resolve_now(int who)
 
 void MDCache::handle_mds_failure(int who)
 {
-  dout(7) << "handle_mds_failure mds" << who << endl;
+  dout(7) << "handle_mds_failure mds" << who << dendl;
   
   // make note of recovery set
   mds->mdsmap->get_recovery_mds_set(recovery_set);
   recovery_set.erase(mds->get_nodeid());
-  dout(1) << "my recovery peers will be " << recovery_set << endl;
+  dout(1) << "my recovery peers will be " << recovery_set << dendl;
 
   // adjust my recovery lists
   wants_resolve.erase(who);   // MDS will ask again
@@ -1203,7 +1203,7 @@ void MDCache::handle_mds_failure(int who)
       list<Context*> waiters;
       in->take_waiting(CInode::WAIT_DIR, waiters);
       mds->queue_waiters(waiters);
-      dout(10) << "kicking WAIT_DIR on " << *in << endl;
+      dout(10) << "kicking WAIT_DIR on " << *in << dendl;
       
       // remove from mds list
       p->second.erase(who);
@@ -1221,9 +1221,9 @@ void MDCache::handle_mds_failure(int who)
     // slave to the failed node?
     if (p->second->slave_to_mds == who) {
       if (p->second->slave_did_prepare()) {
-       dout(10) << " slave request " << *p->second << " uncommitted, will resolve shortly" << endl;
+       dout(10) << " slave request " << *p->second << " uncommitted, will resolve shortly" << dendl;
       } else {
-       dout(10) << " slave request " << *p->second << " has no prepare, finishing up" << endl;
+       dout(10) << " slave request " << *p->second << " has no prepare, finishing up" << dendl;
        if (p->second->slave_request)
          p->second->aborted = true;
        else
@@ -1235,14 +1235,14 @@ void MDCache::handle_mds_failure(int who)
     if (!p->second->committing) {
       if (p->second->witnessed.count(who)) {
        dout(10) << " master request " << *p->second << " no longer witnessed by slave mds" << who
-                << endl;
+                << dendl;
        // discard this peer's prepare (if any)
        p->second->witnessed.erase(who);
       }
       
       if (p->second->waiting_on_slave.count(who)) {
        dout(10) << " master request " << *p->second << " waiting for slave mds" << who
-                << " to recover" << endl;
+                << " to recover" << dendl;
        // retry request when peer recovers
        p->second->waiting_on_slave.erase(who);
        mds->wait_for_active_peer(who, new C_MDS_RetryRequest(this, p->second));
@@ -1251,7 +1251,7 @@ void MDCache::handle_mds_failure(int who)
   }
 
   while (!finish.empty()) {
-    dout(10) << "cleaning up slave request " << *finish.front() << endl;
+    dout(10) << "cleaning up slave request " << *finish.front() << dendl;
     request_finish(finish.front());
     finish.pop_front();
   }
@@ -1265,7 +1265,7 @@ void MDCache::handle_mds_failure(int who)
  */
 void MDCache::handle_mds_recovery(int who)
 {
-  dout(7) << "handle_mds_recovery mds" << who << endl;
+  dout(7) << "handle_mds_recovery mds" << who << dendl;
 
   list<Context*> waiters;
 
@@ -1316,7 +1316,7 @@ void MDCache::handle_mds_recovery(int who)
 
 void MDCache::set_recovery_set(set<int>& s) 
 {
-  dout(7) << "set_recovery_set " << s << endl;
+  dout(7) << "set_recovery_set " << s << dendl;
   recovery_set = s;
 }
 
@@ -1329,7 +1329,7 @@ void MDCache::set_recovery_set(set<int>& s)
  */
 void MDCache::handle_resolve(MMDSResolve *m)
 {
-  dout(7) << "handle_resolve from " << m->get_source() << endl;
+  dout(7) << "handle_resolve from " << m->get_source() << dendl;
   int from = m->get_source().num();
 
   // ambiguous slave requests?
@@ -1341,11 +1341,11 @@ void MDCache::handle_resolve(MMDSResolve *m)
         ++p) {
       if (mds->clientmap.have_completed_request(*p)) {
        // COMMIT
-       dout(10) << " ambiguous slave request " << *p << " will COMMIT" << endl;
+       dout(10) << " ambiguous slave request " << *p << " will COMMIT" << dendl;
        ack->add_commit(*p);
       } else {
        // ABORT
-       dout(10) << " ambiguous slave request " << *p << " will ABORT" << endl;
+       dout(10) << " ambiguous slave request " << *p << " will ABORT" << dendl;
        ack->add_abort(*p);      
       }
     }
@@ -1362,7 +1362,7 @@ void MDCache::handle_resolve(MMDSResolve *m)
       next++;
       CDir *dir = get_dirfrag(p->first);
       assert(dir);
-      dout(10) << "checking ambiguous import " << *dir << endl;
+      dout(10) << "checking ambiguous import " << *dir << dendl;
       if (migrator->is_importing(dir->dirfrag()) &&
          migrator->get_import_peer(dir->dirfrag()) == from) {
        assert(migrator->get_import_state(dir->dirfrag()) == Migrator::IMPORT_ACKING);
@@ -1391,10 +1391,10 @@ void MDCache::handle_resolve(MMDSResolve *m)
        }
 
        if (claimed_by_sender) {
-         dout(7) << "ambiguous import failed on " << *dir << endl;
+         dout(7) << "ambiguous import failed on " << *dir << dendl;
          migrator->import_reverse(dir);
        } else {
-         dout(7) << "ambiguous import succeeded on " << *dir << endl;
+         dout(7) << "ambiguous import succeeded on " << *dir << dendl;
          migrator->import_finish(dir);
        }
       }
@@ -1412,7 +1412,7 @@ void MDCache::handle_resolve(MMDSResolve *m)
     if (forced) {
       dout(10) << " forced frag " << pi->first.frag << " to leaf in " 
               << diri->dirfragtree 
-              << " on " << pi->first << endl;
+              << " on " << pi->first << dendl;
     }
 
     CDir *dir = diri->get_dirfrag(pi->first.frag);
@@ -1429,7 +1429,7 @@ void MDCache::handle_resolve(MMDSResolve *m)
   for (map<dirfrag_t, list<dirfrag_t> >::iterator pi = m->ambiguous_imports.begin();
        pi != m->ambiguous_imports.end();
        ++pi) {
-    dout(10) << "noting ambiguous import on " << pi->first << " bounds " << pi->second << endl;
+    dout(10) << "noting ambiguous import on " << pi->first << " bounds " << pi->second << dendl;
     other_ambiguous_imports[from][pi->first].swap( pi->second );
   }
   
@@ -1445,13 +1445,13 @@ void MDCache::maybe_resolve_finish()
 {
   if (got_resolve != recovery_set) {
     dout(10) << "maybe_resolve_finish still waiting for more resolves, got (" << got_resolve 
-            << "), need (" << recovery_set << ")" << endl;
+            << "), need (" << recovery_set << ")" << dendl;
   } 
   else if (!need_resolve_ack.empty()) {
-    dout(10) << "maybe_resolve_finish still waiting for resolve_ack from (" << need_resolve_ack << ")" << endl;
+    dout(10) << "maybe_resolve_finish still waiting for resolve_ack from (" << need_resolve_ack << ")" << dendl;
   } 
   else {
-    dout(10) << "maybe_resolve_finish got all resolves+resolve_acks, done." << endl;
+    dout(10) << "maybe_resolve_finish got all resolves+resolve_acks, done." << dendl;
     disambiguate_imports();
 
     if (mds->is_resolve()) {
@@ -1464,13 +1464,13 @@ void MDCache::maybe_resolve_finish()
 
 void MDCache::handle_resolve_ack(MMDSResolveAck *ack)
 {
-  dout(10) << "handle_resolve_ack " << *ack << " from " << ack->get_source() << endl;
+  dout(10) << "handle_resolve_ack " << *ack << " from " << ack->get_source() << dendl;
   int from = ack->get_source().num();
 
   for (list<metareqid_t>::iterator p = ack->commit.begin();
        p != ack->commit.end();
        ++p) {
-    dout(10) << " commit on slave " << *p << endl;
+    dout(10) << " commit on slave " << *p << dendl;
     
     if (mds->is_resolve()) {
       // replay
@@ -1489,7 +1489,7 @@ void MDCache::handle_resolve_ack(MMDSResolveAck *ack)
   for (list<metareqid_t>::iterator p = ack->abort.begin();
        p != ack->abort.end();
        ++p) {
-    dout(10) << " abort on slave " << *p << endl;
+    dout(10) << " abort on slave " << *p << dendl;
 
     if (mds->is_resolve()) {
       assert(uncommitted_slave_updates[from].count(*p));
@@ -1521,29 +1521,29 @@ void MDCache::handle_resolve_ack(MMDSResolveAck *ack)
 
 void MDCache::disambiguate_imports()
 {
-  dout(10) << "disambiguate_imports" << endl;
+  dout(10) << "disambiguate_imports" << dendl;
 
   // other nodes' ambiguous imports
   for (map<int, map<dirfrag_t, list<dirfrag_t> > >::iterator p = other_ambiguous_imports.begin();
        p != other_ambiguous_imports.end();
        ++p) {
     int who = p->first;
-    dout(10) << "ambiguous imports for mds" << who << endl;
+    dout(10) << "ambiguous imports for mds" << who << dendl;
 
     for (map<dirfrag_t, list<dirfrag_t> >::iterator q = p->second.begin();
         q != p->second.end();
         ++q) {
-      dout(10) << " ambiguous import " << q->first << " bounds " << q->second << endl;
+      dout(10) << " ambiguous import " << q->first << " bounds " << q->second << dendl;
       CDir *dir = get_dirfrag(q->first);
       if (!dir) continue;
       
       if (dir->authority().first == CDIR_AUTH_UNKNOWN ||   // if i am resolving
          dir->is_ambiguous_auth()) {                      // if i am a surviving bystander
-       dout(10) << "  mds" << who << " did import " << *dir << endl;
+       dout(10) << "  mds" << who << " did import " << *dir << dendl;
        adjust_bounded_subtree_auth(dir, q->second, who);
        try_subtree_merge(dir);
       } else {
-       dout(10) << "  mds" << who << " did not import " << *dir << endl;
+       dout(10) << "  mds" << who << " did not import " << *dir << dendl;
       }
     }
   }
@@ -1557,11 +1557,11 @@ void MDCache::disambiguate_imports()
     if (!dir) continue;
     
     if (dir->authority().first != CDIR_AUTH_UNKNOWN) {
-      dout(10) << "ambiguous import auth known, must not be me " << *dir << endl;
+      dout(10) << "ambiguous import auth known, must not be me " << *dir << dendl;
       cancel_ambiguous_import(q->first);
       mds->mdlog->submit_entry(new EImportFinish(dir, false));
     } else {
-      dout(10) << "ambiguous import auth unknown, must be me " << *dir << endl;
+      dout(10) << "ambiguous import auth unknown, must be me " << *dir << dendl;
       finish_ambiguous_import(q->first);
       mds->mdlog->submit_entry(new EImportFinish(dir, true));
     }
@@ -1600,7 +1600,7 @@ void MDCache::cancel_ambiguous_import(dirfrag_t df)
   assert(my_ambiguous_imports.count(df));
   dout(10) << "cancel_ambiguous_import " << df
           << " bounds " << my_ambiguous_imports[df]
-          << endl;
+          << dendl;
   my_ambiguous_imports.erase(df);
 }
 
@@ -1613,7 +1613,7 @@ void MDCache::finish_ambiguous_import(dirfrag_t df)
   
   dout(10) << "finish_ambiguous_import " << df
           << " bounds " << bounds
-          << endl;
+          << dendl;
   CDir *dir = get_dirfrag(df);
   assert(dir);
   
@@ -1629,7 +1629,7 @@ void MDCache::finish_ambiguous_import(dirfrag_t df)
  */
 void MDCache::recalc_auth_bits()
 {
-  dout(7) << "recalc_auth_bits" << endl;
+  dout(7) << "recalc_auth_bits" << dendl;
 
   for (map<CDir*,set<CDir*> >::iterator p = subtrees.begin();
        p != subtrees.end();
@@ -1638,7 +1638,7 @@ void MDCache::recalc_auth_bits()
     dfq.push_back(p->first);
 
     bool auth = p->first->authority().first == mds->get_nodeid();
-    dout(10) << " subtree auth=" << auth << " for " << *p->first << endl;
+    dout(10) << " subtree auth=" << auth << " for " << *p->first << dendl;
 
     while (!dfq.empty()) {
       CDir *dir = dfq.front();
@@ -1707,7 +1707,7 @@ void MDCache::recalc_auth_bits()
  */
 void MDCache::rejoin_send_rejoins()
 {
-  dout(10) << "rejoin_send_rejoins with recovery_set " << recovery_set << endl;
+  dout(10) << "rejoin_send_rejoins with recovery_set " << recovery_set << dendl;
 
   map<int, MMDSCacheRejoin*> rejoins;
 
@@ -1767,7 +1767,7 @@ void MDCache::rejoin_send_rejoins()
          if (rejoins.count(who) == 0) continue;
          MMDSCacheRejoin *rejoin = rejoins[who];
          
-         dout(15) << " " << *p->second << " authpin on " << **q << endl;
+         dout(15) << " " << *p->second << " authpin on " << **q << dendl;
          MDSCacheObjectInfo i;
          (*q)->set_object_info(i);
          if (i.ino)
@@ -1785,7 +1785,7 @@ void MDCache::rejoin_send_rejoins()
          if (rejoins.count(who) == 0) continue;
          MMDSCacheRejoin *rejoin = rejoins[who];
          
-         dout(15) << " " << *p->second << " xlock on " << **q << " " << *(*q)->get_parent() << endl;
+         dout(15) << " " << *p->second << " xlock on " << **q << " " << *(*q)->get_parent() << dendl;
          MDSCacheObjectInfo i;
          (*q)->get_parent()->set_object_info(i);
          if (i.ino)
@@ -1808,7 +1808,7 @@ void MDCache::rejoin_send_rejoins()
 
   // nothing?
   if (mds->is_rejoin() && rejoins.empty()) {
-    dout(10) << "nothing left to rejoin" << endl;
+    dout(10) << "nothing left to rejoin" << dendl;
     mds->rejoin_done();
   }
 }
@@ -1831,13 +1831,13 @@ void MDCache::rejoin_send_rejoins()
  */
 void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
 {
-  dout(10) << "rejoin_walk " << *dir << endl;
+  dout(10) << "rejoin_walk " << *dir << dendl;
 
   list<CDir*> nested;  // finish this dir, then do nested items
   
   if (mds->is_rejoin()) {
     // WEAK
-    dout(15) << " add_weak_dirfrag " << *dir << endl;
+    dout(15) << " add_weak_dirfrag " << *dir << dendl;
     rejoin->add_weak_dirfrag(dir->dirfrag());
 
     for (map<string,CDentry*>::iterator p = dir->items.begin();
@@ -1845,20 +1845,20 @@ void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
         ++p) {
       CDentry *dn = p->second;
       assert(dn->is_primary());
-      dout(15) << " add_weak_primary_dentry " << *dn << endl;
+      dout(15) << " add_weak_primary_dentry " << *dn << dendl;
       rejoin->add_weak_primary_dentry(dir->dirfrag(), p->first, dn->get_inode()->ino());
       dn->get_inode()->get_nested_dirfrags(nested);
     }
   } else {
     // STRONG
-    dout(15) << " add_strong_dirfrag " << *dir << endl;
+    dout(15) << " add_strong_dirfrag " << *dir << dendl;
     rejoin->add_strong_dirfrag(dir->dirfrag(), dir->get_replica_nonce());
 
     for (map<string,CDentry*>::iterator p = dir->items.begin();
         p != dir->items.end();
         ++p) {
       CDentry *dn = p->second;
-      dout(15) << " add_strong_dentry " << *dn << endl;
+      dout(15) << " add_strong_dentry " << *dn << dendl;
       rejoin->add_strong_dentry(dir->dirfrag(), p->first, 
                                dn->is_primary() ? dn->get_inode()->ino():inodeno_t(0),
                                dn->is_remote() ? dn->get_remote_ino():inodeno_t(0),
@@ -1867,7 +1867,7 @@ void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
                                dn->lock.get_state());
       if (dn->is_primary()) {
        CInode *in = dn->get_inode();
-       dout(15) << " add_strong_inode " << *in << endl;
+       dout(15) << " add_strong_inode " << *in << dendl;
        rejoin->add_strong_inode(in->ino(), in->get_replica_nonce(),
                                 in->get_caps_wanted(),
                                 in->authlock.get_state(),
@@ -1897,7 +1897,7 @@ void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
  */
 void MDCache::handle_cache_rejoin(MMDSCacheRejoin *m)
 {
-  dout(7) << "handle_cache_rejoin " << *m << " from " << m->get_source() << endl;
+  dout(7) << "handle_cache_rejoin " << *m << " from " << m->get_source() << dendl;
 
   switch (m->op) {
   case MMDSCacheRejoin::OP_WEAK:
@@ -1947,7 +1947,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
   
   if (mds->is_active() || mds->is_stopping()) {
     survivor = true;
-    dout(10) << "i am a surivivor, and will ack immediately" << endl;
+    dout(10) << "i am a surivivor, and will ack immediately" << dendl;
     ack = new MMDSCacheRejoin(MMDSCacheRejoin::OP_ACK);
 
     // check cap exports
@@ -1959,7 +1959,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
       for (map<int,inode_caps_reconnect_t>::iterator q = p->second.begin();
           q != p->second.end();
           ++q) {
-       dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << endl;
+       dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << dendl;
        rejoin_import_cap(in, q->first, q->second, from);
       }
     }
@@ -1976,14 +1976,14 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
        if (!path_is_mine(weak->cap_export_paths[p->first]))
          continue;
        cap_import_paths[p->first] = weak->cap_export_paths[p->first];
-       dout(10) << " noting cap import " << p->first << " path " << weak->cap_export_paths[p->first] << endl;
+       dout(10) << " noting cap import " << p->first << " path " << weak->cap_export_paths[p->first] << dendl;
       }
       
       // note
       for (map<int,inode_caps_reconnect_t>::iterator q = p->second.begin();
           q != p->second.end();
           ++q) {
-       dout(10) << " claiming cap import " << p->first << " client" << q->first << endl;
+       dout(10) << " claiming cap import " << p->first << " client" << q->first << dendl;
        cap_imports[p->first][q->first][from] = q->second;
       }
     }
@@ -1997,7 +1997,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
     assert(dir);
 
     int nonce = dir->add_replica(from);
-    dout(10) << " have " << *dir << endl;
+    dout(10) << " have " << *dir << dendl;
     if (ack) 
       ack->add_strong_dirfrag(p->first, nonce);
     
@@ -2011,7 +2011,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
       
       if (survivor) dentry_remove_replica(dn, from);
       int dnonce = dn->add_replica(from);
-      dout(10) << " have " << *dn << endl;
+      dout(10) << " have " << *dn << dendl;
       if (ack) 
        ack->add_strong_dentry(p->first, q->first,
                               dn->get_inode()->ino(), inodeno_t(0), 0, 
@@ -2023,7 +2023,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
 
       if (survivor) inode_remove_replica(in, from);
       int inonce = in->add_replica(from);
-      dout(10) << " have " << *in << endl;
+      dout(10) << " have " << *in << dendl;
 
       // scatter the dirlock, just in case?
       if (!survivor && in->is_dir())
@@ -2055,7 +2055,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
     if (rejoin_gather.empty()) {
       rejoin_gather_finish();
     } else {
-      dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+      dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
     }
   }
 }
@@ -2072,7 +2072,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
 bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
                             Context *retry)
 {
-  dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << endl;
+  dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << dendl;
 
   // scan list
   set<CDir*> fetch_queue;
@@ -2080,13 +2080,13 @@ bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
   while (p != pathmap.end()) {
     CInode *in = get_inode(p->first);
     if (in) {
-      dout(15) << " have " << *in << endl;
+      dout(15) << " have " << *in << dendl;
       pathmap.erase(p++);
       continue;
     }
 
     // traverse
-    dout(17) << " missing " << p->first << " at " << p->second << endl;
+    dout(17) << " missing " << p->first << " at " << p->second << dendl;
     filepath path(p->second);
     CDir *dir = path_traverse_to_dir(path);
     assert(dir);
@@ -2095,7 +2095,7 @@ bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
   }
 
   if (pathmap.empty()) {
-    dout(10) << "parallel_fetch done" << endl;
+    dout(10) << "parallel_fetch done" << dendl;
     assert(fetch_queue.empty());
     delete retry;
     return true;
@@ -2106,7 +2106,7 @@ bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
   for (set<CDir*>::iterator p = fetch_queue.begin();
        p != fetch_queue.end();
        ++p) {
-    dout(10) << "parallel_fetch fetching " << **p << endl;
+    dout(10) << "parallel_fetch fetching " << **p << dendl;
     (*p)->fetch(gather->new_sub());
   }
   
@@ -2123,7 +2123,7 @@ bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
  */
 void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack)
 {
-  dout(10) << "rejoin_scour_survivor_replicas from mds" << from << endl;
+  dout(10) << "rejoin_scour_survivor_replicas from mds" << from << dendl;
 
   // FIXME: what about root and stray inodes.
   
@@ -2137,7 +2137,7 @@ void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack)
        in->is_replica(from) &&
        ack->strong_inodes.count(p->second->ino()) == 0) {
       inode_remove_replica(in, from);
-      dout(10) << " rem " << *in << endl;
+      dout(10) << " rem " << *in << dendl;
     }
 
     if (!in->is_dir()) continue;
@@ -2153,7 +2153,7 @@ void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack)
          dir->is_replica(from) &&
          ack->strong_dirfrags.count(dir->dirfrag()) == 0) {
        dir->remove_replica(from);
-       dout(10) << " rem " << *dir << endl;
+       dout(10) << " rem " << *dir << dendl;
       } 
       
       // dentries
@@ -2166,7 +2166,7 @@ void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack)
            (ack->strong_dentries.count(dir->dirfrag()) == 0 ||
             ack->strong_dentries[dir->dirfrag()].count(dn->get_name()) == 0)) {
          dentry_remove_replica(dn, from);
-         dout(10) << " rem " << *dn << endl;
+         dout(10) << " rem " << *dn << dendl;
        }
       }
     }
@@ -2182,7 +2182,7 @@ CInode *MDCache::rejoin_invent_inode(inodeno_t ino)
   in->state_set(CInode::STATE_REJOINUNDEF);
   add_inode(in);
   rejoin_undef_inodes.insert(in);
-  dout(10) << " invented " << *in << endl;
+  dout(10) << " invented " << *in << dendl;
   return in;
 }
 
@@ -2212,7 +2212,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
       dir = in->get_or_open_dirfrag(this, p->first.frag);
     } else {
       dir->add_replica(from);
-      dout(10) << " have " << *dir << endl;
+      dout(10) << " have " << *dir << dendl;
     }
 
     for (map<string,MMDSCacheRejoin::dn_strong>::iterator q = strong->strong_dentries[p->first].begin();
@@ -2229,18 +2229,18 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
          if (!in) in = rejoin_invent_inode(q->second.ino);
          dn = dir->add_primary_dentry(q->first, in);
 
-         dout(10) << " missing " << q->second.ino << endl;
+         dout(10) << " missing " << q->second.ino << dendl;
          if (!missing) missing = new MMDSCacheRejoin(MMDSCacheRejoin::OP_MISSING);
          missing->add_weak_inode(q->second.ino);  // we want it back!
        }
-       dout(10) << " invented " << *dn << endl;
+       dout(10) << " invented " << *dn << dendl;
       }
 
       // dn auth_pin?
       if (strong->authpinned_dentries.count(p->first) &&
          strong->authpinned_dentries[p->first].count(q->first)) {
        metareqid_t ri = strong->authpinned_dentries[p->first][q->first];
-       dout(10) << " dn authpin by " << ri << " on " << *dn << endl;
+       dout(10) << " dn authpin by " << ri << " on " << *dn << dendl;
        
        // get/create slave mdrequest
        MDRequest *mdr;
@@ -2255,7 +2255,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
       if (strong->xlocked_dentries.count(p->first) &&
          strong->xlocked_dentries[p->first].count(q->first)) {
        metareqid_t ri = strong->xlocked_dentries[p->first][q->first];
-       dout(10) << " dn xlock by " << ri << " on " << *dn << endl;
+       dout(10) << " dn xlock by " << ri << " on " << *dn << dendl;
        MDRequest *mdr = request_get(ri);  // should have this from auth_pin above.
        assert(mdr->is_auth_pinned(dn));
        dn->lock.set_state(LOCK_LOCK);
@@ -2265,7 +2265,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
       }
 
       dn->add_replica(from);
-      dout(10) << " have " << *dn << endl;
+      dout(10) << " have " << *dn << dendl;
       
       // inode?
       if (dn->is_primary()) {
@@ -2279,7 +2279,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
          if (is.caps_wanted) {
            in->mds_caps_wanted[from] = is.caps_wanted;
            dout(15) << " inode caps_wanted " << cap_string(is.caps_wanted)
-                    << " on " << *in << endl;
+                    << " on " << *in << dendl;
          } 
          
          // scatterlock?
@@ -2290,7 +2290,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
          // auth pin?
          if (strong->authpinned_inodes.count(in->ino())) {
            metareqid_t ri = strong->authpinned_inodes[in->ino()];
-           dout(10) << " inode authpin by " << ri << " on " << *in << endl;
+           dout(10) << " inode authpin by " << ri << " on " << *in << dendl;
            
            // get/create slave mdrequest
            MDRequest *mdr;
@@ -2307,7 +2307,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
                 r != strong->xlocked_inodes[in->ino()].end();
                 ++r) {
              SimpleLock *lock = in->get_lock(r->first);
-             dout(10) << " inode xlock by " << r->second << " on " << *lock << " on " << *in << endl;
+             dout(10) << " inode xlock by " << r->second << " on " << *lock << " on " << *in << dendl;
              MDRequest *mdr = request_get(r->second);  // should have this from auth_pin above.
              assert(mdr->is_auth_pinned(in));
              lock->set_state(LOCK_LOCK);
@@ -2317,11 +2317,11 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
            }
          }
        } else {
-         dout(10) << " sender has dentry but not inode, adding them as a replica" << endl;
+         dout(10) << " sender has dentry but not inode, adding them as a replica" << dendl;
        }
        
        in->add_replica(from);
-       dout(10) << " have " << *in << endl;
+       dout(10) << " have " << *in << dendl;
       }
     }
   }
@@ -2335,7 +2335,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
     if (rejoin_gather.empty()) {
       rejoin_gather_finish();
     } else {
-      dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+      dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
     }
   }
 }
@@ -2343,7 +2343,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
 
 void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
 {
-  dout(7) << "handle_cache_rejoin_ack from " << ack->get_source() << endl;
+  dout(7) << "handle_cache_rejoin_ack from " << ack->get_source() << dendl;
   int from = ack->get_source().num();
 
   list<Context*> waiters;
@@ -2357,7 +2357,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
 
     dir->set_replica_nonce(p->second.nonce);
     dir->state_clear(CDir::STATE_REJOINING);
-    dout(10) << " got " << *dir << endl;
+    dout(10) << " got " << *dir << dendl;
 
     // dentries
     for (map<string,MMDSCacheRejoin::dn_strong>::iterator q = ack->strong_dentries[p->first].begin();
@@ -2369,7 +2369,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
       // hmm, did we have the proper linkage here?
       if (dn->is_null() &&
          !q->second.is_null()) {
-       dout(10) << " had bad (missing) linkage for " << *dn << endl;
+       dout(10) << " had bad (missing) linkage for " << *dn << dendl;
        if (q->second.is_remote()) {
          dn->dir->link_remote_inode(dn, q->second.remote_ino, q->second.remote_d_type);
        } else {
@@ -2384,13 +2384,13 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
       }
       else if (!dn->is_null() &&
               q->second.is_null()) {
-       dout(10) << " had bad linkage for " << *dn << endl;
+       dout(10) << " had bad linkage for " << *dn << dendl;
        assert(0);  // hrmpf.  unlink should use slave requests to clean this up during resolve.
       }
       dn->set_replica_nonce(q->second.nonce);
       mds->locker->rejoin_set_state(&dn->lock, q->second.lock, waiters);
       dn->state_clear(CDentry::STATE_REJOINING);
-      dout(10) << " got " << *dn << endl;
+      dout(10) << " got " << *dn << dendl;
     }
   }
 
@@ -2403,7 +2403,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
     in->inode = p->inode;
     in->symlink = p->symlink;
     in->dirfragtree = p->dirfragtree;
-    dout(10) << " got inode content " << *in << endl;
+    dout(10) << " got inode content " << *in << dendl;
   }
 
   // inodes
@@ -2419,7 +2419,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
     mds->locker->rejoin_set_state(&in->filelock, p->second.filelock, waiters);
     mds->locker->rejoin_set_state(&in->dirlock, p->second.dirlock, waiters);
     in->state_clear(CInode::STATE_REJOINING);
-    dout(10) << " got " << *in << endl;
+    dout(10) << " got " << *in << dendl;
   }
 
   // done?
@@ -2430,7 +2430,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
     mds->rejoin_done();
   } else {
     dout(7) << "still need rejoin from (" << rejoin_gather << ")"
-           << ", rejoin_ack from (" << rejoin_ack_gather << ")" << endl;
+           << ", rejoin_ack from (" << rejoin_ack_gather << ")" << dendl;
   }
 }
 
@@ -2439,7 +2439,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
 
 void MDCache::handle_cache_rejoin_missing(MMDSCacheRejoin *missing)
 {
-  dout(7) << "handle_cache_rejoin_missing from " << missing->get_source() << endl;
+  dout(7) << "handle_cache_rejoin_missing from " << missing->get_source() << dendl;
 
   MMDSCacheRejoin *full = new MMDSCacheRejoin(MMDSCacheRejoin::OP_FULL);
   
@@ -2449,11 +2449,11 @@ void MDCache::handle_cache_rejoin_missing(MMDSCacheRejoin *missing)
        ++p) {
     CInode *in = get_inode(*p);
     if (!in) {
-      dout(10) << " don't have inode " << *p << endl;
+      dout(10) << " don't have inode " << *p << dendl;
       continue; // we must have trimmed it after the originalo rejoin
     }
     
-    dout(10) << " sending " << *in << endl;
+    dout(10) << " sending " << *in << dendl;
     full->add_full_inode(in->inode, in->symlink, in->dirfragtree);
   }
 
@@ -2462,7 +2462,7 @@ void MDCache::handle_cache_rejoin_missing(MMDSCacheRejoin *missing)
 
 void MDCache::handle_cache_rejoin_full(MMDSCacheRejoin *full)
 {
-  dout(7) << "handle_cache_rejoin_full from " << full->get_source() << endl;
+  dout(7) << "handle_cache_rejoin_full from " << full->get_source() << dendl;
   int from = full->get_source().num();
   
   // integrate full inodes
@@ -2479,10 +2479,10 @@ void MDCache::handle_cache_rejoin_full(MMDSCacheRejoin *full)
       in->symlink = p->symlink;
       in->dirfragtree = p->dirfragtree;
       in->state_clear(CInode::STATE_REJOINUNDEF);
-      dout(10) << " got full " << *in << endl;
+      dout(10) << " got full " << *in << dendl;
       rejoin_undef_inodes.erase(q);
     } else {
-      dout(10) << " had full " << *in << endl;
+      dout(10) << " had full " << *in << dendl;
     }
   }
 
@@ -2491,7 +2491,7 @@ void MDCache::handle_cache_rejoin_full(MMDSCacheRejoin *full)
   if (rejoin_gather.empty()) {
     rejoin_gather_finish();
   } else {
-    dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+    dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
   }
 }
 
@@ -2505,7 +2505,7 @@ void MDCache::handle_cache_rejoin_full(MMDSCacheRejoin *full)
  */
 void MDCache::rejoin_trim_undef_inodes()
 {
-  dout(10) << "rejoin_trim_undef_inodes" << endl;
+  dout(10) << "rejoin_trim_undef_inodes" << dendl;
 
   while (!rejoin_undef_inodes.empty()) {
     set<CInode*>::iterator p = rejoin_undef_inodes.begin();
@@ -2530,11 +2530,11 @@ void MDCache::rejoin_trim_undef_inodes()
          CDentry *dn = p->second;
          dn->clear_replica_map();
 
-         dout(10) << " trimming " << *dn << endl;
+         dout(10) << " trimming " << *dn << dendl;
          dir->remove_dentry(dn);
        }
 
-       dout(10) << " trimming " << *dir << endl;
+       dout(10) << " trimming " << *dir << dendl;
        in->close_dirfrag(dir->dirfrag().frag);
       }
     }
@@ -2542,10 +2542,10 @@ void MDCache::rejoin_trim_undef_inodes()
     CDentry *dn = in->get_parent_dn();
     if (dn) {
       dn->clear_replica_map();
-      dout(10) << " trimming " << *dn << endl;
+      dout(10) << " trimming " << *dn << dendl;
       dn->dir->remove_dentry(dn);
     } else {
-      dout(10) << " trimming " << *in << endl;
+      dout(10) << " trimming " << *in << dendl;
       remove_inode(in);
     }
   }
@@ -2564,7 +2564,7 @@ public:
 
 void MDCache::rejoin_gather_finish() 
 {
-  dout(10) << "rejoin_gather_finish" << endl;
+  dout(10) << "rejoin_gather_finish" << dendl;
   assert(mds->is_rejoin());
 
   rejoin_trim_undef_inodes();
@@ -2605,7 +2605,7 @@ void MDCache::rejoin_gather_finish()
 void MDCache::rejoin_import_cap(CInode *in, int client, inode_caps_reconnect_t& icr, int frommds)
 {
   dout(10) << "rejoin_import_cap for client" << client << " from mds" << frommds
-          << " on " << *in << endl;
+          << " on " << *in << dendl;
   
   // add cap
   in->reconnect_cap(client, icr);
@@ -2626,7 +2626,7 @@ void MDCache::rejoin_import_cap(CInode *in, int client, inode_caps_reconnect_t&
 
 void MDCache::rejoin_send_acks()
 {
-  dout(7) << "rejoin_send_acks" << endl;
+  dout(7) << "rejoin_send_acks" << dendl;
   
   // send acks to everyone in the recovery set
   map<int,MMDSCacheRejoin*> ack;
@@ -2641,7 +2641,7 @@ void MDCache::rejoin_send_acks()
        p++) {
     CDir *dir = p->first;
     if (!dir->is_auth()) continue;
-    dout(10) << "subtree " << *dir << endl;
+    dout(10) << "subtree " << *dir << dendl;
     
     // auth items in this subtree
     list<CDir*> dq;
@@ -2770,7 +2770,7 @@ void MDCache::purge_inode(inode_t *inode, off_t newsize)
 {
   dout(10) << "purge_inode " << inode->ino << " size " << inode->size 
           << " -> " << newsize
-          << endl;
+          << dendl;
 
   // take note
   assert(purging[inode->ino].count(newsize) == 0);
@@ -2795,7 +2795,7 @@ void MDCache::_do_purge_inode(inode_t *inode, off_t newsize)
 void MDCache::purge_inode_finish(inodeno_t ino, off_t newsize)
 {
   dout(10) << "purge_inode_finish " << ino << " to " << newsize
-          << " - logging our completion" << endl;
+          << " - logging our completion" << dendl;
   
   // log completion
   mds->mdlog->submit_entry(new EPurgeFinish(ino, newsize),
@@ -2804,7 +2804,7 @@ void MDCache::purge_inode_finish(inodeno_t ino, off_t newsize)
 
 void MDCache::purge_inode_finish_2(inodeno_t ino, off_t newsize)
 {
-  dout(10) << "purge_inode_finish_2 " << ino << " to " << newsize << endl;
+  dout(10) << "purge_inode_finish_2 " << ino << " to " << newsize << dendl;
 
   // remove from purging list
   purging[ino].erase(newsize);
@@ -2833,7 +2833,7 @@ void MDCache::remove_recovered_purge(inodeno_t ino, off_t newsize)
 
 void MDCache::start_recovered_purges()
 {
-  dout(10) << "start_recovered_purges (" << purging.size() << " purges)" << endl;
+  dout(10) << "start_recovered_purges (" << purging.size() << " purges)" << dendl;
 
   for (map<inodeno_t, map<off_t,inode_t> >::iterator p = purging.begin();
        p != purging.end();
@@ -2843,7 +2843,7 @@ void MDCache::start_recovered_purges()
         ++q) {
       dout(10) << "start_recovered_purges " << p->first
               << " size " << q->second.size
-              << " to " << q->first << endl;
+              << " to " << q->first << dendl;
       _do_purge_inode(&q->second, q->first);
     }
   }
@@ -2862,7 +2862,7 @@ bool MDCache::trim(int max)
     max = lru.lru_get_max();
     if (!max) return false;
   }
-  dout(7) << "trim max=" << max << "  cur=" << lru.lru_get_size() << endl;
+  dout(7) << "trim max=" << max << "  cur=" << lru.lru_get_size() << dendl;
 
   map<int, MCacheExpire*> expiremap;
 
@@ -2912,7 +2912,7 @@ void MDCache::send_expire_messages(map<int, MCacheExpire*>& expiremap)
   for (map<int, MCacheExpire*>::iterator it = expiremap.begin();
        it != expiremap.end();
        it++) {
-    dout(7) << "sending cache_expire to " << it->first << endl;
+    dout(7) << "sending cache_expire to " << it->first << dendl;
     mds->send_message_mds(it->second, it->first, MDS_PORT_CACHE);
   }
 }
@@ -2920,7 +2920,7 @@ void MDCache::send_expire_messages(map<int, MCacheExpire*>& expiremap)
 
 void MDCache::trim_dentry(CDentry *dn, map<int, MCacheExpire*>& expiremap)
 {
-  dout(12) << "trim_dentry " << *dn << endl;
+  dout(12) << "trim_dentry " << *dn << dendl;
 
   CDir *dir = dn->get_dir();
   assert(dir);
@@ -2928,7 +2928,7 @@ void MDCache::trim_dentry(CDentry *dn, map<int, MCacheExpire*>& expiremap)
   CDir *con = get_subtree_root(dir);
   assert(con);
   
-  dout(12) << " in container " << *con << endl;
+  dout(12) << " in container " << *con << dendl;
 
   // notify dentry authority?
   if (!dn->is_auth()) {
@@ -2942,7 +2942,7 @@ void MDCache::trim_dentry(CDentry *dn, map<int, MCacheExpire*>& expiremap)
          con->is_importing()) break;                // don't send any expire while importing.
       if (a == mds->get_nodeid()) continue;          // on export, ignore myself.
       
-      dout(12) << "  sending expire to mds" << a << " on " << *dn << endl;
+      dout(12) << "  sending expire to mds" << a << " on " << *dn << dendl;
       assert(a != mds->get_nodeid());
       if (expiremap.count(a) == 0) 
        expiremap[a] = new MCacheExpire(mds->get_nodeid());
@@ -2987,7 +2987,7 @@ void MDCache::trim_dirfrag(CDir *dir, CDir *con, map<int, MCacheExpire*>& expire
 {
   assert(dir->get_num_ref() == 0);
 
-  dout(15) << "trim_dirfrag " << *dir << endl;
+  dout(15) << "trim_dirfrag " << *dir << dendl;
 
   CInode *in = dir->get_inode();
 
@@ -2997,7 +2997,7 @@ void MDCache::trim_dirfrag(CDir *dir, CDir *con, map<int, MCacheExpire*>& expire
     // was this an auth delegation?  (if so, slightly modified container)
     dirfrag_t condf;
     if (dir->is_subtree_root()) {
-      dout(12) << " subtree root, container is " << *dir << endl;
+      dout(12) << " subtree root, container is " << *dir << dendl;
       con = dir;
       condf = dir->dirfrag();
     } else {
@@ -3012,7 +3012,7 @@ void MDCache::trim_dirfrag(CDir *dir, CDir *con, map<int, MCacheExpire*>& expire
          con->is_importing()) break;                // don't send any expire while importing.
       if (a == mds->get_nodeid()) continue;          // on export, ignore myself.
 
-      dout(12) << "  sending expire to mds" << a << " on   " << *dir << endl;
+      dout(12) << "  sending expire to mds" << a << " on   " << *dir << dendl;
       assert(a != mds->get_nodeid());
       if (expiremap.count(a) == 0) 
        expiremap[a] = new MCacheExpire(mds->get_nodeid());
@@ -3027,7 +3027,7 @@ void MDCache::trim_dirfrag(CDir *dir, CDir *con, map<int, MCacheExpire*>& expire
 
 void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<int, MCacheExpire*>& expiremap)
 {
-  dout(15) << "trim_inode " << *in << endl;
+  dout(15) << "trim_inode " << *in << dendl;
   assert(in->get_num_ref() == 0);
     
   // DIR
@@ -3056,7 +3056,7 @@ void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<int, MCacheExpi
          con->is_importing()) break;                // don't send any expire while importing.
       if (a == mds->get_nodeid()) continue;          // on export, ignore myself.
 
-      dout(12) << "  sending expire to mds" << a << " on " << *in << endl;
+      dout(12) << "  sending expire to mds" << a << " on " << *in << dendl;
       assert(a != mds->get_nodeid());
       if (expiremap.count(a) == 0) 
        expiremap[a] = new MCacheExpire(mds->get_nodeid());
@@ -3087,7 +3087,7 @@ void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<int, MCacheExpi
  */
 void MDCache::trim_non_auth()
 {
-  dout(7) << "trim_non_auth" << endl;
+  dout(7) << "trim_non_auth" << dendl;
   
   // note first auth item we see.  
   // when we see it the second time, stop.
@@ -3114,7 +3114,7 @@ void MDCache::trim_non_auth()
       assert(dir);
 
       // unlink the dentry
-      dout(15) << "trim_non_auth removing " << *dn << endl;
+      dout(15) << "trim_non_auth removing " << *dn << dendl;
       if (dn->is_remote()) {
        dir->unlink_inode(dn);
       } 
@@ -3172,7 +3172,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
 {
   int from = m->get_from();
   
-  dout(7) << "cache_expire from mds" << from << endl;
+  dout(7) << "cache_expire from mds" << from << dendl;
 
   // loop over realms
   for (map<dirfrag_t,MCacheExpire::realm>::iterator p = m->realms.begin();
@@ -3190,7 +3190,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
           migrator->get_export_state(con) == Migrator::EXPORT_WARNING &&
           migrator->export_has_warned(con,from))) {
        // not auth.
-       dout(7) << "delaying nonauth|warned expires for " << *con << endl;
+       dout(7) << "delaying nonauth|warned expires for " << *con << dendl;
        assert(con->is_frozen_tree_root());
        
        // make a message container
@@ -3201,9 +3201,9 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
        delayed_expire[con][from]->add_realm(p->first, p->second);
        continue;
       }
-      dout(7) << "expires for " << *con << endl;
+      dout(7) << "expires for " << *con << dendl;
     } else {
-      dout(7) << "containerless expires (root, stray inodes)" << endl;
+      dout(7) << "containerless expires (root, stray inodes)" << dendl;
     }
 
     // INODES
@@ -3214,7 +3214,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
       int nonce = it->second;
       
       if (!in) {
-       dout(0) << " inode expire on " << it->first << " from " << from << ", don't have it" << endl;
+       dout(0) << " inode expire on " << it->first << " from " << from << ", don't have it" << dendl;
        assert(in);
       }        
       assert(in->is_auth());
@@ -3222,14 +3222,14 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
       // check nonce
       if (nonce == in->get_replica_nonce(from)) {
        // remove from our cached_by
-       dout(7) << " inode expire on " << *in << " from mds" << from << " cached_by was " << in->get_replicas() << endl;
+       dout(7) << " inode expire on " << *in << " from mds" << from << " cached_by was " << in->get_replicas() << dendl;
        inode_remove_replica(in, from);
       } 
       else {
        // this is an old nonce, ignore expire.
        dout(7) << " inode expire on " << *in << " from mds" << from
                << " with old nonce " << nonce << " (current " << in->get_replica_nonce(from) << "), dropping" 
-               << endl;
+               << dendl;
        assert(in->get_replica_nonce(from) > nonce);
       }
     }
@@ -3242,7 +3242,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
       int nonce = it->second;
       
       if (!dir) {
-       dout(0) << " dir expire on " << it->first << " from " << from << ", don't have it" << endl;
+       dout(0) << " dir expire on " << it->first << " from " << from << ", don't have it" << dendl;
        assert(dir);
       }  
       assert(dir->is_auth());
@@ -3251,14 +3251,14 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
       if (nonce == dir->get_replica_nonce(from)) {
        // remove from our cached_by
        dout(7) << " dir expire on " << *dir << " from mds" << from
-               << " replicas was " << dir->replica_map << endl;
+               << " replicas was " << dir->replica_map << dendl;
        dir->remove_replica(from);
       } 
       else {
        // this is an old nonce, ignore expire.
        dout(7) << " dir expire on " << *dir << " from mds" << from 
                << " with old nonce " << nonce << " (current " << dir->get_replica_nonce(from)
-               << "), dropping" << endl;
+               << "), dropping" << dendl;
        assert(dir->get_replica_nonce(from) > nonce);
       }
     }
@@ -3267,13 +3267,13 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
     for (map<dirfrag_t, map<string,int> >::iterator pd = p->second.dentries.begin();
         pd != p->second.dentries.end();
         ++pd) {
-      dout(10) << " dn expires in dir " << pd->first << endl;
+      dout(10) << " dn expires in dir " << pd->first << dendl;
       CInode *diri = get_inode(pd->first.ino);
       assert(diri);
       CDir *dir = diri->get_dirfrag(pd->first.frag);
       
       if (!dir) {
-       dout(0) << " dn expires on " << pd->first << " from " << from << ", must have refragmented" << endl;
+       dout(0) << " dn expires on " << pd->first << " from " << from << ", must have refragmented" << dendl;
       } else {
        assert(dir->is_auth());
       }
@@ -3294,17 +3294,17 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
        } 
 
        if (!dn) 
-         dout(0) << "  missing dentry for " << p->first << " in " << *dir << endl;
+         dout(0) << "  missing dentry for " << p->first << " in " << *dir << dendl;
        assert(dn);
        
        if (nonce == dn->get_replica_nonce(from)) {
-         dout(7) << "  dentry_expire on " << *dn << " from mds" << from << endl;
+         dout(7) << "  dentry_expire on " << *dn << " from mds" << from << dendl;
          dentry_remove_replica(dn, from);
        } 
        else {
          dout(7) << "  dentry_expire on " << *dn << " from mds" << from
                  << " with old nonce " << nonce << " (current " << dn->get_replica_nonce(from)
-                 << "), dropping" << endl;
+                 << "), dropping" << dendl;
          assert(dn->get_replica_nonce(from) > nonce);
        }
       }
@@ -3318,7 +3318,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
 
 void MDCache::process_delayed_expire(CDir *dir)
 {
-  dout(7) << "process_delayed_expire on " << *dir << endl;
+  dout(7) << "process_delayed_expire on " << *dir << dendl;
   for (map<int,MCacheExpire*>::iterator p = delayed_expire[dir].begin();
        p != delayed_expire[dir].end();
        ++p) 
@@ -3328,7 +3328,7 @@ void MDCache::process_delayed_expire(CDir *dir)
 
 void MDCache::discard_delayed_expire(CDir *dir)
 {
-  dout(7) << "discard_delayed_expire on " << *dir << endl;
+  dout(7) << "discard_delayed_expire on " << *dir << dendl;
   for (map<int,MCacheExpire*>::iterator p = delayed_expire[dir].begin();
        p != delayed_expire[dir].end();
        ++p) 
@@ -3398,7 +3398,7 @@ public:
 
 void MDCache::shutdown_check()
 {
-  dout(0) << "shutdown_check at " << g_clock.now() << endl;
+  dout(0) << "shutdown_check at " << g_clock.now() << dendl;
 
   // cache
   int o = g_conf.debug_mds;
@@ -3408,17 +3408,17 @@ void MDCache::shutdown_check()
   mds->timer.add_event_after(g_conf.mds_shutdown_check, new C_MDC_ShutdownCheck(this));
 
   // this
-  dout(0) << "lru size now " << lru.lru_get_size() << endl;
-  dout(0) << "log len " << mds->mdlog->get_num_events() << endl;
+  dout(0) << "lru size now " << lru.lru_get_size() << dendl;
+  dout(0) << "log len " << mds->mdlog->get_num_events() << dendl;
 
 
   if (mds->filer->is_active()) 
-    dout(0) << "filer still active" << endl;
+    dout(0) << "filer still active" << dendl;
 }
 
 void MDCache::shutdown_start()
 {
-  dout(1) << "shutdown_start" << endl;
+  dout(1) << "shutdown_start" << dendl;
 
   if (g_conf.mds_shutdown_check)
     mds->timer.add_event_after(g_conf.mds_shutdown_check, new C_MDC_ShutdownCheck(this));
@@ -3428,10 +3428,10 @@ void MDCache::shutdown_start()
 
 bool MDCache::shutdown_pass()
 {
-  dout(7) << "shutdown_pass" << endl;
+  dout(7) << "shutdown_pass" << dendl;
 
   if (mds->is_stopped()) {
-    dout(7) << " already shut down" << endl;
+    dout(7) << " already shut down" << dendl;
     show_cache();
     show_subtrees();
     return true;
@@ -3441,7 +3441,7 @@ bool MDCache::shutdown_pass()
   if (g_conf.mds_commit_on_shutdown) {
     
     if (shutdown_commits < 0) {
-      dout(1) << "shutdown_pass committing all dirty dirs" << endl;
+      dout(1) << "shutdown_pass committing all dirty dirs" << dendl;
       shutdown_commits = 0;
       
       for (hash_map<inodeno_t, CInode*>::iterator it = inode_map.begin();
@@ -3465,14 +3465,14 @@ bool MDCache::shutdown_pass()
 
     // commits?
     if (shutdown_commits > 0) {
-      dout(7) << "shutdown_commits still waiting for " << shutdown_commits << endl;
+      dout(7) << "shutdown_commits still waiting for " << shutdown_commits << dendl;
       return false;
     }
   }
 
   // flush anything we can from the cache
   trim(0);
-  dout(5) << "lru size now " << lru.lru_get_size() << endl;
+  dout(5) << "lru size now " << lru.lru_get_size() << dendl;
 
   // flush batching eopens, so that we can properly expire them.
   mds->server->journal_opens();    // hrm, this is sort of a hack.
@@ -3488,7 +3488,7 @@ bool MDCache::shutdown_pass()
       //!migrator->is_importing()
       ) {
     // export to root
-    dout(7) << "looking for subtrees to export to mds0" << endl;
+    dout(7) << "looking for subtrees to export to mds0" << dendl;
     list<CDir*> ls;
     for (map<CDir*, set<CDir*> >::iterator it = subtrees.begin();
          it != subtrees.end();
@@ -3501,14 +3501,14 @@ bool MDCache::shutdown_pass()
     }
     for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
       CDir *dir = *p;
-      dout(7) << "sending " << *dir << " back to mds0" << endl;
+      dout(7) << "sending " << *dir << " back to mds0" << dendl;
       migrator->export_dir(dir, 0);
     }
   }
 
   // subtrees map not empty yet?
   if (!subtrees.empty()) {
-    dout(7) << "still have " << num_subtrees() << " subtrees" << endl;
+    dout(7) << "still have " << num_subtrees() << " subtrees" << dendl;
     show_subtrees();
     migrator->show_importing();
     migrator->show_exporting();
@@ -3522,13 +3522,13 @@ bool MDCache::shutdown_pass()
 
   // empty out stray contents
   // FIXME
-  dout(7) << "FIXME: i need to empty out stray dir contents..." << endl;
+  dout(7) << "FIXME: i need to empty out stray dir contents..." << dendl;
 
   // (wait for) flush log?
   if (g_conf.mds_log_flush_on_shutdown) {
     if (mds->mdlog->get_non_subtreemap_events()) {
       dout(7) << "waiting for log to flush .. " << mds->mdlog->get_num_events() 
-             << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << endl;
+             << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << dendl;
       return false;
     } 
   }
@@ -3538,20 +3538,20 @@ bool MDCache::shutdown_pass()
 
     // (only do this once!)
     if (!mds->mdlog->is_capped()) {
-      dout(7) << "capping the log" << endl;
+      dout(7) << "capping the log" << dendl;
       mds->mdlog->cap();
       // note that this won't flush right away, so we'll make at least one more pass
     }
     
     if (mds->mdlog->get_num_events()) {
       dout(7) << "waiting for log to flush (including subtree_map, now) .. " << mds->mdlog->get_num_events() 
-             << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << endl;
+             << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << dendl;
       return false;
     }
     
     if (!did_shutdown_log_cap) {
       // flush journal header
-      dout(7) << "writing header for (now-empty) journal" << endl;
+      dout(7) << "writing header for (now-empty) journal" << dendl;
       assert(mds->mdlog->empty());
       mds->mdlog->write_head(0);  
       // NOTE: filer active checker below will block us until this completes.
@@ -3562,21 +3562,21 @@ bool MDCache::shutdown_pass()
 
   // filer active?
   if (mds->filer->is_active()) {
-    dout(7) << "filer still active" << endl;
+    dout(7) << "filer still active" << dendl;
     return false;
   }
 
 
   // done?
   if (lru.lru_get_size() > 0) {
-    dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << endl;
+    dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << dendl;
     show_cache();
     //dump();
     return false;
   } 
   
   // done!
-  dout(2) << "shutdown done." << endl;
+  dout(2) << "shutdown done." << dendl;
   return true;
 }
 
@@ -3643,7 +3643,7 @@ void MDCache::dispatch(Message *m)
 
     
   default:
-    dout(7) << "cache unknown message " << m->get_type() << endl;
+    dout(7) << "cache unknown message " << m->get_type() << dendl;
     assert(0);
     break;
   }
@@ -3693,7 +3693,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
   CInode *cur = base;
   if (!cur) cur = get_root();
   if (cur == NULL) {
-    dout(7) << "traverse: i don't have root" << endl;
+    dout(7) << "traverse: i don't have root" << dendl;
     open_root(_get_waiter(mdr, req));
     return 1;
   }
@@ -3706,11 +3706,11 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
 
   unsigned depth = 0;
   while (depth < path.depth()) {
-    dout(12) << "traverse: path seg depth " << depth << " = " << path[depth] << endl;
+    dout(12) << "traverse: path seg depth " << depth << " = " << path[depth] << dendl;
     
     // ENOTDIR?
     if (!cur->is_dir()) {
-      dout(7) << "traverse: " << *cur << " not a dir " << endl;
+      dout(7) << "traverse: " << *cur << " not a dir " << dendl;
       return -ENOTDIR;
     }
 
@@ -3721,7 +3721,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
       if (cur->is_auth()) {
         // parent dir frozen_dir?
         if (cur->is_frozen_dir()) {
-          dout(7) << "traverse: " << *cur->get_parent_dir() << " is frozen_dir, waiting" << endl;
+          dout(7) << "traverse: " << *cur->get_parent_dir() << " is frozen_dir, waiting" << dendl;
           cur->get_parent_dir()->add_waiter(CDir::WAIT_UNFREEZE, _get_waiter(mdr, req));
           return 1;
         }
@@ -3731,16 +3731,16 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
         // discover?
         assert(!cur->is_auth());
         if (cur->is_ambiguous_auth()) {
-         dout(10) << "traverse: need dirfrag " << fg << ", waiting for single auth on " << *cur << endl;
+         dout(10) << "traverse: need dirfrag " << fg << ", waiting for single auth on " << *cur << dendl;
          cur->add_waiter(CInode::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
          return 1;
        } else if (dir_discovers.count(cur->ino())) {
-          dout(10) << "traverse: need dirfrag " << fg << ", already doing discover for " << *cur << endl;
+          dout(10) << "traverse: need dirfrag " << fg << ", already doing discover for " << *cur << dendl;
          assert(cur->is_waiter_for(CInode::WAIT_DIR));
        } else {
          filepath want = path.postfixpath(depth);
          dout(10) << "traverse: need dirfrag " << fg << ", doing discover, want " << want.get_path() 
-                  << " from " << *cur << endl;
+                  << " from " << *cur << dendl;
          mds->send_message_mds(new MDiscover(mds->get_nodeid(),
                                              cur->ino(),
                                              want,
@@ -3760,7 +3760,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
     if (curdir->is_frozen()) {
     // doh!
       // FIXME: traverse is allowed?
-      dout(7) << "traverse: " << *curdir << " is frozen, waiting" << endl;
+      dout(7) << "traverse: " << *curdir << " is frozen, waiting" << dendl;
       curdir->add_waiter(CDir::WAIT_UNFREEZE, _get_waiter(mdr, req));
       if (onfinish) delete onfinish;
       return 1;
@@ -3780,7 +3780,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
       trace.pop_back();
       depth++;
       cur = cur->get_parent_inode();
-      dout(10) << "traverse: following .. back to " << *cur << endl;
+      dout(10) << "traverse: following .. back to " << *cur << dendl;
       continue;
     }
 
@@ -3790,7 +3790,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
 
     // null and last_bit and xlocked by me?
     if (dn && dn->is_null() && null_okay) {
-      dout(10) << "traverse: hit null dentry at tail of traverse, succeeding" << endl;
+      dout(10) << "traverse: hit null dentry at tail of traverse, succeeding" << dendl;
       trace.push_back(dn);
       break; // done!
     }
@@ -3798,7 +3798,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
     if (dn && !dn->is_null()) {
       // dentry exists.  xlocked?
       if (!noperm && dn->lock.is_xlocked() && dn->lock.get_xlocked_by() != mdr) {
-        dout(10) << "traverse: xlocked dentry at " << *dn << endl;
+        dout(10) << "traverse: xlocked dentry at " << *dn << dendl;
         dn->lock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req));
         return 1;
       }
@@ -3809,10 +3809,10 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
         // do i have it?
         CInode *in = get_inode(dn->get_remote_ino());
         if (in) {
-          dout(7) << "linking in remote in " << *in << endl;
+          dout(7) << "linking in remote in " << *in << dendl;
           dn->link_remote(in);
         } else {
-          dout(7) << "remote link to " << dn->get_remote_ino() << ", which i don't have" << endl;
+          dout(7) << "remote link to " << dn->get_remote_ino() << ", which i don't have" << dendl;
          assert(mdr);  // we shouldn't hit non-primary dentries doing a non-mdr traversal!
           open_remote_ino(dn->get_remote_ino(), mdr, _get_waiter(mdr, req));
           return 1;
@@ -3824,17 +3824,17 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
           (follow_trailing_symlink || depth < path.depth()-1)) {
         // symlink, resolve!
         filepath sym = dn->inode->symlink;
-        dout(10) << "traverse: hit symlink " << *dn->inode << " to " << sym << endl;
+        dout(10) << "traverse: hit symlink " << *dn->inode << " to " << sym << dendl;
 
         // break up path components
         // /head/symlink/tail
         filepath head = path.prefixpath(depth);
         filepath tail = path.postfixpath(depth+1);
-        dout(10) << "traverse: path head = " << head << endl;
-        dout(10) << "traverse: path tail = " << tail << endl;
+        dout(10) << "traverse: path head = " << head << dendl;
+        dout(10) << "traverse: path tail = " << tail << dendl;
         
         if (symlinks_resolved.count(pair<CInode*,string>(dn->inode, tail.get_path()))) {
-          dout(10) << "already hit this symlink, bailing to avoid the loop" << endl;
+          dout(10) << "already hit this symlink, bailing to avoid the loop" << dendl;
           return -ELOOP;
         }
         symlinks_resolved.insert(pair<CInode*,string>(dn->inode, tail.get_path()));
@@ -3845,13 +3845,13 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
           trace.clear();
           depth = 0;
           path = tail;
-          dout(10) << "traverse: absolute symlink, path now " << path << " depth " << depth << endl;
+          dout(10) << "traverse: absolute symlink, path now " << path << " depth " << depth << dendl;
         } else {
           // relative
           path = head;
           path.append(sym);
           path.append(tail);
-          dout(10) << "traverse: relative symlink, path now " << path << " depth " << depth << endl;
+          dout(10) << "traverse: relative symlink, path now " << path << " depth " << depth << dendl;
         }
         continue;        
       }
@@ -3861,7 +3861,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
          mdr->client_request->get_mds_wants_replica_in_dirino()) {
        dout(30) << "traverse: REP is here, " 
                 << mdr->client_request->get_mds_wants_replica_in_dirino() 
-                << " vs " << curdir->dirfrag() << endl;
+                << " vs " << curdir->dirfrag() << dendl;
        
        if (mdr->client_request->get_mds_wants_replica_in_dirino() == curdir->ino() &&
            curdir->is_auth() && 
@@ -3874,9 +3874,9 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
          
          if (dn->is_replica(from)) {
            dout(15) << "traverse: REP would replicate to mds" << from << ", but already cached_by " 
-                    << req->get_source() << " dn " << *dn << endl; 
+                    << req->get_source() << " dn " << *dn << dendl; 
          } else {
-           dout(10) << "traverse: REP replicating to " << req->get_source() << " dn " << *dn << endl;
+           dout(10) << "traverse: REP replicating to " << req->get_source() << " dn " << *dn << dendl;
            MDiscoverReply *reply = new MDiscoverReply(curdir->ino());
            reply->add_dentry( dn->replicate_to( from ) );
            if (dn->is_primary())
@@ -3895,7 +3895,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
     }
     
     // MISS.  dentry doesn't exist.
-    dout(12) << "traverse: miss on dentry " << path[depth] << " in " << *curdir << endl;
+    dout(12) << "traverse: miss on dentry " << path[depth] << " in " << *curdir << dendl;
     
     if (curdir->is_auth()) {
       // dentry is mine.
@@ -3904,7 +3904,7 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
         return -ENOENT;
       } else {
        // directory isn't complete; reload
-        dout(7) << "traverse: incomplete dir contents for " << *cur << ", fetching" << endl;
+        dout(7) << "traverse: incomplete dir contents for " << *cur << ", fetching" << dendl;
         touch_inode(cur);
         curdir->fetch(_get_waiter(mdr, req));
        if (mds->logger) mds->logger->inc("cmiss");
@@ -3921,15 +3921,15 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
 
         if (curdir->is_waiting_for_dentry(path[depth])) {
           dout(7) << "traverse: already waiting for discover " << want.get_path()
-                 << " from " << *curdir << endl;
+                 << " from " << *curdir << dendl;
         } 
        else if (curdir->is_ambiguous_auth()) {
-         dout(7) << "traverse: waiting for single auth on " << *curdir << endl;
+         dout(7) << "traverse: waiting for single auth on " << *curdir << dendl;
          curdir->add_waiter(CDir::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
          return 1;
        } 
        else {
-          dout(7) << "traverse: discover " << want << " from " << *curdir << endl;
+          dout(7) << "traverse: discover " << want << " from " << *curdir << dendl;
           touch_inode(cur);
           
           mds->send_message_mds(new MDiscover(mds->get_nodeid(),
@@ -3948,20 +3948,20 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
       } 
       if (onfail == MDS_TRAVERSE_FORWARD) {
         // forward
-        dout(7) << "traverse: not auth for " << path << " in " << *curdir << endl;
+        dout(7) << "traverse: not auth for " << path << " in " << *curdir << dendl;
        
        if (curdir->is_ambiguous_auth()) {
          // wait
-         dout(7) << "traverse: waiting for single auth in " << *curdir << endl;
+         dout(7) << "traverse: waiting for single auth in " << *curdir << dendl;
          curdir->add_waiter(CDir::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
          return 1;
        } else {
-         dout(7) << "traverse: forwarding, not auth for " << *curdir << endl;
+         dout(7) << "traverse: forwarding, not auth for " << *curdir << dendl;
 
          // request replication?
          if (mdr && mdr->client_request && curdir->is_rep()) {
            dout(15) << "traverse: REP fw to mds" << dauth << ", requesting rep under "
-                    << *curdir << " req " << *(MClientRequest*)req << endl;
+                    << *curdir << " req " << *(MClientRequest*)req << dendl;
            mdr->client_request->set_mds_wants_replica_in_dirino(curdir->ino());
            req->clear_payload();  // reencode!
          }
@@ -3989,14 +3989,14 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req,     // who
 
 bool MDCache::path_is_mine(filepath& path)
 {
-  dout(15) << "path_is_mine " << path << endl;
+  dout(15) << "path_is_mine " << path << dendl;
   
   // start at root.  FIXME.
   CInode *cur = root;
   assert(cur);
 
   for (unsigned i=0; i<path.depth(); i++) {
-    dout(15) << "path_is_mine seg " << i << ": " << path[i] << " under " << *cur << endl;
+    dout(15) << "path_is_mine seg " << i << ": " << path[i] << " under " << *cur << dendl;
     frag_t fg = cur->pick_dirfrag(path[i]);
     CDir *dir = cur->get_dirfrag(fg);
     if (!dir) return cur->is_auth();
@@ -4021,7 +4021,7 @@ CDir *MDCache::path_traverse_to_dir(filepath& path)
   CInode *cur = root;
   assert(cur);
   for (unsigned i=0; i<path.depth(); i++) {
-    dout(20) << "path_traverse_to_dir seg " << i << ": " << path[i] << " under " << *cur << endl;
+    dout(20) << "path_traverse_to_dir seg " << i << ": " << path[i] << " under " << *cur << dendl;
     frag_t fg = cur->pick_dirfrag(path[i]);
     CDir *dir = cur->get_or_open_dirfrag(this, fg);
     CDentry *dn = dir->lookup(path[i]);
@@ -4043,7 +4043,7 @@ CDir *MDCache::path_traverse_to_dir(filepath& path)
  */
 void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, Context *fin) 
 {
-  dout(10) << "open_remote_dir on " << *diri << endl;
+  dout(10) << "open_remote_dir on " << *diri << dendl;
   
   assert(diri->is_dir());
   assert(!diri->is_auth());
@@ -4087,11 +4087,11 @@ CInode *MDCache::get_dentry_inode(CDentry *dn, MDRequest *mdr)
   assert(dn->is_remote());
   CInode *in = get_inode(dn->get_remote_ino());
   if (in) {
-    dout(7) << "get_dentry_inode linking in remote in " << *in << endl;
+    dout(7) << "get_dentry_inode linking in remote in " << *in << dendl;
     dn->link_remote(in);
     return in;
   } else {
-    dout(10) << "get_dentry_inode on remote dn, opening inode for " << *dn << endl;
+    dout(10) << "get_dentry_inode on remote dn, opening inode for " << *dn << dendl;
     open_remote_ino(dn->get_remote_ino(), mdr, new C_MDS_RetryRequest(this, mdr));
     return 0;
   }
@@ -4140,7 +4140,7 @@ void MDCache::open_remote_ino(inodeno_t ino,
                               MDRequest *mdr,
                               Context *onfinish)
 {
-  dout(7) << "open_remote_ino on " << ino << endl;
+  dout(7) << "open_remote_ino on " << ino << dendl;
   
   C_MDC_OpenRemoteIno *c = new C_MDC_OpenRemoteIno(this, ino, mdr, onfinish);
   mds->anchorclient->lookup(ino, c->anchortrace, c);
@@ -4152,14 +4152,14 @@ void MDCache::open_remote_ino_2(inodeno_t ino,
                                 Context *onfinish)
 {
   dout(7) << "open_remote_ino_2 on " << ino
-         << ", trace depth is " << anchortrace.size() << endl;
+         << ", trace depth is " << anchortrace.size() << dendl;
   
   // find deepest cached inode in prefix
   unsigned i = anchortrace.size();  // i := array index + 1
   CInode *in = 0;
   while (1) {
     // inode?
-    dout(10) << " " << i << ": " << anchortrace[i-1] << endl;
+    dout(10) << " " << i << ": " << anchortrace[i-1] << dendl;
     in = get_inode(anchortrace[i-1].ino);
     if (in) break;
     i--;
@@ -4169,11 +4169,11 @@ void MDCache::open_remote_ino_2(inodeno_t ino,
       break;
     }
   }
-  dout(10) << "deepest cached inode at " << i << " is " << *in << endl;
+  dout(10) << "deepest cached inode at " << i << " is " << *in << dendl;
 
   if (in->ino() == ino) {
     // success
-    dout(10) << "open_remote_ino_2 have " << *in << endl;
+    dout(10) << "open_remote_ino_2 have " << *in << dendl;
     onfinish->finish(0);
     delete onfinish;
     return;
@@ -4183,13 +4183,13 @@ void MDCache::open_remote_ino_2(inodeno_t ino,
   frag_t frag = anchortrace[i].dirfrag.frag;
 
   if (!in->dirfragtree.contains(frag)) {
-    dout(10) << "frag " << frag << " not valid, requerying anchortable" << endl;
+    dout(10) << "frag " << frag << " not valid, requerying anchortable" << dendl;
     open_remote_ino(ino, mdr, onfinish);
     return;
   }
 
   if (!in->is_auth()) {
-    dout(10) << "opening remote dirfrag " << frag << " under " << *in << endl;
+    dout(10) << "opening remote dirfrag " << frag << " under " << *in << dendl;
     /* FIXME: we re-query the anchortable just to avoid a fragtree update race */
     open_remote_dirfrag(in, frag,
                        new C_MDC_RetryOpenRemoteIno(this, ino, mdr, onfinish));
@@ -4204,18 +4204,18 @@ void MDCache::open_remote_ino_2(inodeno_t ino,
       dout(10) << "expected ino " << anchortrace[i].ino
               << " in complete dir " << *dir
               << ", requerying anchortable"
-              << endl;
+              << dendl;
       open_remote_ino(ino, mdr, onfinish);
     } else {
       dout(10) << "need ino " << anchortrace[i].ino
               << ", fetching incomplete dir " << *dir
-              << endl;
+              << dendl;
       dir->fetch(new C_MDC_OpenRemoteIno(this, ino, anchortrace, mdr, onfinish));
     }
   } else {
     // hmm, discover.
     dout(10) << "have remote dirfrag " << *dir << ", discovering " 
-            << anchortrace[i].ino << endl;
+            << anchortrace[i].ino << dendl;
     
     MDiscover *dis = new MDiscover(mds->get_nodeid(),
                                   dir->dirfrag(),
@@ -4235,7 +4235,7 @@ void MDCache::make_trace(vector<CDentry*>& trace, CInode *in)
     make_trace(trace, parent);
 
     CDentry *dn = in->get_parent_dn();
-    dout(15) << "make_trace adding " << *dn << endl;
+    dout(15) << "make_trace adding " << *dn << dendl;
     trace.push_back(dn);
   }
 }
@@ -4246,7 +4246,7 @@ MDRequest *MDCache::request_start(MClientRequest *req)
   // did we win a forward race against a slave?
   if (active_requests.count(req->get_reqid())) {
     MDRequest *mdr = active_requests[req->get_reqid()];
-    dout(10) << "request_start already had " << *mdr << ", cleaning up" << endl;
+    dout(10) << "request_start already had " << *mdr << ", cleaning up" << dendl;
     assert(mdr->is_slave());
     request_cleanup(mdr);
     delete mdr;
@@ -4255,7 +4255,7 @@ MDRequest *MDCache::request_start(MClientRequest *req)
   // register new client request
   MDRequest *mdr = new MDRequest(req->get_reqid(), req);
   active_requests[req->get_reqid()] = mdr;
-  dout(7) << "request_start " << *mdr << endl;
+  dout(7) << "request_start " << *mdr << dendl;
   return mdr;
 }
 
@@ -4264,7 +4264,7 @@ MDRequest *MDCache::request_start_slave(metareqid_t ri, int by)
   MDRequest *mdr = new MDRequest(ri, by);
   assert(active_requests.count(mdr->reqid) == 0);
   active_requests[mdr->reqid] = mdr;
-  dout(7) << "request_start_slave " << *mdr << " by mds" << by << endl;
+  dout(7) << "request_start_slave " << *mdr << " by mds" << by << dendl;
   return mdr;
 }
 
@@ -4272,13 +4272,13 @@ MDRequest *MDCache::request_start_slave(metareqid_t ri, int by)
 MDRequest *MDCache::request_get(metareqid_t rid)
 {
   assert(active_requests.count(rid));
-  dout(7) << "request_get " << rid << " " << *active_requests[rid] << endl;
+  dout(7) << "request_get " << rid << " " << *active_requests[rid] << dendl;
   return active_requests[rid];
 }
 
 void MDCache::request_finish(MDRequest *mdr)
 {
-  dout(7) << "request_finish " << *mdr << endl;
+  dout(7) << "request_finish " << *mdr << dendl;
 
   // slave finisher?
   if (mdr->slave_commit) {
@@ -4298,7 +4298,7 @@ void MDCache::request_finish(MDRequest *mdr)
 void MDCache::request_forward(MDRequest *mdr, int who, int port)
 {
   if (!port) port = MDS_PORT_SERVER;
-  dout(7) << "request_forward " << *mdr << " to mds" << who << " req " << *mdr << endl;
+  dout(7) << "request_forward " << *mdr << " to mds" << who << " req " << *mdr << dendl;
   
   mds->forward_message_mds(mdr->client_request, who, port);  
   request_cleanup(mdr);
@@ -4328,7 +4328,7 @@ void MDCache::request_forget_foreign_locks(MDRequest *mdr)
       p++;
     else {
       dout(10) << "request_forget_foreign_locks " << **p
-              << " on " << *(*p)->get_parent() << endl;
+              << " on " << *(*p)->get_parent() << dendl;
       (*p)->put_xlock();
       mdr->locks.erase(*p);
       mdr->xlocks.erase(p++);
@@ -4338,7 +4338,7 @@ void MDCache::request_forget_foreign_locks(MDRequest *mdr)
 
 void MDCache::request_cleanup(MDRequest *mdr)
 {
-  dout(15) << "request_cleanup " << *mdr << endl;
+  dout(15) << "request_cleanup " << *mdr << dendl;
   metareqid_t ri = mdr->reqid;
 
   // clear ref, trace
@@ -4434,7 +4434,7 @@ void MDCache::anchor_create(MDRequest *mdr, CInode *in, Context *onfinish)
   // auth pin
   if (!in->can_auth_pin() &&
       !mdr->is_auth_pinned(in)) {
-    dout(7) << "anchor_create not authpinnable, waiting on " << *in << endl;
+    dout(7) << "anchor_create not authpinnable, waiting on " << *in << dendl;
     in->add_waiter(CInode::WAIT_AUTHPINNABLE, onfinish);
     return;
   }
@@ -4444,11 +4444,11 @@ void MDCache::anchor_create(MDRequest *mdr, CInode *in, Context *onfinish)
 
   // already anchoring?
   if (in->state_test(CInode::STATE_ANCHORING)) {
-    dout(7) << "anchor_create already anchoring " << *in << endl;
+    dout(7) << "anchor_create already anchoring " << *in << dendl;
     return;
   }
 
-  dout(7) << "anchor_create " << *in << endl;
+  dout(7) << "anchor_create " << *in << dendl;
 
   // auth: do it
   in->state_set(CInode::STATE_ANCHORING);
@@ -4479,7 +4479,7 @@ public:
 
 void MDCache::_anchor_create_prepared(CInode *in, version_t atid)
 {
-  dout(10) << "_anchor_create_prepared " << *in << " atid " << atid << endl;
+  dout(10) << "_anchor_create_prepared " << *in << " atid " << atid << dendl;
   assert(in->inode.anchored == false);
 
   // predirty, prepare log entry
@@ -4503,7 +4503,7 @@ void MDCache::_anchor_create_prepared(CInode *in, version_t atid)
 
 void MDCache::_anchor_create_logged(CInode *in, version_t atid, version_t pdv)
 {
-  dout(10) << "_anchor_create_logged pdv " << pdv << " on " << *in << endl;
+  dout(10) << "_anchor_create_logged pdv " << pdv << " on " << *in << dendl;
 
   // unpin
   assert(in->state_test(CInode::STATE_ANCHORING));
@@ -4543,7 +4543,7 @@ void MDCache::anchor_destroy(CInode *in, Context *onfinish)
   // auth pin
   if (!in->can_auth_pin()/* &&
                            !mdr->is_auth_pinned(in)*/) {
-    dout(7) << "anchor_destroy not authpinnable, waiting on " << *in << endl;
+    dout(7) << "anchor_destroy not authpinnable, waiting on " << *in << dendl;
     in->add_waiter(CInode::WAIT_AUTHPINNABLE, onfinish);
     return;
   }
@@ -4554,11 +4554,11 @@ void MDCache::anchor_destroy(CInode *in, Context *onfinish)
 
   // already anchoring?
   if (in->state_test(CInode::STATE_UNANCHORING)) {
-    dout(7) << "anchor_destroy already unanchoring " << *in << endl;
+    dout(7) << "anchor_destroy already unanchoring " << *in << dendl;
     return;
   }
 
-  dout(7) << "anchor_destroy " << *in << endl;
+  dout(7) << "anchor_destroy " << *in << dendl;
 
   // auth: do it
   in->state_set(CInode::STATE_UNANCHORING);
@@ -4585,7 +4585,7 @@ public:
 
 void MDCache::_anchor_destroy_prepared(CInode *in, version_t atid)
 {
-  dout(10) << "_anchor_destroy_prepared " << *in << " atid " << atid << endl;
+  dout(10) << "_anchor_destroy_prepared " << *in << " atid " << atid << dendl;
 
   assert(in->inode.anchored == true);
 
@@ -4610,7 +4610,7 @@ void MDCache::_anchor_destroy_prepared(CInode *in, version_t atid)
 
 void MDCache::_anchor_destroy_logged(CInode *in, version_t atid, version_t pdv)
 {
-  dout(10) << "_anchor_destroy_logged pdv " << pdv << " on " << *in << endl;
+  dout(10) << "_anchor_destroy_logged pdv " << pdv << " on " << *in << dendl;
   
   // unpin
   assert(in->state_test(CInode::STATE_UNANCHORING));
@@ -4635,7 +4635,7 @@ void MDCache::_anchor_destroy_logged(CInode *in, version_t atid, version_t pdv)
 
 void MDCache::eval_stray(CDentry *dn)
 {
-  dout(10) << "eval_stray " << *dn << endl;
+  dout(10) << "eval_stray " << *dn << dendl;
   assert(dn->is_primary());
   CInode *in = dn->inode;
   assert(in);
@@ -4677,7 +4677,7 @@ public:
 
 void MDCache::_purge_stray(CDentry *dn)
 {
-  dout(10) << "_purge_stray " << *dn << " " << *dn->inode << endl;
+  dout(10) << "_purge_stray " << *dn << " " << *dn->inode << dendl;
   assert(!dn->is_replicated());
 
   // log removal
@@ -4692,7 +4692,7 @@ void MDCache::_purge_stray(CDentry *dn)
 
 void MDCache::_purge_stray_logged(CDentry *dn, version_t pdv)
 {
-  dout(10) << "_purge_stray_logged " << *dn << " " << *dn->inode << endl;
+  dout(10) << "_purge_stray_logged " << *dn << " " << *dn->inode << dendl;
   CInode *in = dn->inode;
   
   // dirty+unlink dentry
@@ -4709,14 +4709,14 @@ void MDCache::_purge_stray_logged(CDentry *dn, version_t pdv)
 
 void MDCache::reintegrate_stray(CDentry *dn, CDentry *rlink)
 {
-  dout(10) << "reintegrate_stray " << *dn << " into " << *rlink << endl;
+  dout(10) << "reintegrate_stray " << *dn << " into " << *rlink << dendl;
   
 }
  
 
 void MDCache::migrate_stray(CDentry *dn, int dest)
 {
-  dout(10) << "migrate_stray to mds" << dest << " " << *dn << endl;
+  dout(10) << "migrate_stray to mds" << dest << " " << *dn << dendl;
 
 }
 
@@ -4739,24 +4739,24 @@ void MDCache::handle_discover(MDiscover *dis)
   if (dis->get_base_ino() == MDS_INO_ROOT) {
     // wants root
     dout(7) << "handle_discover from mds" << dis->get_asker()
-           << " wants root + " << dis->get_want().get_path() << endl;
+           << " wants root + " << dis->get_want().get_path() << dendl;
 
     assert(mds->get_nodeid() == 0);
     assert(root->is_auth());
 
     // add root
     reply->add_inode( root->replicate_to( dis->get_asker() ) );
-    dout(10) << "added root " << *root << endl;
+    dout(10) << "added root " << *root << dendl;
 
     cur = root;
   }
   else if (dis->get_base_ino() == MDS_INO_STRAY(whoami)) {
     // wants root
     dout(7) << "handle_discover from mds" << dis->get_asker()
-           << " wants stray + " << dis->get_want().get_path() << endl;
+           << " wants stray + " << dis->get_want().get_path() << dendl;
     
     reply->add_inode( stray->replicate_to( dis->get_asker() ) );
-    dout(10) << "added stray " << *stray << endl;
+    dout(10) << "added stray " << *stray << dendl;
 
     cur = stray;
   }
@@ -4767,7 +4767,7 @@ void MDCache::handle_discover(MDiscover *dis)
     if (!cur) {
       dout(7) << "handle_discover mds" << dis->get_asker() 
              << " don't have base ino " << dis->get_base_ino() 
-             << ", dropping" << endl;
+             << ", dropping" << dendl;
       delete reply;
       return;
     }
@@ -4776,12 +4776,12 @@ void MDCache::handle_discover(MDiscover *dis)
       dout(7) << "handle_discover mds" << dis->get_asker() 
              << " has " << *cur 
              << " wants basedir+" << dis->get_want().get_path() 
-             << endl;
+             << dendl;
     } else {
       dout(7) << "handle_discover mds" << dis->get_asker() 
              << " has " << *cur
              << " wants " << dis->get_want().get_path()
-             << endl;
+             << dendl;
     }
   }
 
@@ -4798,7 +4798,7 @@ void MDCache::handle_discover(MDiscover *dis)
 
     // is *cur even a dir at all?
     if (!cur->is_dir()) {
-      dout(7) << *cur << " not a dir" << endl;
+      dout(7) << *cur << " not a dir" << dendl;
       reply->set_flag_error_dir();
       break;
     }
@@ -4818,10 +4818,10 @@ void MDCache::handle_discover(MDiscover *dis)
     if ((!curdir && !cur->is_auth()) ||
        (curdir && !curdir->is_auth())) {
       if (curdir) {
-       dout(7) << " not dirfrag auth, setting dir_auth_hint for " << *curdir << endl;
+       dout(7) << " not dirfrag auth, setting dir_auth_hint for " << *curdir << dendl;
        reply->set_dir_auth_hint(curdir->authority().first);
       } else {
-       dout(7) << " dirfrag not open, not inode auth, setting dir_auth_hint for " << *cur << endl;
+       dout(7) << " dirfrag not open, not inode auth, setting dir_auth_hint for " << *cur << dendl;
        reply->set_dir_auth_hint(cur->authority().first);
       }
       reply->set_wanted_xlocks_hint(dis->wants_xlocked());
@@ -4841,23 +4841,23 @@ void MDCache::handle_discover(MDiscover *dis)
     // is dir frozen?
     if (curdir->is_frozen()) {
       if (reply->is_empty()) {
-       dout(7) << *curdir << " is frozen, empty reply, waiting" << endl;
+       dout(7) << *curdir << " is frozen, empty reply, waiting" << dendl;
        curdir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryMessage(mds, dis));
        delete reply;
        return;
       } else {
-       dout(7) << *curdir << " is frozen, non-empty reply, stopping" << endl;
+       dout(7) << *curdir << " is frozen, non-empty reply, stopping" << dendl;
        break;
       }
     }
     
     // add dir
     if (reply->is_empty() && !dis->wants_base_dir()) {
-      dout(7) << "handle_discover not adding unwanted base dir " << *curdir << endl;
+      dout(7) << "handle_discover not adding unwanted base dir " << *curdir << dendl;
     } else {
       assert(!curdir->is_ambiguous_auth()); // would be frozen.
       reply->add_dir( curdir->replicate_to(dis->get_asker()) );
-      dout(7) << "handle_discover added dir " << *curdir << endl;
+      dout(7) << "handle_discover added dir " << *curdir << dendl;
     }
     if (dis->get_want().depth() == 0) break;
     
@@ -4876,7 +4876,7 @@ void MDCache::handle_discover(MDiscover *dis)
     if (!dn) {
       if (!curdir->is_complete()) {
        // readdir
-       dout(7) << "incomplete dir contents for " << *curdir << ", fetching" << endl;
+       dout(7) << "incomplete dir contents for " << *curdir << ", fetching" << dendl;
        if (reply->is_empty()) {
          // fetch and wait
          curdir->fetch(new C_MDS_RetryMessage(mds, dis));
@@ -4892,14 +4892,14 @@ void MDCache::handle_discover(MDiscover *dis)
       if (dis->get_want_ino()) {
        // set error flag in reply
        dout(7) << "ino " << dis->get_want_ino() << " in this dir, flagging error in "
-               << *curdir << endl;
+               << *curdir << dendl;
        reply->set_flag_error_ino();
        break;
       }
       
       // send null dentry
       dout(7) << "dentry " << dis->get_dentry(i) << " dne, returning null in "
-             << *curdir << endl;
+             << *curdir << dendl;
       dn = curdir->add_null_dentry(dis->get_dentry(i));
     }
     assert(dn);
@@ -4911,9 +4911,9 @@ void MDCache::handle_discover(MDiscover *dis)
       // is this the last (tail) item in the discover traversal?
       bool tailitem = (dis->get_want().depth() == 0) || (i == dis->get_want().depth() - 1);
       if (tailitem && dis->wants_xlocked()) {
-       dout(7) << "handle_discover allowing discovery of xlocked tail " << *dn << endl;
+       dout(7) << "handle_discover allowing discovery of xlocked tail " << *dn << dendl;
       } else {
-       dout(7) << "handle_discover blocking on xlocked " << *dn << endl;
+       dout(7) << "handle_discover blocking on xlocked " << *dn << dendl;
        dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryMessage(mds, dis));
        delete reply;
        return;
@@ -4922,7 +4922,7 @@ void MDCache::handle_discover(MDiscover *dis)
 
     // add dentry
     reply->add_dentry( dn->replicate_to( dis->get_asker() ) );
-    dout(7) << "handle_discover added dentry " << *dn << endl;
+    dout(7) << "handle_discover added dentry " << *dn << dendl;
     
     if (!dn->is_primary()) break;  // stop on null or remote link.
     
@@ -4931,7 +4931,7 @@ void MDCache::handle_discover(MDiscover *dis)
     assert(next->is_auth());
     
     reply->add_inode( next->replicate_to( dis->get_asker() ) );
-    dout(7) << "handle_discover added inode " << *next << endl;
+    dout(7) << "handle_discover added inode " << *next << dendl;
     
     // descend, keep going.
     cur = next;
@@ -4940,10 +4940,10 @@ void MDCache::handle_discover(MDiscover *dis)
 
   // how did we do?
   if (reply->is_empty()) {
-    dout(7) << "handle_discover dropping this empty reply)." << endl;
+    dout(7) << "handle_discover dropping this empty reply)." << dendl;
     delete reply;
   } else {
-    dout(7) << "handle_discover sending result back to asker mds" << dis->get_asker() << endl;
+    dout(7) << "handle_discover sending result back to asker mds" << dis->get_asker() << dendl;
     mds->send_message_mds(reply, dis->get_asker(), MDS_PORT_CACHE);
   }
 
@@ -4961,7 +4961,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
   CInode *cur = get_inode(m->get_base_ino());
     
   if (cur) {
-    dout(7) << "discover_reply " << *cur << " + " << m->get_path() << ", have " << m->get_num_inodes() << " inodes" << endl;
+    dout(7) << "discover_reply " << *cur << " + " << m->get_path() << ", have " << m->get_num_inodes() << " inodes" << dendl;
   } 
   else if (m->get_base_ino() == MDS_INO_ROOT) {
     // it's the root inode.
@@ -4969,25 +4969,25 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
     assert(!m->has_base_dentry());
     assert(!m->has_base_dir());
     
-    dout(7) << "discover_reply root + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << endl;
+    dout(7) << "discover_reply root + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << dendl;
     
     // add in root
     cur = add_replica_inode(m->get_inode(0), NULL);
     cur->force_auth = pair<int,int>(m->get_source().num(), CDIR_AUTH_UNKNOWN);
     set_root(cur);
-    dout(7) << "discover_reply got root " << *cur << endl;
+    dout(7) << "discover_reply got root " << *cur << dendl;
     
     // take root waiters
     finished.swap(waiting_for_root);
   }
   else if (MDS_INO_IS_STRAY(m->get_base_ino())) {
-    dout(7) << "discover_reply stray + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << endl;
+    dout(7) << "discover_reply stray + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << dendl;
     
     // add 
     cur = add_replica_inode(m->get_inode(0), NULL);
     cur->force_auth = pair<int,int>(m->get_source().num(), CDIR_AUTH_UNKNOWN);
 
-    dout(7) << "discover_reply got stray " << *cur << endl;
+    dout(7) << "discover_reply got stray " << *cur << dendl;
     
     // take waiters
     finished.swap(waiting_for_stray[cur->ino()]);
@@ -4995,21 +4995,21 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
   }
 
   // fyi
-  if (m->is_flag_error_dir()) dout(7) << " flag error, dir" << endl;
-  if (m->is_flag_error_dn()) dout(7) << " flag error, dentry = " << m->get_error_dentry() << endl;
+  if (m->is_flag_error_dir()) dout(7) << " flag error, dir" << dendl;
+  if (m->is_flag_error_dn()) dout(7) << " flag error, dentry = " << m->get_error_dentry() << dendl;
   dout(10) << "depth = " << m->get_depth()
           << ", has base_dir/base_dn/root = " 
           << m->has_base_dir() << " / " << m->has_base_dentry() << " / " << m->has_base_inode()
           << ", num dirs/dentries/inodes = " 
           << m->get_num_dirs() << " / " << m->get_num_dentries() << " / " << m->get_num_inodes()
-          << endl;
+          << dendl;
   
   // loop over discover results.
   // indexese follow each ([[dir] dentry] inode) 
   // can start, end with any type.
   
   for (int i=m->has_base_inode(); i<m->get_depth(); i++) {
-    dout(10) << "discover_reply i=" << i << " cur " << *cur << endl;
+    dout(10) << "discover_reply i=" << i << " cur " << *cur << dendl;
 
     // dir
     frag_t fg;
@@ -5034,11 +5034,11 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
       // error!
       assert(cur->is_dir());
       if (curdir) {
-        dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dentry?" << endl;
+        dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dentry?" << dendl;
         curdir->take_dentry_waiting(m->get_error_dentry(),
                                    error);
       } else {
-        dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dir?" << endl;
+        dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dir?" << dendl;
         cur->take_waiting(CInode::WAIT_DIR, error);
        dir_discovers.erase(cur->ino());
       }
@@ -5062,7 +5062,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
   // dir_auth hint?
   if (m->get_dir_auth_hint() != CDIR_AUTH_UNKNOWN &&
       m->get_dir_auth_hint() != mds->get_nodeid()) {
-    dout(7) << " dir_auth_hint is " << m->get_dir_auth_hint() << endl;
+    dout(7) << " dir_auth_hint is " << m->get_dir_auth_hint() << dendl;
 
     // try again.  include dentry _and_ dirfrag, just in case.
     int hint = m->get_dir_auth_hint();
@@ -5085,7 +5085,7 @@ void MDCache::handle_discover_reply(MDiscoverReply *m)
   }
   else if (m->is_flag_error_dir()) {
     // dir error at the end there?
-    dout(7) << " flag_error on dir " << *cur << endl;
+    dout(7) << " flag_error on dir " << *cur << dendl;
     assert(!cur->is_dir());
     cur->take_waiting(CInode::WAIT_DIR, error);
     dir_discovers.erase(cur->ino());
@@ -5110,12 +5110,12 @@ CDir *MDCache::add_replica_dir(CInode *diri,
   if (dir) {
     // had replica. update w/ new nonce.
     dis.update_dir(dir);
-    dout(7) << "add_replica_dir had " << *dir << " nonce " << dir->replica_nonce << endl;
+    dout(7) << "add_replica_dir had " << *dir << " nonce " << dir->replica_nonce << dendl;
   } else {
     // force frag to leaf in the diri tree
     if (!diri->dirfragtree.is_leaf(fg)) {
       dout(7) << "add_replica_dir forcing frag " << fg << " to leaf in the fragtree "
-             << diri->dirfragtree << endl;
+             << diri->dirfragtree << dendl;
       diri->dirfragtree.force_to_leaf(fg);
     }
 
@@ -5129,7 +5129,7 @@ CDir *MDCache::add_replica_dir(CInode *diri,
        diri->ino() < MDS_INO_BASE)
       adjust_subtree_auth(dir, from);
     
-    dout(7) << "add_replica_dir added " << *dir << " nonce " << dir->replica_nonce << endl;
+    dout(7) << "add_replica_dir added " << *dir << " nonce " << dir->replica_nonce << dendl;
     
     // get waiters
     diri->take_waiting(CInode::WAIT_DIR, finished);
@@ -5149,7 +5149,7 @@ CDir *MDCache::forge_replica_dir(CInode *diri, frag_t fg, int from)
   // i'm assuming this is a subtree root. 
   adjust_subtree_auth(dir, from);
 
-  dout(7) << "forge_replica_dir added " << *dir << " while mds" << from << " is down" << endl;
+  dout(7) << "forge_replica_dir added " << *dir << " while mds" << from << " is down" << dendl;
 
   return dir;
 }
@@ -5161,12 +5161,12 @@ CDentry *MDCache::add_replica_dentry(CDir *dir, CDentryDiscover &dis, list<Conte
   // have it?
   if (dn) {
     dis.update_dentry(dn);
-    dout(7) << "add_replica_dentry had " << *dn << endl;
+    dout(7) << "add_replica_dentry had " << *dn << dendl;
   } else {
     dn = dir->add_null_dentry(dis.get_dname());
     dis.update_dentry(dn);
     dis.init_dentry_lock(dn);
-    dout(7) << "add_replica_dentry added " << *dn << endl;
+    dout(7) << "add_replica_dentry added " << *dn << dendl;
   }
   
   // remote_ino linkage?
@@ -5191,12 +5191,12 @@ CInode *MDCache::add_replica_inode(CInodeDiscover& dis, CDentry *dn)
     dis.update_inode(in);
     dis.init_inode_locks(in);
     add_inode(in);
-    dout(10) << "add_replica_inode had " << *in << endl;
+    dout(10) << "add_replica_inode had " << *in << dendl;
     if (dn && dn->is_null()) 
       dn->dir->link_primary_inode(dn, in);
   } else {
     dis.update_inode(in);
-    dout(10) << "add_replica_inode added " << *in << endl;
+    dout(10) << "add_replica_inode added " << *in << dendl;
   }
 
   if (dn) {
@@ -5218,14 +5218,14 @@ CDentry *MDCache::add_replica_stray(bufferlist &bl, CInode *in, int from)
   indis._decode(bl, off);
   CInode *strayin = add_replica_inode(indis, NULL);
   strayin->force_auth = pair<int,int>(from, CDIR_AUTH_UNKNOWN);
-  dout(15) << "strayin " << *strayin << endl;
+  dout(15) << "strayin " << *strayin << dendl;
   
   // dir
   CDirDiscover dirdis;
   dirdis._decode(bl, off);
   CDir *straydir = add_replica_dir(strayin, dirdis.get_dirfrag().frag, dirdis,
                                            from, finished);
-  dout(15) << "straydir " << *straydir << endl;
+  dout(15) << "straydir " << *straydir << dendl;
   
   // dentry
   CDentryDiscover dndis;
@@ -5249,7 +5249,7 @@ int MDCache::send_inode_updates(CInode *in)
   for (set<int>::iterator it = in->cached_by_begin(); 
        it != in->cached_by_end(); 
        it++) {
-    dout(7) << "sending inode_update on " << *in << " to " << *it << endl;
+    dout(7) << "sending inode_update on " << *in << " to " << *it << dendl;
     assert(*it != mds->get_nodeid());
     mds->send_message_mds(new MInodeUpdate(in, in->get_cached_by_nonce(*it)), *it, MDS_PORT_CACHE);
   }
@@ -5263,8 +5263,8 @@ void MDCache::handle_inode_update(MInodeUpdate *m)
   inodeno_t ino = m->get_ino();
   CInode *in = get_inode(m->get_ino());
   if (!in) {
-    //dout(7) << "inode_update on " << m->get_ino() << ", don't have it, ignoring" << endl;
-    dout(7) << "inode_update on " << m->get_ino() << ", don't have it, sending expire" << endl;
+    //dout(7) << "inode_update on " << m->get_ino() << ", don't have it, ignoring" << dendl;
+    dout(7) << "inode_update on " << m->get_ino() << ", don't have it, sending expire" << dendl;
     MCacheExpire *expire = new MCacheExpire(mds->get_nodeid());
     expire->add_inode(m->get_ino(), m->get_nonce());
     mds->send_message_mds(expire, m->get_source().num(), MDS_PORT_CACHE);
@@ -5272,11 +5272,11 @@ void MDCache::handle_inode_update(MInodeUpdate *m)
   }
 
   if (in->is_auth()) {
-    dout(7) << "inode_update on " << *in << ", but i'm the authority!" << endl;
+    dout(7) << "inode_update on " << *in << ", but i'm the authority!" << dendl;
     assert(0); // this should never happen
   }
   
-  dout(7) << "inode_update on " << *in << endl;
+  dout(7) << "inode_update on " << *in << dendl;
 
   // update! NOTE dir_auth is unaffected by this.
   in->decode_basic_state(m->get_payload());
@@ -5306,7 +5306,7 @@ int MDCache::send_dir_updates(CDir *dir, bool bcast)
       who.insert(p->first);
   }
   
-  dout(7) << "sending dir_update on " << *dir << " bcast " << bcast << " to " << who << endl;
+  dout(7) << "sending dir_update on " << *dir << " bcast " << bcast << " to " << who << dendl;
 
   string path;
   dir->inode->make_path(path);
@@ -5317,7 +5317,7 @@ int MDCache::send_dir_updates(CDir *dir, bool bcast)
        it++) {
     if (*it == whoami) continue;
     //if (*it == except) continue;
-    dout(7) << "sending dir_update on " << *dir << " to " << *it << endl;
+    dout(7) << "sending dir_update on " << *dir << " to " << *it << dendl;
 
     mds->send_message_mds(new MDirUpdate(dir->dirfrag(),
                                         dir->dir_rep,
@@ -5335,7 +5335,7 @@ void MDCache::handle_dir_update(MDirUpdate *m)
 {
   CDir *dir = get_dirfrag(m->get_dirfrag());
   if (!dir) {
-    dout(5) << "dir_update on " << m->get_dirfrag() << ", don't have it" << endl;
+    dout(5) << "dir_update on " << m->get_dirfrag() << ", don't have it" << dendl;
 
     // discover it?
     if (m->should_discover()) {
@@ -5345,7 +5345,7 @@ void MDCache::handle_dir_update(MDirUpdate *m)
       vector<CDentry*> trace;
       filepath path = m->get_path();
 
-      dout(5) << "trying discover on dir_update for " << path << endl;
+      dout(5) << "trying discover on dir_update for " << path << dendl;
 
       int r = path_traverse(0, m,
                            0, path, trace, true,
@@ -5366,7 +5366,7 @@ void MDCache::handle_dir_update(MDirUpdate *m)
   }
 
   // update
-  dout(5) << "dir_update on " << *dir << endl;
+  dout(5) << "dir_update on " << *dir << dendl;
   dir->dir_rep = m->get_dir_rep();
   dir->dir_rep_by = m->get_dir_rep_by();
   
@@ -5386,14 +5386,14 @@ void MDCache::handle_dentry_unlink(MDentryUnlink *m)
   CDir *dir = get_dirfrag(m->get_dirfrag());
 
   if (!dir) {
-    dout(7) << "handle_dentry_unlink don't have dirfrag " << m->get_dirfrag() << endl;
+    dout(7) << "handle_dentry_unlink don't have dirfrag " << m->get_dirfrag() << dendl;
   }
   else {
     CDentry *dn = dir->lookup(m->get_dn());
     if (!dn) {
-      dout(7) << "handle_dentry_unlink don't have dentry " << *dir << " dn " << m->get_dn() << endl;
+      dout(7) << "handle_dentry_unlink don't have dentry " << *dir << " dn " << m->get_dn() << dendl;
     } else {
-      dout(7) << "handle_dentry_unlink on " << *dn << endl;
+      dout(7) << "handle_dentry_unlink on " << *dn << dendl;
       
       // move to stray?
       CDentry *straydn = 0;
@@ -5448,7 +5448,7 @@ void MDCache::adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
                                   list<Context*>& waiters)
 {
   dout(10) << "adjust_dir_fragments " << basefrag << " " << bits 
-          << " on " << *diri << endl;
+          << " on " << *diri << dendl;
 
   // yuck.  we may have discovered the inode while it was being fragmented.
   if (!diri->dirfragtree.is_leaf(basefrag))
@@ -5458,7 +5458,7 @@ void MDCache::adjust_dir_fragments(CInode *diri, frag_t basefrag, int bits,
 
   // adjust fragtree
   diri->dirfragtree.split(basefrag, bits);
-  dout(10) << " new fragtree is " << diri->dirfragtree << endl;
+  dout(10) << " new fragtree is " << diri->dirfragtree << dendl;
 
   if (bits > 0) {
     if (base) {
@@ -5519,24 +5519,24 @@ public:
 
 void MDCache::split_dir(CDir *dir, int bits)
 {
-  dout(7) << "split_dir " << *dir << " bits " << bits << endl;
+  dout(7) << "split_dir " << *dir << " bits " << bits << dendl;
   assert(dir->is_auth());
   
   if (mds->mdsmap->is_degraded()) {
-    dout(7) << "cluster degraded, no fragmenting for now" << endl;
+    dout(7) << "cluster degraded, no fragmenting for now" << dendl;
     return;
   }
   if (dir->inode->is_root()) {
-    dout(7) << "i won't fragment root" << endl;
+    dout(7) << "i won't fragment root" << dendl;
     //assert(0);
     return;
   }
   if (dir->state_test(CDir::STATE_FRAGMENTING)) {
-    dout(7) << "already fragmenting" << endl;
+    dout(7) << "already fragmenting" << dendl;
     return;
   }
   if (!dir->can_auth_pin()) {
-    dout(7) << "not authpinnable on " << *dir << endl;
+    dout(7) << "not authpinnable on " << *dir << dendl;
     return;
   }
 
@@ -5590,7 +5590,7 @@ void MDCache::fragment_mark_and_complete(CInode *diri,
                                          frag_t basefrag, int bits) 
 {
   dout(10) << "fragment_mark_and_complete " << basefrag << " by " << bits 
-          << " on " << *diri << endl;
+          << " on " << *diri << dendl;
   
   C_Gather *gather = 0;
   
@@ -5600,13 +5600,13 @@ void MDCache::fragment_mark_and_complete(CInode *diri,
     CDir *dir = *p;
     
     if (!dir->is_complete()) {
-      dout(15) << " fetching incomplete " << *dir << endl;
+      dout(15) << " fetching incomplete " << *dir << dendl;
       if (!gather) gather = new C_Gather(new C_MDC_FragmentMarking(this, diri, startfrags, basefrag, bits));
       dir->fetch(gather->new_sub(), 
                 true);  // ignore authpinnability
     } 
     else if (!dir->state_test(CDir::STATE_DNPINNEDFRAG)) {
-      dout(15) << " marking " << *dir << endl;
+      dout(15) << " marking " << *dir << dendl;
       for (map<string,CDentry*>::iterator p = dir->items.begin();
           p != dir->items.end();
           ++p) {
@@ -5617,7 +5617,7 @@ void MDCache::fragment_mark_and_complete(CInode *diri,
       dir->auth_unpin();  // allow our freeze to complete
     }
     else {
-      dout(15) << " marked " << *dir << endl;
+      dout(15) << " marked " << *dir << dendl;
     }
   }
 }
@@ -5641,7 +5641,7 @@ public:
 void MDCache::fragment_go(CInode *diri, list<CDir*>& startfrags, frag_t basefrag, int bits) 
 {
   dout(10) << "fragment_go " << basefrag << " by " << bits 
-          << " on " << *diri << endl;
+          << " on " << *diri << dendl;
 
   // refragment
   list<CDir*> resultfrags;
@@ -5656,7 +5656,7 @@ void MDCache::fragment_go(CInode *diri, list<CDir*>& startfrags, frag_t basefrag
        p != resultfrags.end();
        p++) {
     CDir *dir = *p;
-    dout(10) << " result frag " << *dir << endl;
+    dout(10) << " result frag " << *dir << dendl;
     dir->state_set(CDir::STATE_FRAGMENTING);
     dir->commit(0, gather->new_sub());
     dir->_freeze_dir();
@@ -5687,7 +5687,7 @@ void MDCache::fragment_stored(CInode *diri, frag_t basefrag, int bits,
                              list<CDir*>& resultfrags)
 {
   dout(10) << "fragment_stored " << basefrag << " by " << bits 
-          << " on " << *diri << endl;
+          << " on " << *diri << dendl;
 
   EFragment *le = new EFragment(mds->mdlog, diri->ino(), basefrag, bits);
 
@@ -5697,7 +5697,7 @@ void MDCache::fragment_stored(CInode *diri, frag_t basefrag, int bits,
        p != resultfrags.end();
        p++) {
     CDir *dir = *p;
-    dout(10) << " result frag " << *dir << endl;
+    dout(10) << " result frag " << *dir << dendl;
 
     if (p == resultfrags.begin()) {
       le->metablob.add_dir_context(dir);
@@ -5740,7 +5740,7 @@ void MDCache::fragment_logged(CInode *diri, frag_t basefrag, int bits,
                              vector<version_t>& pvs)
 {
   dout(10) << "fragment_logged " << basefrag << " bits " << bits 
-          << " on " << *diri << endl;
+          << " on " << *diri << dendl;
   
  
   // dirty resulting frags
@@ -5750,7 +5750,7 @@ void MDCache::fragment_logged(CInode *diri, frag_t basefrag, int bits,
        p != resultfrags.end();
        p++) {
     CDir *dir = *p;
-    dout(10) << " result frag " << *dir << endl;
+    dout(10) << " result frag " << *dir << dendl;
     
     // dirty, unpin, unfreeze
     dir->state_clear(CDir::STATE_FRAGMENTING);  
@@ -5773,7 +5773,7 @@ void MDCache::fragment_logged(CInode *diri, frag_t basefrag, int bits,
 
 void MDCache::handle_fragment_notify(MMDSFragmentNotify *notify)
 {
-  dout(10) << "handle_fragment_notify " << *notify << " from " << notify->get_source() << endl;
+  dout(10) << "handle_fragment_notify " << *notify << " from " << notify->get_source() << dendl;
 
   CInode *diri = get_inode(notify->get_ino());
   if (diri) {
@@ -5808,13 +5808,13 @@ void MDCache::handle_fragment_notify(MMDSFragmentNotify *notify)
 
 void MDCache::show_subtrees(int dbl)
 {
-  //dout(10) << "show_subtrees" << endl;
+  //dout(10) << "show_subtrees" << dendl;
 
   if (dbl > g_conf.debug && dbl > g_conf.debug_mds) 
     return;  // i won't print anything.
 
   if (subtrees.empty()) {
-    dout(dbl) << "no subtrees" << endl;
+    dout(dbl) << "no subtrees" << dendl;
     return;
   }
 
@@ -5822,7 +5822,7 @@ void MDCache::show_subtrees(int dbl)
   list<CDir*> rootfrags;
   if (root) root->get_dirfrags(rootfrags);
   if (stray) stray->get_dirfrags(rootfrags);
-  dout(15) << "rootfrags " << rootfrags << endl;
+  dout(15) << "rootfrags " << rootfrags << dendl;
 
   // queue stuff
   list<pair<CDir*,int> > q;
@@ -5844,8 +5844,8 @@ void MDCache::show_subtrees(int dbl)
     if (d > depth) depth = d;
 
     // sanity check
-    //dout(25) << "saw depth " << d << " " << *dir << endl;
-    if (seen.count(dir)) dout(0) << "aah, already seen " << *dir << endl;
+    //dout(25) << "saw depth " << d << " " << *dir << dendl;
+    if (seen.count(dir)) dout(0) << "aah, already seen " << *dir << dendl;
     assert(seen.count(dir) == 0);
     seen.insert(dir);
 
@@ -5854,7 +5854,7 @@ void MDCache::show_subtrees(int dbl)
       for (set<CDir*>::iterator p = subtrees[dir].begin();
           p != subtrees[dir].end();
           ++p) {
-       //dout(25) << " saw sub " << **p << endl;
+       //dout(25) << " saw sub " << **p << dendl;
        q.push_front(pair<CDir*,int>(*p, d+1));
       }
     }
@@ -5896,7 +5896,7 @@ void MDCache::show_subtrees(int dbl)
       sprintf(s, "%2d,%2d", dir->get_dir_auth().first, dir->get_dir_auth().second);
     
     // print
-    dout(dbl) << indent << "|_" << pad << s << " " << auth << *dir << endl;
+    dout(dbl) << indent << "|_" << pad << s << " " << auth << *dir << dendl;
 
     if (dir->ino() == MDS_INO_ROOT)
       assert(dir->inode == root);
@@ -5922,29 +5922,29 @@ void MDCache::show_subtrees(int dbl)
 
 void MDCache::show_cache()
 {
-  dout(7) << "show_cache" << endl;
+  dout(7) << "show_cache" << dendl;
   
   for (hash_map<inodeno_t,CInode*>::iterator it = inode_map.begin();
        it != inode_map.end();
        it++) {
     // unlinked?
     if (!it->second->parent)
-      dout(7) << " unlinked " << *it->second << endl;
+      dout(7) << " unlinked " << *it->second << dendl;
     
     // dirfrags?
     list<CDir*> dfs;
     it->second->get_dirfrags(dfs);
     for (list<CDir*>::iterator p = dfs.begin(); p != dfs.end(); ++p) {
       CDir *dir = *p;
-      dout(7) << "  dirfrag " << *dir << endl;
+      dout(7) << "  dirfrag " << *dir << dendl;
            
       for (CDir_map_t::iterator p = dir->items.begin();
           p != dir->items.end();
           ++p) {
        CDentry *dn = p->second;
-       dout(7) << "   dentry " << *dn << endl;
+       dout(7) << "   dentry " << *dn << dendl;
        if (dn->is_primary() && dn->inode) 
-         dout(7) << "    inode " << *dn->inode << endl;
+         dout(7) << "    inode " << *dn->inode << dendl;
       }
     }
   }
@@ -5956,7 +5956,7 @@ void MDCache::dump_cache()
   char fn[20];
   sprintf(fn, "cachedump.%d.mds%d", mds->mdsmap->get_epoch(), mds->get_nodeid());
 
-  dout(1) << "dump_cache to " << fn << endl;
+  dout(1) << "dump_cache to " << fn << dendl;
 
   ofstream myfile;
   myfile.open(fn);
@@ -5968,14 +5968,14 @@ void MDCache::dump_cache()
     it->second->get_dirfrags(dfs);
     for (list<CDir*>::iterator p = dfs.begin(); p != dfs.end(); ++p) {
       CDir *dir = *p;
-      myfile << *dir->inode << endl;
-      myfile << *dir << endl;
+      myfile << *dir->inode << dendl;
+      myfile << *dir << dendl;
       
       for (CDir_map_t::iterator p = dir->items.begin();
           p != dir->items.end();
           ++p) {
        CDentry *dn = p->second;
-       myfile << *dn << endl;
+       myfile << *dn << dendl;
       }
     }
   }
index 2d54f34f9575ff3f3c89222e337100cee35f9da0..a197326086e66c3bd15de60a937581c8f9dad5d6 100644 (file)
@@ -23,9 +23,9 @@
 #include "common/Logger.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
-#define  derr(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
+
+#define  dout(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
+#define  derr(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
 
 // cons/des
 
@@ -84,14 +84,14 @@ void MDLog::flush_logger()
 
 void MDLog::reset()
 {
-  dout(5) << "reset to empty log" << endl;
+  dout(5) << "reset to empty log" << dendl;
   init_journaler();
   journaler->reset();
 }
 
 void MDLog::open(Context *c)
 {
-  dout(5) << "open discovering log bounds" << endl;
+  dout(5) << "open discovering log bounds" << dendl;
   init_journaler();
   journaler->recover(c);
 }
@@ -117,7 +117,7 @@ off_t MDLog::get_write_pos()
 void MDLog::submit_entry( LogEvent *le, Context *c ) 
 {
   if (g_conf.mds_log) {
-    dout(5) << "submit_entry " << journaler->get_write_pos() << " : " << *le << endl;
+    dout(5) << "submit_entry " << journaler->get_write_pos() << " : " << *le << dendl;
 
     // encode it, with event type
     {
@@ -153,7 +153,7 @@ void MDLog::submit_entry( LogEvent *le, Context *c )
        (journaler->get_write_pos() - last_subtree_map > log_inode.layout.period()/2)) {
       // log import map
       dout(10) << "submit_entry also logging subtree map: last = " << last_subtree_map
-              << ", cur pos = " << journaler->get_write_pos() << endl;
+              << ", cur pos = " << journaler->get_write_pos() << dendl;
       mds->mdcache->log_subtree_map();
     }
 
@@ -221,7 +221,7 @@ public:
 
 void MDLog::_did_read() 
 {
-  dout(5) << "_did_read()" << endl;
+  dout(5) << "_did_read()" << dendl;
   waiting_for_read = false;
   trim(0);
 }
@@ -230,12 +230,12 @@ void MDLog::_trimmed(LogEvent *le)
 {
   // successful trim?
   if (!le->has_expired(mds)) {
-    dout(7) << "retrimming : " << le->get_start_off() << " : " << *le << endl;
+    dout(7) << "retrimming : " << le->get_start_off() << " : " << *le << dendl;
     le->expire(mds, new C_MDL_Trimmed(this, le));
     return;
   }
 
-  dout(7) << "trimmed : " << le->get_start_off() << " : " << *le << endl;
+  dout(7) << "trimmed : " << le->get_start_off() << " : " << *le << dendl;
 
   if (trimming.begin()->first == le->_end_off) {
     // we trimmed off the front!  
@@ -263,7 +263,7 @@ void MDLog::trim(Context *c)
     trim_waiters.push_back(c);
 
   // trim!
-  dout(10) << "trim " <<  num_events << " events / " << max_events << " max" << endl;
+  dout(10) << "trim " <<  num_events << " events / " << max_events << " max" << dendl;
 
   // hack: only trim for a few seconds at a time
   utime_t stop = g_clock.now();
@@ -279,10 +279,10 @@ void MDLog::trim(Context *c)
     dout(5) << "trim num_events " << num_events << " > max " << max_events
            << ", trimming " << trimming.size()
            << ", byte gap " << gap
-           << endl;
+           << dendl;
 
     if ((int)trimming.size() >= g_conf.mds_log_max_trimming) {
-      dout(7) << "trim  already trimming max, waiting" << endl;
+      dout(7) << "trim  already trimming max, waiting" << dendl;
       return;
     }
     
@@ -298,14 +298,14 @@ void MDLog::trim(Context *c)
       // we just read an event.
       if (le->has_expired(mds)) {
         // obsolete
-       dout(7) << "trim  obsolete : " << le->get_start_off() << " : " << *le << endl;
+       dout(7) << "trim  obsolete : " << le->get_start_off() << " : " << *le << dendl;
         delete le;
         logger->inc("obs");
       } else {
         assert ((int)trimming.size() < g_conf.mds_log_max_trimming);
 
         // trim!
-       dout(7) << "trim  expiring : " << le->get_start_off() << " : " << *le << endl;
+       dout(7) << "trim  expiring : " << le->get_start_off() << " : " << *le << dendl;
         trimming[le->_end_off] = le;
         le->expire(mds, new C_MDL_Trimmed(this, le));
         logger->inc("trims");
@@ -317,10 +317,10 @@ void MDLog::trim(Context *c)
       // need to read!
       if (!waiting_for_read) {
         waiting_for_read = true;
-        dout(7) << "trim  waiting for read" << endl;
+        dout(7) << "trim  waiting for read" << dendl;
         journaler->wait_for_readable(new C_MDL_Reading(this));
       } else {
-        dout(7) << "trim  already waiting for read" << endl;
+        dout(7) << "trim  already waiting for read" << dendl;
       }
       return;
     }
@@ -329,7 +329,7 @@ void MDLog::trim(Context *c)
   dout(10) << "trim num_events " << num_events << " <= max " << max_events
          << ", trimming " << trimming.size()
          << ", done for now."
-         << endl;
+         << dendl;
   
   // trimmed!
   std::list<Context*> finished;
@@ -349,7 +349,7 @@ void MDLog::replay(Context *c)
 
   // empty?
   if (journaler->get_read_pos() == journaler->get_write_pos()) {
-    dout(10) << "replay - journal empty, done." << endl;
+    dout(10) << "replay - journal empty, done." << dendl;
     if (c) {
       c->finish(0);
       delete c;
@@ -363,7 +363,7 @@ void MDLog::replay(Context *c)
 
   // go!
   dout(10) << "replay start, from " << journaler->get_read_pos()
-          << " to " << journaler->get_write_pos() << endl;
+          << " to " << journaler->get_write_pos() << dendl;
 
   assert(num_events == 0);
 
@@ -387,7 +387,7 @@ public:
 void MDLog::_replay_thread()
 {
   mds->mds_lock.Lock();
-  dout(10) << "_replay_thread start" << endl;
+  dout(10) << "_replay_thread start" << dendl;
 
   // loop
   while (1) {
@@ -418,10 +418,10 @@ void MDLog::_replay_thread()
     if (!seen_subtree_map &&
        le->get_type() != EVENT_SUBTREEMAP) {
       dout(10) << "_replay " << pos << " / " << journaler->get_write_pos() 
-              << " -- waiting for subtree_map.  (skipping " << *le << ")" << endl;
+              << " -- waiting for subtree_map.  (skipping " << *le << ")" << dendl;
     } else {
       dout(10) << "_replay " << pos << " / " << journaler->get_write_pos() 
-              << " : " << *le << endl;
+              << " : " << *le << dendl;
       le->replay(mds);
 
       if (le->get_type() == EVENT_SUBTREEMAP)
@@ -436,7 +436,7 @@ void MDLog::_replay_thread()
 
   // done!
   assert(journaler->get_read_pos() == journaler->get_write_pos());
-  dout(10) << "_replay - complete" << endl;
+  dout(10) << "_replay - complete" << dendl;
   
   // move read pointer _back_ to expire pos, for eventual trimming
   journaler->set_read_pos(journaler->get_expire_pos());
@@ -446,7 +446,7 @@ void MDLog::_replay_thread()
   ls.swap(waitfor_replay);
   finish_contexts(ls,0);  
   
-  dout(10) << "_replay_thread finish" << endl;
+  dout(10) << "_replay_thread finish" << dendl;
   mds->mds_lock.Unlock();
 }
 
index 0d85117e07d435d2353ad8800ce3fbb5b814ef91..b45ff0444e74dfad7052a69fff2c321cf2cfe198 100644 (file)
@@ -60,9 +60,9 @@
 
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << whoami << " "
-#define  derr(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << whoami << " "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << whoami << " "
+#define  derr(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << whoami << " "
 
 
 
@@ -251,14 +251,14 @@ void MDS::forward_message_mds(Message *req, int mds, int port)
 void MDS::send_message_client(Message *m, int client)
 {
   version_t seq = clientmap.inc_push_seq(client);
-  dout(10) << "send_message_client client" << client << " seq " << seq << " " << *m << endl;
+  dout(10) << "send_message_client client" << client << " seq " << seq << " " << *m << dendl;
   messenger->send_message(m, clientmap.get_inst(client));
 }
 
 void MDS::send_message_client(Message *m, entity_inst_t clientinst)
 {
   version_t seq = clientmap.inc_push_seq(clientinst.name.num());
-  dout(10) << "send_message_client client" << clientinst.name.num() << " seq " << seq << " " << *m << endl;
+  dout(10) << "send_message_client client" << clientinst.name.num() << " seq " << seq << " " << *m << dendl;
   messenger->send_message(m, clientinst);
 }
 
@@ -281,7 +281,7 @@ void MDS::send_message_client_maybe_open(Message *m, entity_inst_t clientinst)
   int client = clientinst.name.num();
   if (!clientmap.have_session(client)) {
     // no session!
-    dout(10) << "send_message_client opening session with " << clientinst << endl;
+    dout(10) << "send_message_client opening session with " << clientinst << dendl;
     clientmap.add_opening(client);
     mdlog->submit_entry(new ESession(clientinst, true, clientmap.inc_projected()),
                        new C_MDS_SendMessageClientSession(this, m, clientinst));
@@ -394,7 +394,7 @@ void MDS::beacon_send()
   dout(10) << "beacon_send " << MDSMap::get_state_name(want_state)
           << " seq " << beacon_last_seq
           << " (currently " << MDSMap::get_state_name(state) << ")"
-          << endl;
+          << dendl;
 
   beacon_seq_stamp[beacon_last_seq] = g_clock.now();
   
@@ -412,7 +412,7 @@ void MDS::beacon_send()
 void MDS::handle_mds_beacon(MMDSBeacon *m)
 {
   dout(10) << "handle_mds_beacon " << MDSMap::get_state_name(m->get_state())
-          << " seq " << m->get_seq() << endl;
+          << " seq " << m->get_seq() << dendl;
   version_t seq = m->get_seq();
   
   // update lab
@@ -437,7 +437,7 @@ void MDS::reset_beacon_killer()
   when += g_conf.mds_beacon_grace;
   
   dout(15) << "reset_beacon_killer last_acked_stamp at " << beacon_last_acked_stamp
-          << ", will die at " << when << endl;
+          << ", will die at " << when << dendl;
   
   if (beacon_killer) timer.cancel_event(beacon_killer);
 
@@ -450,13 +450,13 @@ void MDS::beacon_kill(utime_t lab)
   if (lab == beacon_last_acked_stamp) {
     dout(0) << "beacon_kill last_acked_stamp " << lab 
            << ", killing myself."
-           << endl;
+           << dendl;
     suicide();
   } else {
     dout(20) << "beacon_kill last_acked_stamp " << beacon_last_acked_stamp 
             << " != my " << lab 
             << ", doing nothing."
-            << endl;
+            << dendl;
   }
 }
 
@@ -466,21 +466,21 @@ void MDS::handle_mds_map(MMDSMap *m)
 {
   version_t hadepoch = mdsmap->get_epoch();
   version_t epoch = m->get_epoch();
-  dout(5) << "handle_mds_map epoch " << epoch << " from " << m->get_source() << endl;
+  dout(5) << "handle_mds_map epoch " << epoch << " from " << m->get_source() << dendl;
 
   // note source's map version
   if (m->get_source().is_mds() && 
       peer_mdsmap_epoch[m->get_source().num()] < epoch) {
     dout(15) << " peer " << m->get_source()
             << " has mdsmap epoch >= " << epoch
-            << endl;
+            << dendl;
     peer_mdsmap_epoch[m->get_source().num()] = epoch;
   }
 
   // is it new?
   if (epoch <= mdsmap->get_epoch()) {
     dout(5) << " old map epoch " << epoch << " <= " << mdsmap->get_epoch() 
-           << ", discarding" << endl;
+           << ", discarding" << dendl;
     delete m;
     return;
   }
@@ -506,7 +506,7 @@ void MDS::handle_mds_map(MMDSMap *m)
   // see who i am
   whoami = mdsmap->get_addr_rank(messenger->get_myaddr());
   if (whoami < 0) {
-    dout(1) << "handle_mds_map i'm not in the mdsmap, killing myself" << endl;
+    dout(1) << "handle_mds_map i'm not in the mdsmap, killing myself" << dendl;
     suicide();
     return;
   }
@@ -517,7 +517,7 @@ void MDS::handle_mds_map(MMDSMap *m)
     reopen_logger();
     dout(1) << "handle_mds_map i am now mds" << whoami
            << " incarnation " << mdsmap->get_inc(whoami)
-           << endl;
+           << dendl;
 
     // do i need an osdmap?
     if (oldwhoami < 0) {
@@ -545,17 +545,17 @@ void MDS::handle_mds_map(MMDSMap *m)
   // did it change?
   if (oldstate != state) {
     if (state == want_state) {
-      dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state) << endl;
+      dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state) << dendl;
     } else {
       dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state)
              << ", although i wanted " << mdsmap->get_state_name(want_state)
-             << endl;
+             << dendl;
       want_state = state;
     }    
 
     // contemplate suicide
     if (mdsmap->get_inst(whoami) != messenger->get_myinst()) {
-      dout(1) << "apparently i've been replaced by " << mdsmap->get_inst(whoami) << ", committing suicide." << endl;
+      dout(1) << "apparently i've been replaced by " << mdsmap->get_inst(whoami) << ", committing suicide." << dendl;
       suicide();
       return;
     }
@@ -578,7 +578,7 @@ void MDS::handle_mds_map(MMDSMap *m)
       stopping_start();
     } else if (is_stopped()) {
       assert(oldstate == MDSMap::STATE_STOPPING);
-      dout(1) << "now stopped, sending down:out and exiting" << endl;
+      dout(1) << "now stopped, sending down:out and exiting" << dendl;
       suicide();
       return;
     }
@@ -591,7 +591,7 @@ void MDS::handle_mds_map(MMDSMap *m)
     set<int> resolve;
     mdsmap->get_mds_set(resolve, MDSMap::STATE_RESOLVE);
     if (oldresolve != resolve) {
-      dout(10) << "resolve set is " << resolve << ", was " << oldresolve << endl;
+      dout(10) << "resolve set is " << resolve << ", was " << oldresolve << dendl;
       for (set<int>::iterator p = resolve.begin(); p != resolve.end(); ++p) {
        if (*p == whoami) continue;
        if (oldresolve.count(*p)) continue;
@@ -666,7 +666,7 @@ void MDS::handle_mds_map(MMDSMap *m)
 
 void MDS::bcast_mds_map()
 {
-  dout(7) << "bcast_mds_map " << mdsmap->get_epoch() << endl;
+  dout(7) << "bcast_mds_map " << mdsmap->get_epoch() << dendl;
 
   // share the map with mounted clients
   for (set<int>::const_iterator p = clientmap.get_session_set().begin();
@@ -682,7 +682,7 @@ void MDS::bcast_mds_map()
 void MDS::handle_osd_map(MOSDMap *m)
 {
   version_t hadepoch = osdmap->get_epoch();
-  dout(10) << "handle_osd_map had " << hadepoch << endl;
+  dout(10) << "handle_osd_map had " << hadepoch << dendl;
   
   // process
   objecter->handle_osd_map(m);
@@ -697,7 +697,7 @@ void MDS::handle_osd_map(MOSDMap *m)
 
 void MDS::set_want_state(int s)
 {
-  dout(3) << "set_want_state " << MDSMap::get_state_name(s) << endl;
+  dout(3) << "set_want_state " << MDSMap::get_state_name(s) << dendl;
   want_state = s;
   beacon_send();
 }
@@ -724,12 +724,12 @@ public:
 
 void MDS::boot_create()
 {
-  dout(3) << "boot_create" << endl;
+  dout(3) << "boot_create" << dendl;
 
   C_Gather *fin = new C_Gather(new C_MDS_BootFinish(this));
 
   if (whoami == 0) {
-    dout(3) << "boot_create since i am also mds0, creating root inode and dir" << endl;
+    dout(3) << "boot_create since i am also mds0, creating root inode and dir" << dendl;
 
     // create root inode.
     mdcache->open_root(0);
@@ -747,7 +747,7 @@ void MDS::boot_create()
 
   // create my stray dir
   {
-    dout(10) << "boot_create creating local stray dir" << endl;
+    dout(10) << "boot_create creating local stray dir" << dendl;
     mdcache->open_local_stray();
     CInode *stray = mdcache->get_stray();
     CDir *dir = stray->get_dirfrag(frag_t());
@@ -757,7 +757,7 @@ void MDS::boot_create()
   }
 
   // start with a fresh journal
-  dout(10) << "boot_create creating fresh journal" << endl;
+  dout(10) << "boot_create creating fresh journal" << dendl;
   mdlog->reset();
   mdlog->write_head(fin->new_sub());
   
@@ -765,7 +765,7 @@ void MDS::boot_create()
   mdcache->log_subtree_map(fin->new_sub());
 
   // fixme: fake out idalloc (reset, pretend loaded)
-  dout(10) << "boot_create creating fresh idalloc table" << endl;
+  dout(10) << "boot_create creating fresh idalloc table" << dendl;
   idalloc->reset();
   idalloc->save(fin->new_sub());
 
@@ -774,7 +774,7 @@ void MDS::boot_create()
   
   // fixme: fake out anchortable
   if (mdsmap->get_anchortable() == whoami) {
-    dout(10) << "boot_create creating fresh anchortable" << endl;
+    dout(10) << "boot_create creating fresh anchortable" << dendl;
     anchortable->create_fresh();
     anchortable->save(fin->new_sub());
   }
@@ -782,38 +782,38 @@ void MDS::boot_create()
 
 void MDS::boot_start()
 {
-  dout(2) << "boot_start" << endl;
+  dout(2) << "boot_start" << dendl;
   
   C_Gather *fin = new C_Gather(new C_MDS_BootFinish(this));
   
-  dout(2) << "boot_start opening idalloc" << endl;
+  dout(2) << "boot_start opening idalloc" << dendl;
   idalloc->load(fin->new_sub());
 
-  dout(2) << "boot_start opening clientmap" << endl;
+  dout(2) << "boot_start opening clientmap" << dendl;
   clientmap.load(fin->new_sub());
   
   if (mdsmap->get_anchortable() == whoami) {
-    dout(2) << "boot_start opening anchor table" << endl;
+    dout(2) << "boot_start opening anchor table" << dendl;
     anchortable->load(fin->new_sub());
   } else {
-    dout(2) << "boot_start i have no anchor table" << endl;
+    dout(2) << "boot_start i have no anchor table" << dendl;
   }
 
-  dout(2) << "boot_start opening mds log" << endl;
+  dout(2) << "boot_start opening mds log" << dendl;
   mdlog->open(fin->new_sub());
 
   if (mdsmap->get_root() == whoami) {
-    dout(2) << "boot_start opening root directory" << endl;
+    dout(2) << "boot_start opening root directory" << dendl;
     mdcache->open_root(fin->new_sub());
   }
 
-  dout(2) << "boot_start opening local stray directory" << endl;
+  dout(2) << "boot_start opening local stray directory" << dendl;
   mdcache->open_local_stray();
 }
 
 void MDS::boot_finish()
 {
-  dout(3) << "boot_finish" << endl;
+  dout(3) << "boot_finish" << dendl;
 
   if (is_starting()) {
     // make sure mdslog is empty
@@ -841,26 +841,26 @@ void MDS::boot_replay(int step)
   case 1:
     {
       C_Gather *gather = new C_Gather(new C_MDS_BootRecover(this, 2));
-      dout(2) << "boot_replay " << step << ": opening idalloc" << endl;
+      dout(2) << "boot_replay " << step << ": opening idalloc" << dendl;
       idalloc->load(gather->new_sub());
 
-      dout(2) << "boot_replay " << step << ": opening clientmap" << endl;
+      dout(2) << "boot_replay " << step << ": opening clientmap" << dendl;
       clientmap.load(gather->new_sub());
 
       if (mdsmap->get_anchortable() == whoami) {
-       dout(2) << "boot_replay " << step << ": opening anchor table" << endl;
+       dout(2) << "boot_replay " << step << ": opening anchor table" << dendl;
        anchortable->load(gather->new_sub());
       }
     }
     break;
 
   case 2:
-    dout(2) << "boot_replay " << step << ": opening mds log" << endl;
+    dout(2) << "boot_replay " << step << ": opening mds log" << dendl;
     mdlog->open(new C_MDS_BootRecover(this, 3));
     break;
     
   case 3:
-    dout(2) << "boot_replay " << step << ": replaying mds log" << endl;
+    dout(2) << "boot_replay " << step << ": replaying mds log" << dendl;
     mdlog->replay(new C_MDS_BootRecover(this, 4));
     break;
 
@@ -874,13 +874,13 @@ void MDS::boot_replay(int step)
 
 void MDS::replay_start()
 {
-  dout(1) << "replay_start" << endl;
+  dout(1) << "replay_start" << dendl;
 
   // initialize gather sets
   set<int> rs;
   mdsmap->get_recovery_mds_set(rs);
   rs.erase(whoami);
-  dout(1) << "now replay.  my recovery peers are " << rs << endl;
+  dout(1) << "now replay.  my recovery peers are " << rs << dendl;
   mdcache->set_recovery_set(rs);
 
   // note: don't actually start yet.  boot() will get called once we have 
@@ -889,14 +889,14 @@ void MDS::replay_start()
 
 void MDS::replay_done()
 {
-  dout(1) << "replay_done" << endl;
+  dout(1) << "replay_done" << dendl;
 
   if (mdsmap->get_num_in_mds() == 1 &&
       mdsmap->get_num_mds(MDSMap::STATE_FAILED) == 0) { // just me!
-    dout(2) << "i am alone, moving to state reconnect" << endl;      
+    dout(2) << "i am alone, moving to state reconnect" << dendl;      
     set_want_state(MDSMap::STATE_RECONNECT);
   } else {
-    dout(2) << "i am not alone, moving to state resolve" << endl;
+    dout(2) << "i am not alone, moving to state resolve" << dendl;
     set_want_state(MDSMap::STATE_RESOLVE);
   }
 }
@@ -904,7 +904,7 @@ void MDS::replay_done()
 
 void MDS::resolve_start()
 {
-  dout(1) << "resolve_start" << endl;
+  dout(1) << "resolve_start" << dendl;
 
   set<int> who;
   mdsmap->get_mds_set(who, MDSMap::STATE_RESOLVE);
@@ -918,18 +918,18 @@ void MDS::resolve_start()
 }
 void MDS::resolve_done()
 {
-  dout(1) << "resolve_done" << endl;
+  dout(1) << "resolve_done" << dendl;
   set_want_state(MDSMap::STATE_RECONNECT);
 }
 
 void MDS::reconnect_start()
 {
-  dout(1) << "reconnect_start" << endl;
+  dout(1) << "reconnect_start" << dendl;
   server->reconnect_clients();
 }
 void MDS::reconnect_done()
 {
-  dout(1) << "reconnect_done" << endl;
+  dout(1) << "reconnect_done" << dendl;
   set_want_state(MDSMap::STATE_REJOIN);    // move to rejoin state
 
   /*
@@ -948,12 +948,12 @@ void MDS::reconnect_done()
 
 void MDS::rejoin_joint_start()
 {
-  dout(1) << "rejoin_joint_start" << endl;
+  dout(1) << "rejoin_joint_start" << dendl;
   mdcache->rejoin_send_rejoins();
 }
 void MDS::rejoin_done()
 {
-  dout(1) << "rejoin_done" << endl;
+  dout(1) << "rejoin_done" << dendl;
   mdcache->show_subtrees();
   mdcache->show_cache();
   set_want_state(MDSMap::STATE_ACTIVE);
@@ -962,7 +962,7 @@ void MDS::rejoin_done()
 
 void MDS::recovery_done()
 {
-  dout(1) << "recovery_done -- successful recovery!" << endl;
+  dout(1) << "recovery_done -- successful recovery!" << dendl;
   assert(is_active());
   
   // kick anchortable (resent AGREEs)
@@ -980,7 +980,7 @@ void MDS::recovery_done()
 
 void MDS::handle_mds_recovery(int who) 
 {
-  dout(5) << "handle_mds_recovery mds" << who << endl;
+  dout(5) << "handle_mds_recovery mds" << who << dendl;
   
   mdcache->handle_mds_recovery(who);
 
@@ -995,8 +995,8 @@ void MDS::handle_mds_recovery(int who)
 
 void MDS::shutdown_start()
 {
-  dout(1) << "shutdown_start" << endl;
-  derr(0) << "mds shutdown start" << endl;
+  dout(1) << "shutdown_start" << dendl;
+  derr(0) << "mds shutdown start" << dendl;
 
   // tell everyone to stop.
   set<int> active;
@@ -1005,7 +1005,7 @@ void MDS::shutdown_start()
        p != active.end();
        p++) {
     if (mdsmap->is_up(*p)) {
-      dout(1) << "sending MShutdownStart to mds" << *p << endl;
+      dout(1) << "sending MShutdownStart to mds" << *p << dendl;
       send_message_mds(new MGenericMessage(MSG_MDS_SHUTDOWNSTART),
                       *p, MDS_PORT_MAIN);
     }
@@ -1017,7 +1017,7 @@ void MDS::shutdown_start()
 
 void MDS::handle_shutdown_start(Message *m)
 {
-  dout(1) << " handle_shutdown_start" << endl;
+  dout(1) << " handle_shutdown_start" << dendl;
 
   set_want_state(MDSMap::STATE_STOPPING);
   delete m;
@@ -1027,7 +1027,7 @@ void MDS::handle_shutdown_start(Message *m)
 
 void MDS::stopping_start()
 {
-  dout(1) << "stopping_start" << endl;
+  dout(1) << "stopping_start" << dendl;
 
   // start cache shutdown
   mdcache->shutdown_start();
@@ -1041,7 +1041,7 @@ void MDS::stopping_start()
 }
 void MDS::stopping_done()
 {
-  dout(1) << "stopping_done" << endl;
+  dout(1) << "stopping_done" << dendl;
 
   // tell monitor we shut down cleanly.
   set_want_state(MDSMap::STATE_STOPPED);
@@ -1051,7 +1051,7 @@ void MDS::stopping_done()
 
 void MDS::suicide()
 {
-  dout(1) << "suicide" << endl;
+  dout(1) << "suicide" << dendl;
 
   // flush loggers
   if (logger) logger->flush(true);
@@ -1105,12 +1105,12 @@ void MDS::my_dispatch(Message *m)
       // bogus mds?
       if (m->get_type() != MSG_MDS_MAP) {
        dout(5) << "got " << *m << " from down/old/bad/imposter mds " << m->get_source()
-               << ", dropping" << endl;
+               << ", dropping" << dendl;
        delete m;
        return;
       } else {
        dout(5) << "got " << *m << " from old/bad/imposter mds " << m->get_source()
-               << ", but it's an mdsmap, looking at it" << endl;
+               << ", but it's an mdsmap, looking at it" << dendl;
       }
     }
   }
@@ -1152,14 +1152,14 @@ void MDS::my_dispatch(Message *m)
     break;
 
   default:
-    dout(1) << "MDS dispatch unknown message port" << m->get_dest_port() << endl;
+    dout(1) << "MDS dispatch unknown message port" << m->get_dest_port() << dendl;
     assert(0);
   }
   
   // finish any triggered contexts
   if (finished_queue.size()) {
-    dout(7) << "mds has " << finished_queue.size() << " queued contexts" << endl;
-    dout(10) << finished_queue << endl;
+    dout(7) << "mds has " << finished_queue.size() << " queued contexts" << dendl;
+    dout(10) << finished_queue << dendl;
     list<Context*> ls;
     ls.splice(ls.begin(), finished_queue);
     assert(finished_queue.empty());
@@ -1185,7 +1185,7 @@ void MDS::my_dispatch(Message *m)
     if (s.size() < 2 || mdcache->get_num_inodes() < 10) 
       break;  // need peers for this to work.
 
-    dout(7) << "mds thrashing exports pass " << (i+1) << "/" << g_conf.mds_thrash_exports << endl;
+    dout(7) << "mds thrashing exports pass " << (i+1) << "/" << g_conf.mds_thrash_exports << dendl;
     
     // pick a random dir inode
     CInode *in = mdcache->hack_pick_random_inode();
@@ -1209,7 +1209,7 @@ void MDS::my_dispatch(Message *m)
   // hack: thrash exports
   for (int i=0; i<g_conf.mds_thrash_fragments; i++) {
     if (!is_active()) break;
-    dout(7) << "mds thrashing fragments pass " << (i+1) << "/" << g_conf.mds_thrash_fragments << endl;
+    dout(7) << "mds thrashing fragments pass " << (i+1) << "/" << g_conf.mds_thrash_fragments << dendl;
     
     // pick a random dir inode
     CInode *in = mdcache->hack_pick_random_inode();
@@ -1230,7 +1230,7 @@ void MDS::my_dispatch(Message *m)
       mdcache->get_root()->dir &&
       !(mdcache->get_root()->dir->is_hashed() || 
         mdcache->get_root()->dir->is_hashing())) {
-    dout(0) << "hashing root" << endl;
+    dout(0) << "hashing root" << dendl;
     mdcache->migrator->hash_dir(mdcache->get_root()->dir);
   }
   */
@@ -1240,7 +1240,7 @@ void MDS::my_dispatch(Message *m)
   // shut down?
   if (is_stopping()) {
     if (mdcache->shutdown_pass()) {
-      dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to down:stopped" << endl;
+      dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to down:stopped" << dendl;
       stopping_done();
     }
   }
@@ -1293,7 +1293,7 @@ void MDS::proc_message(Message *m)
 void MDS::ms_handle_failure(Message *m, const entity_inst_t& inst) 
 {
   mds_lock.Lock();
-  dout(10) << "handle_ms_failure to " << inst << " on " << *m << endl;
+  dout(10) << "handle_ms_failure to " << inst << " on " << *m << dendl;
   
   if (m->get_type() == MSG_MDS_MAP && m->get_dest().is_client()) 
     server->client_reconnect_failure(m->get_dest().num());
@@ -1308,7 +1308,7 @@ void MDS::ms_handle_failure(Message *m, const entity_inst_t& inst)
 
 void MDS::handle_ping(MPing *m)
 {
-  dout(10) << " received ping from " << m->get_source() << " with seq " << m->seq << endl;
+  dout(10) << " received ping from " << m->get_source() << " with seq " << m->seq << dendl;
 
   messenger->send_message(new MPingAck(m),
                           m->get_source_inst());
index f6ed961f40f1ad4e8081319fc0a67612722668a3..b227f25bd6e44600e7161e595c8df86655493546 100644 (file)
@@ -48,8 +48,8 @@
 #include "messages/MExportDirFinish.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".migrator "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".migrator "
 
 
 
@@ -111,7 +111,7 @@ public:
 
 void Migrator::export_empty_import(CDir *dir)
 {
-  dout(7) << "export_empty_import " << *dir << endl;
+  dout(7) << "export_empty_import " << *dir << dendl;
   
   if (dir->inode->is_auth()) return;
   if (!dir->is_auth()) return;
@@ -120,18 +120,18 @@ void Migrator::export_empty_import(CDir *dir)
   if (dir->is_freezing() || dir->is_frozen()) return;
   
   if (dir->get_size() > 0) {
-    dout(7) << "not actually empty" << endl;
+    dout(7) << "not actually empty" << dendl;
     return;
   }
 
   if (dir->inode->is_root()) {
-    dout(7) << "root" << endl;
+    dout(7) << "root" << dendl;
     return;
   }
   
   // is it really empty?
   if (!dir->is_complete()) {
-    dout(7) << "not complete, fetching." << endl;
+    dout(7) << "not complete, fetching." << dendl;
     dir->fetch(new C_MDC_EmptyImport(this,dir));
     return;
   }
@@ -141,11 +141,11 @@ void Migrator::export_empty_import(CDir *dir)
   // comment this out ot wreak havoc?
   //if (mds->is_shutting_down()) dest = 0;  // this is more efficient.
   
-  dout(7) << "really empty, exporting to " << dest << endl;
+  dout(7) << "really empty, exporting to " << dest << dendl;
   assert (dest != mds->get_nodeid());
   
   dout(-7) << "exporting to mds" << dest 
-           << " empty import " << *dir << endl;
+           << " empty import " << *dir << dendl;
   export_dir( dir, dest );
 }
 
@@ -157,7 +157,7 @@ void Migrator::export_empty_import(CDir *dir)
 
 void Migrator::handle_mds_failure_or_stop(int who)
 {
-  dout(5) << "handle_mds_failure_or_stop mds" << who << endl;
+  dout(5) << "handle_mds_failure_or_stop mds" << who << dendl;
 
   // check my exports
   map<CDir*,int>::iterator p = export_state.begin();
@@ -172,11 +172,11 @@ void Migrator::handle_mds_failure_or_stop(int who)
     if (export_peer[dir] == who ||
        p->second == EXPORT_DISCOVERING || p->second == EXPORT_FREEZING) { 
       // the guy i'm exporting to failed, or we're just freezing.
-      dout(10) << "cleaning up export state " << p->second << " of " << *dir << endl;
+      dout(10) << "cleaning up export state " << p->second << " of " << *dir << dendl;
       
       switch (p->second) {
       case EXPORT_DISCOVERING:
-       dout(10) << "export state=discovering : canceling freeze and removing auth_pin" << endl;
+       dout(10) << "export state=discovering : canceling freeze and removing auth_pin" << dendl;
        dir->unfreeze_tree();  // cancel the freeze
        dir->auth_unpin();
        export_state.erase(dir); // clean up
@@ -187,7 +187,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
        
       case EXPORT_FREEZING:
-       dout(10) << "export state=freezing : canceling freeze" << endl;
+       dout(10) << "export state=freezing : canceling freeze" << dendl;
        dir->unfreeze_tree();  // cancel the freeze
        export_state.erase(dir); // clean up
        dir->state_clear(CDir::STATE_EXPORTING);
@@ -198,13 +198,13 @@ void Migrator::handle_mds_failure_or_stop(int who)
 
        // NOTE: state order reversal, warning comes after loggingstart+prepping
       case EXPORT_WARNING:
-       dout(10) << "export state=warning : unpinning bounds, unfreezing, notifying" << endl;
+       dout(10) << "export state=warning : unpinning bounds, unfreezing, notifying" << dendl;
        // fall-thru
 
        //case EXPORT_LOGGINGSTART:
       case EXPORT_PREPPING:
        if (p->second != EXPORT_WARNING) 
-         dout(10) << "export state=loggingstart|prepping : unpinning bounds, unfreezing" << endl;
+         dout(10) << "export state=loggingstart|prepping : unpinning bounds, unfreezing" << dendl;
        {
          // unpin bounds
          set<CDir*> bounds;
@@ -226,7 +226,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
        
       case EXPORT_EXPORTING:
-       dout(10) << "export state=exporting : reversing, and unfreezing" << endl;
+       dout(10) << "export state=exporting : reversing, and unfreezing" << dendl;
        export_reverse(dir);
        export_state.erase(dir); // clean up
        dir->state_clear(CDir::STATE_EXPORTING);
@@ -235,7 +235,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
 
       case EXPORT_LOGGINGFINISH:
       case EXPORT_NOTIFYING:
-       dout(10) << "export state=loggingfinish|notifying : ignoring dest failure, we were successful." << endl;
+       dout(10) << "export state=loggingfinish|notifying : ignoring dest failure, we were successful." << dendl;
        // leave export_state, don't clean up now.
        break;
 
@@ -273,7 +273,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
          // exporter waiting for warning acks, let's fake theirs.
          dout(10) << "faking export_warning_ack from mds" << who
                   << " on " << *dir << " to mds" << export_peer[dir] 
-                  << endl;
+                  << dendl;
          if (export_warning_ack_waiting[dir].empty()) 
            export_go(dir);
        }
@@ -285,7 +285,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
          // exporter is waiting for notify acks, fake it
          dout(10) << "faking export_notify_ack from mds" << who
                   << " on " << *dir << " to mds" << export_peer[dir] 
-                  << endl;
+                  << dendl;
          if (export_notify_ack_waiting[dir].empty()) 
            export_finish(dir);
        }
@@ -309,13 +309,13 @@ void Migrator::handle_mds_failure_or_stop(int who)
     if (import_peer[df] == who) {
       switch (q->second) {
       case IMPORT_DISCOVERING:
-       dout(10) << "import state=discovering : clearing state" << endl;
+       dout(10) << "import state=discovering : clearing state" << dendl;
        import_state.erase(df);
        import_peer.erase(df);
        break;
 
       case IMPORT_DISCOVERED:
-       dout(10) << "import state=discovered : unpinning inode " << *diri << endl;
+       dout(10) << "import state=discovered : unpinning inode " << *diri << dendl;
        assert(diri);
        // unpin base
        diri->put(CInode::PIN_IMPORTING);
@@ -325,7 +325,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
 
       case IMPORT_PREPPING:
        if (q->second == IMPORT_PREPPING) {
-         dout(10) << "import state=prepping : unpinning base+bounds " << *dir << endl;
+         dout(10) << "import state=prepping : unpinning base+bounds " << *dir << dendl;
        }
        assert(dir);
        {
@@ -337,7 +337,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
 
       case IMPORT_PREPPED:
-       dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << endl;
+       dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << dendl;
        assert(dir);
        {
          set<CDir*> bounds;
@@ -360,13 +360,13 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
 
       case IMPORT_LOGGINGSTART:
-       dout(10) << "import state=loggingstart : reversing import on " << *dir << endl;
+       dout(10) << "import state=loggingstart : reversing import on " << *dir << dendl;
        import_reverse(dir);
        break;
 
       case IMPORT_ACKING:
        // hrm.  make this an ambiguous import, and wait for exporter recovery to disambiguate
-       dout(10) << "import state=acking : noting ambiguous import " << *dir << endl;
+       dout(10) << "import state=acking : noting ambiguous import " << *dir << dendl;
        {
          set<CDir*> bounds;
          cache->get_subtree_bounds(dir, bounds);
@@ -375,7 +375,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
        break;
        
       case IMPORT_ABORTING:
-       dout(10) << "import state=aborting : ignoring repeat failure " << *dir << endl;
+       dout(10) << "import state=aborting : ignoring repeat failure " << *dir << dendl;
        break;
       }
     } else {
@@ -383,7 +383,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
          import_bystanders[dir].count(who)) {
        dout(10) << "faking export_notify_ack from mds" << who
                 << " on aborting import " << *dir << " from mds" << import_peer[df] 
-                << endl;
+                << dendl;
        import_bystanders[dir].erase(who);
        if (import_bystanders[dir].empty()) {
          import_bystanders.erase(dir);
@@ -401,7 +401,7 @@ void Migrator::handle_mds_failure_or_stop(int who)
 
 void Migrator::show_importing()
 {  
-  dout(10) << "show_importing" << endl;
+  dout(10) << "show_importing" << dendl;
   for (map<dirfrag_t,int>::iterator p = import_state.begin();
        p != import_state.end();
        p++) {
@@ -411,19 +411,19 @@ void Migrator::show_importing()
               << ": (" << p->second << ") " << get_import_statename(p->second) 
               << " " << p->first
               << " " << *dir
-              << endl;
+              << dendl;
     } else {
       dout(10) << " importing from " << import_peer[p->first]
               << ": (" << p->second << ") " << get_import_statename(p->second) 
               << " " << p->first 
-              << endl;
+              << dendl;
     }
   }
 }
 
 void Migrator::show_exporting() 
 {
-  dout(10) << "show_exporting" << endl;
+  dout(10) << "show_exporting" << dendl;
   for (map<CDir*,int>::iterator p = export_state.begin();
        p != export_state.end();
        p++) 
@@ -431,7 +431,7 @@ void Migrator::show_exporting()
             << ": (" << p->second << ") " << get_export_statename(p->second) 
             << " " << p->first->dirfrag()
             << " " << *p->first
-            << endl;
+            << dendl;
 }
 
 
@@ -507,28 +507,28 @@ public:
  */
 void Migrator::export_dir(CDir *dir, int dest)
 {
-  dout(7) << "export_dir " << *dir << " to " << dest << endl;
+  dout(7) << "export_dir " << *dir << " to " << dest << dendl;
   assert(dir->is_auth());
   assert(dest != mds->get_nodeid());
    
   if (mds->mdsmap->is_degraded()) {
-    dout(7) << "cluster degraded, no exports for now" << endl;
+    dout(7) << "cluster degraded, no exports for now" << dendl;
     return;
   }
 
   if (dir->inode->is_root()) {
-    dout(7) << "i won't export root" << endl;
+    dout(7) << "i won't export root" << dendl;
     //assert(0);
     return;
   }
 
   if (dir->is_frozen() ||
       dir->is_freezing()) {
-    dout(7) << " can't export, freezing|frozen.  wait for other exports to finish first." << endl;
+    dout(7) << " can't export, freezing|frozen.  wait for other exports to finish first." << dendl;
     return;
   }
   if (dir->state_test(CDir::STATE_EXPORTING)) {
-    dout(7) << "already exporting" << endl;
+    dout(7) << "already exporting" << dendl;
     return;
   }
   
@@ -536,7 +536,7 @@ void Migrator::export_dir(CDir *dir, int dest)
   vector<CDentry*> trace;
   cache->make_trace(trace, dir->inode);
   if (!mds->locker->dentry_can_rdlock_trace(trace)) {
-    dout(7) << "export_dir couldn't pin path, failing." << endl;
+    dout(7) << "export_dir couldn't pin path, failing." << dendl;
     return;
   }
 
@@ -568,12 +568,12 @@ void Migrator::handle_export_discover_ack(MExportDirDiscoverAck *m)
   assert(dir);
   
   dout(7) << "export_discover_ack from " << m->get_source()
-         << " on " << *dir << endl;
+         << " on " << *dir << dendl;
 
   if (export_state.count(dir) == 0 ||
       export_state[dir] != EXPORT_DISCOVERING ||
       export_peer[dir] != m->get_source().num()) {
-    dout(7) << "must have aborted" << endl;
+    dout(7) << "must have aborted" << dendl;
   } else {
     // freeze the subtree
     export_state[dir] = EXPORT_FREEZING;
@@ -585,7 +585,7 @@ void Migrator::handle_export_discover_ack(MExportDirDiscoverAck *m)
 
 void Migrator::export_frozen(CDir *dir)
 {
-  dout(7) << "export_frozen on " << *dir << endl;
+  dout(7) << "export_frozen on " << *dir << dendl;
   assert(dir->is_frozen());
   int dest = export_peer[dir];
 
@@ -606,7 +606,7 @@ void Migrator::export_frozen(CDir *dir)
        p != dir->replicas_end();
        p++) {
     if (p->first != dest) {
-      dout(10) << "bystander mds" << p->first << endl;
+      dout(10) << "bystander mds" << p->first << dendl;
       prep->add_bystander(p->first);
     }
   }
@@ -632,7 +632,7 @@ void Migrator::export_frozen(CDir *dir)
     bound->get(CDir::PIN_EXPORTBOUND);
     bound->state_set(CDir::STATE_EXPORTBOUND);
     
-    dout(7) << "  export bound " << *bound << endl;
+    dout(7) << "  export bound " << *bound << dendl;
 
     prep->add_export( bound->dirfrag() );
 
@@ -649,13 +649,13 @@ void Migrator::export_frozen(CDir *dir)
       // inode
       assert(cur->inode->is_auth());
       inode_trace.push_front(cur->inode);
-      dout(7) << "  will add " << *cur->inode << endl;
+      dout(7) << "  will add " << *cur->inode << dendl;
       
       // include the dirfrag?  only if it's not the bounding subtree root.
       if (cur != bound) {
        assert(cur->is_auth());
         prep->add_dirfrag( cur->replicate_to(dest) );  // yay!
-        dout(7) << "  added " << *cur << endl;
+        dout(7) << "  added " << *cur << dendl;
       }
       
       cur = cur->get_parent_dir();
@@ -665,8 +665,8 @@ void Migrator::export_frozen(CDir *dir)
          it != inode_trace.end();
          it++) {
       CInode *in = *it;
-      dout(7) << "  added " << *in->parent << endl;
-      dout(7) << "  added " << *in << endl;
+      dout(7) << "  added " << *in->parent << dendl;
+      dout(7) << "  added " << *in << dendl;
       prep->add_inode( in->parent->get_dir()->dirfrag(),
                       in->parent->get_name(),
                        in->parent->replicate_to(dest),
@@ -685,12 +685,12 @@ void Migrator::handle_export_prep_ack(MExportDirPrepAck *m)
   CDir *dir = cache->get_dirfrag(m->get_dirfrag());
   assert(dir);
 
-  dout(7) << "export_prep_ack " << *dir << endl;
+  dout(7) << "export_prep_ack " << *dir << dendl;
 
   if (export_state.count(dir) == 0 ||
       export_state[dir] != EXPORT_PREPPING) {
     // export must have aborted.  
-    dout(7) << "export must have aborted" << endl;
+    dout(7) << "export must have aborted" << dendl;
     delete m;
     return;
   }
@@ -735,7 +735,7 @@ void Migrator::export_go(CDir *dir)
 {  
   assert(export_peer.count(dir));
   int dest = export_peer[dir];
-  dout(7) << "export_go " << *dir << " to " << dest << endl;
+  dout(7) << "export_go " << *dir << " to " << dest << dendl;
 
   cache->show_subtrees();
   
@@ -805,7 +805,7 @@ void Migrator::encode_export_inode(CInode *in, bufferlist& enc_state, int new_au
   for (map<int, Capability>::iterator it = in->client_caps.begin();
        it != in->client_caps.end();
        it++) {
-    dout(7) << "encode_export_inode " << *in << " telling client" << it->first << " stale caps" << endl;
+    dout(7) << "encode_export_inode " << *in << " telling client" << it->first << " stale caps" << dendl;
     MClientFileCaps *m = new MClientFileCaps(MClientFileCaps::OP_STALE,
                                             in->inode, 
                                              it->second.get_last_seq(), 
@@ -826,7 +826,7 @@ void Migrator::encode_export_inode(CInode *in, bufferlist& enc_state, int new_au
   istate._encode( enc_state );
 
   // we're export this inode; fix inode state
-  dout(7) << "encode_export_inode " << *in << endl;
+  dout(7) << "encode_export_inode " << *in << dendl;
   
   if (in->is_dirty()) in->mark_clean();
   
@@ -863,7 +863,7 @@ int Migrator::encode_export_dir(list<bufferlist>& dirstatelist,
 {
   int num_exported = 0;
 
-  dout(7) << "encode_export_dir " << *dir << " " << dir->nitems << " items" << endl;
+  dout(7) << "encode_export_dir " << *dir << " " << dir->nitems << " items" << dendl;
   
   assert(dir->get_projected_version() == dir->get_version());
 
@@ -903,7 +903,7 @@ int Migrator::encode_export_dir(list<bufferlist>& dirstatelist,
     num_exported++;
     
     // -- dentry
-    dout(7) << "encode_export_dir exporting " << *dn << endl;
+    dout(7) << "encode_export_dir exporting " << *dn << dendl;
     
     // name
     ::_encode(it->first, enc_dir);
@@ -989,7 +989,7 @@ void Migrator::handle_export_ack(MExportDirAck *m)
   assert(dir->is_frozen_tree_root());  // i'm exporting!
 
   // yay!
-  dout(7) << "handle_export_ack " << *dir << endl;
+  dout(7) << "handle_export_ack " << *dir << dendl;
 
   export_warning_ack_waiting.erase(dir);
   
@@ -1028,7 +1028,7 @@ void Migrator::handle_export_ack(MExportDirAck *m)
  */
 void Migrator::export_reverse(CDir *dir)
 {
-  dout(7) << "export_reverse " << *dir << endl;
+  dout(7) << "export_reverse " << *dir << dendl;
   
   assert(export_state[dir] == EXPORT_EXPORTING);
   assert(export_data.count(dir));
@@ -1086,7 +1086,7 @@ void Migrator::export_reverse(CDir *dir)
  */
 void Migrator::export_logged_finish(CDir *dir)
 {
-  dout(7) << "export_logged_finish " << *dir << endl;
+  dout(7) << "export_logged_finish " << *dir << dendl;
 
   // send notifies
   int dest = export_peer[dir];
@@ -1140,7 +1140,7 @@ void Migrator::handle_export_notify_ack(MExportDirNotifyAck *m)
     // exporting. process warning.
     dout(7) << "handle_export_notify_ack from " << m->get_source()
            << ": exporting, processing warning on "
-           << *dir << endl;
+           << *dir << dendl;
     assert(export_warning_ack_waiting.count(dir));
     export_warning_ack_waiting[dir].erase(from);
     
@@ -1151,7 +1151,7 @@ void Migrator::handle_export_notify_ack(MExportDirNotifyAck *m)
     // exporting. process notify.
     dout(7) << "handle_export_notify_ack from " << m->get_source()
            << ": exporting, processing notify on "
-           << *dir << endl;
+           << *dir << dendl;
     assert(export_notify_ack_waiting.count(dir));
     export_notify_ack_waiting[dir].erase(from);
     
@@ -1162,7 +1162,7 @@ void Migrator::handle_export_notify_ack(MExportDirNotifyAck *m)
     // reversing import
     dout(7) << "handle_export_notify_ack from " << m->get_source()
            << ": aborting import on "
-           << *dir << endl;
+           << *dir << dendl;
     assert(import_bystanders[dir].count(from));
     import_bystanders[dir].erase(from);
     if (import_bystanders[dir].empty()) {
@@ -1177,10 +1177,10 @@ void Migrator::handle_export_notify_ack(MExportDirNotifyAck *m)
 
 void Migrator::export_finish(CDir *dir)
 {
-  dout(5) << "export_finish " << *dir << endl;
+  dout(5) << "export_finish " << *dir << dendl;
 
   if (export_state.count(dir) == 0) {
-    dout(7) << "target must have failed, not sending final commit message.  export succeeded anyway." << endl;
+    dout(7) << "target must have failed, not sending final commit message.  export succeeded anyway." << dendl;
     return;
   }
 
@@ -1189,11 +1189,11 @@ void Migrator::export_finish(CDir *dir)
     mds->send_message_mds(new MExportDirFinish(dir->dirfrag()), 
                          export_peer[dir], MDS_PORT_MIGRATOR);
   } else {
-    dout(7) << "not sending MExportDirFinish, dest has failed" << endl;
+    dout(7) << "not sending MExportDirFinish, dest has failed" << dendl;
   }
   
   // unfreeze
-  dout(7) << "export_finish unfreezing" << endl;
+  dout(7) << "export_finish unfreezing" << dendl;
   dir->unfreeze_tree();
   
   // unpin bounds
@@ -1213,7 +1213,7 @@ void Migrator::export_finish(CDir *dir)
   cache->try_subtree_merge(dir);
   
   // unpin path
-  dout(7) << "export_finish unpinning path" << endl;
+  dout(7) << "export_finish unpinning path" << dendl;
   vector<CDentry*> trace;
   cache->make_trace(trace, dir->inode);
   mds->locker->dentry_anon_rdlock_trace_finish(trace);
@@ -1256,7 +1256,7 @@ void Migrator::handle_export_discover(MExportDirDiscover *m)
 {
   assert(m->get_source().num() != mds->get_nodeid());
 
-  dout(7) << "handle_export_discover on " << m->get_path() << endl;
+  dout(7) << "handle_export_discover on " << m->get_path() << dendl;
 
   // note import state
   dirfrag_t df = m->get_dirfrag();
@@ -1271,7 +1271,7 @@ void Migrator::handle_export_discover(MExportDirDiscover *m)
   // am i retrying after ancient path_traverse results?
   if (import_state.count(df) == 0 &&
       import_state[df] != IMPORT_DISCOVERING) {
-    dout(7) << "hmm import_state is off, i must be obsolete lookup" << endl;
+    dout(7) << "hmm import_state is off, i must be obsolete lookup" << dendl;
     delete m;
     return;
   }
@@ -1287,7 +1287,7 @@ void Migrator::handle_export_discover(MExportDirDiscover *m)
                                 MDS_TRAVERSE_DISCOVER);
     if (r > 0) return; // wait
     if (r < 0) {
-      dout(7) << "handle_export_discover_2 failed to discover or not dir " << m->get_path() << ", NAK" << endl;
+      dout(7) << "handle_export_discover_2 failed to discover or not dir " << m->get_path() << ", NAK" << dendl;
       assert(0);    // this shouldn't happen if the auth pins his path properly!!!! 
     }
 
@@ -1295,7 +1295,7 @@ void Migrator::handle_export_discover(MExportDirDiscover *m)
   }
 
   // yay
-  dout(7) << "handle_export_discover have " << df << " inode " << *in << endl;
+  dout(7) << "handle_export_discover have " << df << " inode " << *in << dendl;
   
   import_state[m->get_dirfrag()] = IMPORT_DISCOVERED;
   
@@ -1304,14 +1304,14 @@ void Migrator::handle_export_discover(MExportDirDiscover *m)
   in->get(CInode::PIN_IMPORTING);
 
   // reply
-  dout(7) << " sending export_discover_ack on " << *in << endl;
+  dout(7) << " sending export_discover_ack on " << *in << dendl;
   mds->send_message_mds(new MExportDirDiscoverAck(df),
                        import_peer[df], MDS_PORT_MIGRATOR);
 }
 
 void Migrator::handle_export_cancel(MExportDirCancel *m)
 {
-  dout(7) << "handle_export_cancel on " << m->get_dirfrag() << endl;
+  dout(7) << "handle_export_cancel on " << m->get_dirfrag() << dendl;
 
   if (import_state[m->get_dirfrag()] == IMPORT_DISCOVERED) {
     CInode *in = cache->get_inode(m->get_dirfrag().ino);
@@ -1338,7 +1338,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
       (import_state[m->get_dirfrag()] != IMPORT_DISCOVERED &&
        import_state[m->get_dirfrag()] != IMPORT_PREPPING) ||
       import_peer[m->get_dirfrag()] != oldauth) {
-    dout(10) << "handle_export_prep import has aborted, dropping" << endl;
+    dout(10) << "handle_export_prep import has aborted, dropping" << dendl;
     delete m;
     return;
   }
@@ -1355,11 +1355,11 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
     dir = cache->add_replica_dir(diri, 
                                 m->get_dirfrag().frag, *m->get_dirfrag_discover(m->get_dirfrag()), 
                                 oldauth, finished);
-    dout(7) << "handle_export_prep on " << *dir << " (first pass)" << endl;
+    dout(7) << "handle_export_prep on " << *dir << " (first pass)" << dendl;
   } else {
     dir = cache->get_dirfrag(m->get_dirfrag());
     assert(dir);
-    dout(7) << "handle_export_prep on " << *dir << " (subsequent pass)" << endl;
+    dout(7) << "handle_export_prep on " << *dir << " (subsequent pass)" << dendl;
   }
   assert(dir->is_auth() == false);
 
@@ -1370,13 +1370,13 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
   for (list<dirfrag_t>::iterator p = m->get_bounds().begin();
        p != m->get_bounds().end();
        ++p) {
-    dout(10) << " bound " << *p << endl;
+    dout(10) << " bound " << *p << dendl;
     import_bound_fragset[p->ino].insert(p->frag);
   }
 
   // assimilate contents?
   if (!m->did_assim()) {
-    dout(7) << "doing assim on " << *dir << endl;
+    dout(7) << "doing assim on " << *dir << dendl;
     m->mark_assim();  // only do this the first time!
 
     // move pin to dir
@@ -1390,7 +1390,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
     
     // bystander list
     import_bystanders[dir] = m->get_bystanders();
-    dout(7) << "bystanders are " << import_bystanders[dir] << endl;
+    dout(7) << "bystanders are " << import_bystanders[dir] << dendl;
 
     // assimilate traces to exports
     for (list<CInodeDiscover*>::iterator it = m->get_inodes().begin();
@@ -1400,7 +1400,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
       CInode *in = cache->get_inode( (*it)->get_ino() );
       if (in) {
         (*it)->update_inode(in);
-        dout(7) << " updated " << *in << endl;
+        dout(7) << " updated " << *in << dendl;
       } else {
         in = new CInode(mds->mdcache, false);
         (*it)->update_inode(in);
@@ -1411,7 +1411,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
        cache->add_inode( in );
         condir->add_primary_dentry( m->get_dentry(in->ino()), in );
         
-        dout(7) << "   added " << *in << endl;
+        dout(7) << "   added " << *in << dendl;
       }
       
       assert( in->get_parent_dir()->dirfrag() == m->get_containing_dirfrag(in->ino()) );
@@ -1433,11 +1433,11 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
       CInode *in = cache->get_inode(p->first);
       assert(in);
       in->get_stickydirs();
-      dout(7) << " set stickydirs on bound inode " << *in << endl;
+      dout(7) << " set stickydirs on bound inode " << *in << dendl;
     }
 
   } else {
-    dout(7) << " not doing assim on " << *dir << endl;
+    dout(7) << " not doing assim on " << *dir << dendl;
   }
 
   if (!finished.empty())
@@ -1456,31 +1456,31 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
     list<frag_t> fglist;
     for (set<frag_t>::iterator q = p->second.begin(); q != p->second.end(); ++q)
       in->dirfragtree.get_leaves_under(*q, fglist);
-    dout(10) << " bound inode " << p->first << " fragset " << p->second << " maps to " << fglist << endl;
+    dout(10) << " bound inode " << p->first << " fragset " << p->second << " maps to " << fglist << dendl;
     
     for (list<frag_t>::iterator q = fglist.begin();
         q != fglist.end();
         ++q) {
       CDir *bound = cache->get_dirfrag(dirfrag_t(p->first, *q));
       if (!bound) {
-       dout(7) << "  opening bounding dirfrag " << *q << " on " << *in << endl;
+       dout(7) << "  opening bounding dirfrag " << *q << " on " << *in << dendl;
        cache->open_remote_dirfrag(in, *q,
                                   new C_MDS_RetryMessage(mds, m));
        return;
       }
 
       if (!bound->state_test(CDir::STATE_IMPORTBOUND)) {
-       dout(7) << "  pinning import bound " << *bound << endl;
+       dout(7) << "  pinning import bound " << *bound << dendl;
        bound->get(CDir::PIN_IMPORTBOUND);
        bound->state_set(CDir::STATE_IMPORTBOUND);
       } else {
-       dout(7) << "  already pinned import bound " << *bound << endl;
+       dout(7) << "  already pinned import bound " << *bound << dendl;
       }
       import_bounds.insert(bound);
     }
   }
 
-  dout(7) << " all ready, noting auth and freezing import region" << endl;
+  dout(7) << " all ready, noting auth and freezing import region" << dendl;
   
   // note that i am an ambiguous auth for this subtree.
   // specify bounds, since the exporter explicitly defines the region.
@@ -1492,7 +1492,7 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
   dir->_freeze_tree();
   
   // ok!
-  dout(7) << " sending export_prep_ack on " << *dir << endl;
+  dout(7) << " sending export_prep_ack on " << *dir << dendl;
   mds->send_message_mds(new MExportDirPrepAck(dir->dirfrag()),
                        m->get_source().num(), MDS_PORT_MIGRATOR);
   
@@ -1526,7 +1526,7 @@ void Migrator::handle_export_dir(MExportDir *m)
   assert(dir);
 
   int oldauth = m->get_source().num();
-  dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << endl;
+  dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << dendl;
   assert(dir->is_auth() == false);
 
   cache->show_subtrees();
@@ -1554,7 +1554,7 @@ void Migrator::handle_export_dir(MExportDir *m)
                        imported_client_map);
     m->get_dirstate().pop_front();
   }
-  dout(10) << " " << m->get_bounds().size() << " imported bounds" << endl;
+  dout(10) << " " << m->get_bounds().size() << " imported bounds" << dendl;
   
   // include bounds in EImportStart
   set<CDir*> import_bounds;
@@ -1567,7 +1567,7 @@ void Migrator::handle_export_dir(MExportDir *m)
   // adjust popularity
   mds->balancer->add_import(dir);
 
-  dout(7) << "handle_export_dir did " << *dir << endl;
+  dout(7) << "handle_export_dir did " << *dir << dendl;
 
   // log it
   mds->mdlog->submit_entry(le,
@@ -1622,7 +1622,7 @@ void Migrator::import_remove_pins(CDir *dir, set<CDir*>& bounds)
  */
 void Migrator::import_reverse(CDir *dir)
 {
-  dout(7) << "import_reverse " << *dir << endl;
+  dout(7) << "import_reverse " << *dir << dendl;
 
   set<CDir*> bounds;
   cache->get_subtree_bounds(dir, bounds);
@@ -1686,11 +1686,11 @@ void Migrator::import_reverse(CDir *dir)
 
   // bystanders?
   if (import_bystanders[dir].empty()) {
-    dout(7) << "no bystanders, finishing reverse now" << endl;
+    dout(7) << "no bystanders, finishing reverse now" << dendl;
     import_reverse_unfreeze(dir);
   } else {
     // notify them; wait in aborting state
-    dout(7) << "notifying bystanders of abort" << endl;
+    dout(7) << "notifying bystanders of abort" << dendl;
     import_notify_abort(dir, bounds);
     import_state[dir->dirfrag()] = IMPORT_ABORTING;
   }
@@ -1698,7 +1698,7 @@ void Migrator::import_reverse(CDir *dir)
 
 void Migrator::import_notify_abort(CDir *dir, set<CDir*>& bounds)
 {
-  dout(7) << "import_notify_abort " << *dir << endl;
+  dout(7) << "import_notify_abort " << *dir << dendl;
   
   for (set<int>::iterator p = import_bystanders[dir].begin();
        p != import_bystanders[dir].end();
@@ -1716,7 +1716,7 @@ void Migrator::import_notify_abort(CDir *dir, set<CDir*>& bounds)
 
 void Migrator::import_reverse_unfreeze(CDir *dir)
 {
-  dout(7) << "import_reverse_unfreeze " << *dir << endl;
+  dout(7) << "import_reverse_unfreeze " << *dir << dendl;
   dir->unfreeze_tree();
   cache->discard_delayed_expire(dir);
   import_reverse_final(dir);
@@ -1724,7 +1724,7 @@ void Migrator::import_reverse_unfreeze(CDir *dir)
 
 void Migrator::import_reverse_final(CDir *dir) 
 {
-  dout(7) << "import_reverse_final " << *dir << endl;
+  dout(7) << "import_reverse_final " << *dir << dendl;
 
   // clean up
   import_state.erase(dir->dirfrag());
@@ -1742,13 +1742,13 @@ void Migrator::import_reverse_final(CDir *dir)
 
 void Migrator::import_logged_start(CDir *dir, int from) 
 {
-  dout(7) << "import_logged " << *dir << endl;
+  dout(7) << "import_logged " << *dir << dendl;
 
   // note state
   import_state[dir->dirfrag()] = IMPORT_ACKING;
 
   // send notify's etc.
-  dout(7) << "sending ack for " << *dir << " to old auth mds" << from << endl;
+  dout(7) << "sending ack for " << *dir << " to old auth mds" << from << dendl;
   mds->send_message_mds(new MExportDirAck(dir->dirfrag()),
                        from, MDS_PORT_MIGRATOR);
 
@@ -1760,14 +1760,14 @@ void Migrator::handle_export_finish(MExportDirFinish *m)
 {
   CDir *dir = cache->get_dirfrag(m->get_dirfrag());
   assert(dir);
-  dout(7) << "handle_export_finish on " << *dir << endl;
+  dout(7) << "handle_export_finish on " << *dir << dendl;
   import_finish(dir);
   delete m;
 }
 
 void Migrator::import_finish(CDir *dir) 
 {
-  dout(7) << "import_finish on " << *dir << endl;
+  dout(7) << "import_finish on " << *dir << dendl;
 
   // log finish
   mds->mdlog->submit_entry(new EImportFinish(dir, true));
@@ -1811,7 +1811,7 @@ void Migrator::import_finish(CDir *dir)
 void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int oldauth,
                                   map<int,entity_inst_t>& imported_client_map)
 {  
-  dout(15) << "decode_import_inode on " << *dn << endl;
+  dout(15) << "decode_import_inode on " << *dn << dendl;
 
   CInodeExport istate;
   off = istate._decode(bl, off);
@@ -1838,9 +1838,9 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int ol
   // add inode?
   if (added) {
     cache->add_inode(in);
-    dout(10) << "added " << *in << endl;
+    dout(10) << "added " << *in << dendl;
   } else {
-    dout(10) << "  had " << *in << endl;
+    dout(10) << "  had " << *in << dendl;
   }
   
   
@@ -1882,7 +1882,7 @@ int Migrator::decode_import_dir(bufferlist& bl,
   CDir *dir = diri->get_or_open_dirfrag(mds->mdcache, dstate.get_dirfrag().frag);
   assert(dir);
   
-  dout(7) << "decode_import_dir " << *dir << endl;
+  dout(7) << "decode_import_dir " << *dir << dendl;
 
   // assimilate state
   dstate.update_dir( dir );
@@ -1916,7 +1916,7 @@ int Migrator::decode_import_dir(bufferlist& bl,
        it++) 
     import_root->add_waiter(CDir::WAIT_UNFREEZE, *it);  // UNFREEZE will get kicked both on success or failure
   
-  dout(15) << "doing contents" << endl;
+  dout(15) << "doing contents" << dendl;
   
   // contents
   long nden = dstate.get_nden();
@@ -1934,7 +1934,7 @@ int Migrator::decode_import_dir(bufferlist& bl,
     
     // decode state
     dn->decode_import_state(bl, off, oldauth, mds->get_nodeid());
-    dout(15) << "decode_import_dir got " << *dn << endl;
+    dout(15) << "decode_import_dir got " << *dn << dendl;
     
     // points to...
     char icode;
@@ -1969,7 +1969,7 @@ int Migrator::decode_import_dir(bufferlist& bl,
       le->metablob.add_dentry(dn, dn->is_dirty());
   }
   
-  dout(7) << "decode_import_dir done " << *dir << endl;
+  dout(7) << "decode_import_dir done " << *dir << dendl;
   return num_imported;
 }
 
@@ -1989,14 +1989,14 @@ void Migrator::handle_export_notify(MExportDirNotify *m)
   
   if (!dir) {
     dout(7) << "handle_export_notify " << old_auth << " -> " << new_auth
-           << " on missing dir " << m->get_dirfrag() << endl;
+           << " on missing dir " << m->get_dirfrag() << dendl;
   } else if (dir->authority() != old_auth) {
     dout(7) << "handle_export_notify old_auth was " << dir->authority() 
            << " != " << old_auth << " -> " << new_auth
-           << " on " << *dir << endl;
+           << " on " << *dir << dendl;
   } else {
     dout(7) << "handle_export_notify " << old_auth << " -> " << new_auth
-           << " on " << *dir << endl;
+           << " on " << *dir << dendl;
     // adjust auth
     set<CDir*> have;
     cache->map_dirfrag_set(m->get_bounds(), have);
@@ -2012,7 +2012,7 @@ void Migrator::handle_export_notify(MExportDirNotify *m)
                          from, MDS_PORT_MIGRATOR);
   } else {
     // aborted.  no ack.
-    dout(7) << "handle_export_notify no ack requested" << endl;
+    dout(7) << "handle_export_notify no ack requested" << dendl;
   }
   
   delete m;
index b43598db78ac3dc79ee17f4d2ea4f18ca5470ed0..a56bc0a09c9e076634782b50df1a9e3f2f6df11f 100644 (file)
@@ -55,9 +55,9 @@
 using namespace std;
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
-#define  derr(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
+
+#define  dout(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
+#define  derr(l)    if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
 
 
 void Server::reopen_logger()
@@ -95,7 +95,7 @@ void Server::dispatch(Message *m)
 
   // active?
   if (!mds->is_active()) {
-    dout(3) << "not active yet, waiting" << endl;
+    dout(3) << "not active yet, waiting" << dendl;
     mds->wait_for_active(new C_MDS_RetryMessage(mds, m));
     return;
   }
@@ -112,7 +112,7 @@ void Server::dispatch(Message *m)
     return;
   }
 
-  dout(1) << "server unknown message " << m->get_type() << endl;
+  dout(1) << "server unknown message " << m->get_type() << dendl;
   assert(0);
 }
 
@@ -139,31 +139,31 @@ public:
 
 void Server::handle_client_session(MClientSession *m)
 {
-  dout(3) << "handle_client_session " << *m << " from " << m->get_source() << endl;
+  dout(3) << "handle_client_session " << *m << " from " << m->get_source() << dendl;
   int from = m->get_source().num();
   bool open = m->op == MClientSession::OP_REQUEST_OPEN;
 
   if (open) {
     if (mds->clientmap.have_session(from)) {
-      dout(10) << "already open, dropping this req" << endl;
+      dout(10) << "already open, dropping this req" << dendl;
       delete m;
       return;
     }
     if (mds->clientmap.is_opening(from)) {
-      dout(10) << "already opening, dropping this req" << endl;
+      dout(10) << "already opening, dropping this req" << dendl;
       delete m;
       return;
     }
     mds->clientmap.add_opening(from);
   } else {
     if (mds->clientmap.is_closing(from)) {
-      dout(10) << "already closing, dropping this req" << endl;
+      dout(10) << "already closing, dropping this req" << dendl;
       delete m;
       return;
     }
     if (m->seq < mds->clientmap.get_push_seq(from)) {
       dout(10) << "old push seq " << m->seq << " < " << mds->clientmap.get_push_seq(from) 
-              << ", dropping" << endl;
+              << ", dropping" << dendl;
       delete m;
       return;
     }
@@ -185,7 +185,7 @@ void Server::_session_logged(entity_inst_t client_inst, bool open, version_t cma
 {
   dout(10) << "_session_logged " << client_inst << " " << (open ? "open":"close")
           << " " << cmapv 
-          << endl;
+          << dendl;
 
   // apply
   int from = client_inst.name.num();
@@ -212,7 +212,7 @@ void Server::_session_logged(entity_inst_t client_inst, bool open, version_t cma
 
 void Server::terminate_sessions()
 {
-  dout(2) << "terminate_sessions" << endl;
+  dout(2) << "terminate_sessions" << dendl;
 
   // kill them off.  clients will retry etc.
   for (set<int>::const_iterator p = mds->clientmap.get_session_set().begin();
@@ -232,12 +232,12 @@ void Server::reconnect_clients()
 {
   // reconnect with clients
   if (mds->clientmap.get_session_set().empty()) {
-    dout(7) << "reconnect_clients -- no sessions, doing nothing." << endl;
+    dout(7) << "reconnect_clients -- no sessions, doing nothing." << dendl;
     reconnect_gather_finish();
     return;
   }
   
-  dout(7) << "reconnect_clients -- sending mdsmap to clients with sessions" << endl;
+  dout(7) << "reconnect_clients -- sending mdsmap to clients with sessions" << dendl;
   
   mds->bcast_mds_map();  // send mdsmap to all client sessions
 
@@ -248,11 +248,11 @@ void Server::reconnect_clients()
 
 void Server::handle_client_reconnect(MClientReconnect *m)
 {
-  dout(7) << "handle_client_reconnect " << m->get_source() << endl;
+  dout(7) << "handle_client_reconnect " << m->get_source() << dendl;
   int from = m->get_source().num();
 
   if (m->closed) {
-    dout(7) << " client had no session, removing from clientmap" << endl;
+    dout(7) << " client had no session, removing from clientmap" << dendl;
 
     mds->clientmap.add_closing(from);
     version_t cmapv = mds->clientmap.inc_projected();
@@ -268,7 +268,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
       CInode *in = mdcache->get_inode(p->first);
       if (in && in->is_auth()) {
        // we recovered it, and it's ours.  take note.
-       dout(15) << "open caps on " << *in << endl;
+       dout(15) << "open caps on " << *in << dendl;
        in->reconnect_cap(from, p->second);
        reconnected_caps.insert(in);
        continue;
@@ -279,7 +279,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
          !mds->mdcache->path_is_mine(path)) {
        // not mine.
        dout(0) << "non-auth " << p->first << " " << m->inode_path[p->first]
-               << ", will pass off to authority" << endl;
+               << ", will pass off to authority" << dendl;
        
        // mark client caps stale.
        inode_t fake_inode;
@@ -296,7 +296,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
       } else {
        // mine.  fetch later.
        dout(0) << "missing " << p->first << " " << m->inode_path[p->first]
-               << " (mine), will load later" << endl;
+               << " (mine), will load later" << dendl;
        mdcache->rejoin_recovered_caps(p->first, m->inode_path[p->first], from, p->second, 
                                       -1);  // "from" me.
       }
@@ -315,7 +315,7 @@ void Server::handle_client_reconnect(MClientReconnect *m)
  */
 void Server::process_reconnected_caps()
 {
-  dout(10) << "process_reconnected_caps" << endl;
+  dout(10) << "process_reconnected_caps" << dendl;
 
   // adjust filelock state appropriately
   for (set<CInode*>::iterator p = reconnected_caps.begin();
@@ -342,7 +342,7 @@ void Server::process_reconnected_caps()
     }
     dout(15) << " issued " << cap_string(issued)
             << " chose " << in->filelock
-            << " on " << *in << endl;
+            << " on " << *in << dendl;
   }
   reconnected_caps.clear();  // clean up
 }
@@ -350,7 +350,7 @@ void Server::process_reconnected_caps()
 
 void Server::client_reconnect_failure(int from) 
 {
-  dout(5) << "client_reconnect_failure on client" << from << endl;
+  dout(5) << "client_reconnect_failure on client" << from << dendl;
   client_reconnect_gather.erase(from);
   if (client_reconnect_gather.empty()) 
     reconnect_gather_finish();
@@ -358,7 +358,7 @@ void Server::client_reconnect_failure(int from)
 
 void Server::reconnect_gather_finish()
 {
-  dout(7) << "reconnect_gather_finish" << endl;
+  dout(7) << "reconnect_gather_finish" << dendl;
   mds->reconnect_done();
 }
 
@@ -388,7 +388,7 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei)
   
   dout(10) << "reply_request " << reply->get_result() 
           << " (" << strerror(-reply->get_result())
-          << ") " << *req << endl;
+          << ") " << *req << dendl;
 
   // note result code in clientmap?
   if (!req->is_idempotent())
@@ -415,26 +415,26 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei)
  */
 void Server::handle_client_request(MClientRequest *req)
 {
-  dout(4) << "handle_client_request " << *req << endl;
+  dout(4) << "handle_client_request " << *req << dendl;
   int client = req->get_client();
 
   if (logger) logger->inc("hcreq");
 
   if (!mds->is_active()) {
-    dout(5) << " not active, discarding client request." << endl;
+    dout(5) << " not active, discarding client request." << dendl;
     delete req;
     return;
   }
   
   if (!mdcache->get_root()) {
-    dout(5) << "need to open root" << endl;
+    dout(5) << "need to open root" << dendl;
     mdcache->open_root(new C_MDS_RetryMessage(mds, req));
     return;
   }
 
   // active session?
   if (!mds->clientmap.have_session(client)) {
-    dout(1) << "no session for client" << client << ", dropping" << endl;
+    dout(1) << "no session for client" << client << ", dropping" << dendl;
     delete req;
     return;
   }
@@ -446,7 +446,7 @@ void Server::handle_client_request(MClientRequest *req)
   // retry?
   if (req->get_retry_attempt()) {
     if (mds->clientmap.have_completed_request(req->get_reqid())) {
-      dout(5) << "already completed " << req->get_reqid() << endl;
+      dout(5) << "already completed " << req->get_reqid() << dendl;
       mds->messenger->send_message(new MClientReply(req, 0),
                                   req->get_client_inst());
       delete req;
@@ -455,7 +455,7 @@ void Server::handle_client_request(MClientRequest *req)
   }
   // trim completed_request list
   if (req->get_oldest_client_tid() > 0) {
-    dout(15) << " oldest_client_tid=" << req->get_oldest_client_tid() << endl;
+    dout(15) << " oldest_client_tid=" << req->get_oldest_client_tid() << dendl;
     mds->clientmap.trim_completed_requests(client,
                                           req->get_oldest_client_tid());
   }
@@ -486,7 +486,7 @@ void Server::handle_client_request(MClientRequest *req)
   MDRequest *mdr = mdcache->request_start(req);
 
   if (ref) {
-    dout(10) << "inode op on ref " << *ref << endl;
+    dout(10) << "inode op on ref " << *ref << dendl;
     mdr->ref = ref;
     mdr->pin(ref);
   }
@@ -503,9 +503,9 @@ void Server::dispatch_client_request(MDRequest *mdr)
   if (logger) logger->inc("dcreq");
 
   if (mdr->ref) {
-    dout(7) << "dispatch_client_request " << *req << " ref " << *mdr->ref << endl;
+    dout(7) << "dispatch_client_request " << *req << " ref " << *mdr->ref << dendl;
   } else {
-    dout(7) << "dispatch_client_request " << *req << endl;
+    dout(7) << "dispatch_client_request " << *req << dendl;
   }
 
   // we shouldn't be waiting on anyone.
@@ -569,7 +569,7 @@ void Server::dispatch_client_request(MDRequest *mdr)
 
 
   default:
-    dout(1) << " unknown client op " << req->get_op() << endl;
+    dout(1) << " unknown client op " << req->get_op() << dendl;
     assert(0);
   }
 }
@@ -580,7 +580,7 @@ void Server::dispatch_client_request(MDRequest *mdr)
 
 void Server::handle_slave_request(MMDSSlaveRequest *m)
 {
-  dout(4) << "handle_slave_request " << m->get_reqid() << " from " << m->get_source() << endl;
+  dout(4) << "handle_slave_request " << m->get_reqid() << " from " << m->get_source() << dendl;
   int from = m->get_source().num();
 
   if (logger) logger->inc("hsreq");
@@ -596,7 +596,7 @@ void Server::handle_slave_request(MMDSSlaveRequest *m)
                                                 m->get_object_info());
        MDRequest *mdr = mdcache->request_get(m->get_reqid());
        mdr->slaves.insert(from);
-       dout(10) << "got remote xlock on " << *lock << " on " << *lock->get_parent() << endl;
+       dout(10) << "got remote xlock on " << *lock << " on " << *lock->get_parent() << dendl;
        mdr->xlocks.insert(lock);
        mdr->locks.insert(lock);
        lock->get_xlock(mdr);
@@ -648,7 +648,7 @@ void Server::handle_slave_request(MMDSSlaveRequest *m)
       mdr = mdcache->request_get(m->get_reqid());
       if (mdr->slave_to_mds != from) {   // may not even be a slave! (e.g. forward race)
        dout(10) << "local request " << *mdr << " not slave to mds" << from
-                << ", ignoring " << *m << endl;
+                << ", ignoring " << *m << dendl;
        delete m;
        return;
       }
@@ -656,7 +656,7 @@ void Server::handle_slave_request(MMDSSlaveRequest *m)
       // new?
       if (m->get_op() == MMDSSlaveRequest::OP_FINISH) {
        dout(10) << "missing slave request for " << m->get_reqid() 
-                << " OP_FINISH, must have lost race with a forward" << endl;
+                << " OP_FINISH, must have lost race with a forward" << dendl;
        delete m;
        return;
       }
@@ -671,10 +671,10 @@ void Server::handle_slave_request(MMDSSlaveRequest *m)
 
 void Server::dispatch_slave_request(MDRequest *mdr)
 {
-  dout(7) << "dispatch_slave_request " << *mdr << " " << *mdr->slave_request << endl;
+  dout(7) << "dispatch_slave_request " << *mdr << " " << *mdr->slave_request << dendl;
 
   if (mdr->aborted) {
-    dout(7) << " abort flag set, finishing" << endl;
+    dout(7) << " abort flag set, finishing" << dendl;
     mdcache->request_finish(mdr);
     return;
   }
@@ -707,9 +707,9 @@ void Server::dispatch_slave_request(MDRequest *mdr)
       } else {
        if (lock) {
          dout(10) << "not auth for remote xlock attempt, dropping on " 
-                  << *lock << " on " << *lock->get_parent() << endl;
+                  << *lock << " on " << *lock->get_parent() << dendl;
        } else {
-         dout(10) << "don't have object, dropping" << endl;
+         dout(10) << "don't have object, dropping" << dendl;
          assert(0); // can this happen, if we auth pinned properly.
        }
       }
@@ -763,7 +763,7 @@ void Server::dispatch_slave_request(MDRequest *mdr)
 
 void Server::handle_slave_auth_pin(MDRequest *mdr)
 {
-  dout(10) << "handle_slave_auth_pin " << *mdr << endl;
+  dout(10) << "handle_slave_auth_pin " << *mdr << dendl;
 
   // build list of objects
   list<MDSCacheObject*> objects;
@@ -774,7 +774,7 @@ void Server::handle_slave_auth_pin(MDRequest *mdr)
        ++p) {
     MDSCacheObject *object = mdcache->get_object(*p);
     if (!object) {
-      dout(10) << " don't have " << *p << endl;
+      dout(10) << " don't have " << *p << dendl;
       fail = true;
       break;
     }
@@ -788,14 +788,14 @@ void Server::handle_slave_auth_pin(MDRequest *mdr)
         p != objects.end();
         ++p) {
       if (!(*p)->is_auth()) {
-       dout(10) << " not auth for " << **p << endl;
+       dout(10) << " not auth for " << **p << dendl;
        fail = true;
        break;
       }
       if (!mdr->is_auth_pinned(*p) &&
          !(*p)->can_auth_pin()) {
        // wait
-       dout(10) << " waiting for authpinnable on " << **p << endl;
+       dout(10) << " waiting for authpinnable on " << **p << dendl;
        (*p)->add_waiter(CDir::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
        mdr->drop_local_auth_pins();
        return;
@@ -810,7 +810,7 @@ void Server::handle_slave_auth_pin(MDRequest *mdr)
     for (list<MDSCacheObject*>::iterator p = objects.begin();
         p != objects.end();
         ++p) {
-      dout(10) << "auth_pinning " << **p << endl;
+      dout(10) << "auth_pinning " << **p << dendl;
       mdr->auth_pin(*p);
     }
   }
@@ -837,7 +837,7 @@ void Server::handle_slave_auth_pin(MDRequest *mdr)
 
 void Server::handle_slave_auth_pin_ack(MDRequest *mdr, MMDSSlaveRequest *ack)
 {
-  dout(10) << "handle_slave_auth_pin_ack on " << *mdr << " " << *ack << endl;
+  dout(10) << "handle_slave_auth_pin_ack on " << *mdr << " " << *ack << dendl;
   int from = ack->get_source().num();
 
   // added auth pins?
@@ -847,7 +847,7 @@ void Server::handle_slave_auth_pin_ack(MDRequest *mdr, MMDSSlaveRequest *ack)
        ++p) {
     MDSCacheObject *object = mdcache->get_object(*p);
     assert(object);  // we pinned it
-    dout(10) << " remote has pinned " << *object << endl;
+    dout(10) << " remote has pinned " << *object << dendl;
     if (!mdr->is_auth_pinned(object))
       mdr->auth_pins.insert(object);
     pinned.insert(object);
@@ -858,7 +858,7 @@ void Server::handle_slave_auth_pin_ack(MDRequest *mdr, MMDSSlaveRequest *ack)
   while (p != mdr->auth_pins.end()) {
     if ((*p)->authority().first == from &&
        pinned.count(*p) == 0) {
-      dout(10) << " remote has unpinned " << **p << endl;
+      dout(10) << " remote has unpinned " << **p << dendl;
       set<MDSCacheObject*>::iterator o = p;
       ++p;
       mdr->auth_pins.erase(o);
@@ -878,7 +878,7 @@ void Server::handle_slave_auth_pin_ack(MDRequest *mdr, MMDSSlaveRequest *ack)
   if (mdr->waiting_on_slave.empty())
     dispatch_client_request(mdr);
   else 
-    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
 }
 
 
@@ -895,7 +895,7 @@ CDir *Server::validate_dentry_dir(MDRequest *mdr, CInode *diri, const string& dn
 {
   // make sure parent is a dir?
   if (!diri->is_dir()) {
-    dout(7) << "validate_dentry_dir: not a dir" << endl;
+    dout(7) << "validate_dentry_dir: not a dir" << dendl;
     reply_request(mdr, -ENOTDIR);
     return false;
   }
@@ -908,7 +908,7 @@ CDir *Server::validate_dentry_dir(MDRequest *mdr, CInode *diri, const string& dn
 
   // frozen?
   if (dir->is_frozen()) {
-    dout(7) << "dir is frozen " << *dir << endl;
+    dout(7) << "dir is frozen " << *dir << dendl;
     dir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mdcache, mdr));
     return false;
   }
@@ -923,21 +923,21 @@ CDir *Server::validate_dentry_dir(MDRequest *mdr, CInode *diri, const string& dn
  */
 CDentry* Server::prepare_null_dentry(MDRequest *mdr, CDir *dir, const string& dname, bool okexist)
 {
-  dout(10) << "prepare_null_dentry " << dname << " in " << *dir << endl;
+  dout(10) << "prepare_null_dentry " << dname << " in " << *dir << dendl;
   assert(dir->is_auth());
   
   // does it already exist?
   CDentry *dn = dir->lookup(dname);
   if (dn) {
     if (dn->lock.is_xlocked_by_other(mdr)) {
-      dout(10) << "waiting on xlocked dentry " << *dn << endl;
+      dout(10) << "waiting on xlocked dentry " << *dn << dendl;
       dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
       return 0;
     }
 
     if (!dn->is_null()) {
       // name already exists
-      dout(10) << "dentry " << dname << " exists in " << *dir << endl;
+      dout(10) << "dentry " << dname << " exists in " << *dir << dendl;
       if (!okexist) {
         reply_request(mdr, -EEXIST);
         return 0;
@@ -949,7 +949,7 @@ CDentry* Server::prepare_null_dentry(MDRequest *mdr, CDir *dir, const string& dn
 
   // make sure dir is complete
   if (!dir->is_complete()) {
-    dout(7) << " incomplete dir contents for " << *dir << ", fetching" << endl;
+    dout(7) << " incomplete dir contents for " << *dir << ", fetching" << dendl;
     dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
     return 0;
   }
@@ -957,7 +957,7 @@ CDentry* Server::prepare_null_dentry(MDRequest *mdr, CDir *dir, const string& dn
   // create
   dn = dir->add_null_dentry(dname);
   dn->mark_new();
-  dout(10) << "prepare_null_dentry added " << *dn << endl;
+  dout(10) << "prepare_null_dentry added " << *dn << dendl;
 
   return dn;
 }
@@ -973,7 +973,7 @@ CInode* Server::prepare_new_inode(MDRequest *mdr, CDir *dir)
   in->inode.uid = mdr->client_request->get_caller_uid();
   in->inode.gid = mdr->client_request->get_caller_gid();
   in->inode.ctime = in->inode.mtime = in->inode.atime = mdr->now;   // now
-  dout(10) << "prepare_new_inode " << *in << endl;
+  dout(10) << "prepare_new_inode " << *in << dendl;
 
   return in;
 }
@@ -984,14 +984,14 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector<CDentry*> &trace, file
 {
   // figure parent dir vs dname
   if (refpath.depth() == 0) {
-    dout(7) << "can't do that to root" << endl;
+    dout(7) << "can't do that to root" << dendl;
     reply_request(mdr, -EINVAL);
     return 0;
   }
   string dname = refpath.last_dentry();
   refpath.pop_dentry();
   
-  dout(10) << "traverse_to_auth_dir dirpath " << refpath << " dname " << dname << endl;
+  dout(10) << "traverse_to_auth_dir dirpath " << refpath << " dname " << dname << dendl;
 
   // traverse to parent dir
   int r = mdcache->path_traverse(mdr, mdr->client_request,
@@ -1017,7 +1017,7 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector<CDentry*> &trace, file
   if (!dir)
     return 0; // forwarded or waiting for freeze
 
-  dout(10) << "traverse_to_auth_dir " << *dir << endl;
+  dout(10) << "traverse_to_auth_dir " << *dir << dendl;
   return dir;
 }
 
@@ -1056,10 +1056,10 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
        (dn->is_null() ||
         (dn->is_remote() && dn->inode))) {
       if (dn->is_ambiguous_auth()) {
-       dout(10) << "waiting for single auth on " << *dn << endl;
+       dout(10) << "waiting for single auth on " << *dn << dendl;
        dn->dir->add_waiter(CInode::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
       } else {
-       dout(10) << "fw to auth for " << *dn << endl;
+       dout(10) << "fw to auth for " << *dn << dendl;
        mdcache->request_forward(mdr, dn->authority().first);
        return 0;
       }
@@ -1069,15 +1069,15 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
     ref = mdcache->get_dentry_inode(dn, mdr);
     if (!ref) return 0;
   }
-  dout(10) << "ref is " << *ref << endl;
+  dout(10) << "ref is " << *ref << dendl;
 
   // fw to inode auth?
   if (want_auth && !ref->is_auth()) {
     if (ref->is_ambiguous_auth()) {
-      dout(10) << "waiting for single auth on " << *ref << endl;
+      dout(10) << "waiting for single auth on " << *ref << dendl;
       ref->add_waiter(CInode::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
     } else {
-      dout(10) << "fw to auth for " << *ref << endl;
+      dout(10) << "fw to auth for " << *ref << dendl;
       mdcache->request_forward(mdr, ref->authority().first);
     }
     return 0;
@@ -1086,7 +1086,7 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
   // auth_pin?
   if (want_auth) {
     if (ref->is_frozen()) {
-      dout(7) << "waiting for !frozen/authpinnable on " << *ref << endl;
+      dout(7) << "waiting for !frozen/authpinnable on " << *ref << dendl;
       ref->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
       return 0;
     }
@@ -1126,11 +1126,11 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequest *mdr, bool okexist, bool mus
   vector<CDentry*> trace;
   CDir *dir = traverse_to_auth_dir(mdr, trace, req->get_filepath());
   if (!dir) return 0;
-  dout(10) << "rdlock_path_xlock_dentry dir " << *dir << endl;
+  dout(10) << "rdlock_path_xlock_dentry dir " << *dir << dendl;
 
   // make sure we can auth_pin (or have already authpinned) dir
   if (dir->is_frozen()) {
-    dout(7) << "waiting for !frozen/authpinnable on " << *dir << endl;
+    dout(7) << "waiting for !frozen/authpinnable on " << *dir << dendl;
     dir->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
     return 0;
   }
@@ -1143,21 +1143,21 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequest *mdr, bool okexist, bool mus
 
     // make sure dir is complete
     if (!dn && !dir->is_complete()) {
-      dout(7) << " incomplete dir contents for " << *dir << ", fetching" << endl;
+      dout(7) << " incomplete dir contents for " << *dir << ", fetching" << dendl;
       dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
       return 0;
     }
 
     // readable?
     if (dn && dn->lock.is_xlocked_by_other(mdr)) {
-      dout(10) << "waiting on xlocked dentry " << *dn << endl;
+      dout(10) << "waiting on xlocked dentry " << *dn << dendl;
       dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
       return 0;
     }
       
     // exists?
     if (!dn || dn->is_null()) {
-      dout(7) << "dentry " << dname << " dne in " << *dir << endl;
+      dout(7) << "dentry " << dname << " dne in " << *dir << dendl;
       reply_request(mdr, -ENOENT);
       return 0;
     }    
@@ -1205,14 +1205,14 @@ CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequest *mdr)
   // not open and inode not mine?
   if (!dir && !diri->is_auth()) {
     int inauth = diri->authority().first;
-    dout(7) << "try_open_auth_dirfrag: not open, not inode auth, fw to mds" << inauth << endl;
+    dout(7) << "try_open_auth_dirfrag: not open, not inode auth, fw to mds" << inauth << dendl;
     mdcache->request_forward(mdr, inauth);
     return 0;
   }
 
   // not open and inode frozen?
   if (!dir && diri->is_frozen_dir()) {
-    dout(10) << "try_open_auth_dirfrag: dir inode is frozen, waiting " << *diri << endl;
+    dout(10) << "try_open_auth_dirfrag: dir inode is frozen, waiting " << *diri << dendl;
     assert(diri->get_parent_dir());
     diri->get_parent_dir()->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mdcache, mdr));
     return 0;
@@ -1226,7 +1226,7 @@ CDir* Server::try_open_auth_dirfrag(CInode *diri, frag_t fg, MDRequest *mdr)
   if (!dir->is_auth()) {
     int auth = dir->authority().first;
     dout(7) << "try_open_auth_dirfrag: not auth for " << *dir
-           << ", fw to mds" << auth << endl;
+           << ", fw to mds" << auth << dendl;
     mdcache->request_forward(mdr, auth);
     return 0;
   }
@@ -1251,7 +1251,7 @@ version_t Server::predirty_dn_diri(MDRequest *mdr, CDentry *dn, EMetaBlob *blob)
     assert(mdr->wrlocks.count(&diri->dirlock));
     
     dirpv = diri->pre_dirty();
-    dout(10) << "predirty_dn_diri ctime/mtime " << mdr->now << " pv " << dirpv << " on " << *diri << endl;
+    dout(10) << "predirty_dn_diri ctime/mtime " << mdr->now << " pv " << dirpv << " on " << *diri << dendl;
     
     // predirty+journal
     inode_t *pi = diri->project_inode();
@@ -1264,7 +1264,7 @@ version_t Server::predirty_dn_diri(MDRequest *mdr, CDentry *dn, EMetaBlob *blob)
     inode_t *ji = blob->add_primary_dentry(diri->get_parent_dn(), true);    
     ji->ctime = ji->mtime = mdr->now;
 
-    dout(10) << "predirty_dn_diri (non-auth) ctime/mtime " << mdr->now << " on " << *diri << endl;
+    dout(10) << "predirty_dn_diri (non-auth) ctime/mtime " << mdr->now << " on " << *diri << dendl;
     
     blob->add_dirtied_inode_mtime(diri->ino(), mdr->now);
   }
@@ -1285,12 +1285,12 @@ void Server::dirty_dn_diri(CDentry *dn, version_t dirpv, utime_t mtime)
     // we journaled and predirtied.
     assert(diri->is_auth() && !diri->is_root());
     diri->pop_and_dirty_projected_inode();
-    dout(10) << "dirty_dn_diri ctime/mtime " << mtime << " v " << diri->inode.version << " on " << *diri << endl;
+    dout(10) << "dirty_dn_diri ctime/mtime " << mtime << " v " << diri->inode.version << " on " << *diri << dendl;
   } else {
     // dirlock scatterlock will propagate the update.
     diri->inode.ctime = diri->inode.mtime = mtime;
     diri->dirlock.set_updated();
-    dout(10) << "dirty_dn_diri (non-dirty) ctime/mtime " << mtime << " on " << *diri << endl;
+    dout(10) << "dirty_dn_diri (non-dirty) ctime/mtime " << mtime << " on " << *diri << dendl;
   }
 }
 
@@ -1328,7 +1328,7 @@ void Server::handle_client_stat(MDRequest *mdr)
     return;
 
   // reply
-  dout(10) << "reply to stat on " << *req << endl;
+  dout(10) << "reply to stat on " << *req << dendl;
   MClientReply *reply = new MClientReply(req);
   reply_request(mdr, reply, ref);
 }
@@ -1492,14 +1492,14 @@ int Server::encode_dir_contents(CDir *dir,
     CInode *in = dn->inode;
     InodeStat *st;
     if (in) {
-      dout(12) << "including inode " << *in << endl;
+      dout(12) << "including inode " << *in << dendl;
 
       // add this item
       // note: InodeStat makes note of whether inode data is readable.
       st = new InodeStat(in, mds->get_nodeid());
     } else {
       assert(dn->is_remote());
-      dout(12) << "including inode-less (remote) dentry " << *dn << endl;
+      dout(12) << "including inode-less (remote) dentry " << *dn << dendl;
       st = new InodeStat;
       st->mask = STAT_MASK_INO | STAT_MASK_TYPE;
       memset(&st->inode, 0, sizeof(st->inode));
@@ -1524,7 +1524,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
   // it's a directory, right?
   if (!diri->is_dir()) {
     // not a dir
-    dout(10) << "reply to " << *req << " readdir -ENOTDIR" << endl;
+    dout(10) << "reply to " << *req << " readdir -ENOTDIR" << dendl;
     reply_request(mdr, -ENOTDIR, diri);
     return;
   }
@@ -1534,7 +1534,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
 
   // does the frag exist?
   if (diri->dirfragtree[fg] != fg) {
-    dout(10) << "frag " << fg << " doesn't appear in fragtree " << diri->dirfragtree << endl;
+    dout(10) << "frag " << fg << " doesn't appear in fragtree " << diri->dirfragtree << dendl;
     reply_request(mdr, -EAGAIN, diri);
     return;
   }
@@ -1554,7 +1554,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
 
   if (!dir->is_complete()) {
     // fetch
-    dout(10) << " incomplete dir contents for readdir on " << *dir << ", fetching" << endl;
+    dout(10) << " incomplete dir contents for readdir on " << *dir << ", fetching" << dendl;
     dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
     return;
   }
@@ -1573,7 +1573,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
   MClientReply *reply = new MClientReply(req);
   reply->take_dir_items(dnls, inls, numfiles);
   
-  dout(10) << "reply to " << *req << " readdir " << numfiles << " files" << endl;
+  dout(10) << "reply to " << *req << " readdir " << numfiles << " files" << dendl;
   reply->set_result(0);
 
   // bump popularity.  NOTE: this doesn't quite capture it.
@@ -1705,7 +1705,7 @@ void Server::handle_client_mkdir(MDRequest *mdr)
       !newdir->is_hashing()) {
     int dest = rand() % mds->mdsmap->get_num_mds();
     if (dest != whoami) {
-      dout(10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << endl;
+      dout(10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << dendl;
       mdcache->migrator->export_dir(newdir, dest);
     }
   }
@@ -1757,7 +1757,7 @@ void Server::handle_client_link(MDRequest *mdr)
 
   dout(7) << "handle_client_link " << req->get_filepath()
          << " to " << req->get_sarg()
-         << endl;
+         << dendl;
 
   // traverse to dest dir, make sure it's ours.
   const filepath &linkpath = req->get_filepath();
@@ -1765,11 +1765,11 @@ void Server::handle_client_link(MDRequest *mdr)
   vector<CDentry*> linktrace;
   CDir *dir = traverse_to_auth_dir(mdr, linktrace, linkpath);
   if (!dir) return;
-  dout(7) << "handle_client_link link " << dname << " in " << *dir << endl;
+  dout(7) << "handle_client_link link " << dname << " in " << *dir << dendl;
   
   // traverse to link target
   filepath targetpath = req->get_sarg();
-  dout(7) << "handle_client_link discovering target " << targetpath << endl;
+  dout(7) << "handle_client_link discovering target " << targetpath << dendl;
   vector<CDentry*> targettrace;
   int r = mdcache->path_traverse(mdr, req,
                                 0, targetpath, targettrace, false,
@@ -1786,9 +1786,9 @@ void Server::handle_client_link(MDRequest *mdr)
   assert(targeti);
 
   // dir?
-  dout(7) << "target is " << *targeti << endl;
+  dout(7) << "target is " << *targeti << dendl;
   if (targeti->is_dir()) {
-    dout(7) << "target is a dir, failing..." << endl;
+    dout(7) << "target is a dir, failing..." << dendl;
     reply_request(mdr, -EINVAL);
     return;
   }
@@ -1820,15 +1820,15 @@ void Server::handle_client_link(MDRequest *mdr)
   // does the target need an anchor?
   if (targeti->is_auth()) {
     /*if (targeti->get_parent_dir() == dn->dir) {
-      dout(7) << "target is in the same dirfrag, sweet" << endl;
+      dout(7) << "target is in the same dirfrag, sweet" << dendl;
     } 
     else 
       */
     if (targeti->is_anchored() && !targeti->is_unanchoring()) {
-      dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << endl;
+      dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << dendl;
     } 
     else {
-      dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << endl;
+      dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << dendl;
       
       mdcache->anchor_create(mdr, targeti,
                             new C_MDS_RetryRequest(mdcache, mdr));
@@ -1868,7 +1868,7 @@ public:
 
 void Server::_link_local(MDRequest *mdr, CDentry *dn, CInode *targeti)
 {
-  dout(10) << "_link_local " << *dn << " to " << *targeti << endl;
+  dout(10) << "_link_local " << *dn << " to " << *targeti << dendl;
 
   // predirty NEW dentry
   version_t dnpv = dn->pre_dirty();
@@ -1896,7 +1896,7 @@ void Server::_link_local(MDRequest *mdr, CDentry *dn, CInode *targeti)
 void Server::_link_local_finish(MDRequest *mdr, CDentry *dn, CInode *targeti,
                                version_t dnpv, version_t tipv, version_t dirpv)
 {
-  dout(10) << "_link_local_finish " << *dn << " to " << *targeti << endl;
+  dout(10) << "_link_local_finish " << *dn << " to " << *targeti << dendl;
 
   // link and unlock the NEW dentry
   dn->dir->link_remote_inode(dn, targeti->ino(), MODE_TO_DT(targeti->inode.mode));
@@ -1940,12 +1940,12 @@ public:
 
 void Server::_link_remote(MDRequest *mdr, CDentry *dn, CInode *targeti)
 {
-  dout(10) << "_link_remote " << *dn << " to " << *targeti << endl;
+  dout(10) << "_link_remote " << *dn << " to " << *targeti << dendl;
     
   // 1. send LinkPrepare to dest (journal nlink++ prepare)
   int linkauth = targeti->authority().first;
   if (mdr->witnessed.count(linkauth) == 0) {
-    dout(10) << " targeti auth must prepare nlink++" << endl;
+    dout(10) << " targeti auth must prepare nlink++" << dendl;
 
     MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_LINKPREP);
     targeti->set_object_info(req->get_object_info());
@@ -1956,7 +1956,7 @@ void Server::_link_remote(MDRequest *mdr, CDentry *dn, CInode *targeti)
     mdr->waiting_on_slave.insert(linkauth);
     return;
   }
-  dout(10) << " targeti auth has prepared nlink++" << endl;
+  dout(10) << " targeti auth has prepared nlink++" << dendl;
 
   // go.
   // predirty dentry
@@ -1980,7 +1980,7 @@ void Server::_link_remote(MDRequest *mdr, CDentry *dn, CInode *targeti)
 void Server::_link_remote_finish(MDRequest *mdr, CDentry *dn, CInode *targeti,
                                 version_t dpv, version_t dirpv)
 {
-  dout(10) << "_link_remote_finish " << *dn << " to " << *targeti << endl;
+  dout(10) << "_link_remote_finish " << *dn << " to " << *targeti << dendl;
 
   // link the new dentry
   dn->dir->link_remote_inode(dn, targeti->ino(), MODE_TO_DT(targeti->inode.mode));
@@ -2020,11 +2020,11 @@ void Server::handle_slave_link_prep(MDRequest *mdr)
 {
   dout(10) << "handle_slave_link_prep " << *mdr 
           << " on " << mdr->slave_request->get_object_info() 
-          << endl;
+          << dendl;
 
   CInode *targeti = mdcache->get_inode(mdr->slave_request->get_object_info().ino);
   assert(targeti);
-  dout(10) << "targeti " << *targeti << endl;
+  dout(10) << "targeti " << *targeti << dendl;
   CDentry *dn = targeti->get_parent_dn();
   assert(dn->is_primary());
 
@@ -2033,10 +2033,10 @@ void Server::handle_slave_link_prep(MDRequest *mdr)
   // anchor?
   if (mdr->slave_request->get_op() == MMDSSlaveRequest::OP_LINKPREP) {
     if (targeti->is_anchored() && !targeti->is_unanchoring()) {
-      dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << endl;
+      dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << dendl;
     } 
     else {
-      dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << endl;
+      dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << dendl;
       mdcache->anchor_create(mdr, targeti,
                             new C_MDS_RetryRequest(mdcache, mdr));
       return;
@@ -2059,7 +2059,7 @@ void Server::handle_slave_link_prep(MDRequest *mdr)
   pi->ctime = mdr->now;
   pi->version = targeti->pre_dirty();
 
-  dout(10) << " projected inode " << pi << " v " << pi->version << endl;
+  dout(10) << " projected inode " << pi << " v " << pi->version << dendl;
 
   // journal it
   ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_link_prep", mdr->reqid, mdr->slave_to_mds, ESlaveUpdate::OP_PREPARE);
@@ -2088,7 +2088,7 @@ void Server::_logged_slave_link(MDRequest *mdr, CInode *targeti, utime_t old_cti
 {
   dout(10) << "_logged_slave_link " << *mdr
           << " inc=" << inc
-          << " " << *targeti << endl;
+          << " " << *targeti << dendl;
 
   version_t old_version = targeti->inode.version;
 
@@ -2117,7 +2117,7 @@ void Server::_commit_slave_link(MDRequest *mdr, int r, CInode *targeti,
   dout(10) << "_commit_slave_link " << *mdr
           << " r=" << r
           << " inc=" << inc
-          << " " << *targeti << endl;
+          << " " << *targeti << dendl;
 
   ESlaveUpdate *le;
   if (r == 0) {
@@ -2146,7 +2146,7 @@ void Server::_commit_slave_link(MDRequest *mdr, int r, CInode *targeti,
 void Server::handle_slave_link_prep_ack(MDRequest *mdr, MMDSSlaveRequest *m)
 {
   dout(10) << "handle_slave_link_prep_ack " << *mdr 
-          << " " << *m << endl;
+          << " " << *m << dendl;
   int from = m->get_source().num();
 
   // note slave
@@ -2202,14 +2202,14 @@ void Server::handle_client_unlink(MDRequest *mdr)
   if (req->get_op() == MDS_OP_RMDIR) rmdir = true;
   
   if (rmdir) {
-    dout(7) << "handle_client_rmdir on " << *dn << endl;
+    dout(7) << "handle_client_rmdir on " << *dn << dendl;
   } else {
-    dout(7) << "handle_client_unlink on " << *dn << endl;
+    dout(7) << "handle_client_unlink on " << *dn << dendl;
   }
 
   // readable?
   if (dn->lock.is_xlocked_by_other(mdr)) {
-    dout(10) << "waiting on xlocked dentry " << *dn << endl;
+    dout(10) << "waiting on xlocked dentry " << *dn << dendl;
     dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
     return;
   }
@@ -2220,7 +2220,7 @@ void Server::handle_client_unlink(MDRequest *mdr)
   mdr->trace.swap(trace);
   CInode *in = mdcache->get_dentry_inode(dn, mdr);
   if (!in) return;
-  dout(7) << "dn links to " << *in << endl;
+  dout(7) << "dn links to " << *in << dendl;
 
   // rmdir vs is_dir 
   if (in->is_dir()) {
@@ -2229,14 +2229,14 @@ void Server::handle_client_unlink(MDRequest *mdr)
       if (!_verify_rmdir(mdr, in))
        return;
     } else {
-      dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << endl;
+      dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << dendl;
       reply_request(mdr, -EISDIR);
       return;
     }
   } else {
     if (rmdir) {
       // unlink
-      dout(7) << "handle_client_rmdir on non-dir " << *in << ", returning error" << endl;
+      dout(7) << "handle_client_rmdir on non-dir " << *in << ", returning error" << dendl;
       reply_request(mdr, -ENOTDIR);
       return;
     }
@@ -2263,11 +2263,11 @@ void Server::handle_client_unlink(MDRequest *mdr)
   CDentry *straydn = 0;
   if (dn->is_primary()) {
     straydn = mdcache->get_or_create_stray_dentry(dn->inode);
-    dout(10) << " straydn is " << *straydn << endl;
+    dout(10) << " straydn is " << *straydn << dendl;
 
     if (!mdr->dst_reanchor_atid &&
        dn->inode->is_anchored()) {
-      dout(10) << "reanchoring to stray " << *dn->inode << endl;
+      dout(10) << "reanchoring to stray " << *dn->inode << dendl;
       vector<Anchor> trace;
       straydn->make_anchor_trace(trace, dn->inode);
       mds->anchorclient->prepare_update(dn->inode->ino(), trace, &mdr->dst_reanchor_atid, 
@@ -2306,7 +2306,7 @@ public:
 
 void Server::_unlink_local(MDRequest *mdr, CDentry *dn, CDentry *straydn)
 {
-  dout(10) << "_unlink_local " << *dn << endl;
+  dout(10) << "_unlink_local " << *dn << dendl;
 
   // ok, let's do it.
   // prepare log entry
@@ -2355,7 +2355,7 @@ void Server::_unlink_local_finish(MDRequest *mdr,
                                  CDentry *dn, CDentry *straydn,
                                  version_t dnpv, version_t dirpv) 
 {
-  dout(10) << "_unlink_local_finish " << *dn << endl;
+  dout(10) << "_unlink_local_finish " << *dn << dendl;
 
   // unlink main dentry
   CInode *in = dn->inode;
@@ -2375,7 +2375,7 @@ void Server::_unlink_local_finish(MDRequest *mdr,
   for (map<int,int>::iterator it = dn->replicas_begin();
        it != dn->replicas_end();
        it++) {
-    dout(7) << "_unlink_local_finish sending MDentryUnlink to mds" << it->first << endl;
+    dout(7) << "_unlink_local_finish sending MDentryUnlink to mds" << it->first << dendl;
     MDentryUnlink *unlink = new MDentryUnlink(dn->dir->dirfrag(), dn->name);
     if (straydn) {
       unlink->strayin = straydn->dir->inode->replicate_to(it->first);
@@ -2424,12 +2424,12 @@ public:
 
 void Server::_unlink_remote(MDRequest *mdr, CDentry *dn) 
 {
-  dout(10) << "_unlink_remote " << *dn << " " << *dn->inode << endl;
+  dout(10) << "_unlink_remote " << *dn << " " << *dn->inode << dendl;
 
   // 1. send LinkPrepare to dest (journal nlink-- prepare)
   int inauth = dn->inode->authority().first;
   if (mdr->witnessed.count(inauth) == 0) {
-    dout(10) << " inode auth must prepare nlink--" << endl;
+    dout(10) << " inode auth must prepare nlink--" << dendl;
 
     MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_UNLINKPREP);
     dn->inode->set_object_info(req->get_object_info());
@@ -2440,7 +2440,7 @@ void Server::_unlink_remote(MDRequest *mdr, CDentry *dn)
     mdr->waiting_on_slave.insert(inauth);
     return;
   }
-  dout(10) << " inode auth has prepared nlink--" << endl;
+  dout(10) << " inode auth has prepared nlink--" << dendl;
 
   // ok, let's do it.
   // prepare log entry
@@ -2473,7 +2473,7 @@ void Server::_unlink_remote_finish(MDRequest *mdr,
                                   CDentry *dn, 
                                   version_t dnpv, version_t dirpv) 
 {
-  dout(10) << "_unlink_remote_finish " << *dn << endl;
+  dout(10) << "_unlink_remote_finish " << *dn << dendl;
 
   // unlink main dentry
   dn->dir->unlink_inode(dn);
@@ -2486,7 +2486,7 @@ void Server::_unlink_remote_finish(MDRequest *mdr,
   for (map<int,int>::iterator it = dn->replicas_begin();
        it != dn->replicas_end();
        it++) {
-    dout(7) << "_unlink_remote_finish sending MDentryUnlink to mds" << it->first << endl;
+    dout(7) << "_unlink_remote_finish sending MDentryUnlink to mds" << it->first << dendl;
     MDentryUnlink *unlink = new MDentryUnlink(dn->dir->dirfrag(), dn->name);
     mds->send_message_mds(unlink, it->first, MDS_PORT_CACHE);
   }
@@ -2518,7 +2518,7 @@ void Server::_unlink_remote_finish(MDRequest *mdr,
  */
 bool Server::_verify_rmdir(MDRequest *mdr, CInode *in)
 {
-  dout(10) << "_verify_rmdir " << *in << endl;
+  dout(10) << "_verify_rmdir " << *in << dendl;
   assert(in->is_auth());
 
   list<frag_t> frags;
@@ -2534,21 +2534,21 @@ bool Server::_verify_rmdir(MDRequest *mdr, CInode *in)
     if (dir->is_auth() &&
        dir->get_size() == 0 && 
        !dir->is_complete()) {
-      dout(7) << "_verify_rmdir fetching incomplete dir " << *dir << endl;
+      dout(7) << "_verify_rmdir fetching incomplete dir " << *dir << dendl;
       dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
       return false;
     }
     
     // does the frag _look_ empty?
     if (dir->get_size()) {
-      dout(10) << "_verify_rmdir still " << dir->get_size() << " items in frag " << *dir << endl;
+      dout(10) << "_verify_rmdir still " << dir->get_size() << " items in frag " << *dir << dendl;
       reply_request(mdr, -ENOTEMPTY);
       return false;
     }
     
     // not dir auth?
     if (!dir->is_auth()) {
-      dout(10) << "_verify_rmdir not auth for " << *dir << ", FIXME BUG" << endl;
+      dout(10) << "_verify_rmdir not auth for " << *dir << ", FIXME BUG" << dendl;
       reply_request(mdr, -ENOTEMPTY);
       return false;
     }
@@ -2560,7 +2560,7 @@ bool Server::_verify_rmdir(MDRequest *mdr, CInode *in)
       // export sanity check
       if (!in->is_auth()) {
         // i should be exporting this now/soon, since the dir is empty.
-        dout(7) << "handle_client_rmdir dir is auth, but not inode." << endl;
+        dout(7) << "handle_client_rmdir dir is auth, but not inode." << dendl;
        mdcache->migrator->export_empty_import(in->dir);          
         in->dir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mds, req, diri));
         return;
@@ -2597,7 +2597,7 @@ public:
 void Server::handle_client_rename(MDRequest *mdr)
 {
   MClientRequest *req = mdr->client_request;
-  dout(7) << "handle_client_rename " << *req << endl;
+  dout(7) << "handle_client_rename " << *req << dendl;
 
   // traverse to dest dir (not dest)
   //  we do this FIRST, because the rename should occur on the 
@@ -2607,7 +2607,7 @@ void Server::handle_client_rename(MDRequest *mdr)
   vector<CDentry*> desttrace;
   CDir *destdir = traverse_to_auth_dir(mdr, desttrace, destpath);
   if (!destdir) return;  // fw or error out
-  dout(10) << "dest will be " << destname << " in " << *destdir << endl;
+  dout(10) << "dest will be " << destname << " in " << *destdir << dendl;
   assert(destdir->is_auth());
 
   // traverse to src
@@ -2623,14 +2623,14 @@ void Server::handle_client_rename(MDRequest *mdr)
     return;
   }
   CDentry *srcdn = srctrace[srctrace.size()-1];
-  dout(10) << " srcdn " << *srcdn << endl;
+  dout(10) << " srcdn " << *srcdn << dendl;
   CInode *srci = mdcache->get_dentry_inode(srcdn, mdr);
-  dout(10) << " srci " << *srci << endl;
+  dout(10) << " srci " << *srci << dendl;
 
   // -- some sanity checks --
   // src == dest?
   if (srcdn->get_dir() == destdir && srcdn->name == destname) {
-    dout(7) << "rename src=dest, noop" << endl;
+    dout(7) << "rename src=dest, noop" << dendl;
     reply_request(mdr, 0);
     return;
   }
@@ -2640,7 +2640,7 @@ void Server::handle_client_rename(MDRequest *mdr)
   CDentry *pdn = destdir->inode->parent;
   while (pdn) {
     if (pdn == srcdn) {
-      dout(7) << "cannot rename item to be a child of itself" << endl;
+      dout(7) << "cannot rename item to be a child of itself" << dendl;
       reply_request(mdr, -EINVAL);
       return;
     }
@@ -2657,10 +2657,10 @@ void Server::handle_client_rename(MDRequest *mdr)
 
   CInode *oldin = 0;
   if (destdn && !destdn->is_null()) {
-    //dout(10) << "dest dn exists " << *destdn << endl;
+    //dout(10) << "dest dn exists " << *destdn << dendl;
     oldin = mdcache->get_dentry_inode(destdn, mdr);
     if (!oldin) return;
-    dout(10) << " oldin " << *oldin << endl;
+    dout(10) << " oldin " << *oldin << dendl;
     
     // mv /some/thing /to/some/existing_other_thing
     if (oldin->is_dir() && !srci->is_dir()) {
@@ -2682,7 +2682,7 @@ void Server::handle_client_rename(MDRequest *mdr)
     if (!destdn) return;
   }
 
-  dout(10) << " destdn " << *destdn << endl;
+  dout(10) << " destdn " << *destdn << dendl;
 
 
   // -- locks --
@@ -2716,7 +2716,7 @@ void Server::handle_client_rename(MDRequest *mdr)
   if (srcdn->is_primary() && 
       !srcdn->is_auth() && 
       srci->is_dir()) {
-    dout(10) << "srci is remote dir, setting stickydirs and opening all frags" << endl;
+    dout(10) << "srci is remote dir, setting stickydirs and opening all frags" << dendl;
     mdr->set_stickydirs(srci);
 
     list<frag_t> frags;
@@ -2726,7 +2726,7 @@ void Server::handle_client_rename(MDRequest *mdr)
         ++p) {
       CDir *dir = srci->get_dirfrag(*p);
       if (!dir) {
-       dout(10) << " opening " << *dir << endl;
+       dout(10) << " opening " << *dir << dendl;
        mdcache->open_remote_dirfrag(srci, *p, new C_MDS_RetryRequest(mdcache, mdr));
        return;
       }
@@ -2741,7 +2741,7 @@ void Server::handle_client_rename(MDRequest *mdr)
   CDentry *straydn = 0;
   if (destdn->is_primary()) {
     straydn = mdcache->get_or_create_stray_dentry(destdn->inode);
-    dout(10) << "straydn is " << *straydn << endl;
+    dout(10) << "straydn is " << *straydn << dendl;
   }
 
   // -- prepare witnesses --
@@ -2765,9 +2765,9 @@ void Server::handle_client_rename(MDRequest *mdr)
        p != witnesses.end();
        ++p) {
     if (mdr->witnessed.count(*p)) {
-      dout(10) << " already witnessed by mds" << *p << endl;
+      dout(10) << " already witnessed by mds" << *p << dendl;
     } else {
-      dout(10) << " not yet witnessed by mds" << *p << ", sending prepare" << endl;
+      dout(10) << " not yet witnessed by mds" << *p << ", sending prepare" << dendl;
       MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEPREP);
       srcdn->make_path(req->srcdnpath);
       destdn->make_path(req->destdnpath);
@@ -2800,7 +2800,7 @@ void Server::handle_client_rename(MDRequest *mdr)
     if (mdr->inode_import.length() == 0) {
       // get inode
       int auth = srcdn->authority().first;
-      dout(10) << " requesting inode export from srcdn auth mds" << auth << endl;
+      dout(10) << " requesting inode export from srcdn auth mds" << auth << dendl;
       MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEGETINODE);
       srcdn->make_path(req->srcdnpath);
       mds->send_message_mds(req, auth, MDS_PORT_SERVER);
@@ -2809,7 +2809,7 @@ void Server::handle_client_rename(MDRequest *mdr)
       mdr->waiting_on_slave.insert(auth);
       return;
     } else {
-      dout(10) << " already (just!) got inode export from srcdn auth" << endl;
+      dout(10) << " already (just!) got inode export from srcdn auth" << dendl;
       /*int off = 0;
       mdcache->migrator->decode_import_inode(destdn, mdr->inode_import, off, 
                                             srcdn->authority().first);
@@ -2828,7 +2828,7 @@ void Server::handle_client_rename(MDRequest *mdr)
     if (srcdn->is_primary() && srcdn->inode->is_anchored() &&
        srcdn->dir != destdn->dir &&
        !mdr->src_reanchor_atid) {
-      dout(10) << "reanchoring src->dst " << *srcdn->inode << endl;
+      dout(10) << "reanchoring src->dst " << *srcdn->inode << dendl;
       vector<Anchor> trace;
       destdn->make_anchor_trace(trace, srcdn->inode);
       
@@ -2839,7 +2839,7 @@ void Server::handle_client_rename(MDRequest *mdr)
     if (destdn->is_primary() &&
        destdn->inode->is_anchored() &&
        !mdr->dst_reanchor_atid) {
-      dout(10) << "reanchoring dst->stray " << *destdn->inode << endl;
+      dout(10) << "reanchoring dst->stray " << *destdn->inode << dendl;
 
       assert(straydn);
       vector<Anchor> trace;
@@ -2877,7 +2877,7 @@ void Server::handle_client_rename(MDRequest *mdr)
 
 void Server::_rename_finish(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn)
 {
-  dout(10) << "_rename_finish " << *mdr << endl;
+  dout(10) << "_rename_finish " << *mdr << dendl;
 
   // apply
   _rename_apply(mdr, srcdn, destdn, straydn);
@@ -2911,7 +2911,7 @@ void Server::_rename_prepare(MDRequest *mdr,
                             EMetaBlob *metablob, 
                             CDentry *srcdn, CDentry *destdn, CDentry *straydn)
 {
-  dout(10) << "_rename_prepare " << *mdr << " " << *srcdn << " " << *destdn << endl;
+  dout(10) << "_rename_prepare " << *mdr << " " << *srcdn << " " << *destdn << dendl;
 
   // primary+remote link merge?
   bool linkmerge = (srcdn->inode == destdn->inode &&
@@ -2927,7 +2927,7 @@ void Server::_rename_prepare(MDRequest *mdr,
   version_t ipv = 0;   // it's version
   
   if (linkmerge) {
-    dout(10) << "will merge remote+primary links" << endl;
+    dout(10) << "will merge remote+primary links" << dendl;
 
     // destdn -> primary
     metablob->add_dir_context(destdn->dir);
@@ -2960,7 +2960,7 @@ void Server::_rename_prepare(MDRequest *mdr,
       if (destdn->inode->is_auth())
        ipv = mdr->pvmap[destdn->inode] = destdn->inode->pre_dirty();
       ji = metablob->add_primary_dentry(destdn->inode->parent, true, destdn->inode);  // update primary
-      dout(10) << "remote targeti (nlink--) is " << *destdn->inode << endl;
+      dout(10) << "remote targeti (nlink--) is " << *destdn->inode << dendl;
     }
     else {
       assert(destdn->is_null());
@@ -2969,7 +2969,7 @@ void Server::_rename_prepare(MDRequest *mdr,
     // add dest dentry
     metablob->add_dir_context(destdn->dir);
     if (srcdn->is_primary()) {
-      dout(10) << "src is a primary dentry" << endl;
+      dout(10) << "src is a primary dentry" << dendl;
       if (destdn->is_auth()) {
        version_t siv;
        if (srcdn->is_auth())
@@ -2982,7 +2982,7 @@ void Server::_rename_prepare(MDRequest *mdr,
 
     } else {
       assert(srcdn->is_remote());
-      dout(10) << "src is a remote dentry" << endl;
+      dout(10) << "src is a remote dentry" << dendl;
       if (destdn->is_auth())
        mdr->pvmap[destdn] = destdn->pre_dirty();
       metablob->add_remote_dentry(destdn, true, srcdn->get_remote_ino()); 
@@ -3024,8 +3024,8 @@ void Server::_rename_prepare(MDRequest *mdr,
 
 void Server::_rename_apply(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn)
 {
-  dout(10) << "_rename_apply " << *mdr << " " << *srcdn << " " << *destdn << endl;
-  dout(10) << " pvs " << mdr->pvmap << endl;
+  dout(10) << "_rename_apply " << *mdr << " " << *srcdn << " " << *destdn << dendl;
+  dout(10) << " pvs " << mdr->pvmap << dendl;
 
   CInode *oldin = destdn->inode;
   
@@ -3042,7 +3042,7 @@ void Server::_rename_apply(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDen
 
   if (linkmerge) {
     if (destdn->is_primary()) {
-      dout(10) << "merging remote onto primary link" << endl;
+      dout(10) << "merging remote onto primary link" << dendl;
 
       // nlink-- in place
       destdn->inode->inode.nlink--;
@@ -3055,7 +3055,7 @@ void Server::_rename_apply(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDen
       if (srcdn->is_auth())
        srcdn->mark_dirty(mdr->pvmap[srcdn]);
     } else {
-      dout(10) << "merging primary onto remote link" << endl;
+      dout(10) << "merging primary onto remote link" << dendl;
       assert(srcdn->is_primary());
       
       // move inode to dest
@@ -3080,7 +3080,7 @@ void Server::_rename_apply(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDen
       destdn->dir->unlink_inode(destdn);
 
     if (straydn) {
-      dout(10) << "straydn is " << *straydn << endl;
+      dout(10) << "straydn is " << *straydn << dendl;
 
       // relink oldin to stray dir.  destdn was primary.
       assert(oldin);
@@ -3176,11 +3176,11 @@ void Server::handle_slave_rename_prep(MDRequest *mdr)
   dout(10) << "handle_slave_rename_prep " << *mdr 
           << " " << mdr->slave_request->srcdnpath 
           << " to " << mdr->slave_request->destdnpath
-          << endl;
+          << dendl;
 
   // discover destdn
   filepath destpath(mdr->slave_request->destdnpath);
-  dout(10) << " dest " << destpath << endl;
+  dout(10) << " dest " << destpath << dendl;
   vector<CDentry*> trace;
   int r = mdcache->path_traverse(mdr, mdr->slave_request, 
                                 0, destpath, trace, false,
@@ -3189,13 +3189,13 @@ void Server::handle_slave_rename_prep(MDRequest *mdr)
   assert(r == 0);  // we shouldn't get an error here!
       
   CDentry *destdn = trace[trace.size()-1];
-  dout(10) << " destdn " << *destdn << endl;
+  dout(10) << " destdn " << *destdn << dendl;
   mdr->pin(destdn);
   
       
   // discover srcdn
   filepath srcpath(mdr->slave_request->srcdnpath);
-  dout(10) << " src " << srcpath << endl;
+  dout(10) << " src " << srcpath << dendl;
   r = mdcache->path_traverse(mdr, mdr->slave_request,
                             0, srcpath, trace, false,  
                             MDS_TRAVERSE_DISCOVERXLOCK);
@@ -3203,7 +3203,7 @@ void Server::handle_slave_rename_prep(MDRequest *mdr)
   assert(r == 0);  // we shouldn't get an error here!
       
   CDentry *srcdn = trace[trace.size()-1];
-  dout(10) << " srcdn " << *srcdn << endl;
+  dout(10) << " srcdn " << *srcdn << dendl;
   mdr->pin(srcdn);
   assert(srcdn->inode);
   mdr->pin(srcdn->inode);
@@ -3230,7 +3230,7 @@ void Server::handle_slave_rename_prep(MDRequest *mdr)
     mds->mdlog->submit_entry(le, new C_MDS_SlaveRenamePrep(this, mdr, srcdn, destdn, straydn));
   } else {
     // don't journal.
-    dout(10) << "not journaling, i'm not auth for anything, and srci isn't open" << endl;
+    dout(10) << "not journaling, i'm not auth for anything, and srci isn't open" << dendl;
     _logged_slave_rename(mdr, srcdn, destdn, straydn);
   }
 }
@@ -3238,7 +3238,7 @@ void Server::handle_slave_rename_prep(MDRequest *mdr)
 void Server::_logged_slave_rename(MDRequest *mdr, 
                                  CDentry *srcdn, CDentry *destdn, CDentry *straydn)
 {
-  dout(10) << "_logged_slave_rename " << *mdr << endl;
+  dout(10) << "_logged_slave_rename " << *mdr << dendl;
 
   // ack
   MMDSSlaveRequest *reply = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEPREPACK);
@@ -3269,7 +3269,7 @@ void Server::_logged_slave_rename(MDRequest *mdr,
 void Server::_commit_slave_rename(MDRequest *mdr, int r,
                                  CDentry *srcdn, CDentry *destdn, CDentry *straydn)
 {
-  dout(10) << "_commit_slave_rename " << *mdr << " r=" << r << endl;
+  dout(10) << "_commit_slave_rename " << *mdr << " r=" << r << dendl;
 
   ESlaveUpdate *le;
   if (r == 0) {
@@ -3289,7 +3289,7 @@ void Server::handle_slave_rename_prep_ack(MDRequest *mdr, MMDSSlaveRequest *m)
 {
   dout(10) << "handle_slave_rename_prep_ack " << *mdr 
           << " witnessed by " << m->get_source()
-          << " " << *m << endl;
+          << " " << *m << dendl;
   int from = m->get_source().num();
 
   // note slave
@@ -3302,7 +3302,7 @@ void Server::handle_slave_rename_prep_ack(MDRequest *mdr, MMDSSlaveRequest *m)
 
   // add extra witnesses?
   if (!m->srcdn_replicas.empty()) {
-    dout(10) << " extra witnesses (srcdn replicas) are " << m->srcdn_replicas << endl;
+    dout(10) << " extra witnesses (srcdn replicas) are " << m->srcdn_replicas << dendl;
     mdr->extra_witnesses = m->srcdn_replicas;
     mdr->extra_witnesses.erase(mds->get_nodeid());  // not me!
   }
@@ -3314,14 +3314,14 @@ void Server::handle_slave_rename_prep_ack(MDRequest *mdr, MMDSSlaveRequest *m)
   if (mdr->waiting_on_slave.empty())
     dispatch_client_request(mdr);  // go again!
   else 
-    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
 }
 
 
 
 void Server::handle_slave_rename_get_inode(MDRequest *mdr)
 {
-  dout(10) << "handle_slave_rename_get_inode " << *mdr << endl;
+  dout(10) << "handle_slave_rename_get_inode " << *mdr << dendl;
 
   assert(mdr->srcdn);
   assert(mdr->srcdn->is_auth());
@@ -3329,7 +3329,7 @@ void Server::handle_slave_rename_get_inode(MDRequest *mdr)
 
   // reply
   MMDSSlaveRequest *reply = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEGETINODEACK);
-  dout(10) << " replying with inode export info " << *mdr->srcdn->inode << endl;
+  dout(10) << " replying with inode export info " << *mdr->srcdn->inode << dendl;
 
   map<int,entity_inst_t> exported_client_map;
   bufferlist inodebl;
@@ -3353,11 +3353,11 @@ void Server::handle_slave_rename_get_inode(MDRequest *mdr)
 void Server::handle_slave_rename_get_inode_ack(MDRequest *mdr, MMDSSlaveRequest *m)
 {
   dout(10) << "handle_slave_rename_get_inode_ack " << *mdr 
-          << " " << *m << endl;
+          << " " << *m << dendl;
   int from = m->get_source().num();
 
   assert(m->inode_export.length());
-  dout(10) << " got inode export, saving in " << *mdr << endl;
+  dout(10) << " got inode export, saving in " << *mdr << dendl;
   mdr->inode_import.claim(m->inode_export);
   mdr->inode_import_v = m->inode_export_v;
 
@@ -3367,7 +3367,7 @@ void Server::handle_slave_rename_get_inode_ack(MDRequest *mdr, MMDSSlaveRequest
   if (mdr->waiting_on_slave.empty())
     dispatch_client_request(mdr);  // go again!
   else 
-    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+    dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
 }
 
 
@@ -3484,14 +3484,14 @@ void Server::handle_client_open(MDRequest *mdr)
   dout(10) << "open flags = " << flags
           << ", filemode = " << cmode
           << ", need_auth = " << need_auth
-          << endl;
+          << dendl;
 
   CInode *cur = rdlock_path_pin_ref(mdr, need_auth);
   if (!cur) return;
   
   // regular file?
   if ((cur->inode.mode & INODE_TYPE_MASK) != INODE_MODE_FILE) {
-    dout(7) << "not a regular file " << *cur << endl;
+    dout(7) << "not a regular file " << *cur << dendl;
     reply_request(mdr, -EINVAL);                 // FIXME what error do we want?
     return;
   }
@@ -3533,7 +3533,7 @@ void Server::_do_open(MDRequest *mdr, CInode *cur)
   
   dout(12) << "_do_open issuing caps " << cap_string(cap->pending())
           << " for " << req->get_source()
-          << " on " << *cur << endl;
+          << " on " << *cur << dendl;
   
   // hit pop
   mdr->now = g_clock.now();
@@ -3560,7 +3560,7 @@ void Server::_do_open(MDRequest *mdr, CInode *cur)
 
 void Server::queue_journal_open(CInode *in)
 {
-  dout(10) << "queue_journal_open on " << *in << endl;
+  dout(10) << "queue_journal_open on " << *in << dendl;
 
   if (journal_open_queue.count(in) == 0) {
     // pin so our pointer stays valid
@@ -3574,7 +3574,7 @@ void Server::queue_journal_open(CInode *in)
 
 void Server::journal_opens()
 {
-  dout(10) << "journal_opens " << journal_open_queue.size() << " inodes" << endl;
+  dout(10) << "journal_opens " << journal_open_queue.size() << " inodes" << dendl;
   if (journal_open_queue.empty()) return;
 
   EOpen *le = 0;
@@ -3725,7 +3725,7 @@ void Server::handle_client_openc(MDRequest *mdr)
 {
   MClientRequest *req = mdr->client_request;
 
-  dout(7) << "open w/ O_CREAT on " << req->get_filepath() << endl;
+  dout(7) << "open w/ O_CREAT on " << req->get_filepath() << dendl;
   
   bool excl = (req->args.open.flags & O_EXCL);
   CDentry *dn = rdlock_path_xlock_dentry(mdr, !excl, false);
@@ -3734,7 +3734,7 @@ void Server::handle_client_openc(MDRequest *mdr)
   if (!dn->is_null()) {
     // it existed.  
     if (req->args.open.flags & O_EXCL) {
-      dout(10) << "O_EXCL, target exists, failing with -EEXIST" << endl;
+      dout(10) << "O_EXCL, target exists, failing with -EEXIST" << dendl;
       reply_request(mdr, -EEXIST, dn->get_dir()->get_inode());
       return;
     } 
index a533f62e450e2441a04682edc531f5ffd20d1767..83707fdfbfc828aa180ea6539e441daa5ca35550 100644 (file)
 #include "IdAllocator.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
-#define  derr(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+
+#define  dout(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+#define  derr(l)    if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
 
 
 // -----------------------
 // EString
 
 bool EString::has_expired(MDS *mds) {
-  dout(10) << "EString.has_expired " << event << endl; 
+  dout(10) << "EString.has_expired " << event << dendl; 
   return true;
 }
 void EString::expire(MDS *mds, Context *c)
 {
-  dout(10) << "EString.expire " << event << endl; 
+  dout(10) << "EString.expire " << event << dendl; 
 }
 void EString::replay(MDS *mds)
 {
-  dout(10) << "EString.replay " << event << endl; 
+  dout(10) << "EString.replay " << event << dendl; 
 }
 
 
@@ -103,7 +103,7 @@ bool EMetaBlob::has_expired(MDS *mds)
 
     if (dir->authority().first != mds->get_nodeid()) {
       dout(10) << "EMetaBlob.has_expired not auth, needed dirv " << lp->second.dirv
-              << " for " << *dir << endl;
+              << " for " << *dir << dendl;
       continue;       // not our problem
     }
 
@@ -112,8 +112,8 @@ bool EMetaBlob::has_expired(MDS *mds)
       //             but is not perfectly safe.  for benchmarking ONLY!
       if (dir->get_committing_version() >= lp->second.dirv ||   // committING, not committED.
          dir->get_committed_version_equivalent() >= lp->second.dirv) {
-       dout(10) << "EMetaBlob.has_expired have dirv " << lp->second.dirv
-                << " for " << *dir << endl;
+       dout(10) << "EMetaBlob.has_expired have|committING (unsafe hack!) dirv " << lp->second.dirv
+                << " for " << *dir << dendl;
        continue;       // yay
       }
     } else {
@@ -121,7 +121,7 @@ bool EMetaBlob::has_expired(MDS *mds)
       if (dir->get_committed_version() >= lp->second.dirv ||
          dir->get_committed_version_equivalent() >= lp->second.dirv) {
        dout(10) << "EMetaBlob.has_expired have dirv " << lp->second.dirv
-                << " for " << *dir << endl;
+                << " for " << *dir << dendl;
        continue;       // yay
       }
     }
@@ -131,18 +131,18 @@ bool EMetaBlob::has_expired(MDS *mds)
       if (ex->is_exporting()) {
        // wait until export is acked (logged on remote) and committed (logged locally)
        dout(10) << "EMetaBlob.has_expired ambiguous auth for " << *dir
-                << ", exporting on " << *ex << endl;
+                << ", exporting on " << *ex << dendl;
        return false;
       } else {
        dout(10) << "EMetaBlob.has_expired ambiguous auth for " << *dir
-                << ", importing on " << *ex << endl;
+                << ", importing on " << *ex << dendl;
        return false;
       }
     }
 
     if (dir->get_committed_version() < lp->second.dirv) {
       dout(10) << "EMetaBlob.has_expired need dirv " << lp->second.dirv
-              << " for " << *dir << endl;
+              << " for " << *dir << dendl;
       return false;  // not committed.
     }
 
@@ -155,7 +155,7 @@ bool EMetaBlob::has_expired(MDS *mds)
        ++p) {
     if (!mds->anchorclient->has_committed(*p)) {
       dout(10) << "EMetaBlob.has_expired anchor transaction " << *p 
-              << " not yet acked" << endl;
+              << " not yet acked" << dendl;
       return false;
     }
   }
@@ -168,7 +168,7 @@ bool EMetaBlob::has_expired(MDS *mds)
       if (in) {
        if (in->inode.ctime == p->second &&
            in->dirlock.is_updated()) {
-         dout(10) << "EMetaBlob.has_expired dirty mtime dirlock hasn't flushed on " << *in << endl;
+         dout(10) << "EMetaBlob.has_expired dirty mtime dirlock hasn't flushed on " << *in << dendl;
          return false;
        }
       }
@@ -179,11 +179,11 @@ bool EMetaBlob::has_expired(MDS *mds)
     version_t cv = mds->idalloc->get_committed_version();
     if (cv < alloc_tablev) {
       dout(10) << "EMetaBlob.has_expired idalloc tablev " << alloc_tablev << " > " << cv
-              << ", still dirty" << endl;
+              << ", still dirty" << dendl;
       return false;   // still dirty
     } else {
       dout(10) << "EMetaBlob.has_expired idalloc tablev " << alloc_tablev << " <= " << cv
-              << ", already flushed" << endl;
+              << ", already flushed" << dendl;
     }
   }
 
@@ -194,7 +194,7 @@ bool EMetaBlob::has_expired(MDS *mds)
        ++p) {
     if (mds->mdcache->is_purging(p->first.ino, p->second)) {
       dout(10) << "EMetaBlob.has_expired still purging inode " << p->first.ino 
-              << " to " << p->second << endl;
+              << " to " << p->second << dendl;
       return false;
     }
   }  
@@ -205,7 +205,7 @@ bool EMetaBlob::has_expired(MDS *mds)
        ++p) {
     if (mds->clientmap.have_completed_request(*p)) {
       dout(10) << "EMetaBlob.has_expired still have completed request " << *p
-              << endl;
+              << dendl;
       return false;
     }
   }
@@ -235,13 +235,13 @@ void EMetaBlob::expire(MDS *mds, Context *c)
 
     if (dir->authority().first != mds->get_nodeid()) {
       dout(10) << "EMetaBlob.expire not auth, needed dirv " << lp->second.dirv
-              << " for " << *dir << endl;
+              << " for " << *dir << dendl;
       continue;     // not our problem
     }
     if (dir->get_committed_version() >= lp->second.dirv ||
        dir->get_committed_version_equivalent() >= lp->second.dirv) {
       dout(10) << "EMetaBlob.expire have dirv " << lp->second.dirv
-              << " on " << *dir << endl;
+              << " on " << *dir << dendl;
       continue;   // yay
     }
     
@@ -250,12 +250,12 @@ void EMetaBlob::expire(MDS *mds, Context *c)
       if (ex->is_exporting()) {
        // wait until export is acked (logged on remote) and committed (logged locally)
        dout(10) << "EMetaBlob.expire ambiguous auth for " << *dir
-                << ", waiting for export finish on " << *ex << endl;
+                << ", waiting for export finish on " << *ex << dendl;
        waitfor_export.push_back(ex);
        continue;
       } else {
        dout(10) << "EMetaBlob.expire ambiguous auth for " << *dir
-                << ", waiting for import finish on " << *ex << endl;
+                << ", waiting for import finish on " << *ex << dendl;
        waitfor_import.push_back(ex);
        continue;
       }
@@ -263,7 +263,7 @@ void EMetaBlob::expire(MDS *mds, Context *c)
     
     assert(dir->get_committed_version() < lp->second.dirv);
     dout(10) << "EMetaBlob.expire need dirv " << lp->second.dirv
-            << ", committing " << *dir << endl;
+            << ", committing " << *dir << dendl;
     commit[dir] = MAX(commit[dir], lp->second.dirv);
     ncommit++;
   }
@@ -298,7 +298,7 @@ void EMetaBlob::expire(MDS *mds, Context *c)
        ++p) {
     if (!mds->anchorclient->has_committed(*p)) {
       dout(10) << "EMetaBlob.expire anchor transaction " << *p 
-              << " not yet acked, waiting" << endl;
+              << " not yet acked, waiting" << dendl;
       mds->anchorclient->wait_for_ack(*p, gather->new_sub());
     }
   }
@@ -313,7 +313,7 @@ void EMetaBlob::expire(MDS *mds, Context *c)
        if (in->inode.ctime == p->second &&
            in->dirlock.is_updated()) {
          dout(10) << "EMetaBlob.expire dirty mtime dirlock hasn't flushed, waiting on " 
-                  << *in << endl;
+                  << *in << dendl;
          in->dirlock.add_waiter(SimpleLock::WAIT_STABLE, gather->new_sub());
        }
       }
@@ -323,7 +323,7 @@ void EMetaBlob::expire(MDS *mds, Context *c)
   if (!allocated_inos.empty()) {
     version_t cv = mds->idalloc->get_committed_version();
     if (cv < alloc_tablev) {
-      dout(10) << "EMetaBlob.expire saving idalloc table, need " << alloc_tablev << endl;
+      dout(10) << "EMetaBlob.expire saving idalloc table, need " << alloc_tablev << dendl;
       mds->idalloc->save(gather->new_sub(), alloc_tablev);
     }
   }
@@ -334,7 +334,7 @@ void EMetaBlob::expire(MDS *mds, Context *c)
        ++p) {
     if (mds->mdcache->is_purging(p->first.ino, p->second)) {
       dout(10) << "EMetaBlob.expire waiting for purge of inode " << p->first.ino
-              << " to " << p->second << endl;
+              << " to " << p->second << dendl;
       mds->mdcache->wait_for_purge(p->first.ino, p->second, gather->new_sub());
     }
   }
@@ -345,24 +345,24 @@ void EMetaBlob::expire(MDS *mds, Context *c)
        ++p) {
     if (mds->clientmap.have_completed_request(*p)) {
       dout(10) << "EMetaBlob.expire waiting on completed request " << *p
-              << endl;
+              << dendl;
       mds->clientmap.add_trim_waiter(*p, gather->new_sub());
     }
   }
 
-  dout(10) << "my gather finsher is " << gather << " with " << gather->get_num() << endl;
+  dout(10) << "my gather finsher is " << gather << " with " << gather->get_num() << dendl;
 
 }
 
 void EMetaBlob::replay(MDS *mds)
 {
-  dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps" << endl;
+  dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps" << dendl;
 
   // walk through my dirs (in order!)
   for (list<dirfrag_t>::iterator lp = lump_order.begin();
        lp != lump_order.end();
        ++lp) {
-    dout(10) << "EMetaBlob.replay dir " << *lp << endl;
+    dout(10) << "EMetaBlob.replay dir " << *lp << dendl;
     dirlump &lump = lump_map[*lp];
 
     // the dir 
@@ -373,11 +373,11 @@ void EMetaBlob::replay(MDS *mds)
       if (!diri) {
        if ((*lp).ino == MDS_INO_ROOT) {
          diri = mds->mdcache->create_root_inode();
-         dout(10) << "EMetaBlob.replay created root " << *diri << endl;
+         dout(10) << "EMetaBlob.replay created root " << *diri << dendl;
        } else if (MDS_INO_IS_STRAY((*lp).ino)) {
          int whose = (*lp).ino - MDS_INO_STRAY_OFFSET;
          diri = mds->mdcache->create_stray_inode(whose);
-         dout(10) << "EMetaBlob.replay created stray " << *diri << endl;
+         dout(10) << "EMetaBlob.replay created stray " << *diri << dendl;
        } else {
          assert(0);
        }
@@ -388,7 +388,7 @@ void EMetaBlob::replay(MDS *mds)
       if ((*lp).ino < MDS_INO_BASE) 
        mds->mdcache->adjust_subtree_auth(dir, CDIR_AUTH_UNKNOWN);
 
-      dout(10) << "EMetaBlob.replay added dir " << *dir << endl;  
+      dout(10) << "EMetaBlob.replay added dir " << *dir << dendl;  
     }
     dir->set_version( lump.dirv );
     if (lump.is_dirty())
@@ -408,11 +408,11 @@ void EMetaBlob::replay(MDS *mds)
        dn = dir->add_null_dentry(p->dn);
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay added " << *dn << endl;
+       dout(10) << "EMetaBlob.replay added " << *dn << dendl;
       } else {
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay had " << *dn << endl;
+       dout(10) << "EMetaBlob.replay had " << *dn << dendl;
       }
 
       CInode *in = mds->mdcache->get_inode(p->inode.ino);
@@ -424,10 +424,10 @@ void EMetaBlob::replay(MDS *mds)
        mds->mdcache->add_inode(in);
        dir->link_primary_inode(dn, in);
        if (p->dirty) in->_mark_dirty();
-       dout(10) << "EMetaBlob.replay added " << *in << endl;
+       dout(10) << "EMetaBlob.replay added " << *in << dendl;
       } else {
        if (dn->get_inode() != in && in->get_parent_dn()) {
-         dout(10) << "EMetaBlob.replay unlinking " << *in << endl;
+         dout(10) << "EMetaBlob.replay unlinking " << *in << dendl;
          in->get_parent_dn()->get_dir()->unlink_inode(in->get_parent_dn());
        }
        in->inode = p->inode;
@@ -436,9 +436,9 @@ void EMetaBlob::replay(MDS *mds)
        if (p->dirty) in->_mark_dirty();
        if (dn->get_inode() != in) {
          dir->link_primary_inode(dn, in);
-         dout(10) << "EMetaBlob.replay linked " << *in << endl;
+         dout(10) << "EMetaBlob.replay linked " << *in << dendl;
        } else {
-         dout(10) << "EMetaBlob.replay had " << *in << endl;
+         dout(10) << "EMetaBlob.replay had " << *in << dendl;
        }
       }
     }
@@ -452,16 +452,16 @@ void EMetaBlob::replay(MDS *mds)
        dn = dir->add_remote_dentry(p->dn, p->ino, p->d_type);
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay added " << *dn << endl;
+       dout(10) << "EMetaBlob.replay added " << *dn << dendl;
       } else {
        if (!dn->is_null()) {
-         dout(10) << "EMetaBlob.replay unlinking " << *dn << endl;
+         dout(10) << "EMetaBlob.replay unlinking " << *dn << dendl;
          dir->unlink_inode(dn);
        }
        dn->set_remote(p->ino, p->d_type);
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay had " << *dn << endl;
+       dout(10) << "EMetaBlob.replay had " << *dn << dendl;
       }
     }
 
@@ -474,15 +474,15 @@ void EMetaBlob::replay(MDS *mds)
        dn = dir->add_null_dentry(p->dn);
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay added " << *dn << endl;
+       dout(10) << "EMetaBlob.replay added " << *dn << dendl;
       } else {
        if (!dn->is_null()) {
-         dout(10) << "EMetaBlob.replay unlinking " << *dn << endl;
+         dout(10) << "EMetaBlob.replay unlinking " << *dn << dendl;
          dir->unlink_inode(dn);
        }
        dn->set_version(p->dnv);
        if (p->dirty) dn->_mark_dirty();
-       dout(10) << "EMetaBlob.replay had " << *dn << endl;
+       dout(10) << "EMetaBlob.replay had " << *dn << dendl;
       }
     }
   }
@@ -491,7 +491,7 @@ void EMetaBlob::replay(MDS *mds)
   for (list<version_t>::iterator p = atids.begin();
        p != atids.end();
        ++p) {
-    dout(10) << "EMetaBlob.replay noting anchor transaction " << *p << endl;
+    dout(10) << "EMetaBlob.replay noting anchor transaction " << *p << dendl;
     mds->anchorclient->got_journaled_agree(*p);
   }
 
@@ -501,7 +501,7 @@ void EMetaBlob::replay(MDS *mds)
         p != dirty_inode_mtimes.end();
         ++p) {
       CInode *in = mds->mdcache->get_inode(p->first);
-      dout(10) << "EMetaBlob.replay setting dirlock updated flag on " << *in << endl;
+      dout(10) << "EMetaBlob.replay setting dirlock updated flag on " << *in << dendl;
       in->dirlock.set_updated();
     }
 
@@ -509,13 +509,13 @@ void EMetaBlob::replay(MDS *mds)
   if (!allocated_inos.empty()) {
     if (mds->idalloc->get_version() >= alloc_tablev) {
       dout(10) << "EMetaBlob.replay idalloc tablev " << alloc_tablev
-              << " <= table " << mds->idalloc->get_version() << endl;
+              << " <= table " << mds->idalloc->get_version() << dendl;
     } else {
       for (list<inodeno_t>::iterator p = allocated_inos.begin();
           p != allocated_inos.end();
           ++p) {
        dout(10) << " EMetaBlob.replay idalloc " << *p << " tablev " << alloc_tablev
-                << " - 1 == table " << mds->idalloc->get_version() << endl;
+                << " - 1 == table " << mds->idalloc->get_version() << dendl;
        assert(alloc_tablev-1 == mds->idalloc->get_version());
        
        inodeno_t ino = mds->idalloc->alloc_id();
@@ -531,7 +531,7 @@ void EMetaBlob::replay(MDS *mds)
        p != truncated_inodes.end();
        ++p) {
     dout(10) << "EMetaBlob.replay will purge truncated inode " << p->first.ino
-            << " to " << p->second << endl;
+            << " to " << p->second << dendl;
     mds->mdcache->add_recovered_purge(p->first, p->second);  
   }
 
@@ -548,22 +548,22 @@ bool ESession::has_expired(MDS *mds)
 {
   if (mds->clientmap.get_committed() >= cmapv) {
     dout(10) << "ESession.has_expired newer clientmap " << mds->clientmap.get_committed() 
-            << " >= " << cmapv << " has committed" << endl;
+            << " >= " << cmapv << " has committed" << dendl;
     return true;
   } else if (mds->clientmap.get_committing() >= cmapv) {
     dout(10) << "ESession.has_expired newer clientmap " << mds->clientmap.get_committing() 
-            << " >= " << cmapv << " is still committing" << endl;
+            << " >= " << cmapv << " is still committing" << dendl;
     return false;
   } else {
     dout(10) << "ESession.has_expired clientmap " << mds->clientmap.get_version() 
-            << " > " << cmapv << ", need to save" << endl;
+            << " > " << cmapv << ", need to save" << dendl;
     return false;
   }
 }
 
 void ESession::expire(MDS *mds, Context *c)
 {  
-  dout(10) << "ESession.expire saving clientmap" << endl;
+  dout(10) << "ESession.expire saving clientmap" << dendl;
   mds->clientmap.save(c, cmapv);
 }
 
@@ -571,7 +571,7 @@ void ESession::replay(MDS *mds)
 {
   if (mds->clientmap.get_version() >= cmapv) {
     dout(10) << "ESession.replay clientmap " << mds->clientmap.get_version() 
-            << " >= " << cmapv << ", noop" << endl;
+            << " >= " << cmapv << ", noop" << dendl;
 
     // hrm, this isn't very pretty.
     if (!open)
@@ -579,7 +579,7 @@ void ESession::replay(MDS *mds)
 
   } else {
     dout(10) << "ESession.replay clientmap " << mds->clientmap.get_version() 
-            << " < " << cmapv << endl;
+            << " < " << cmapv << dendl;
     assert(mds->clientmap.get_version() + 1 == cmapv);
     if (open) {
       mds->clientmap.open_session(client_inst);
@@ -601,18 +601,18 @@ bool EAnchor::has_expired(MDS *mds)
   version_t cv = mds->anchortable->get_committed_version();
   if (cv < version) {
     dout(10) << "EAnchor.has_expired v " << version << " > " << cv
-            << ", still dirty" << endl;
+            << ", still dirty" << dendl;
     return false;   // still dirty
   } else {
     dout(10) << "EAnchor.has_expired v " << version << " <= " << cv
-            << ", already flushed" << endl;
+            << ", already flushed" << dendl;
     return true;    // already flushed
   }
 }
 
 void EAnchor::expire(MDS *mds, Context *c)
 {
-  dout(10) << "EAnchor.expire saving anchor table" << endl;
+  dout(10) << "EAnchor.expire saving anchor table" << dendl;
   mds->anchortable->save(c);
 }
 
@@ -620,10 +620,10 @@ void EAnchor::replay(MDS *mds)
 {
   if (mds->anchortable->get_version() >= version) {
     dout(10) << "EAnchor.replay event " << version
-            << " <= table " << mds->anchortable->get_version() << endl;
+            << " <= table " << mds->anchortable->get_version() << dendl;
   } else {
     dout(10) << " EAnchor.replay event " << version
-            << " - 1 == table " << mds->anchortable->get_version() << endl;
+            << " - 1 == table " << mds->anchortable->get_version() << dendl;
     assert(version-1 == mds->anchortable->get_version());
     
     switch (op) {
@@ -664,7 +664,7 @@ void EAnchorClient::expire(MDS *mds, Context *c)
 
 void EAnchorClient::replay(MDS *mds)
 {
-  dout(10) << " EAnchorClient.replay op " << op << " atid " << atid << endl;
+  dout(10) << " EAnchorClient.replay op " << op << " atid " << atid << dendl;
     
   switch (op) {
     // anchorclient
@@ -708,7 +708,7 @@ bool EOpen::has_expired(MDS *mds)
        in->is_any_caps() &&
        !(in->last_open_journaled > get_start_off() ||
          in->last_open_journaled == 0)) {
-      dout(10) << "EOpen.has_expired still refer to caps on " << *in << endl;
+      dout(10) << "EOpen.has_expired still refer to caps on " << *in << dendl;
       return false;
     }
   }
@@ -717,10 +717,10 @@ bool EOpen::has_expired(MDS *mds)
 
 void EOpen::expire(MDS *mds, Context *c)
 {
-  dout(10) << "EOpen.expire " << endl;
+  dout(10) << "EOpen.expire " << dendl;
   
   if (mds->mdlog->is_capped()) {
-    dout(0) << "uh oh, log is capped, but i have unexpired opens." << endl;
+    dout(0) << "uh oh, log is capped, but i have unexpired opens." << dendl;
     assert(0);
   }
 
@@ -730,7 +730,7 @@ void EOpen::expire(MDS *mds, Context *c)
     if (!in->is_any_caps()) continue;
     
     dout(10) << "EOpen.expire " << in->ino()
-            << " last_open_journaled " << in->last_open_journaled << endl;
+            << " last_open_journaled " << in->last_open_journaled << dendl;
 
     mds->server->queue_journal_open(in);
   }
@@ -740,7 +740,7 @@ void EOpen::expire(MDS *mds, Context *c)
 
 void EOpen::replay(MDS *mds)
 {
-  dout(10) << "EOpen.replay " << endl;
+  dout(10) << "EOpen.replay " << dendl;
   metablob.replay(mds);
 }
 
@@ -754,12 +754,12 @@ bool ESlaveUpdate::has_expired(MDS *mds)
   case ESlaveUpdate::OP_PREPARE:
     if (mds->mdcache->ambiguous_slave_updates.count(reqid) == 0) {
       dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master 
-              << ": haven't yet seen commit|rollback" << endl;
+              << ": haven't yet seen commit|rollback" << dendl;
       return false;
     } 
     else if (mds->mdcache->ambiguous_slave_updates[reqid]) {
       dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master 
-              << ": committed, checking metablob" << endl;
+              << ": committed, checking metablob" << dendl;
       bool exp = metablob.has_expired(mds);
       if (exp) 
        mds->mdcache->ambiguous_slave_updates.erase(reqid);
@@ -767,7 +767,7 @@ bool ESlaveUpdate::has_expired(MDS *mds)
     }
     else {
       dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master 
-              << ": aborted" << endl;
+              << ": aborted" << dendl;
       mds->mdcache->ambiguous_slave_updates.erase(reqid);
       return true;
     }
@@ -778,7 +778,7 @@ bool ESlaveUpdate::has_expired(MDS *mds)
       dout(10) << "ESlaveUpdate.has_expired "
               << ((op == ESlaveUpdate::OP_COMMIT) ? "commit ":"rollback ")
               << reqid << " for mds" << master 
-              << ": noting commit, kicking prepare waiter" << endl;
+              << ": noting commit, kicking prepare waiter" << dendl;
       mds->mdcache->ambiguous_slave_updates[reqid] = (op == ESlaveUpdate::OP_COMMIT);
       mds->mdcache->waiting_for_slave_update_commit[reqid]->finish(0);
       delete mds->mdcache->waiting_for_slave_update_commit[reqid];
@@ -787,7 +787,7 @@ bool ESlaveUpdate::has_expired(MDS *mds)
       dout(10) << "ESlaveUpdate.has_expired "
               << ((op == ESlaveUpdate::OP_COMMIT) ? "commit ":"rollback ")
               << reqid << " for mds" << master 
-              << ": no prepare waiter, ignoring" << endl;
+              << ": no prepare waiter, ignoring" << dendl;
     }
     return true;
 
@@ -804,13 +804,13 @@ void ESlaveUpdate::expire(MDS *mds, Context *c)
   if (mds->mdcache->ambiguous_slave_updates.count(reqid) == 0) {
     // wait
     dout(10) << "ESlaveUpdate.expire prepare " << reqid << " for mds" << master
-            << ": waiting for commit|rollback" << endl;
+            << ": waiting for commit|rollback" << dendl;
     mds->mdcache->waiting_for_slave_update_commit[reqid] = c;
   } else {
     // we committed.. expire the metablob
     assert(mds->mdcache->ambiguous_slave_updates[reqid] == true); 
     dout(10) << "ESlaveUpdate.expire prepare " << reqid << " for mds" << master
-            << ": waiting for metablob to expire" << endl;
+            << ": waiting for metablob to expire" << dendl;
     metablob.expire(mds, c);
   }
 }
@@ -821,7 +821,7 @@ void ESlaveUpdate::replay(MDS *mds)
   case ESlaveUpdate::OP_PREPARE:
     // FIXME: horribly inefficient copy; EMetaBlob needs a swap() or something
     dout(10) << "ESlaveUpdate.replay prepare " << reqid << " for mds" << master 
-            << ": saving blob for later commit" << endl;
+            << ": saving blob for later commit" << dendl;
     assert(mds->mdcache->uncommitted_slave_updates[master].count(reqid) == 0);
     mds->mdcache->uncommitted_slave_updates[master][reqid] = metablob;
     break;
@@ -829,24 +829,24 @@ void ESlaveUpdate::replay(MDS *mds)
   case ESlaveUpdate::OP_COMMIT:
     if (mds->mdcache->uncommitted_slave_updates[master].count(reqid)) {
       dout(10) << "ESlaveUpdate.replay commit " << reqid << " for mds" << master
-              << ": applying previously saved blob" << endl;
+              << ": applying previously saved blob" << dendl;
       mds->mdcache->uncommitted_slave_updates[master][reqid].replay(mds);
       mds->mdcache->uncommitted_slave_updates[master].erase(reqid);
     } else {
       dout(10) << "ESlaveUpdate.replay commit " << reqid << " for mds" << master 
-              << ": ignoring, no previously saved blob" << endl;
+              << ": ignoring, no previously saved blob" << dendl;
     }
     break;
 
   case ESlaveUpdate::OP_ROLLBACK:
     if (mds->mdcache->uncommitted_slave_updates[master].count(reqid)) {
       dout(10) << "ESlaveUpdate.replay abort " << reqid << " for mds" << master
-              << ": discarding previously saved blob" << endl;
+              << ": discarding previously saved blob" << dendl;
       assert(mds->mdcache->uncommitted_slave_updates[master].count(reqid));
       mds->mdcache->uncommitted_slave_updates[master].erase(reqid);
     } else {
       dout(10) << "ESlaveUpdate.replay abort " << reqid << " for mds" << master 
-              << ": ignoring, no previously saved blob" << endl;
+              << ": ignoring, no previously saved blob" << dendl;
     }
     break;
 
@@ -862,31 +862,31 @@ void ESlaveUpdate::replay(MDS *mds)
 bool ESubtreeMap::has_expired(MDS *mds)
 {
   if (mds->mdlog->get_last_subtree_map_offset() > get_start_off()) {
-    dout(10) << "ESubtreeMap.has_expired -- there's a newer map" << endl;
+    dout(10) << "ESubtreeMap.has_expired -- there's a newer map" << dendl;
     return true;
   } else if (mds->mdlog->is_capped()) {
-    dout(10) << "ESubtreeMap.has_expired -- log is capped, allowing map to expire" << endl;
+    dout(10) << "ESubtreeMap.has_expired -- log is capped, allowing map to expire" << dendl;
     return true;
   } else {
     dout(10) << "ESubtreeMap.has_expired -- not until there's a newer map written" 
             << " (" << get_start_off() << " >= " << mds->mdlog->get_last_subtree_map_offset() << ")"
-            << endl;
+            << dendl;
     return false;
   }
 }
 
 void ESubtreeMap::expire(MDS *mds, Context *c)
 {
-  dout(10) << "ESubtreeMap.has_expire -- waiting for a newer map to be written (or for shutdown)" << endl;
+  dout(10) << "ESubtreeMap.has_expire -- waiting for a newer map to be written (or for shutdown)" << dendl;
   mds->mdlog->add_subtree_map_expire_waiter(c);
 }
 
 void ESubtreeMap::replay(MDS *mds) 
 {
   if (mds->mdcache->is_subtrees()) {
-    dout(10) << "ESubtreeMap.replay -- ignoring, already have import map" << endl;
+    dout(10) << "ESubtreeMap.replay -- ignoring, already have import map" << dendl;
   } else {
-    dout(10) << "ESubtreeMap.replay -- reconstructing (auth) subtree spanning tree" << endl;
+    dout(10) << "ESubtreeMap.replay -- reconstructing (auth) subtree spanning tree" << dendl;
     
     // first, stick the spanning tree in my cache
     //metablob.print(cout);
@@ -920,7 +920,7 @@ void EFragment::expire(MDS *mds, Context *c)
 
 void EFragment::replay(MDS *mds)
 {
-  dout(10) << "EFragment.replay " << ino << " " << basefrag << " by " << bits << endl;
+  dout(10) << "EFragment.replay " << ino << " " << basefrag << " by " << bits << dendl;
   
   CInode *in = mds->mdcache->get_inode(ino);
   assert(in);
@@ -950,7 +950,7 @@ void EPurgeFinish::expire(MDS *mds, Context *c)
 
 void EPurgeFinish::replay(MDS *mds)
 {
-  dout(10) << "EPurgeFinish.replay " << ino << " to " << newsize << endl;
+  dout(10) << "EPurgeFinish.replay " << ino << " to " << newsize << dendl;
   mds->mdcache->remove_recovered_purge(ino, newsize);
 }
 
@@ -967,7 +967,7 @@ bool EExport::has_expired(MDS *mds)
 {
   CDir *dir = mds->mdcache->get_dirfrag(base);
   if (dir && mds->mdcache->migrator->is_exporting(dir)) {
-    dout(10) << "EExport.has_expired still exporting " << *dir << endl;
+    dout(10) << "EExport.has_expired still exporting " << *dir << dendl;
     return false;
   }
   return true;
@@ -979,13 +979,13 @@ void EExport::expire(MDS *mds, Context *c)
   assert(dir);
   assert(mds->mdcache->migrator->is_exporting(dir));
 
-  dout(10) << "EExport.expire waiting for export of " << *dir << endl;
+  dout(10) << "EExport.expire waiting for export of " << *dir << dendl;
   mds->mdcache->migrator->add_export_finish_waiter(dir, c);
 }
 
 void EExport::replay(MDS *mds)
 {
-  dout(10) << "EExport.replay " << base << endl;
+  dout(10) << "EExport.replay " << base << dendl;
   metablob.replay(mds);
   
   CDir *dir = mds->mdcache->get_dirfrag(base);
@@ -1016,13 +1016,13 @@ bool EImportStart::has_expired(MDS *mds)
 
 void EImportStart::expire(MDS *mds, Context *c)
 {
-  dout(10) << "EImportStart.expire " << base << endl;
+  dout(10) << "EImportStart.expire " << base << dendl;
   metablob.expire(mds, c);
 }
 
 void EImportStart::replay(MDS *mds)
 {
-  dout(10) << "EImportStart.replay " << base << endl;
+  dout(10) << "EImportStart.replay " << base << dendl;
   metablob.replay(mds);
 
   // put in ambiguous import list
@@ -1044,7 +1044,7 @@ void EImportFinish::expire(MDS *mds, Context *c)
 void EImportFinish::replay(MDS *mds)
 {
   if (mds->mdcache->have_ambiguous_import(base)) {
-    dout(10) << "EImportFinish.replay " << base << " success=" << success << endl;
+    dout(10) << "EImportFinish.replay " << base << " success=" << success << dendl;
     if (success) 
       mds->mdcache->finish_ambiguous_import(base);
     else
@@ -1052,7 +1052,7 @@ void EImportFinish::replay(MDS *mds)
   } else {
     dout(10) << "EImportFinish.replay " << base << " success=" << success
             << ", predates my subtree_map start point, ignoring" 
-            << endl;
+            << dendl;
     // verify that?
   }
 }
index b9ffe9fff65ea3e05a9d5e9998e3c2a027f31c4b..0b05dd1d1b9b3d5b61791baa2d37ad173df71355 100644 (file)
@@ -582,7 +582,7 @@ protected:
     pdout(10,g_conf.debug_mds) << (mdsco_db_line_prefix(this)) 
                               << "add_waiter " << hex << mask << dec << " " << c
                               << " on " << *this
-                              << endl;
+                              << dendl;
     
   }
   virtual void take_waiting(int mask, list<Context*>& ls) {
@@ -595,13 +595,13 @@ protected:
                                   << "take_waiting mask " << hex << mask << dec << " took " << it->second
                                   << " tag " << it->first
                                   << " on " << *this
-                                  << endl;
+                                  << dendl;
        waiting.erase(it++);
       } else {
        pdout(10,g_conf.debug_mds) << "take_waiting mask " << hex << mask << dec << " SKIPPING " << it->second
                                   << " tag " << it->first
                                   << " on " << *this 
-                                  << endl;
+                                  << dendl;
        it++;
       }
     }
index 5821bc85db38e26b8866f8928478327b72552a37..cd3729e2914a0e8eaad59db8389e0bbda77e1449 100644 (file)
@@ -213,7 +213,6 @@ class MDiscoverReply : public Message {
       dirs.push_back( new CDirDiscover() );
       dirs[i]->_decode(payload, off);
     }
-    //dout(12) << n << " dirs out" << endl;
 
     // inodes
     payload.copy(off, sizeof(int), (char*)&n);
@@ -222,7 +221,6 @@ class MDiscoverReply : public Message {
       inodes.push_back( new CInodeDiscover() );
       inodes[i]->_decode(payload, off);
     }
-    //dout(12) << n << " inodes out" << endl;
 
     // dentries
     payload.copy(off, sizeof(int), (char*)&n);
@@ -250,7 +248,6 @@ class MDiscoverReply : public Message {
          it != dirs.end();
          it++) 
       (*it)->_encode( payload );
-    //dout(12) << n << " dirs in" << endl;
     
     // inodes
     n = inodes.size();
@@ -259,7 +256,6 @@ class MDiscoverReply : public Message {
          it != inodes.end();
          it++) 
        (*it)->_encode( payload );
-    //dout(12) << n << " inodes in" << endl;
 
     // dentries
     n = dentries.size();
@@ -268,7 +264,6 @@ class MDiscoverReply : public Message {
          it != dentries.end();
          it++) 
        (*it)->_encode( payload );
-    //dout(12) << n << " dentries in" << endl;
   }
 
 };
index 838ab54219ccbca3a94f38d5d338489312d4bc1a..225c5a56b8c514c522b784b69d089ecdb78ecb6a 100644 (file)
@@ -26,7 +26,7 @@ public:
 
   char *get_type_name() { return "pg_stats"; }
   void print(ostream& out) {
-    out << "pg_stats" << endl;
+    out << "pg_stats";
   }
 
   void encode_payload() {
index 2dc5d27672b114ee200ad8de093c7fd82a1c45d8..220f81d548cbcbf0ae6dd8b3d5b7fd53f364151d 100644 (file)
@@ -25,9 +25,9 @@
 #include "common/Timer.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
 
 
 
@@ -40,13 +40,13 @@ bool ClientMonitor::update_from_paxos()
   assert(paxosv >= client_map.version);
 
   dout(10) << "update_from_paxos paxosv " << paxosv 
-          << ", my v " << client_map.version << endl;
+          << ", my v " << client_map.version << dendl;
 
 
   if (client_map.version == 0 && paxosv > 1 &&
       mon->store->exists_bl_ss("clientmap","latest")) {
     // starting up: load latest
-    dout(7) << "update_from_paxos startup: loading latest full clientmap" << endl;
+    dout(7) << "update_from_paxos startup: loading latest full clientmap" << dendl;
     bufferlist bl;
     mon->store->get_bl_ss(bl, "clientmap", "latest");
     int off = 0;
@@ -58,14 +58,14 @@ bool ClientMonitor::update_from_paxos()
     bufferlist bl;
     bool success = paxos->read(client_map.version+1, bl);
     if (success) {
-      dout(7) << "update_from_paxos  applying incremental " << client_map.version+1 << endl;
+      dout(7) << "update_from_paxos  applying incremental " << client_map.version+1 << dendl;
       Incremental inc;
       int off = 0;
       inc._decode(bl, off);
       client_map.apply_incremental(inc);
       
     } else {
-      dout(7) << "update_from_paxos  couldn't read incremental " << client_map.version+1 << endl;
+      dout(7) << "update_from_paxos  couldn't read incremental " << client_map.version+1 << dendl;
       return false;
     }
   }
@@ -86,12 +86,12 @@ void ClientMonitor::create_pending()
   pending_inc.next_client = client_map.next_client;
   dout(10) << "create_pending v " << pending_inc.version
           << ", next is " << pending_inc.next_client
-          << endl;
+          << dendl;
 }
 
 void ClientMonitor::create_initial()
 {
-  dout(1) << "create_initial -- creating initial map" << endl;
+  dout(1) << "create_initial -- creating initial map" << dendl;
 }
 
 
@@ -101,7 +101,7 @@ void ClientMonitor::encode_pending(bufferlist &bl)
   assert(mon->is_leader());
   dout(10) << "encode_pending v " << pending_inc.version 
           << ", next is " << pending_inc.next_client
-          << endl;
+          << dendl;
   assert(paxos->get_version() + 1 == pending_inc.version);
   pending_inc._encode(bl);
 }
@@ -112,7 +112,7 @@ void ClientMonitor::encode_pending(bufferlist &bl)
 
 bool ClientMonitor::preprocess_query(Message *m)
 {
-  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
 
   switch (m->get_type()) {
   case MSG_CLIENT_MOUNT:
@@ -123,7 +123,7 @@ bool ClientMonitor::preprocess_query(Message *m)
       if (mount->instance == 0 &&                  // only check for addr uniqueness if the client claims to be alone
          client_map.addr_client.count(addr)) {
        int client = client_map.addr_client[addr];
-       dout(7) << " client" << client << " already mounted" << endl;
+       dout(7) << " client" << client << " already mounted" << dendl;
        _mounted(client, (MClientMount*)m);
        return true;
       }
@@ -135,7 +135,7 @@ bool ClientMonitor::preprocess_query(Message *m)
       // already unmounted?
       int client = m->get_source().num();
       if (client_map.client_addr.count(client) == 0) {
-       dout(7) << " client" << client << " not mounted" << endl;
+       dout(7) << " client" << client << " not mounted" << dendl;
        _unmounted((MClientUnmount*)m);
        return true;
       }
@@ -152,7 +152,7 @@ bool ClientMonitor::preprocess_query(Message *m)
 
 bool ClientMonitor::prepare_update(Message *m)
 {
-  dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
   
   switch (m->get_type()) {
   case MSG_CLIENT_MOUNT:
@@ -166,13 +166,13 @@ bool ClientMonitor::prepare_update(Message *m)
       // choose a client id
       if (client < 0) {
        client = pending_inc.next_client;
-       dout(10) << "mount: assigned client" << client << " to " << addr << endl;
+       dout(10) << "mount: assigned client" << client << " to " << addr << dendl;
       } else {
-       dout(10) << "mount: client" << client << " requested by " << addr << endl;
+       dout(10) << "mount: client" << client << " requested by " << addr << dendl;
        if (client_map.client_addr.count(client)) {
          assert(client_map.client_addr[client] != addr);
          dout(0) << "mount: WARNING: client" << client << " requested by " << addr
-                 << ", which used to be " << client_map.client_addr[client] << endl;
+                 << ", which used to be " << client_map.client_addr[client] << dendl;
        }
       }
       
@@ -212,7 +212,7 @@ void ClientMonitor::_mounted(int client, MClientMount *m)
   to.addr = m->addr;
   to.name = MSG_ADDR_CLIENT(client);
 
-  dout(10) << "_mounted client" << client << " at " << to << endl;
+  dout(10) << "_mounted client" << client << " at " << to << dendl;
   
   // reply with latest mds, osd maps
   mon->mdsmon->send_latest(to);
@@ -223,7 +223,7 @@ void ClientMonitor::_mounted(int client, MClientMount *m)
 
 void ClientMonitor::_unmounted(MClientUnmount *m)
 {
-  dout(10) << "_unmounted " << m->inst << endl;
+  dout(10) << "_unmounted " << m->inst << dendl;
   
   // reply with (same) unmount message
   mon->messenger->send_message(m, m->inst);
@@ -234,7 +234,7 @@ void ClientMonitor::_unmounted(MClientUnmount *m)
       client_map.version > 1 &&
       client_map.client_addr.empty() && 
       g_conf.mon_stop_on_last_unmount) {
-    dout(1) << "last client unmounted" << endl;
+    dout(1) << "last client unmounted" << dendl;
     mon->do_stop();
   }
 }
index 816946d3cbfe3c73924d8c3bab3e13de7cd45b89..d962525bcc515d832552bc8bac3e3621472154ac 100644 (file)
@@ -20,9 +20,9 @@
 #include "messages/MMonElection.h"
 
 #include "config.h"
-#undef dout
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
+
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
 
 
 void Elector::init()
@@ -30,7 +30,7 @@ void Elector::init()
   epoch = mon->store->get_int("mon_epoch");
   if (!epoch)
     epoch = 1;
-  dout(1) << "init, last seen epoch " << epoch << endl;
+  dout(1) << "init, last seen epoch " << epoch << dendl;
 }
 
 void Elector::shutdown()
@@ -41,7 +41,7 @@ void Elector::shutdown()
 
 void Elector::bump_epoch(epoch_t e) 
 {
-  dout(10) << "bump_epoch " << epoch << " to " << e << endl;
+  dout(10) << "bump_epoch " << epoch << " to " << e << dendl;
   assert(epoch < e);
   epoch = e;
   mon->store->put_int(epoch, "mon_epoch");
@@ -55,7 +55,7 @@ void Elector::bump_epoch(epoch_t e)
 
 void Elector::start()
 {
-  dout(5) << "start -- can i be leader?" << endl;
+  dout(5) << "start -- can i be leader?" << dendl;
   
   // start by trying to elect me
   if (epoch % 2 == 0) 
@@ -76,7 +76,7 @@ void Elector::start()
 
 void Elector::defer(int who)
 {
-  dout(5) << "defer to " << who << endl;
+  dout(5) << "defer to " << who << dendl;
 
   if (electing_me) {
     // drop out
@@ -115,7 +115,7 @@ void Elector::cancel_timer()
 
 void Elector::expire()
 {
-  dout(5) << "election timer expired" << endl;
+  dout(5) << "election timer expired" << dendl;
   
   // did i win?
   if (electing_me &&
@@ -156,7 +156,7 @@ void Elector::victory()
 
 void Elector::handle_propose(MMonElection *m)
 {
-  dout(5) << "handle_propose from " << m->get_source() << endl;
+  dout(5) << "handle_propose from " << m->get_source() << dendl;
   int from = m->get_source().num();
 
   assert(m->epoch % 2 == 1); // election
@@ -167,7 +167,7 @@ void Elector::handle_propose(MMonElection *m)
           epoch % 2 == 0 &&    // in a non-election cycle
           mon->quorum.count(from) == 0) {  // from someone outside the quorum
     // a mon just started up, call a new election so they can rejoin!
-    dout(5) << " got propose from old epoch, " << m->get_source() << " must have just started" << endl;
+    dout(5) << " got propose from old epoch, " << m->get_source() << " must have just started" << dendl;
     start();
   }
 
@@ -175,7 +175,7 @@ void Elector::handle_propose(MMonElection *m)
     // i would win over them.
     if (leader_acked >= 0) {        // we already acked someone
       assert(leader_acked < from);  // and they still win, of course
-      dout(5) << "no, we already acked " << leader_acked << endl;
+      dout(5) << "no, we already acked " << leader_acked << dendl;
     } else {
       // wait, i should win!
       if (!electing_me)
@@ -189,7 +189,7 @@ void Elector::handle_propose(MMonElection *m)
       defer(from);
     } else {
       // ignore them!
-      dout(5) << "no, we already acked " << leader_acked << endl;
+      dout(5) << "no, we already acked " << leader_acked << dendl;
     }
   }
   
@@ -198,12 +198,12 @@ void Elector::handle_propose(MMonElection *m)
  
 void Elector::handle_ack(MMonElection *m)
 {
-  dout(5) << "handle_ack from " << m->get_source() << endl;
+  dout(5) << "handle_ack from " << m->get_source() << dendl;
   int from = m->get_source().num();
   
   assert(m->epoch % 2 == 1); // election
   if (m->epoch > epoch) {
-    dout(5) << "woah, that's a newer epoch, i must have rebooted.  bumping and re-starting!" << endl;
+    dout(5) << "woah, that's a newer epoch, i must have rebooted.  bumping and re-starting!" << dendl;
     bump_epoch(m->epoch);
     start();
     delete m;
@@ -214,7 +214,7 @@ void Elector::handle_ack(MMonElection *m)
   if (electing_me) {
     // thanks
     acked_me.insert(from);
-    dout(5) << " so far i have " << acked_me << endl;
+    dout(5) << " so far i have " << acked_me << dendl;
     
     // is that _everyone_?
     if (acked_me.size() == (unsigned)mon->monmap->num_mon) {
@@ -232,7 +232,7 @@ void Elector::handle_ack(MMonElection *m)
 
 void Elector::handle_victory(MMonElection *m)
 {
-  dout(5) << "handle_victory from " << m->get_source() << endl;
+  dout(5) << "handle_victory from " << m->get_source() << dendl;
   int from = m->get_source().num();
 
   assert(from < whoami);
@@ -265,7 +265,7 @@ void Elector::dispatch(Message *m)
       }
 
       if (em->epoch < epoch) {
-       dout(5) << "old epoch, dropping" << endl;
+       dout(5) << "old epoch, dropping" << dendl;
        delete em;
        break;
       }
index 89ba5dc435579480732fc6cc9de8f889c24176ef..5e3303f1fe7e3f3ec1f2dab2e8557624d4f99f02 100644 (file)
@@ -33,9 +33,9 @@
 #include <sstream>
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
 
 
 
@@ -43,7 +43,7 @@
 
 void MDSMonitor::print_map(MDSMap &m)
 {
-  dout(7) << "print_map epoch " << m.get_epoch() << " target_num " << m.target_num << endl;
+  dout(7) << "print_map epoch " << m.get_epoch() << " target_num " << m.target_num << dendl;
   entity_inst_t blank;
   set<int> all;
   m.get_mds_set(all);
@@ -53,7 +53,7 @@ void MDSMonitor::print_map(MDSMap &m)
     dout(7) << " mds" << *p << "." << m.mds_inc[*p]
            << " : " << MDSMap::get_state_name(m.get_state(*p))
            << " : " << (m.have_inst(*p) ? m.get_inst(*p) : blank)
-           << endl;
+           << dendl;
   }
 }
 
@@ -63,7 +63,7 @@ void MDSMonitor::print_map(MDSMap &m)
 
 void MDSMonitor::create_initial()
 {
-  dout(10) << "create_initial" << endl;
+  dout(10) << "create_initial" << dendl;
   pending_mdsmap.target_num = g_conf.num_mds;
   pending_mdsmap.created = g_clock.now();
   print_map(pending_mdsmap);
@@ -78,17 +78,17 @@ bool MDSMonitor::update_from_paxos()
   assert(paxosv >= mdsmap.epoch);
 
   dout(10) << "update_from_paxos paxosv " << paxosv 
-          << ", my e " << mdsmap.epoch << endl;
+          << ", my e " << mdsmap.epoch << dendl;
 
   // read and decode
   mdsmap_bl.clear();
   bool success = paxos->read(paxosv, mdsmap_bl);
   assert(success);
-  dout(10) << "update_from_paxos  got " << paxosv << endl;
+  dout(10) << "update_from_paxos  got " << paxosv << dendl;
   mdsmap.decode(mdsmap_bl);
 
   // new map
-  dout(7) << "new map:" << endl;
+  dout(7) << "new map:" << dendl;
   print_map(mdsmap);
 
   // bcast map to mds, waiters
@@ -103,12 +103,12 @@ void MDSMonitor::create_pending()
 {
   pending_mdsmap = mdsmap;
   pending_mdsmap.epoch++;
-  dout(10) << "create_pending e" << pending_mdsmap.epoch << endl;
+  dout(10) << "create_pending e" << pending_mdsmap.epoch << dendl;
 }
 
 void MDSMonitor::encode_pending(bufferlist &bl)
 {
-  dout(10) << "encode_pending e" << pending_mdsmap.epoch << endl;
+  dout(10) << "encode_pending e" << pending_mdsmap.epoch << dendl;
   
   //print_map(pending_mdsmap);
 
@@ -120,7 +120,7 @@ void MDSMonitor::encode_pending(bufferlist &bl)
 
 bool MDSMonitor::preprocess_query(Message *m)
 {
-  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
 
   switch (m->get_type()) {
     
@@ -146,11 +146,11 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
 {
   dout(12) << "preprocess_beacon " << *m
           << " from " << m->get_mds_inst()
-          << endl;
+          << dendl;
 
   // fw to leader?
   if (!mon->is_leader()) {
-    dout(10) << "fw to leader" << endl;
+    dout(10) << "fw to leader" << dendl;
     mon->messenger->send_message(m, mon->monmap->get_inst(mon->get_leader()));
     return true;
   }
@@ -175,7 +175,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
 
   // reply to beacon
   if (mdsmap.mds_state_seq[from] > seq) {
-    dout(7) << "mds_beacon " << *m << " has old seq, ignoring" << endl;
+    dout(7) << "mds_beacon " << *m << " has old seq, ignoring" << dendl;
     delete m;
     return true;
   }
@@ -191,11 +191,11 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
   if (mdsmap.mds_state.count(from) == 0) { 
     if (state == MDSMap::STATE_BOOT)
       return false;  // need to add to map
-    dout(1) << "mds_beacon " << *m << " announcing non-boot state, ignoring" << endl;
+    dout(1) << "mds_beacon " << *m << " announcing non-boot state, ignoring" << dendl;
   } else if (mdsmap.mds_state[from] != state) {
     if (mdsmap.get_epoch() == m->get_last_epoch_seen()) 
       return false;  // need to update map
-    dout(10) << "mds_beacon " << *m << " ignoring requested state, because mds hasn't seen latest map" << endl;
+    dout(10) << "mds_beacon " << *m << " ignoring requested state, because mds hasn't seen latest map" << dendl;
   }
   
   // we're done.
@@ -206,7 +206,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m)
 
 bool MDSMonitor::prepare_update(Message *m)
 {
-  dout(7) << "prepare_update " << *m << endl;
+  dout(7) << "prepare_update " << *m << dendl;
 
   switch (m->get_type()) {
     
@@ -235,7 +235,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
   // -- this is an update --
   dout(12) << "handle_beacon " << *m
           << " from " << m->get_mds_inst()
-          << endl;
+          << dendl;
   int from = m->get_mds_inst().name.num();
   int state = m->get_state();
   version_t seq = m->get_seq();
@@ -249,7 +249,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
       // wants to be (or already is) a specific MDS. 
       if (!g_conf.mon_allow_mds_bully &&
          (!mdsmap.have_inst(from) || mdsmap.get_inst(from) != m->get_mds_inst())) {
-       dout(10) << "mds_beacon boot: mds" << from << " is someone else" << endl;
+       dout(10) << "mds_beacon boot: mds" << from << " is someone else" << dendl;
        from = -1;
       } else {
        switch (mdsmap.get_state(from)) {
@@ -270,7 +270,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
        dout(10) << "mds_beacon boot: mds" << from
                 << " was " << MDSMap::get_state_name(mdsmap.get_state(from))
                 << ", " << MDSMap::get_state_name(state) 
-                << endl;
+                << dendl;
       }
     }
     if (from < 0) {
@@ -278,7 +278,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
       if (from >= 0) {
        state = pending_mdsmap.mds_state[from];
        dout(10) << "mds_beacon boot: already pending mds" << from
-                << " " << MDSMap::get_state_name(state) << endl;
+                << " " << MDSMap::get_state_name(state) << dendl;
        delete m;
        return false;
       }
@@ -289,7 +289,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
       pending_mdsmap.get_failed_mds_set(failed);
       if (!failed.empty()) {
        from = *failed.begin();
-       dout(10) << "mds_beacon boot: assigned failed mds" << from << endl;
+       dout(10) << "mds_beacon boot: assigned failed mds" << from << dendl;
        state = MDSMap::STATE_REPLAY;
       }
     }
@@ -297,11 +297,11 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
       // ok, just pick any unused mds id.
       for (from=0; ; ++from) {
        if (pending_mdsmap.is_dne(from)) {
-         dout(10) << "mds_beacon boot: assigned new mds" << from << endl;
+         dout(10) << "mds_beacon boot: assigned new mds" << from << dendl;
          state = MDSMap::STATE_CREATING;
          break;
        } else if (pending_mdsmap.is_stopped(from)) {
-         dout(10) << "mds_beacon boot: assigned stopped mds" << from << endl;
+         dout(10) << "mds_beacon boot: assigned stopped mds" << from << dendl;
          state = MDSMap::STATE_STARTING;
          break;
        }
@@ -325,7 +325,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
   if (state == MDSMap::STATE_ACTIVE && 
       mdsmap.is_creating(from)) {
     pending_mdsmap.mds_created.insert(from);
-    dout(10) << "mds_beacon created mds" << from << endl;
+    dout(10) << "mds_beacon created mds" << from << dendl;
   }
   
   // if starting|creating and degraded|full, go to standby
@@ -335,14 +335,14 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
        mdsmap.is_creating(from)) &&
       (pending_mdsmap.is_degraded() || 
        pending_mdsmap.is_full())) {
-    dout(10) << "mds_beacon cluster degraded|full, mds" << from << " will be standby" << endl;
+    dout(10) << "mds_beacon cluster degraded|full, mds" << from << " will be standby" << dendl;
     state = MDSMap::STATE_STANDBY;
   }
 
   // update the map
   dout(10) << "mds_beacon mds" << from << " " << MDSMap::get_state_name(mdsmap.mds_state[from])
           << " -> " << MDSMap::get_state_name(state)
-          << endl;
+          << dendl;
 
   // has someone join or leave the cluster?
   if (state == MDSMap::STATE_REPLAY ||
@@ -358,7 +358,7 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
   else
     pending_mdsmap.mds_state_seq.erase(from);
   
-  dout(7) << "pending map now:" << endl;
+  dout(7) << "pending map now:" << dendl;
   print_map(pending_mdsmap);
 
   paxos->wait_for_commit(new C_Updated(this, from, m));
@@ -370,10 +370,10 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m)
 void MDSMonitor::_updated(int from, MMDSBeacon *m)
 {
   if (m->get_state() == MDSMap::STATE_BOOT) {
-    dout(10) << "_updated (booted) mds" << from << " " << *m << endl;
+    dout(10) << "_updated (booted) mds" << from << " " << *m << dendl;
     mon->osdmon->send_latest(mdsmap.get_inst(from));
   } else {
-    dout(10) << "_updated mds" << from << " " << *m << endl;
+    dout(10) << "_updated mds" << from << " " << *m << dendl;
   }
   if (m->get_state() == MDSMap::STATE_STOPPED) {
     // send the map manually (they're out of the map, so they won't get it automatic)
@@ -413,7 +413,7 @@ bool MDSMonitor::handle_command(MMonCommand *m)
     else if (m->cmd[1] == "set_target_num" && m->cmd.size() > 2) {
       pending_mdsmap.target_num = atoi(m->cmd[2].c_str());
       r = 0;
-      ss << "target_num = " << pending_mdsmap.target_num << endl;
+      ss << "target_num = " << pending_mdsmap.target_num << dendl;
     }
   }
   if (r == -EINVAL) {
@@ -432,7 +432,7 @@ bool MDSMonitor::handle_command(MMonCommand *m)
 
 void MDSMonitor::bcast_latest_mds()
 {
-  dout(10) << "bcast_latest_mds " << mdsmap.get_epoch() << endl;
+  dout(10) << "bcast_latest_mds " << mdsmap.get_epoch() << dendl;
   
   // tell mds
   set<int> up;
@@ -445,13 +445,13 @@ void MDSMonitor::bcast_latest_mds()
 
 void MDSMonitor::send_full(entity_inst_t dest)
 {
-  dout(11) << "send_full to " << dest << endl;
+  dout(11) << "send_full to " << dest << dendl;
   mon->messenger->send_message(new MMDSMap(&mdsmap), dest);
 }
 
 void MDSMonitor::send_to_waiting()
 {
-  dout(10) << "send_to_waiting " << mdsmap.get_epoch() << endl;
+  dout(10) << "send_to_waiting " << mdsmap.get_epoch() << dendl;
   for (list<entity_inst_t>::iterator i = waiting_for_map.begin();
        i != waiting_for_map.end();
        i++) 
@@ -525,7 +525,7 @@ void MDSMonitor::tick()
          
          dout(10) << "no beacon from mds" << *p << " since " << last_beacon[*p]
                   << ", marking " << mdsmap.get_state_name(newstate)
-                  << endl;
+                  << dendl;
          
          // update map
          pending_mdsmap.mds_state[*p] = newstate;
@@ -533,7 +533,7 @@ void MDSMonitor::tick()
          changed = true;
        }
       } else {
-       dout(10) << "no beacons from mds" << *p << ", assuming one " << now << endl;
+       dout(10) << "no beacons from mds" << *p << ", assuming one " << now << dendl;
        last_beacon[*p] = now;
       }
     }
@@ -549,11 +549,11 @@ void MDSMonitor::do_stop()
   // hrm...
   if (!mon->is_leader() ||
       !paxos->is_active()) {
-    dout(-10) << "do_stop can't stop right now, mdsmap not writeable" << endl;
+    dout(-10) << "do_stop can't stop right now, mdsmap not writeable" << dendl;
     return;
   }
 
-  dout(7) << "do_stop stopping active mds nodes" << endl;
+  dout(7) << "do_stop stopping active mds nodes" << dendl;
   print_map(mdsmap);
 
   for (map<int,int>::iterator p = mdsmap.mds_state.begin();
index bf7e01bfc67e9c5744526d476e41997f90cf8df6..bca81c93329f3ae7564fb8425860c21c5b3d3394 100644 (file)
@@ -40,9 +40,9 @@
 #include "PGMonitor.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
 
 
 
@@ -50,7 +50,7 @@ void Monitor::init()
 {
   lock.Lock();
   
-  dout(1) << "init" << endl;
+  dout(1) << "init" << dendl;
   
   // store
   char s[80];
@@ -97,7 +97,7 @@ void Monitor::init()
 
 void Monitor::shutdown()
 {
-  dout(1) << "shutdown" << endl;
+  dout(1) << "shutdown" << dendl;
   
   elector.shutdown();
   
@@ -107,7 +107,7 @@ void Monitor::shutdown()
         it != osdmon->osdmap.get_osds().end();
         it++) {
       if (osdmon->osdmap.is_down(*it)) continue;
-      dout(10) << "sending shutdown to osd" << *it << endl;
+      dout(10) << "sending shutdown to osd" << *it << dendl;
       messenger->send_message(new MGenericMessage(MSG_SHUTDOWN),
                              osdmon->osdmap.get_inst(*it));
     }
@@ -145,7 +145,7 @@ void Monitor::call_election()
 {
   if (monmap->num_mon == 1) return;
   
-  dout(10) << "call_election" << endl;
+  dout(10) << "call_election" << dendl;
   state = STATE_STARTING;
   
   // tell paxos
@@ -164,7 +164,7 @@ void Monitor::win_election(epoch_t epoch, set<int>& active)
   leader = whoami;
   mon_epoch = epoch;
   quorum = active;
-  dout(10) << "win_election, epoch " << mon_epoch << " quorum is " << quorum << endl;
+  dout(10) << "win_election, epoch " << mon_epoch << " quorum is " << quorum << dendl;
   
   // init paxos
   paxos_test.leader_init();
@@ -185,7 +185,7 @@ void Monitor::lose_election(epoch_t epoch, int l)
   state = STATE_PEON;
   mon_epoch = epoch;
   leader = l;
-  dout(10) << "lose_election, epoch " << mon_epoch << " leader is mon" << leader << endl;
+  dout(10) << "lose_election, epoch " << mon_epoch << " leader is mon" << leader << dendl;
   
   // init paxos
   paxos_test.peon_init();
@@ -204,7 +204,7 @@ void Monitor::lose_election(epoch_t epoch, int l)
 
 void Monitor::handle_command(MMonCommand *m)
 {
-  dout(0) << "handle_command " << *m << endl;
+  dout(0) << "handle_command " << *m << dendl;
   
   int r = -1;
   string rs = "unrecognized command";
@@ -232,7 +232,7 @@ void Monitor::handle_command(MMonCommand *m)
 
 void Monitor::do_stop()
 {
-  dout(0) << "do_stop -- shutting down" << endl;
+  dout(0) << "do_stop -- shutting down" << dendl;
   mdsmon->do_stop();
 }
 
@@ -329,7 +329,7 @@ void Monitor::dispatch(Message *m)
 
       
     default:
-      dout(0) << "unknown message " << *m << endl;
+      dout(0) << "unknown message " << *m << dendl;
       assert(0);
     }
   }
@@ -341,10 +341,10 @@ void Monitor::handle_shutdown(Message *m)
 {
   assert(m->get_source().is_mon());
   if (m->get_source().num() == get_leader()) {
-    dout(1) << "shutdown from leader " << m->get_source() << endl;
+    dout(1) << "shutdown from leader " << m->get_source() << dendl;
     shutdown();
   } else {
-    dout(1) << "ignoring shutdown from non-leader " << m->get_source() << endl;
+    dout(1) << "ignoring shutdown from non-leader " << m->get_source() << dendl;
   }
   delete m;
 }
@@ -388,7 +388,7 @@ void Monitor::tick()
   tick_timer = 0;
 
   // ok go.
-  dout(11) << "tick" << endl;
+  dout(11) << "tick" << dendl;
   
   osdmon->tick();
   mdsmon->tick();
index 7f00bf83921df3f2abf547338264f17174c74ff7..d41436524bfd12da223605aecaa5ac1815483b2f 100644 (file)
@@ -16,9 +16,9 @@
 #include "common/Clock.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " store(" << dir <<") "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " store(" << dir <<") "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " store(" << dir <<") "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " store(" << dir <<") "
 
 #include <stdio.h>
 #include <sys/types.h>
 
 void MonitorStore::mount()
 {
-  dout(1) << "mount" << endl;
+  dout(1) << "mount" << dendl;
   // verify dir exists
   DIR *d = ::opendir(dir.c_str());
   if (!d) {
-    derr(1) << "basedir " << dir << " dne" << endl;
+    derr(1) << "basedir " << dir << " dne" << dendl;
     assert(0);
   }
   ::closedir(d);
@@ -51,11 +51,11 @@ void MonitorStore::mount()
 
 void MonitorStore::mkfs()
 {
-  dout(1) << "mkfs" << endl;
+  dout(1) << "mkfs" << dendl;
 
   char cmd[200];
   sprintf(cmd, "test -d %s && /bin/rm -r %s ; mkdir -p %s", dir.c_str(), dir.c_str(), dir.c_str());
-  dout(1) << cmd << endl;
+  dout(1) << cmd << dendl;
   system(cmd);
 }
 
@@ -79,9 +79,9 @@ version_t MonitorStore::get_int(const char *a, const char *b)
   version_t val = atoi(buf);
   
   if (b) {
-    dout(15) << "get_int " << a << "/" << b << " = " << val << endl;
+    dout(15) << "get_int " << a << "/" << b << " = " << val << dendl;
   } else {
-    dout(15) << "get_int " << a << " = " << val << endl;
+    dout(15) << "get_int " << a << " = " << val << dendl;
   }
   return val;
 }
@@ -93,10 +93,10 @@ void MonitorStore::put_int(version_t val, const char *a, const char *b)
   sprintf(fn, "%s/%s", dir.c_str(), a);
   if (b) {
     ::mkdir(fn, 0755);
-    dout(15) << "set_int " << a << "/" << b << " = " << val << endl;
+    dout(15) << "set_int " << a << "/" << b << " = " << val << dendl;
     sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
   } else {
-    dout(15) << "set_int " << a << " = " << val << endl;
+    dout(15) << "set_int " << a << " = " << val << dendl;
   }
   
   char vs[30];
@@ -125,16 +125,16 @@ bool MonitorStore::exists_bl_ss(const char *a, const char *b)
 {
   char fn[200];
   if (b) {
-    dout(15) << "exists_bl " << a << "/" << b << endl;
+    dout(15) << "exists_bl " << a << "/" << b << dendl;
     sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
   } else {
-    dout(15) << "exists_bl " << a << endl;
+    dout(15) << "exists_bl " << a << dendl;
     sprintf(fn, "%s/%s", dir.c_str(), a);
   }
   
   struct stat st;
   int r = ::stat(fn, &st);
-  //dout(15) << "exists_bl stat " << fn << " r=" << r << " errno " << errno << " " << strerror(errno) << endl;
+  //dout(15) << "exists_bl stat " << fn << " r=" << r << " errno " << errno << " " << strerror(errno) << dendl;
   return r == 0;
 }
 
@@ -151,9 +151,9 @@ int MonitorStore::get_bl_ss(bufferlist& bl, const char *a, const char *b)
   int fd = ::open(fn, O_RDONLY);
   if (!fd) {
     if (b) {
-      dout(15) << "get_bl " << a << "/" << b << " DNE" << endl;
+      dout(15) << "get_bl " << a << "/" << b << " DNE" << dendl;
     } else {
-      dout(15) << "get_bl " << a << " DNE" << endl;
+      dout(15) << "get_bl " << a << " DNE" << dendl;
     }
     return 0;
   }
@@ -169,9 +169,9 @@ int MonitorStore::get_bl_ss(bufferlist& bl, const char *a, const char *b)
   bufferptr bp(len);
   int off = 0;
   while (off < len) {
-    dout(20) << "reading at off " << off << " of " << len << endl;
+    dout(20) << "reading at off " << off << " of " << len << dendl;
     int r = ::read(fd, bp.c_str()+off, len-off);
-    if (r < 0) derr(0) << "errno on read " << strerror(errno) << endl;
+    if (r < 0) derr(0) << "errno on read " << strerror(errno) << dendl;
     assert(r>0);
     off += r;
   }
@@ -179,9 +179,9 @@ int MonitorStore::get_bl_ss(bufferlist& bl, const char *a, const char *b)
   ::close(fd);
 
   if (b) {
-    dout(15) << "get_bl " << a << "/" << b << " = " << bl.length() << " bytes" << endl;
+    dout(15) << "get_bl " << a << "/" << b << " = " << bl.length() << " bytes" << dendl;
   } else {
-    dout(15) << "get_bl " << a << " = " << bl.length() << " bytes" << endl;
+    dout(15) << "get_bl " << a << " = " << bl.length() << " bytes" << dendl;
   }
 
   return len;
@@ -193,10 +193,10 @@ int MonitorStore::put_bl_ss(bufferlist& bl, const char *a, const char *b)
   sprintf(fn, "%s/%s", dir.c_str(), a);
   if (b) {
     ::mkdir(fn, 0755);
-    dout(15) << "put_bl " << a << "/" << b << " = " << bl.length() << " bytes" << endl;
+    dout(15) << "put_bl " << a << "/" << b << " = " << bl.length() << " bytes" << dendl;
     sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
   } else {
-    dout(15) << "put_bl " << a << " = " << bl.length() << " bytes" << endl;
+    dout(15) << "put_bl " << a << " = " << bl.length() << " bytes" << dendl;
   }
   
   char tfn[200];
@@ -213,9 +213,9 @@ int MonitorStore::put_bl_ss(bufferlist& bl, const char *a, const char *b)
        it++)  {
     int r = ::write(fd, it->c_str(), it->length());
     if (r != (int)it->length())
-      derr(0) << "put_bl_ss ::write() returned " << r << " not " << it->length() << endl;
+      derr(0) << "put_bl_ss ::write() returned " << r << " not " << it->length() << dendl;
     if (r < 0) 
-      derr(0) << "put_bl_ss ::write() errored out, errno is " << strerror(errno) << endl;
+      derr(0) << "put_bl_ss ::write() errored out, errno is " << strerror(errno) << dendl;
   }
 
   ::fsync(fd);
index d96fa178bb10b21d5eb75f9ff1d8e78db6d9ec58..2a7526878f94e889ffe3546ffe543a19d4b836d0 100644 (file)
 #include "common/Timer.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
+
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
 
 
 // FAKING
@@ -56,11 +57,11 @@ public:
 void OSDMonitor::fake_osd_failure(int osd, bool down) 
 {
   if (down) {
-    dout(1) << "fake_osd_failure DOWN osd" << osd << endl;
+    dout(1) << "fake_osd_failure DOWN osd" << osd << dendl;
     pending_inc.new_down[osd].first = osdmap.osd_inst[osd];
     pending_inc.new_down[osd].second = false;
   } else {
-    dout(1) << "fake_osd_failure OUT osd" << osd << endl;
+    dout(1) << "fake_osd_failure OUT osd" << osd << dendl;
     pending_inc.new_out.push_back(osd);
   }
   propose_pending();
@@ -72,7 +73,7 @@ void OSDMonitor::fake_osd_failure(int osd, bool down)
 
 void OSDMonitor::fake_osdmap_update()
 {
-  dout(1) << "fake_osdmap_update" << endl;
+  dout(1) << "fake_osdmap_update" << dendl;
   propose_pending();
 
   // tell a random osd
@@ -86,10 +87,10 @@ void OSDMonitor::fake_reorg()
   int r = rand() % g_conf.num_osd;
   
   if (osdmap.is_out(r)) {
-    dout(1) << "fake_reorg marking osd" << r << " in" << endl;
+    dout(1) << "fake_reorg marking osd" << r << " in" << dendl;
     pending_inc.new_in.push_back(r);
   } else {
-    dout(1) << "fake_reorg marking osd" << r << " out" << endl;
+    dout(1) << "fake_reorg marking osd" << r << " out" << dendl;
     pending_inc.new_out.push_back(r);
   }
 
@@ -106,7 +107,7 @@ void OSDMonitor::create_initial()
   assert(mon->is_leader());
   assert(paxos->get_version() == 0);
 
-  dout(1) << "create_initial -- creating initial osdmap from g_conf" << endl;
+  dout(1) << "create_initial -- creating initial osdmap from g_conf" << dendl;
 
   // <HACK set up OSDMap from g_conf>
   OSDMap newmap;
@@ -135,14 +136,14 @@ void OSDMonitor::create_initial()
     
     // add osds
     int nper = ((g_conf.num_osd - 1) / ndom) + 1;
-    cerr << ndom << " failure domains, " << nper << " osds each" << endl;
+    cerr << ndom << " failure domains, " << nper << " osds each" << dendl;
     int i = 0;
     for (int dom=0; dom<ndom; dom++) {
       for (int j=0; j<nper; j++) {
        newmap.osds.insert(i);
        newmap.down_osds[i] = true; // initially DOWN
        domain[dom]->add_item(i, 1.0);
-       //cerr << "osd" << i << " in domain " << dom << endl;
+       //cerr << "osd" << i << " in domain " << dom << dendl;
        i++;
        if (i == g_conf.num_osd) break;
       }
@@ -151,7 +152,7 @@ void OSDMonitor::create_initial()
     // root
     Bucket *root = new ListBucket(2);
     for (int i=0; i<ndom; i++) {
-      //cerr << "dom " << i << " w " << domain[i]->get_weight() << endl;
+      //cerr << "dom " << i << " w " << domain[i]->get_weight() << dendl;
       root->add_item(domid[i], domain[i]->get_weight());
     }
     int nroot = newmap.crush.add_bucket(root);    
@@ -226,13 +227,13 @@ void OSDMonitor::create_initial()
   for (map<int,float>::iterator i = g_fake_osd_down.begin();
           i != g_fake_osd_down.end();
           i++) {
-       dout(0) << "will fake osd" << i->first << " DOWN after " << i->second << endl;
+       dout(0) << "will fake osd" << i->first << " DOWN after " << i->second << dendl;
        mon->timer.add_event_after(i->second, new C_Mon_FakeOSDFailure(this, i->first, 1));
   }
   for (map<int,float>::iterator i = g_fake_osd_out.begin();
           i != g_fake_osd_out.end();
           i++) {
-       dout(0) << "will fake osd" << i->first << " OUT after " << i->second << endl;
+       dout(0) << "will fake osd" << i->first << " OUT after " << i->second << dendl;
        mon->timer.add_event_after(i->second, new C_Mon_FakeOSDFailure(this, i->first, 0));
   }
 
@@ -249,13 +250,13 @@ bool OSDMonitor::update_from_paxos()
   assert(paxosv >= osdmap.epoch);
 
   dout(15) << "update_from_paxos paxos e " << paxosv 
-          << ", my e " << osdmap.epoch << endl;
+          << ", my e " << osdmap.epoch << dendl;
 
   if (osdmap.epoch == 0 && paxosv > 1) {
     // startup: just load latest full map
     epoch_t lastfull = mon->store->get_int("osdmap_full","last_epoch");
     if (lastfull) {
-      dout(7) << "update_from_paxos startup: loading latest full map e" << lastfull << endl;
+      dout(7) << "update_from_paxos startup: loading latest full map e" << lastfull << dendl;
       bufferlist bl;
       mon->store->get_bl_sn(bl, "osdmap_full", lastfull);
       osdmap.decode(bl);
@@ -268,7 +269,7 @@ bool OSDMonitor::update_from_paxos()
     bool success = paxos->read(osdmap.epoch+1, bl);
     assert(success);
     
-    dout(7) << "update_from_paxos  applying incremental " << osdmap.epoch+1 << endl;
+    dout(7) << "update_from_paxos  applying incremental " << osdmap.epoch+1 << dendl;
     OSDMap::Incremental inc;
     int off = 0;
     inc.decode(bl, off);
@@ -292,13 +293,13 @@ void OSDMonitor::create_pending()
 {
   pending_inc = OSDMap::Incremental(osdmap.epoch+1);
   dout(10) << "create_pending e " << pending_inc.epoch
-          << endl;
+          << dendl;
 }
 
 void OSDMonitor::encode_pending(bufferlist &bl)
 {
   dout(10) << "encode_pending e " << pending_inc.epoch
-          << endl;
+          << dendl;
   
   // finish up pending_inc
   pending_inc.ctime = g_clock.now();
@@ -308,27 +309,27 @@ void OSDMonitor::encode_pending(bufferlist &bl)
   for (map<int,pair<entity_inst_t,bool> >::iterator i = pending_inc.new_down.begin();
        i != pending_inc.new_down.end();
        i++) {
-    dout(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << endl;
-    derr(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << endl;
+    dout(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
+    derr(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
     mon->messenger->mark_down(i->second.first.addr);
   }
   for (map<int,entity_inst_t>::iterator i = pending_inc.new_up.begin();
        i != pending_inc.new_up.end(); 
        i++) { 
-    dout(0) << " osd" << i->first << " UP " << i->second << endl;
-    derr(0) << " osd" << i->first << " UP " << i->second << endl;
+    dout(0) << " osd" << i->first << " UP " << i->second << dendl;
+    derr(0) << " osd" << i->first << " UP " << i->second << dendl;
   }
   for (list<int>::iterator i = pending_inc.new_out.begin();
        i != pending_inc.new_out.end();
        i++) {
-    dout(0) << " osd" << *i << " OUT" << endl;
-    derr(0) << " osd" << *i << " OUT" << endl;
+    dout(0) << " osd" << *i << " OUT" << dendl;
+    derr(0) << " osd" << *i << " OUT" << dendl;
   }
   for (list<int>::iterator i = pending_inc.new_in.begin();
        i != pending_inc.new_in.end();
        i++) {
-    dout(0) << " osd" << *i << " IN" << endl;
-    derr(0) << " osd" << *i << " IN" << endl;
+    dout(0) << " osd" << *i << " IN" << dendl;
+    derr(0) << " osd" << *i << " IN" << dendl;
   }
 
   // encode
@@ -341,7 +342,7 @@ void OSDMonitor::encode_pending(bufferlist &bl)
 
 bool OSDMonitor::preprocess_query(Message *m)
 {
-  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
 
   switch (m->get_type()) {
     // READs
@@ -370,7 +371,7 @@ bool OSDMonitor::preprocess_query(Message *m)
 
 bool OSDMonitor::prepare_update(Message *m)
 {
-  dout(7) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+  dout(7) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
   
   switch (m->get_type()) {
     // damp updates
@@ -397,7 +398,7 @@ bool OSDMonitor::prepare_update(Message *m)
 bool OSDMonitor::should_propose_now()
 {
   // don't propose initial map until _all_ osds boot.
-  //dout(10) << "should_propose_now " << pending_inc.new_up.size() << " vs " << osdmap.get_osds().size() << endl;
+  //dout(10) << "should_propose_now " << pending_inc.new_up.size() << " vs " << osdmap.get_osds().size() << dendl;
   if (osdmap.epoch == 1 &&
       pending_inc.new_up.size() < osdmap.get_osds().size())
     return false;  // not all up (yet)
@@ -413,7 +414,7 @@ bool OSDMonitor::should_propose_now()
 
 void OSDMonitor::handle_osd_getmap(MOSDGetMap *m)
 {
-  dout(7) << "handle_osd_getmap from " << m->get_source() << " from " << m->get_start_epoch() << endl;
+  dout(7) << "handle_osd_getmap from " << m->get_source() << " from " << m->get_start_epoch() << dendl;
   
   if (m->get_start_epoch())
     send_incremental(m->get_source_inst(), m->get_start_epoch());
@@ -436,30 +437,30 @@ bool OSDMonitor::preprocess_failure(MOSDFailure *m)
 
   // weird?
   if (!osdmap.have_inst(badboy)) {
-    dout(5) << "preprocess_failure dne(/dup?): " << m->get_failed() << ", from " << m->get_from() << endl;
+    dout(5) << "preprocess_failure dne(/dup?): " << m->get_failed() << ", from " << m->get_from() << dendl;
     send_incremental(m->get_from(), m->get_epoch()+1);
     return true;
   }
   if (osdmap.get_inst(badboy) != m->get_failed()) {
     dout(5) << "preprocess_failure wrong osd: report " << m->get_failed() << " != map's " << osdmap.get_inst(badboy)
-           << ", from " << m->get_from() << endl;
+           << ", from " << m->get_from() << dendl;
     send_incremental(m->get_from(), m->get_epoch()+1);
     return true;
   }
   // already reported?
   if (osdmap.is_down(badboy)) {
-    dout(5) << "preprocess_failure dup: " << m->get_failed() << ", from " << m->get_from() << endl;
+    dout(5) << "preprocess_failure dup: " << m->get_failed() << ", from " << m->get_from() << dendl;
     send_incremental(m->get_from(), m->get_epoch()+1);
     return true;
   }
 
-  dout(10) << "preprocess_failure new: " << m->get_failed() << ", from " << m->get_from() << endl;
+  dout(10) << "preprocess_failure new: " << m->get_failed() << ", from " << m->get_from() << dendl;
   return false;
 }
 
 bool OSDMonitor::prepare_failure(MOSDFailure *m)
 {
-  dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_from() << endl;
+  dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_from() << dendl;
   
   // FIXME
   // take their word for it
@@ -480,7 +481,7 @@ bool OSDMonitor::prepare_failure(MOSDFailure *m)
 
 void OSDMonitor::_reported_failure(MOSDFailure *m)
 {
-  dout(7) << "_reported_failure on " << m->get_failed() << ", telling " << m->get_from() << endl;
+  dout(7) << "_reported_failure on " << m->get_failed() << ", telling " << m->get_from() << dendl;
   send_latest(m->get_from(), m->get_epoch());
 }
 
@@ -496,31 +497,31 @@ bool OSDMonitor::preprocess_boot(MOSDBoot *m)
   if (osdmap.is_up(from) &&
       osdmap.get_inst(from) == m->inst) {
     // yup.
-    dout(7) << "preprocess_boot dup from " << m->inst << endl;
+    dout(7) << "preprocess_boot dup from " << m->inst << dendl;
     _booted(m);
     return true;
   }
   
-  dout(10) << "preprocess_boot from " << m->inst << endl;
+  dout(10) << "preprocess_boot from " << m->inst << dendl;
   return false;
 }
 
 bool OSDMonitor::prepare_boot(MOSDBoot *m)
 {
-  dout(7) << "prepare_boot from " << m->inst << endl;
+  dout(7) << "prepare_boot from " << m->inst << dendl;
   assert(m->inst.name.is_osd());
   int from = m->inst.name.num();
   
   // does this osd exist?
   if (!osdmap.exists(from)) {
-    dout(1) << "boot from non-existent osd" << from << endl;
+    dout(1) << "boot from non-existent osd" << from << dendl;
     delete m;
     return true;
   }
 
   // already up?  mark down first?
   if (osdmap.is_up(from)) {
-    dout(7) << "prepare_boot was up, first marking down " << osdmap.get_inst(from) << endl;
+    dout(7) << "prepare_boot was up, first marking down " << osdmap.get_inst(from) << dendl;
     assert(osdmap.get_inst(from) != m->inst);  // preproces should have caught it
     
     // mark previous guy down
@@ -545,7 +546,7 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
 
 void OSDMonitor::_booted(MOSDBoot *m)
 {
-  dout(7) << "_booted " << m->inst << endl;
+  dout(7) << "_booted " << m->inst << dendl;
   send_latest(m->inst, m->sb.current_epoch);
   delete m;
 }
@@ -559,7 +560,7 @@ void OSDMonitor::_booted(MOSDBoot *m)
 
 void OSDMonitor::send_to_waiting()
 {
-  dout(10) << "send_to_waiting " << osdmap.get_epoch() << endl;
+  dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl;
 
   for (map<entity_name_t,pair<entity_inst_t,epoch_t> >::iterator i = awaiting_map.begin();
        i != awaiting_map.end();
@@ -574,13 +575,13 @@ void OSDMonitor::send_to_waiting()
 void OSDMonitor::send_latest(entity_inst_t who, epoch_t start)
 {
   if (paxos->is_readable()) {
-    dout(5) << "send_latest to " << who << " now" << endl;
+    dout(5) << "send_latest to " << who << " now" << dendl;
     if (start == 0)
       send_full(who);
     else
       send_incremental(who, start);
   } else {
-    dout(5) << "send_latest to " << who << " later" << endl;
+    dout(5) << "send_latest to " << who << " later" << dendl;
     awaiting_map[who.name].first = who;
     awaiting_map[who.name].second = start;
   }
@@ -589,14 +590,14 @@ void OSDMonitor::send_latest(entity_inst_t who, epoch_t start)
 
 void OSDMonitor::send_full(entity_inst_t who)
 {
-  dout(5) << "send_full to " << who << endl;
+  dout(5) << "send_full to " << who << dendl;
   mon->messenger->send_message(new MOSDMap(&osdmap), who);
 }
 
 void OSDMonitor::send_incremental(entity_inst_t dest, epoch_t from)
 {
   dout(5) << "send_incremental from " << from << " -> " << osdmap.get_epoch()
-         << " to " << dest << endl;
+         << " to " << dest << dendl;
   
   MOSDMap *m = new MOSDMap;
   
@@ -605,11 +606,11 @@ void OSDMonitor::send_incremental(entity_inst_t dest, epoch_t from)
        e--) {
     bufferlist bl;
     if (mon->store->get_bl_sn(bl, "osdmap", e) > 0) {
-      dout(20) << "send_incremental    inc " << e << " " << bl.length() << " bytes" << endl;
+      dout(20) << "send_incremental    inc " << e << " " << bl.length() << " bytes" << dendl;
       m->incremental_maps[e] = bl;
     } 
     else if (mon->store->get_bl_sn(bl, "osdmap_full", e) > 0) {
-      dout(20) << "send_incremental   full " << e << endl;
+      dout(20) << "send_incremental   full " << e << dendl;
       m->maps[e] = bl;
     }
     else {
@@ -624,7 +625,7 @@ void OSDMonitor::send_incremental(entity_inst_t dest, epoch_t from)
 void OSDMonitor::bcast_latest_mds()
 {
   epoch_t e = osdmap.get_epoch();
-  dout(1) << "bcast_latest_mds epoch " << e << endl;
+  dout(1) << "bcast_latest_mds epoch " << e << dendl;
   
   // tell mds
   set<int> up;
@@ -639,7 +640,7 @@ void OSDMonitor::bcast_latest_mds()
 void OSDMonitor::bcast_latest_osd()
 {
   epoch_t e = osdmap.get_epoch();
-  dout(1) << "bcast_latest_osd epoch " << e << endl;
+  dout(1) << "bcast_latest_osd epoch " << e << dendl;
 
   // tell osds
   set<int> osds;
@@ -656,7 +657,7 @@ void OSDMonitor::bcast_latest_osd()
 void OSDMonitor::bcast_full_osd()
 {
   epoch_t e = osdmap.get_epoch();
-  dout(1) << "bcast_full_osd epoch " << e << endl;
+  dout(1) << "bcast_full_osd epoch " << e << dendl;
 
   // tell osds
   set<int> osds;
@@ -685,7 +686,7 @@ void OSDMonitor::tick()
     down -= i->second;
     
     if (down.sec() >= g_conf.mon_osd_down_out_interval) {
-      dout(10) << "tick marking osd" << i->first << " OUT after " << down << " sec" << endl;
+      dout(10) << "tick marking osd" << i->first << " OUT after " << down << " sec" << dendl;
       mark_out.push_back(i->first);
     }
   }
@@ -714,7 +715,7 @@ void OSDMonitor::init()
   if (get_map_bl(0, bl)) {  // FIXME
     // yay!
     osdmap.decode(bl);
-    dout(1) << "init got epoch " << osdmap.get_epoch() << " from store" << endl;
+    dout(1) << "init got epoch " << osdmap.get_epoch() << " from store" << dendl;
 
     // set up pending_inc
     pending_inc.epoch = osdmap.get_epoch()+1;
@@ -729,7 +730,7 @@ void OSDMonitor::mark_all_down()
 {
   assert(mon->is_leader());
 
-  dout(7) << "mark_all_down" << endl;
+  dout(7) << "mark_all_down" << dendl;
 
   for (set<int>::iterator it = osdmap.get_osds().begin();
        it != osdmap.get_osds().end();
@@ -761,7 +762,7 @@ void OSDMonitor::mark_all_down()
 
 void OSDMonitor::election_finished()
 {
-  dout(10) << "election_finished" << endl;
+  dout(10) << "election_finished" << dendl;
 
   if (mon->is_leader()) {
     if (g_conf.mkfs) {
@@ -770,7 +771,7 @@ void OSDMonitor::election_finished()
     } else {
       //
       epoch_t epoch = mon->store->get_int("osd_epoch");
-      dout(10) << " last epoch was " << epoch << endl;
+      dout(10) << " last epoch was " << epoch << dendl;
       bufferlist bl, blinc;
       int r = mon->store->get_bl_sn(bl, "osdmap_full", epoch);
       assert(r>0);
index 5865229dde14556adc902329cfe6cd7607197371..1babdc677232cc8d578bc274cfd22e2e17b50ddd 100644 (file)
 #include "common/Timer.h"
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
 
 
 
 void PGMonitor::create_initial()
 {
-  dout(1) << "create_initial -- creating initial map" << endl;
+  dout(1) << "create_initial -- creating initial map" << dendl;
 }
 
 bool PGMonitor::update_from_paxos()
@@ -47,7 +47,7 @@ bool PGMonitor::update_from_paxos()
   if (pg_map.version == 0 && paxosv > 1 &&
       mon->store->exists_bl_ss("pgmap","latest")) {
     // starting up: load latest
-    dout(7) << "update_from_paxos startup: loading latest full pgmap" << endl;
+    dout(7) << "update_from_paxos startup: loading latest full pgmap" << dendl;
     bufferlist bl;
     mon->store->get_bl_ss(bl, "pgmap", "latest");
     int off = 0;
@@ -59,14 +59,14 @@ bool PGMonitor::update_from_paxos()
     bufferlist bl;
     bool success = paxos->read(pg_map.version+1, bl);
     if (success) {
-      dout(7) << "update_from_paxos  applying incremental " << pg_map.version+1 << endl;
+      dout(7) << "update_from_paxos  applying incremental " << pg_map.version+1 << dendl;
       PGMap::Incremental inc;
       int off = 0;
       inc._decode(bl, off);
       pg_map.apply_incremental(inc);
       
     } else {
-      dout(7) << "update_from_paxos  couldn't read incremental " << pg_map.version+1 << endl;
+      dout(7) << "update_from_paxos  couldn't read incremental " << pg_map.version+1 << dendl;
       return false;
     }
   }
@@ -83,20 +83,20 @@ void PGMonitor::create_pending()
 {
   pending_inc = PGMap::Incremental();
   pending_inc.version = pg_map.version + 1;
-  dout(10) << "create_pending v " << pending_inc.version << endl;
+  dout(10) << "create_pending v " << pending_inc.version << dendl;
 }
 
 void PGMonitor::encode_pending(bufferlist &bl)
 {
   assert(mon->is_leader());
-  dout(10) << "encode_pending v " << pending_inc.version << endl;
+  dout(10) << "encode_pending v " << pending_inc.version << dendl;
   assert(paxos->get_version() + 1 == pending_inc.version);
   pending_inc._encode(bl);
 }
 
 bool PGMonitor::preprocess_query(Message *m)
 {
-  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
 
   switch (m->get_type()) {
   case MSG_STATFS:
@@ -113,7 +113,7 @@ bool PGMonitor::preprocess_query(Message *m)
            pg_map.pg_stat[p->first].reported < p->second.reported)
          return false;
       }
-      dout(10) << " message contains no new pg stats" << endl;
+      dout(10) << " message contains no new pg stats" << dendl;
       return true;
     }
 
@@ -126,7 +126,7 @@ bool PGMonitor::preprocess_query(Message *m)
 
 bool PGMonitor::prepare_update(Message *m)
 {
-  dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
   switch (m->get_type()) {
   case MSG_PGSTATS:
     return handle_pg_stats((MPGStats*)m);
@@ -141,7 +141,7 @@ bool PGMonitor::prepare_update(Message *m)
 
 void PGMonitor::handle_statfs(MStatfs *statfs)
 {
-  dout(10) << "handle_statfs " << *statfs << " from " << statfs->get_source() << endl;
+  dout(10) << "handle_statfs " << *statfs << " from " << statfs->get_source() << dendl;
 
   // fill out stfs
   MStatfsReply *reply = new MStatfsReply(statfs->tid);
@@ -164,7 +164,7 @@ void PGMonitor::handle_statfs(MStatfs *statfs)
 
 bool PGMonitor::handle_pg_stats(MPGStats *stats) 
 {
-  dout(10) << "handle_pg_stats " << *stats << " from " << stats->get_source() << endl;
+  dout(10) << "handle_pg_stats " << *stats << " from " << stats->get_source() << dendl;
   
   for (map<pg_t,pg_stat_t>::iterator p = stats->pg_stat.begin();
        p != stats->pg_stat.end();
@@ -172,17 +172,17 @@ bool PGMonitor::handle_pg_stats(MPGStats *stats)
     pg_t pgid;
     if ((pg_map.pg_stat.count(pgid) && 
         pg_map.pg_stat[pgid].reported >= p->second.reported)) {
-      dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported << endl;
+      dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported << dendl;
       continue;
     }
     if (pending_inc.pg_stat_updates.count(pgid) && 
        pending_inc.pg_stat_updates[pgid].reported >= p->second.reported) {
       dout(15) << " had " << pgid << " from " << pending_inc.pg_stat_updates[pgid].reported
-              << " (pending)" << endl;
+              << " (pending)" << dendl;
       continue;
     }
 
-    dout(15) << " got " << pgid << " reported at " << p->second.reported << endl;
+    dout(15) << " got " << pgid << " reported at " << p->second.reported << dendl;
     pending_inc.pg_stat_updates[pgid] = p->second;
 
     // we don't care about consistency; apply to live map.
index 0ecf0f5a6caf8acc8b2106f076261adcb5d29ca5..75601ab0a277621f136d032d9474253347bb0ce8 100644 (file)
@@ -19,9 +19,9 @@
 #include "messages/MMonPaxos.h"
 
 #include "config.h"
-#undef dout
-#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cerr << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
+
+#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cerr << dbeginl << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << dbeginl << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
 
 
 void Paxos::init()
@@ -31,7 +31,7 @@ void Paxos::init()
   accepted_pn = mon->store->get_int(machine_name, "accepted_pn");
   last_committed = mon->store->get_int(machine_name, "last_committed");
 
-  dout(10) << "init" << endl;
+  dout(10) << "init" << dendl;
 }
 
 // ---------------------------------
@@ -57,14 +57,14 @@ void Paxos::collect(version_t oldpn)
     mon->store->get_bl_sn(uncommitted_value, machine_name, last_committed+1);
     dout(10) << "learned uncommitted " << (last_committed+1)
             << " (" << uncommitted_value.length() << " bytes) from myself" 
-            << endl;
+            << dendl;
   }
 
   // pick new pn
   accepted_pn = get_new_proposal_number(MAX(accepted_pn, oldpn));
   accepted_pn_from = last_committed;
   num_last = 1;
-  dout(10) << "collect with pn " << accepted_pn << endl;
+  dout(10) << "collect with pn " << accepted_pn << dendl;
 
   // send collect
   for (set<int>::const_iterator p = mon->get_quorum().begin();
@@ -84,7 +84,7 @@ void Paxos::collect(version_t oldpn)
 // peon
 void Paxos::handle_collect(MMonPaxos *collect)
 {
-  dout(10) << "handle_collect " << *collect << endl;
+  dout(10) << "handle_collect " << *collect << dendl;
 
   assert(mon->is_peon()); // mon epoch filter should catch strays
 
@@ -102,7 +102,7 @@ void Paxos::handle_collect(MMonPaxos *collect)
     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 
-            << " (" << bl.length() << " bytes)" << endl;
+            << " (" << bl.length() << " bytes)" << dendl;
     last->values[last_committed+1] = bl;
     last->uncommitted_pn = accepted_pn;
   }
@@ -112,13 +112,13 @@ void Paxos::handle_collect(MMonPaxos *collect)
     // ok, accept it
     accepted_pn = collect->pn;
     accepted_pn_from = collect->pn_from;
-    dout(10) << "accepting pn " << accepted_pn << " from " << accepted_pn_from << endl;
+    dout(10) << "accepting pn " << accepted_pn << " from " << accepted_pn_from << dendl;
     mon->store->put_int(accepted_pn, machine_name, "accepted_pn");
   } 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;
+            << dendl;
   }
   last->pn = accepted_pn;
   last->pn_from = accepted_pn_from;
@@ -130,7 +130,7 @@ void Paxos::handle_collect(MMonPaxos *collect)
     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;
+              << last->values[v].length() << " bytes)" << dendl;
     }
   }
 
@@ -143,10 +143,10 @@ void Paxos::handle_collect(MMonPaxos *collect)
 // leader
 void Paxos::handle_last(MMonPaxos *last)
 {
-  dout(10) << "handle_last " << *last << endl;
+  dout(10) << "handle_last " << *last << dendl;
 
   if (!mon->is_leader()) {
-    dout(10) << "not leader, dropping" << endl;
+    dout(10) << "not leader, dropping" << dendl;
     delete last;
     return;
   }
@@ -154,14 +154,14 @@ void Paxos::handle_last(MMonPaxos *last)
   // share committed values?
   if (last->last_committed < last_committed) {
     // share committed values
-    dout(10) << "sending commit to " << last->get_source() << endl;
+    dout(10) << "sending commit to " << last->get_source() << dendl;
     MMonPaxos *commit = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_COMMIT, machine_id);
     for (version_t v = last->last_committed+1;
         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;
+              << commit->values[v].length() << " bytes)" << dendl;
     }
     commit->last_committed = last_committed;
     mon->messenger->send_message(commit, last->get_source_inst());
@@ -174,23 +174,23 @@ void Paxos::handle_last(MMonPaxos *last)
         v++) {
       mon->store->put_bl_sn(last->values[v], machine_name, v);
       dout(10) << "committing " << v << " " 
-              << last->values[v].length() << " bytes" << endl;
+              << last->values[v].length() << " bytes" << dendl;
     }
     last_committed = last->last_committed;
     mon->store->put_int(last_committed, machine_name, "last_committed");
-    dout(10) << "last_committed now " << last_committed << endl;
+    dout(10) << "last_committed now " << last_committed << dendl;
   }
       
   // do they accept your pn?
   if (last->pn > accepted_pn) {
     // no, try again.
-    dout(10) << " they had a higher pn than us, picking a new one." << endl;
+    dout(10) << " they had a higher pn than us, picking a new one." << dendl;
     collect(last->pn);
   } else {
     // yes, they accepted our pn.  great.
     num_last++;
     dout(10) << " they accepted our pn, we now have " 
-            << num_last << " peons" << endl;
+            << num_last << " peons" << dendl;
 
     // did this person send back an accepted but uncommitted value?
     if (last->uncommitted_pn &&
@@ -201,7 +201,7 @@ void Paxos::handle_last(MMonPaxos *last)
       dout(10) << "we learned an uncommitted value for " << uncommitted_v 
               << " pn " << uncommitted_pn
               << " " << uncommitted_value.length() << " bytes"
-              << endl;
+              << dendl;
     }
     
     // is that everyone?
@@ -212,11 +212,11 @@ void Paxos::handle_last(MMonPaxos *last)
       // did we learn an old value?
       if (uncommitted_v == last_committed+1 &&
          uncommitted_value.length()) {
-       dout(10) << "that's everyone.  begin on old learned value" << endl;
+       dout(10) << "that's everyone.  begin on old learned value" << dendl;
        begin(uncommitted_value);
       } else {
        // active!
-       dout(10) << "that's everyone.  active!" << endl;
+       dout(10) << "that's everyone.  active!" << dendl;
        extend_lease();
 
        // wake people up
@@ -236,7 +236,7 @@ void Paxos::begin(bufferlist& v)
 {
   dout(10) << "begin for " << last_committed+1 << " " 
           << v.length() << " bytes"
-          << endl;
+          << dendl;
 
   assert(mon->is_leader());
   assert(is_active());
@@ -272,7 +272,7 @@ void Paxos::begin(bufferlist& v)
        ++p) {
     if (*p == whoami) continue;
     
-    dout(10) << " sending begin to mon" << *p << endl;
+    dout(10) << " sending begin to mon" << *p << dendl;
     MMonPaxos *begin = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_BEGIN, machine_id);
     begin->values[last_committed+1] = new_value;
     begin->last_committed = last_committed;
@@ -289,11 +289,11 @@ void Paxos::begin(bufferlist& v)
 // peon
 void Paxos::handle_begin(MMonPaxos *begin)
 {
-  dout(10) << "handle_begin " << *begin << endl;
+  dout(10) << "handle_begin " << *begin << dendl;
 
   // can we accept this?
   if (begin->pn < accepted_pn) {
-    dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << endl;
+    dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << dendl;
     delete begin;
     return;
   }
@@ -306,7 +306,7 @@ void Paxos::handle_begin(MMonPaxos *begin)
 
   // yes.
   version_t v = last_committed+1;
-  dout(10) << "accepting value for " << v << " pn " << accepted_pn << endl;
+  dout(10) << "accepting value for " << v << " pn " << accepted_pn << dendl;
   mon->store->put_bl_sn(begin->values[v], machine_name, v);
   
   // reply
@@ -321,18 +321,18 @@ void Paxos::handle_begin(MMonPaxos *begin)
 // leader
 void Paxos::handle_accept(MMonPaxos *accept)
 {
-  dout(10) << "handle_accept " << *accept << endl;
+  dout(10) << "handle_accept " << *accept << dendl;
   int from = accept->get_source().num();
 
   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;
+    dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << dendl;
     delete accept;
     return;
   }
   if (last_committed > 0 &&
       accept->last_committed < last_committed-1) {
-    dout(10) << " this is from an old round, ignoring" << endl;
+    dout(10) << " this is from an old round, ignoring" << dendl;
     delete accept;
     return;
   }
@@ -342,19 +342,19 @@ void Paxos::handle_accept(MMonPaxos *accept)
   assert(state == STATE_UPDATING);
   assert(accepted.count(from) == 0);
   accepted.insert(from);
-  dout(10) << " now " << accepted << " have accepted" << endl;
+  dout(10) << " now " << accepted << " have accepted" << dendl;
 
   // new majority?
   if (accepted.size() == (unsigned)mon->monmap->num_mon/2+1) {
     // yay, commit!
     // note: this may happen before the lease is reextended (below)
-    dout(10) << " got majority, committing" << endl;
+    dout(10) << " got majority, committing" << dendl;
     commit();
   }
 
   // done?
   if (accepted == mon->get_quorum()) {
-    dout(10) << " got quorum, done with update" << endl;
+    dout(10) << " got quorum, done with update" << dendl;
     // cancel timeout event
     mon->timer.cancel_event(accept_timeout_event);
     accept_timeout_event = 0;
@@ -373,7 +373,7 @@ void Paxos::handle_accept(MMonPaxos *accept)
 
 void Paxos::accept_timeout()
 {
-  dout(5) << "accept timeout, calling fresh election" << endl;
+  dout(5) << "accept timeout, calling fresh election" << dendl;
   accept_timeout_event = 0;
   assert(mon->is_leader());
   assert(is_updating());
@@ -383,7 +383,7 @@ void Paxos::accept_timeout()
 
 void Paxos::commit()
 {
-  dout(10) << "commit " << last_committed+1 << endl;
+  dout(10) << "commit " << last_committed+1 << dendl;
 
   // commit locally
   last_committed++;
@@ -395,7 +395,7 @@ void Paxos::commit()
        ++p) {
     if (*p == whoami) continue;
 
-    dout(10) << " sending commit to mon" << *p << endl;
+    dout(10) << " sending commit to mon" << *p << dendl;
     MMonPaxos *commit = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_COMMIT, machine_id);
     commit->values[last_committed] = new_value;
     commit->pn = accepted_pn;
@@ -410,10 +410,10 @@ void Paxos::commit()
 
 void Paxos::handle_commit(MMonPaxos *commit)
 {
-  dout(10) << "handle_commit on " << commit->last_committed << endl;
+  dout(10) << "handle_commit on " << commit->last_committed << dendl;
 
   if (!mon->is_peon()) {
-    dout(10) << "not a peon, dropping" << endl;
+    dout(10) << "not a peon, dropping" << dendl;
     assert(0);
     delete commit;
     return;
@@ -425,7 +425,7 @@ void Paxos::handle_commit(MMonPaxos *commit)
        ++p) {
     assert(p->first == last_committed+1);
     last_committed = p->first;
-    dout(10) << " storing " << last_committed << " (" << p->second.length() << " bytes)" << endl;
+    dout(10) << " storing " << last_committed << " (" << p->second.length() << " bytes)" << dendl;
     mon->store->put_bl_sn(p->second, machine_name, last_committed);
   }
   mon->store->put_int(last_committed, machine_name, "last_committed");
@@ -443,7 +443,7 @@ void Paxos::extend_lease()
   acked_lease.clear();
   acked_lease.insert(whoami);
 
-  dout(7) << "extend_lease now+" << g_conf.mon_lease << " (" << lease_expire << ")" << endl;
+  dout(7) << "extend_lease now+" << g_conf.mon_lease << " (" << lease_expire << ")" << dendl;
 
   // bcast
   for (set<int>::const_iterator p = mon->get_quorum().begin();
@@ -478,7 +478,7 @@ void Paxos::handle_lease(MMonPaxos *lease)
   // sanity
   if (!mon->is_peon() ||
       last_committed != lease->last_committed) {
-    dout(10) << "handle_lease i'm not a peon, or they're not the leader, or the last_committed doesn't match, dropping" << endl;
+    dout(10) << "handle_lease i'm not a peon, or they're not the leader, or the last_committed doesn't match, dropping" << dendl;
     delete lease;
     return;
   }
@@ -490,7 +490,7 @@ void Paxos::handle_lease(MMonPaxos *lease)
   state = STATE_ACTIVE;
   
   dout(10) << "handle_lease on " << lease->last_committed
-          << " now " << lease_expire << endl;
+          << " now " << lease_expire << dendl;
 
   // ack
   MMonPaxos *ack = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_LEASE_ACK, machine_id);
@@ -517,7 +517,7 @@ void Paxos::handle_lease_ack(MMonPaxos *ack)
   int from = ack->get_source().num();
 
   if (!lease_ack_timeout_event) {
-    dout(10) << "handle_lease_ack from " << ack->get_source() << " -- stray (probably since revoked)" << endl;
+    dout(10) << "handle_lease_ack from " << ack->get_source() << " -- stray (probably since revoked)" << dendl;
   }
   else if (acked_lease.count(from) == 0) {
     acked_lease.insert(from);
@@ -525,18 +525,18 @@ void Paxos::handle_lease_ack(MMonPaxos *ack)
     if (acked_lease == mon->get_quorum()) {
       // yay!
       dout(10) << "handle_lease_ack from " << ack->get_source() 
-              << " -- got everyone" << endl;
+              << " -- got everyone" << dendl;
       mon->timer.cancel_event(lease_ack_timeout_event);
       lease_ack_timeout_event = 0;
     } else {
       dout(10) << "handle_lease_ack from " << ack->get_source() 
               << " -- still need "
               << mon->get_quorum().size() - acked_lease.size()
-              << " more" << endl;
+              << " more" << dendl;
     }
   } else {
     dout(10) << "handle_lease_ack from " << ack->get_source() 
-            << " dup (lagging!), ignoring" << endl;
+            << " dup (lagging!), ignoring" << dendl;
   }
   
   delete ack;
@@ -544,7 +544,7 @@ void Paxos::handle_lease_ack(MMonPaxos *ack)
 
 void Paxos::lease_ack_timeout()
 {
-  dout(5) << "lease_ack_timeout -- calling new election" << endl;
+  dout(5) << "lease_ack_timeout -- calling new election" << dendl;
   assert(mon->is_leader());
   assert(is_active());
 
@@ -555,7 +555,7 @@ void Paxos::lease_ack_timeout()
 
 void Paxos::lease_timeout()
 {
-  dout(5) << "lease_timeout -- calling new election" << endl;
+  dout(5) << "lease_timeout -- calling new election" << dendl;
   assert(mon->is_peon());
 
   lease_timeout_event = 0;
@@ -587,7 +587,7 @@ version_t Paxos::get_new_proposal_number(version_t gt)
   // write
   mon->store->put_int(last_pn, machine_name, "last_pn");
 
-  dout(10) << "get_new_proposal_number = " << last_pn << endl;
+  dout(10) << "get_new_proposal_number = " << last_pn << dendl;
   return last_pn;
 }
 
@@ -621,7 +621,7 @@ void Paxos::leader_init()
   cancel_events();
   state = STATE_RECOVERING;
   lease_expire = utime_t();
-  dout(10) << "leader_init -- starting paxos recovery" << endl;
+  dout(10) << "leader_init -- starting paxos recovery" << dendl;
   collect(0);
 }
 
@@ -630,7 +630,7 @@ void Paxos::peon_init()
   cancel_events();
   state = STATE_RECOVERING;
   lease_expire = utime_t();
-  dout(10) << "peon_init -- i am a peon" << endl;
+  dout(10) << "peon_init -- i am a peon" << dendl;
 
   // no chance to write now!
   finish_contexts(waiting_for_writeable, -1);
@@ -639,7 +639,7 @@ void Paxos::peon_init()
 
 void Paxos::election_starting()
 {
-  dout(10) << "election_starting -- canceling timeouts" << endl;
+  dout(10) << "election_starting -- canceling timeouts" << dendl;
   cancel_events();
   new_value.clear();
 
@@ -651,7 +651,7 @@ void Paxos::dispatch(Message *m)
 {
   // election in progress?
   if (mon->is_starting()) {
-    dout(5) << "election in progress, dropping " << *m << endl;
+    dout(5) << "election in progress, dropping " << *m << dendl;
     delete m;
     return;    
   }
@@ -711,7 +711,7 @@ void Paxos::dispatch(Message *m)
 
 bool Paxos::is_readable()
 {
-  //dout(15) << "is_readable now=" << g_clock.now() << " lease_expire=" << lease_expire << endl;
+  //dout(15) << "is_readable now=" << g_clock.now() << " lease_expire=" << lease_expire << dendl;
   return 
     (mon->is_peon() || mon->is_leader()) &&
     is_active() &&
@@ -759,7 +759,7 @@ bool Paxos::propose_new_value(bufferlist& bl, Context *oncommit)
   // writeable?
   if (!is_writeable()) {
     dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes"
-           << " -- not writeable" << endl;
+           << " -- not writeable" << dendl;
     if (oncommit) {
       oncommit->finish(-1);
       delete oncommit;
@@ -774,7 +774,7 @@ bool Paxos::propose_new_value(bufferlist& bl, Context *oncommit)
   cancel_events();
 
   // ok!
-  dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes" << endl;
+  dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes" << dendl;
   if (oncommit)
     waiting_for_commit.push_back(oncommit);
   begin(bl);
index 6f4fba2d6c27dafde48e8556249bb21fad17342a..1666d683a40de56abeeb250f848e645ce60ca7d0 100644 (file)
 
 
 #include "config.h"
-#undef dout
-#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxosservice(" << get_paxos_name(paxos->machine_id) << ") "
-//#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << "." << get_paxos_name(paxos->machine_id) << " "
+
+#define  dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxosservice(" << get_paxos_name(paxos->machine_id) << ") "
+//#define  derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << "." << get_paxos_name(paxos->machine_id) << " "
 
 
 
 
 void PaxosService::dispatch(Message *m)
 {
-  dout(10) << "dispatch " << *m << " from " << m->get_source_inst() << endl;
+  dout(10) << "dispatch " << *m << " from " << m->get_source_inst() << dendl;
   
   // make sure our map is readable and up to date
   if (!paxos->is_readable()) {
-    dout(10) << " waiting for paxos -> readable" << endl;
+    dout(10) << " waiting for paxos -> readable" << dendl;
     paxos->wait_for_readable(new C_RetryMessage(this, m));
     return;
   }
@@ -47,14 +47,14 @@ void PaxosService::dispatch(Message *m)
   // leader?
   if (!mon->is_leader()) {
     // fw to leader
-    dout(10) << " fw to leader mon" << mon->get_leader() << endl;
+    dout(10) << " fw to leader mon" << mon->get_leader() << dendl;
     mon->messenger->send_message(m, mon->monmap->get_inst(mon->get_leader()));
     return;
   }
   
   // writeable?
   if (!paxos->is_writeable()) {
-    dout(10) << " waiting for paxos -> writeable" << endl;
+    dout(10) << " waiting for paxos -> writeable" << dendl;
     paxos->wait_for_writeable(new C_RetryMessage(this, m));
     return;
   }
@@ -67,11 +67,11 @@ void PaxosService::dispatch(Message *m)
 
 void PaxosService::_commit()
 {
-  dout(7) << "_commit" << endl;
+  dout(7) << "_commit" << dendl;
   update_from_paxos();   // notify service of new paxos state
 
   if (mon->is_leader()) {
-    dout(7) << "_commit creating new pending" << endl;
+    dout(7) << "_commit creating new pending" << dendl;
     assert(have_pending == false);
     create_pending();
     have_pending = true;
@@ -81,7 +81,7 @@ void PaxosService::_commit()
 
 void PaxosService::propose_pending()
 {
-  dout(10) << "propose_pending" << endl;
+  dout(10) << "propose_pending" << dendl;
   assert(have_pending);
 
   // finish and encode
@@ -97,7 +97,7 @@ void PaxosService::propose_pending()
 
 void PaxosService::election_finished()
 {
-  dout(10) << "election_finished" << endl;
+  dout(10) << "election_finished" << dendl;
 
   if (have_pending && 
       !mon->is_leader()) {
@@ -114,7 +114,7 @@ void PaxosService::election_finished()
 
 void PaxosService::_active()
 {
-  dout(10) << "_active" << endl;
+  dout(10) << "_active" << dendl;
   assert(paxos->is_active());
 
   // pull latest from paxos
index 0715dbb5b3b73daba85f6d5b9bb8822126e95cc2..fb7514e49458b3091d6f67bd1f44aedc43b2da72 100644 (file)
@@ -25,8 +25,6 @@
 
 #include "config.h"
 
-#include "debug.h"
-#undef dout
 #define dout(x) if ((x) <= g_conf.debug_ms) cout << dbeginl << g_clock.now() << " "
 
 
index 766f90fb41fb8668cc49013c9794f347b554ad76..bcc519af9b95e866aced9f9bbd6eef4eceb72c0f 100644 (file)
@@ -94,8 +94,8 @@ using namespace std;
 #include "messages/MLock.h"
 
 #include "config.h"
-#undef  dout
-#define dout(l)    if (l<=g_conf.debug) cout << "messenger: "
+
+#define dout(l)    if (l<=g_conf.debug) cout << dbeginl << g_clock.now() << " MESSENGER: "
 #define DEBUGLVL  10    // debug level of output
 
 
@@ -354,7 +354,7 @@ decode_message(msg_envelope_t& env, bufferlist& payload)
     break;
 
   default:
-    dout(1) << "can't decode unknown message type " << env.type << endl;
+    dout(1) << "can't decode unknown message type " << env.type << dendl;
     assert(0);
   }
   
index 1929eca62e93d6d17b90ec484ed8324127c6ef06..7ad9671d4af5443c41825758163927b190652e60 100644 (file)
 #include <iostream>
 #include <fstream>
 
+#include "debug.h"
 #undef dout
-#define dout(l)  if (l<=g_conf.debug_ms) cout << g_clock.now() << " -- " << rank.my_addr << " "
-#define derr(l)  if (l<=g_conf.debug_ms) cerr << g_clock.now() << " -- " << rank.my_addr << " "
+#define dout(l)  if (l<=g_conf.debug_ms) cout << dbeginl << g_clock.now() << " -- " << rank.my_addr << " "
+#define derr(l)  if (l<=g_conf.debug_ms) cerr << dbeginl << g_clock.now() << " -- " << rank.my_addr << " "
 
 
 
@@ -59,7 +60,7 @@ void simplemessenger_sigint(int r)
 void Rank::sigint()
 {
   lock.Lock();
-  derr(0) << "got control-c, exiting" << endl;
+  derr(0) << "got control-c, exiting" << dendl;
   
   // force close listener socket
   ::close(accepter.listen_sd);
@@ -77,17 +78,17 @@ void Rank::sigint()
 
 void noop_signal_handler(int s)
 {
-  //cout << "blah_handler got " << s << endl;
+  //dout(0) << "blah_handler got " << s << dendl;
 }
 
 int Rank::Accepter::start()
 {
   // bind to a socket
-  dout(10) << "accepter.start" << endl;
+  dout(10) << "accepter.start" << dendl;
   
   char hostname[100];
   gethostname(hostname, 100);
-  dout(1) << "accepter.start my hostname is " << hostname << endl;
+  dout(1) << "accepter.start my hostname is " << hostname << dendl;
 
   // is there a .ceph_hosts file?
   {
@@ -103,11 +104,11 @@ int Rank::Accepter::start()
        if (!ospace) continue;
        string host = line.substr(0, ospace);
        string addr = line.substr(ospace+1);
-       dout(15) << ".ceph_hosts: host '" << host << "' -> '" << addr << "'" << endl;
+       dout(15) << ".ceph_hosts: host '" << host << "' -> '" << addr << "'" << dendl;
        if (host == hostname) {
          parse_ip_port(addr.c_str(), g_my_addr);
          g_my_addr.nonce = getpid(); // FIXME: pid might not be best choice here.
-         dout(0) << ".ceph_hosts: my addr is " << g_my_addr << endl;
+         dout(0) << ".ceph_hosts: my addr is " << g_my_addr << dendl;
          break;
        }
       }
@@ -125,14 +126,14 @@ int Rank::Accepter::start()
   /* bind to port */
   int rc = bind(listen_sd, (struct sockaddr *) &rank.listen_addr, sizeof(rank.listen_addr));
   if (rc < 0) 
-    derr(0) << "accepter.start unable to bind to " << rank.listen_addr << endl;
+    derr(0) << "accepter.start unable to bind to " << rank.listen_addr << dendl;
   assert(rc >= 0);
 
   // what port did we get?
   socklen_t llen = sizeof(rank.listen_addr);
   getsockname(listen_sd, (sockaddr*)&rank.listen_addr, &llen);
   
-  dout(10) << "accepter.start bound to " << rank.listen_addr << endl;
+  dout(10) << "accepter.start bound to " << rank.listen_addr << dendl;
 
   // listen!
   rc = ::listen(listen_sd, 1000);
@@ -156,7 +157,7 @@ int Rank::Accepter::start()
     rank.my_addr.nonce = getpid(); // FIXME: pid might not be best choice here.
   }
 
-  dout(10) << "accepter.start my addr is " << rank.my_addr << endl;
+  dout(10) << "accepter.start my addr is " << rank.my_addr << dendl;
 
   // set up signal handler
   old_sigint_handler = signal(SIGINT, simplemessenger_sigint);
@@ -175,15 +176,15 @@ int Rank::Accepter::start()
 
 void *Rank::Accepter::entry()
 {
-  dout(10) << "accepter starting" << endl;
+  dout(10) << "accepter starting" << dendl;
   
   fd_set fds;
   while (!done) {
     FD_ZERO(&fds);
     FD_SET(listen_sd, &fds);
-    dout(20) << "accepter calling select" << endl;
+    dout(20) << "accepter calling select" << dendl;
     int r = ::select(listen_sd+1, &fds, 0, &fds, 0);
-    dout(20) << "accepter select got " << r << endl;
+    dout(20) << "accepter select got " << r << dendl;
     
     if (done) break;
 
@@ -192,7 +193,7 @@ void *Rank::Accepter::entry()
     socklen_t slen = sizeof(addr);
     int sd = ::accept(listen_sd, (sockaddr*)&addr, &slen);  // FIXME: make this non-blocking.
     if (sd > 0) {
-      dout(10) << "accepted incoming on sd " << sd << endl;
+      dout(10) << "accepted incoming on sd " << sd << dendl;
       
       rank.lock.Lock();
       if (!rank.local.empty()) {
@@ -201,7 +202,7 @@ void *Rank::Accepter::entry()
       }
       rank.lock.Unlock();
     } else {
-      dout(10) << "no incoming connection?" << endl;
+      dout(10) << "no incoming connection?" << dendl;
     }
   }
 
@@ -237,7 +238,7 @@ int Rank::Pipe::accept()
   // identify peer
   rc = tcp_read(sd, (char*)&peer_addr, sizeof(peer_addr));
   if (rc < 0) {
-    dout(10) << "pipe(? " << this << ").accept couldn't read peer inst" << endl;
+    dout(10) << "pipe(? " << this << ").accept couldn't read peer inst" << dendl;
     ::close(sd);
     done = true;
     return -1;
@@ -252,19 +253,19 @@ int Rank::Pipe::accept()
   {
     if (rank.rank_pipe.count(peer_addr) == 0) {
       // install a pipe!
-      dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr << endl;
+      dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr << dendl;
       rank.rank_pipe[peer_addr] = this;
     } else {
       // low ranks' Pipes "win"
       if (peer_addr < rank.my_addr) {
        dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr 
-                << ", already had pipe, but switching to this new one" << endl;
+                << ", already had pipe, but switching to this new one" << dendl;
        // switch to this new Pipe
        rank.rank_pipe[peer_addr]->close();  // close old one
        rank.rank_pipe[peer_addr] = this;
       } else {
        dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr 
-                << ", already had pipe, sticking with it" << endl;
+                << ", already had pipe, sticking with it" << dendl;
       }
     }
   }
@@ -275,7 +276,7 @@ int Rank::Pipe::accept()
 
 int Rank::Pipe::connect()
 {
-  dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect" << endl;
+  dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect" << dendl;
 
   // create socket?
   sd = socket(AF_INET,SOCK_STREAM,0);
@@ -296,7 +297,7 @@ int Rank::Pipe::connect()
   rc = ::connect(sd, (sockaddr*)&tcpaddr, sizeof(myAddr));
   if (rc < 0) {
     dout(10) << "connect error " << peer_addr
-            << ", " << errno << ": " << strerror(errno) << endl;
+            << ", " << errno << ": " << strerror(errno) << dendl;
     return rc;
   }
 
@@ -304,11 +305,11 @@ int Rank::Pipe::connect()
   entity_addr_t paddr;
   rc = tcp_read(sd, (char*)&paddr, sizeof(paddr));
   if (!rc) { // bool
-    dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect couldn't read peer addr" << endl;
+    dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect couldn't read peer addr" << dendl;
     return -1;
   }
   if (peer_addr != paddr) {
-    dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect peer identifies itself as " << paddr << ", wrong guy!" << endl;
+    dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect peer identifies itself as " << paddr << ", wrong guy!" << dendl;
     ::close(sd);
     sd = 0;
     return -1;
@@ -323,11 +324,11 @@ int Rank::Pipe::connect()
   rank.lock.Lock();
   {
     if (rank.rank_pipe.count(peer_addr) == 0) {
-      dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect registering pipe" << endl;
+      dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect registering pipe" << dendl;
       rank.rank_pipe[peer_addr] = this;
     } else {
       // this is normal.
-      dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect pipe already registered." << endl;
+      dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect pipe already registered." << dendl;
     }
   }
   rank.lock.Unlock();
@@ -342,7 +343,7 @@ int Rank::Pipe::connect()
 
 void Rank::Pipe::close()
 {
-  dout(10) << "pipe(" << peer_addr << ' ' << this << ").close" << endl;
+  dout(10) << "pipe(" << peer_addr << ' ' << this << ").close" << dendl;
 
   // unreg ourselves
   rank.lock.Lock();
@@ -350,7 +351,7 @@ void Rank::Pipe::close()
     if (rank.rank_pipe.count(peer_addr) &&
         rank.rank_pipe[peer_addr] == this) {
       dout(10) << "pipe(" << peer_addr << ' ' << this
-              << ").close unregistering pipe" << endl;
+              << ").close unregistering pipe" << dendl;
       rank.rank_pipe.erase(peer_addr);
     }
   }
@@ -359,16 +360,16 @@ void Rank::Pipe::close()
   // queue close message?
   if (!need_to_send_close) {
     dout(10) << "pipe(" << peer_addr << ' ' << this
-            << ").close already closing/closed" << endl;
+            << ").close already closing/closed" << dendl;
     return;
   }
   
   if (!writer_running) {
     dout(10) << "pipe(" << peer_addr << ' ' << this
-            << ").close not queueing MSG_CLOSE, no writer running" << endl;  
+            << ").close not queueing MSG_CLOSE, no writer running" << dendl;  
   } else {
     dout(10) << "pipe(" << peer_addr << ' ' << this
-            << ").close queueing MSG_CLOSE" << endl;
+            << ").close queueing MSG_CLOSE" << dendl;
     lock.Lock();
     q.push_back(new MGenericMessage(MSG_CLOSE));
     cond.Signal();
@@ -393,10 +394,10 @@ void Rank::Pipe::reader()
     if (!m || m->get_type() == 0) {
       if (m) {
        delete m;
-       dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader read MSG_CLOSE message" << endl;
+       dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader read MSG_CLOSE message" << dendl;
        need_to_send_close = false;
       } else {
-       derr(10) << "pipe(" << peer_addr << ' ' << this << ").reader read null message" << endl;
+       derr(10) << "pipe(" << peer_addr << ' ' << this << ").reader read null message" << dendl;
       }
 
       close();
@@ -406,7 +407,7 @@ void Rank::Pipe::reader()
       break;
     }
 
-    dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader got message for " << m->get_dest() << endl;
+    dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader got message for " << m->get_dest() << dendl;
 
     EntityMessenger *entity = 0;
 
@@ -425,7 +426,7 @@ void Rank::Pipe::reader()
            if (rank.stopped.count(m->get_dest())) {
              // ignore it
            } else {
-             derr(0) << "pipe(" << peer_addr << ' ' << this << ").reader got message " << *m << " for " << m->get_dest() << ", which isn't local" << endl;
+             derr(0) << "pipe(" << peer_addr << ' ' << this << ").reader got message " << *m << " for " << m->get_dest() << ", which isn't local" << dendl;
              assert(0);  // FIXME do this differently
            }
          }
@@ -449,7 +450,7 @@ void Rank::Pipe::reader()
   lock.Unlock();
 
   if (reap) {
-    dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader queueing for reap" << endl;
+    dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader queueing for reap" << dendl;
     ::close(sd);
     rank.lock.Lock();
     {
@@ -471,7 +472,7 @@ void Rank::Pipe::writer()
     if (rc < 0) {
       derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error connecting, " 
              << errno << ": " << strerror(errno)
-             << endl;
+             << dendl;
       done = true;
       list<Message*> out;
       fail(out);
@@ -483,7 +484,7 @@ void Rank::Pipe::writer()
   while (!q.empty() || !done) {
     
     if (!q.empty()) {
-      dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer grabbing message(s)" << endl;
+      dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer grabbing message(s)" << dendl;
       
       // grab outgoing list
       list<Message*> out;
@@ -496,7 +497,7 @@ void Rank::Pipe::writer()
         Message *m = out.front();
         out.pop_front();
 
-        dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sending " << *m << endl;
+        dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sending " << *m << dendl;
 
         // stamp.
         m->set_source_addr(rank.my_addr);
@@ -509,7 +510,7 @@ void Rank::Pipe::writer()
           // failed!
           derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error sending " << *m << " to " << m->get_dest()
                  << ", " << errno << ": " << strerror(errno)
-                 << endl;
+                 << dendl;
           out.push_front(m);
           fail(out);
           done = true;
@@ -529,12 +530,12 @@ void Rank::Pipe::writer()
     }
     
     // wait
-    dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sleeping" << endl;
+    dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sleeping" << dendl;
     cond.Wait(lock);
   }
   lock.Unlock(); 
   
-  dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer finishing" << endl;
+  dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer finishing" << dendl;
 
   // reap?
   bool reap = false;
@@ -546,7 +547,7 @@ void Rank::Pipe::writer()
   lock.Unlock();
   
   if (reap) {
-    dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer queueing for reap" << endl;
+    dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer queueing for reap" << dendl;
     ::close(sd);
     rank.lock.Lock();
     {
@@ -561,7 +562,7 @@ void Rank::Pipe::writer()
 Message *Rank::Pipe::read_message()
 {
   // envelope
-  //dout(10) << "receiver.read_message from sd " << sd  << endl;
+  //dout(10) << "receiver.read_message from sd " << sd  << dendl;
   
   msg_envelope_t env; 
   if (!tcp_read( sd, (char*)&env, sizeof(env) )) {
@@ -572,7 +573,7 @@ Message *Rank::Pipe::read_message()
   dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got envelope type=" << env.type 
            << " src " << env.src << " dst " << env.dst
            << " nchunks=" << env.nchunks
-           << endl;
+           << dendl;
   
   // payload
   bufferlist blist;
@@ -595,7 +596,7 @@ Message *Rank::Pipe::read_message()
     blist.push_back(bp);
     
     dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got frag " << i << " of " << env.nchunks 
-             << " len " << bp.length() << endl;
+             << " len " << bp.length() << dendl;
   }
   
   // unmarshall message
@@ -603,7 +604,7 @@ Message *Rank::Pipe::read_message()
   Message *m = decode_message(env, blist);
   
   dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got " << s << " byte message from " 
-           << m->get_source() << endl;
+           << m->get_source() << dendl;
   
   return m;
 }
@@ -625,13 +626,13 @@ int Rank::Pipe::write_message(Message *m)
 
   dout(20)  << "pipe(" << peer_addr << ' ' << this << ").writer sending " << m << " " << *m 
             << " to " << m->get_dest()
-            << endl;
+            << dendl;
   
   // send envelope
   int r = tcp_write( sd, (char*)env, sizeof(*env) );
   if (r < 0) { 
     derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error sending envelope for " << *m
-             << " to " << m->get_dest() << endl; 
+             << " to " << m->get_dest() << dendl; 
     need_to_send_close = false;
     return -1;
   }
@@ -643,17 +644,17 @@ int Rank::Pipe::write_message(Message *m)
   for (list<bufferptr>::const_iterator it = blist.buffers().begin();
        it != blist.buffers().end();
        it++) {
-    dout(10) << "pipe(" << peer_addr << ' ' << this << ").writer tcp_sending frag " << i << " len " << (*it).length() << endl;
+    dout(10) << "pipe(" << peer_addr << ' ' << this << ").writer tcp_sending frag " << i << " len " << (*it).length() << dendl;
     int32_t size = (*it).length();
     r = tcp_write( sd, (char*)&size, sizeof(size) );
     if (r < 0) { 
-      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending chunk len for " << *m << " to " << m->get_dest() << endl; 
+      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending chunk len for " << *m << " to " << m->get_dest() << dendl; 
       need_to_send_close = false;
       return -1;
     }
     r = tcp_write( sd, (*it).c_str(), size );
     if (r < 0) { 
-      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data chunk for " << *m << " to " << m->get_dest() << endl; 
+      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data chunk for " << *m << " to " << m->get_dest() << dendl; 
       need_to_send_close = false;
       return -1;
     }
@@ -664,11 +665,11 @@ int Rank::Pipe::write_message(Message *m)
   int32_t size = blist.length();
   r = tcp_write( sd, (char*)&size, sizeof(size) );
   if (r < 0) { 
-    derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data len for " << *m << " to " << m->get_dest() << endl; 
+    derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data len for " << *m << " to " << m->get_dest() << dendl; 
     need_to_send_close = false;
     return -1;
   }
-  dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer data len is " << size << " in " << blist.buffers().size() << " buffers" << endl;
+  dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer data len is " << size << " in " << blist.buffers().size() << " buffers" << dendl;
 
   for (list<bufferptr>::const_iterator it = blist.buffers().begin();
        it != blist.buffers().end();
@@ -676,7 +677,7 @@ int Rank::Pipe::write_message(Message *m)
     if ((*it).length() == 0) continue;  // blank buffer.
     r = tcp_write( sd, (char*)(*it).c_str(), (*it).length() );
     if (r < 0) { 
-      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data megachunk for " << *m << " to " << m->get_dest() << " : len " << (*it).length() << endl; 
+      derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data megachunk for " << *m << " to " << m->get_dest() << " : len " << (*it).length() << dendl; 
       need_to_send_close = false;
       return -1;
     }
@@ -689,7 +690,7 @@ int Rank::Pipe::write_message(Message *m)
 
 void Rank::Pipe::fail(list<Message*>& out)
 {
-  derr(10) << "pipe(" << peer_addr << ' ' << this << ").fail" << endl;
+  derr(10) << "pipe(" << peer_addr << ' ' << this << ").fail" << dendl;
 
   // FIXME: possible race before i reclaim lock here?
   
@@ -721,7 +722,7 @@ void Rank::Pipe::fail(list<Message*>& out)
         Dispatcher *dis = mgr->get_dispatcher();
        if (mgr->is_stopped()) {
          // ignore.
-         dout(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << *q.front() << ", dispatcher stopping, ignoring." << endl;
+         dout(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << *q.front() << ", dispatcher stopping, ignoring." << dendl;
          delete q.front();
        } else {
          by_dis[dis][q.front()->get_dest()].push_back(q.front());
@@ -746,7 +747,7 @@ void Rank::Pipe::fail(list<Message*>& out)
       for (list<Message*>::iterator k = j->second.begin();
            k != j->second.end();
            ++k) {
-       derr(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << **k << " to " << (*k)->get_dest_inst() << endl;
+       derr(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << **k << " to " << (*k)->get_dest_inst() << dendl;
        if (i->first)
          i->first->ms_handle_failure(*k, (*k)->get_dest_inst());
       }
@@ -777,7 +778,7 @@ Rank::~Rank()
 /*
 void Rank::set_listen_addr(tcpaddr_t& a)
 {
-  dout(10) << "set_listen_addr " << a << endl;
+  dout(10) << "set_listen_addr " << a << dendl;
   memcpy((char*)&listen_addr.sin_addr.s_addr, (char*)&a.sin_addr.s_addr, 4);
   listen_addr.sin_port = a.sin_port;
 }
@@ -815,7 +816,7 @@ void Rank::single_dispatcher_entry()
                  << " <-- " << m->get_source_inst()
                  << " ---- " << *m
                   << " -- " << m 
-                  << endl;
+                  << dendl;
           
          assert(local.count(m->get_dest()));
          local[m->get_dest()]->dispatch(m);
@@ -835,17 +836,17 @@ void Rank::single_dispatcher_entry()
  */
 void Rank::reaper()
 {
-  dout(10) << "reaper" << endl;
+  dout(10) << "reaper" << dendl;
   assert(lock.is_locked());
 
   while (!pipe_reap_queue.empty()) {
     Pipe *p = pipe_reap_queue.front();
-    dout(10) << "reaper reaping pipe " << p->get_peer_addr() << endl;
+    dout(10) << "reaper reaping pipe " << p->get_peer_addr() << dendl;
     pipe_reap_queue.pop_front();
     assert(pipes.count(p));
     pipes.erase(p);
     p->join();
-    dout(10) << "reaper reaped pipe " << p->get_peer_addr() << endl;
+    dout(10) << "reaper reaped pipe " << p->get_peer_addr() << dendl;
     delete p;
   }
 }
@@ -855,11 +856,11 @@ int Rank::start_rank()
 {
   lock.Lock();
   if (started) {
-    dout(10) << "start_rank already started" << endl;
+    dout(10) << "start_rank already started" << dendl;
     lock.Unlock();
     return 0;
   }
-  dout(10) << "start_rank" << endl;
+  dout(10) << "start_rank" << dendl;
   lock.Unlock();
 
   // bind to a socket
@@ -874,7 +875,7 @@ int Rank::start_rank()
 
   lock.Lock();
 
-  dout(1) << "start_rank at " << listen_addr << endl;
+  dout(1) << "start_rank at " << listen_addr << dendl;
   started = true;
   lock.Unlock();
   return 0;
@@ -890,7 +891,7 @@ Rank::Pipe *Rank::connect_rank(const entity_addr_t& addr)
   assert(rank.lock.is_locked());
   assert(addr != rank.my_addr);
   
-  dout(10) << "connect_rank to " << addr << endl;
+  dout(10) << "connect_rank to " << addr << dendl;
   
   // create pipe
   Pipe *pipe = new Pipe(addr);
@@ -924,7 +925,7 @@ Rank::EntityMessenger *Rank::find_unnamed(entity_name_t a)
  */
 Rank::EntityMessenger *Rank::register_entity(entity_name_t name)
 {
-  dout(10) << "register_entity " << name << endl;
+  dout(10) << "register_entity " << name << dendl;
   lock.Lock();
   
   // create messenger
@@ -942,7 +943,7 @@ Rank::EntityMessenger *Rank::register_entity(entity_name_t name)
 void Rank::unregister_entity(EntityMessenger *msgr)
 {
   lock.Lock();
-  dout(10) << "unregister_entity " << msgr->get_myname() << endl;
+  dout(10) << "unregister_entity " << msgr->get_myname() << dendl;
   
   // remove from local directory.
   entity_name_t name = msgr->get_myname();
@@ -970,25 +971,25 @@ void Rank::submit_message(Message *m, const entity_addr_t& dest_addr)
     if (dest_addr == my_addr) {
       if (local.count(dest)) {
         // local
-        dout(20) << "submit_message " << *m << " dest " << dest << " local" << endl;
+        dout(20) << "submit_message " << *m << " dest " << dest << " local" << dendl;
         if (g_conf.ms_single_dispatch) {
           _submit_single_dispatch(m);
         } else {
           entity = local[dest];
         }
       } else {
-        derr(0) << "submit_message " << *m << " dest " << dest << " " << dest_addr << " local but not in local map?" << endl;
+        derr(0) << "submit_message " << *m << " dest " << dest << " " << dest_addr << " local but not in local map?" << dendl;
         //assert(0);  // hmpf, this is probably mds->mon beacon from newsyn.
       }
     }
     else {
       // remote.
       if (rank_pipe.count( dest_addr )) {
-        dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", already connected." << endl;
+        dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", already connected." << dendl;
         // connected.
         pipe = rank_pipe[ dest_addr ];
       } else {
-        dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", connecting." << endl;
+        dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", connecting." << dendl;
         // not connected.
         pipe = connect_rank( dest_addr );
       }
@@ -999,12 +1000,12 @@ void Rank::submit_message(Message *m, const entity_addr_t& dest_addr)
   // do it
   if (entity) {  
     // local!
-    dout(20) << "submit_message " << *m << " dest " << dest << " local, queueing" << endl;
+    dout(20) << "submit_message " << *m << " dest " << dest << " local, queueing" << dendl;
     entity->queue_message(m);
   } 
   else if (pipe) {
     // remote!
-    dout(20) << "submit_message " << *m << " dest " << dest << " remote, sending" << endl;
+    dout(20) << "submit_message " << *m << " dest " << dest << " remote, sending" << dendl;
     pipe->send(m);
   } 
 }
@@ -1021,10 +1022,10 @@ void Rank::wait()
     reaper();
 
     if (local.empty()) {
-      dout(10) << "wait: everything stopped" << endl;
+      dout(10) << "wait: everything stopped" << dendl;
       break;   // everything stopped.
     } else {
-      dout(10) << "wait: local still has " << local.size() << " items, waiting" << endl;
+      dout(10) << "wait: local still has " << local.size() << " items, waiting" << dendl;
     }
     
     wait_cond.Wait(lock);
@@ -1032,13 +1033,13 @@ void Rank::wait()
   lock.Unlock();
   
   // done!  clean up.
-  dout(-10) << "wait: stopping accepter thread" << endl;
+  dout(-10) << "wait: stopping accepter thread" << dendl;
   accepter.stop();
-  dout(-10) << "wait: stopped accepter thread" << endl;
+  dout(-10) << "wait: stopped accepter thread" << dendl;
 
   // stop dispatch thread
   if (g_conf.ms_single_dispatch) {
-    dout(10) << "wait: stopping dispatch thread" << endl;
+    dout(10) << "wait: stopping dispatch thread" << dendl;
     lock.Lock();
     single_dispatch_stop = true;
     single_dispatch_cond.Signal();
@@ -1049,7 +1050,7 @@ void Rank::wait()
   // reap pipes
   lock.Lock();
   {
-    dout(10) << "wait: closing pipes" << endl;
+    dout(10) << "wait: closing pipes" << dendl;
     list<Pipe*> toclose;
     for (hash_map<entity_addr_t,Pipe*>::iterator i = rank_pipe.begin();
          i != rank_pipe.end();
@@ -1060,7 +1061,7 @@ void Rank::wait()
         i++)
       (*i)->close();
 
-    dout(10) << "wait: waiting for pipes " << pipes << " to close" << endl;
+    dout(10) << "wait: waiting for pipes " << pipes << " to close" << dendl;
     while (!pipes.empty()) {
       wait_cond.Wait(lock);
       reaper();
@@ -1068,8 +1069,8 @@ void Rank::wait()
   }
   lock.Unlock();
 
-  dout(10) << "wait: done." << endl;
-  dout(1) << "shutdown complete." << endl;
+  dout(10) << "wait: done." << dendl;
+  dout(1) << "shutdown complete." << dendl;
 }
 
 
@@ -1105,7 +1106,7 @@ void Rank::EntityMessenger::dispatch_entry()
         while (!ls.empty()) {
          if (stop) {
            dout(1) << "dispatch: stop=true, discarding " << ls.size() 
-                   << " messages in dispatch queue" << endl;
+                   << " messages in dispatch queue" << dendl;
            break;
          }
           Message *m = ls.front();
@@ -1114,7 +1115,7 @@ void Rank::EntityMessenger::dispatch_entry()
                  << " <-- " << m->get_source_inst()
                  << " ---- " << *m
                   << " -- " << m 
-                  << endl;
+                  << dendl;
           dispatch(m);
         }
       }
@@ -1131,7 +1132,7 @@ void Rank::EntityMessenger::dispatch_entry()
 
 void Rank::EntityMessenger::ready()
 {
-  dout(10) << "ready " << get_myaddr() << endl;
+  dout(10) << "ready " << get_myaddr() << dendl;
 
   if (g_conf.ms_single_dispatch) {
     rank.lock.Lock();
@@ -1151,14 +1152,14 @@ void Rank::EntityMessenger::ready()
 
 int Rank::EntityMessenger::shutdown()
 {
-  dout(10) << "shutdown " << get_myaddr() << endl;
+  dout(10) << "shutdown " << get_myaddr() << dendl;
   
   // stop my dispatch thread
   if (dispatch_thread.am_self()) {
-    dout(10) << "shutdown i am dispatch, setting stop flag" << endl;
+    dout(10) << "shutdown i am dispatch, setting stop flag" << dendl;
     stop = true;
   } else {
-    dout(10) << "shutdown i am not dispatch, setting stop flag and joining thread." << endl;
+    dout(10) << "shutdown i am not dispatch, setting stop flag and joining thread." << dendl;
     lock.Lock();
     stop = true;
     cond.Signal();
@@ -1171,7 +1172,7 @@ int Rank::EntityMessenger::shutdown()
 
 void Rank::EntityMessenger::suicide()
 {
-  dout(10) << "suicide " << get_myaddr() << endl;
+  dout(10) << "suicide " << get_myaddr() << dendl;
   shutdown();
   // hmm, or exit(0)?
 }
@@ -1199,7 +1200,7 @@ int Rank::EntityMessenger::send_message(Message *m, entity_inst_t dest,
           << " --> " << dest.name << " " << dest.addr
           << " -- " << *m
          << " -- " << m
-          << endl;
+          << dendl;
 
   rank.submit_message(m, dest.addr);
 
@@ -1219,7 +1220,7 @@ void Rank::EntityMessenger::reset_myname(entity_name_t newname)
   rank.lock.Lock();
   {
     entity_name_t oldname = get_myname();
-    dout(10) << "reset_myname " << oldname << " to " << newname << endl;
+    dout(10) << "reset_myname " << oldname << " to " << newname << dendl;
     
     rank.local.erase(oldname);
     rank.local[newname] = this;
@@ -1244,19 +1245,19 @@ void Rank::mark_down(entity_addr_t addr)
   /*
   if (entity_map.count(a) &&
       entity_map[a] > inst) {
-    dout(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << endl;
-    derr(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << endl;
+    dout(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << dendl;
+    derr(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << dendl;
     // do nothing!
   } else {
     if (entity_map.count(a) == 0) {
       // don't know it
-      dout(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << endl;
-      derr(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << endl;
+      dout(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << dendl;
+      derr(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << dendl;
     } else {
       // know it
       assert(entity_map[a] <= inst);
-      dout(10) << "mark_down " << a << " inst " << inst << endl;
-      derr(10) << "mark_down " << a << " inst " << inst << endl;
+      dout(10) << "mark_down " << a << " inst " << inst << dendl;
+      derr(10) << "mark_down " << a << " inst " << inst << dendl;
       
       entity_map.erase(a);
       
index 5f449ab83605b2e975d61ea454744ee3e5502997..a921bee1f103b0b55fb99477fc85a6fcd8b5deef 100644 (file)
@@ -16,36 +16,36 @@ bool tcp_read(int sd, char *buf, int len)
   while (len > 0) {
     int got = ::recv( sd, buf, len, 0 );
     if (got == 0) {
-      dout(18) << "tcp_read socket " << sd << " closed" << endl;
+      generic_dout(18) << "tcp_read socket " << sd << " closed" << dendl;
       return false;
     }
     if (got < 0) {
-      dout(18) << "tcp_read bailing with " << got << endl;
+      generic_dout(18) << "tcp_read bailing with " << got << dendl;
       return false;
     }
     assert(got >= 0);
     len -= got;
     buf += got;
-    //dout(DBL) << "tcp_read got " << got << ", " << len << " left" << endl;
+    //generic_dout(DBL) << "tcp_read got " << got << ", " << len << " left" << dendl;
   }
   return true;
 }
 
 int tcp_write(int sd, char *buf, int len)
 {
-  //dout(DBL) << "tcp_write writing " << len << endl;
+  //generic_dout(DBL) << "tcp_write writing " << len << dendl;
   assert(len > 0);
   while (len > 0) {
     int did = ::send( sd, buf, len, 0 );
     if (did < 0) {
-      dout(1) << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << endl;
-      //cerr << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << endl;
+      generic_dout(1) << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << dendl;
+      //cerr << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << dendl;
     }
     //assert(did >= 0);
     if (did < 0) return did;
     len -= did;
     buf += did;
-    //dout(DBL) << "tcp_write did " << did << ", " << len << " left" << endl;
+    //generic_dout(DBL) << "tcp_write did " << did << ", " << len << " left" << dendl;
   }
   return 0;
 }
index e09238c2e77e58cb404d9263baebdd4aa0e41424..8415b023b4ef2c0bae6fa3cc239b896f74ae8e19 100644 (file)
@@ -28,29 +28,29 @@ inline bool tcp_read(int sd, char *buf, int len) {
   while (len > 0) {
     int got = ::recv( sd, buf, len, 0 );
     if (got <= 0) {
-      //dout(18) << "tcp_read socket " << sd << " closed" << endl;
+      //generic_dout(18) << "tcp_read socket " << sd << " closed" << dendl;
       return false;
     }
     len -= got;
     buf += got;
-    //dout(DBL) << "tcp_read got " << got << ", " << len << " left" << endl;
+    //generic_dout(DBL) << "tcp_read got " << got << ", " << len << " left" << dendl;
   }
   return true;
 }
 
 inline int tcp_write(int sd, char *buf, int len) {
-  //dout(DBL) << "tcp_write writing " << len << endl;
+  //generic_dout(DBL) << "tcp_write writing " << len << dendl;
   assert(len > 0);
   while (len > 0) {
     int did = ::send( sd, buf, len, 0 );
     if (did < 0) {
-      //dout(1) << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << endl;
-      //cerr << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << endl;
+      //generic_dout(1) << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << dendl;
+      //cerr << "tcp_write error did = " << did << "  errno " << errno << " " << strerror(errno) << dendl;
       return did;
     }
     len -= did;
     buf += did;
-    //dout(DBL) << "tcp_write did " << did << ", " << len << " left" << endl;
+    //generic_dout(DBL) << "tcp_write did " << did << ", " << len << " left" << dendl;
   }
   return 0;
 }
index 4cb38ed43557cf918d54ff12e30069e20d0c8c75..475803d719f3f3c8022e1b645b6a2d49a83454f3 100644 (file)
@@ -127,7 +127,7 @@ class C_Tick : public Context {
 public:
   void finish(int) {
     utime_t now = g_clock.now() - tick_start;
-    dout(0) << "tick +" << g_conf.tick << " -> " << now << "  (" << tick_count << ")" << endl;
+    cout << "tick +" << g_conf.tick << " -> " << now << "  (" << tick_count << ")" << endl;
     tick_count += g_conf.tick;
     utime_t next = tick_start;
     next.sec_ref() += tick_count;
@@ -148,7 +148,7 @@ class C_Debug : public Context {
   void finish(int) {
     int size = &g_conf.debug_after - &g_conf.debug;
     memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
-    dout(0) << "debug_after flipping debug settings" << endl;
+    cout << "debug_after flipping debug settings" << endl;
   }
 };
 
@@ -354,7 +354,7 @@ int main(int argc, char **argv)
     nclients++;
   }
 
-  if (!clientlist.empty()) dout(2) << "i have " << clientlist << endl;
+  if (!clientlist.empty()) generic_dout(2) << "i have " << clientlist << dendl;
 
   for (set<int>::iterator it = clientlist.begin();
        it != clientlist.end();
@@ -387,7 +387,7 @@ int main(int argc, char **argv)
   
 
   if (myrank && !started) {
-    //dout(1) << "IDLE" << endl;
+    //dout(1) << "IDLE" << dendl;
     cerr << "idle at " << rank.my_addr << " " << hostname << "." << pid << endl; 
     //rank.stop_rank();
   } 
index 6cb63fd4a09dab72f798cc164c436192d70f50e8..20f2b3f1304c3037f4d72b546edb0d4bbc11c703 100644 (file)
@@ -19,17 +19,15 @@ Foundation.  See file COPYING. */
 
 using namespace std;
 
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cout << "bdbstore(" << device << ")@" << __LINE__ << "."
-#undef derr
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cerr << "bdbstore(" << device << ")@" << __LINE__ << "."
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cout << dbeginl << "bdbstore(" << device << ")@" << __LINE__ << "."
+#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cerr << dbeginl << "bdbstore(" << device << ")@" << __LINE__ << "."
 
 #define CLEANUP(onsafe) do { \
-    dout(6) << "DELETE " << hex << onsafe << dec << endl; \
+    dout(6) << "DELETE " << hex << onsafe << dec << dendl; \
     delete onsafe; \
   } while (0)
 #define COMMIT(onsafe) do { \
-    dout(6) << "COMMIT " << hex << onsafe << dec << endl; \
+    dout(6) << "COMMIT " << hex << onsafe << dec << dendl; \
     sync(onsafe); \
   } while (0)
 
@@ -104,7 +102,7 @@ DbEnv *OSBDB::getenv ()
                    | DB_PRIVATE);
   if (envp->open (NULL, env_flags, 0) != 0)
     {
-      std::cerr << "failed to open environment " << std::endl;
+      std::cerr << "failed to open environment " << std::dendl;
       assert(0);
     }
   return envp;
@@ -140,7 +138,7 @@ int OSBDB::opendb(DBTYPE type, int flags, bool new_env)
   if ((ret = db->open (NULL, device.c_str(), NULL, type, flags, 0)) != 0)
     {
       derr(1) << "failed to open database: " << device << ": "
-              << db_strerror(ret) << std::endl;
+              << db_strerror(ret) << std::dendl;
       return -EINVAL;
     }
   opened = true;
@@ -149,11 +147,11 @@ int OSBDB::opendb(DBTYPE type, int flags, bool new_env)
 
 int OSBDB::mount()
 {
-  dout(2) << "mount " << device << endl;
+  dout(2) << "mount " << device << dendl;
 
   if (mounted)
     {
-      dout(4) << "..already mounted" << endl;
+      dout(4) << "..already mounted" << dendl;
       return 0;
     }
 
@@ -162,7 +160,7 @@ int OSBDB::mount()
       int ret;
       if ((ret = opendb ()) != 0)
         {
-          dout(4) << "..returns " << ret << endl;
+          dout(4) << "..returns " << ret << dendl;
           return ret;
         }
     }
@@ -178,15 +176,15 @@ int OSBDB::mount()
 
   if (db->get (NULL, &key, &value, 0) != 0)
     {
-      dout(4) << "..get superblock fails" << endl;
+      dout(4) << "..get superblock fails" << dendl;
       return -EINVAL; // XXX how to say "badly formed fs?"
     }
 
-  dout(3) << ".mount " << super << endl;
+  dout(3) << ".mount " << super << dendl;
 
   if (super.version != OSBDB_THIS_VERSION)
     {
-      dout(4) << "version mismatch (" << super.version << ")" << endl;
+      dout(4) << "version mismatch (" << super.version << ")" << dendl;
       return -EINVAL;
     }
 
@@ -201,7 +199,7 @@ int OSBDB::mount()
       db->get_flags (&flags);
       dout(1) << "mounted version " << OSBDB_THIS_VERSION << "; Btree; "
               << "min keys per page: " << minkey << "; flags: "
-              << hex << flags << dec << endl;
+              << hex << flags << dec << dendl;
       cout << dec;
     }
   else
@@ -215,12 +213,12 @@ int OSBDB::mount()
       dout(1) << "mounted version " << OSBDB_THIS_VERSION << "; Hash; "
               << "fill factor: " << ffactor
               << " table size: " << nelem << "; flags: "
-              << hex << flags << dec << endl;
+              << hex << flags << dec << dendl;
       cout << dec;
     }
 
   mounted = true;
-  dout(4) << "..mounted" << endl;
+  dout(4) << "..mounted" << dendl;
   return 0;
 }
 
@@ -229,7 +227,7 @@ int OSBDB::umount()
   if (!mounted)
     return -EINVAL;
 
-  dout(2) << "umount" << endl;
+  dout(2) << "umount" << dendl;
 
   int ret;
   if (opened)
@@ -239,7 +237,7 @@ int OSBDB::umount()
           env->log_flush (NULL);
           if ((ret = env->lsn_reset (device.c_str(), 0)) != 0)
             {
-              derr(1) << "lsn_reset: " << db_strerror (ret) << endl;
+              derr(1) << "lsn_reset: " << db_strerror (ret) << dendl;
             }
         }
 
@@ -247,7 +245,7 @@ int OSBDB::umount()
 
       if ((ret = db->close (0)) != 0)
         {
-          derr(1) << "close: " << db_strerror(ret) << endl;
+          derr(1) << "close: " << db_strerror(ret) << dendl;
           return -EINVAL;
         }
       delete db;
@@ -262,7 +260,7 @@ int OSBDB::umount()
     }
   mounted = false;
   opened = false;
-  dout(4) << "..unmounted" << endl;
+  dout(4) << "..unmounted" << dendl;
   return 0;
 }
 
@@ -271,7 +269,7 @@ int OSBDB::mkfs()
   if (mounted)
     return -EINVAL;
 
-  dout(2) << "mkfs" << endl;
+  dout(2) << "mkfs" << dendl;
 
   string d = env_dir;
   d += device;
@@ -282,17 +280,17 @@ int OSBDB::mkfs()
                     DB_CREATE, true)) != 0)
     {
       derr(1) << "failed to open database: " << device << ": "
-              << db_strerror(ret) << std::endl;
+              << db_strerror(ret) << std::dendl;
       return -EINVAL;
     }
   opened = true;
-  dout(3) << "..opened " << device << endl;
+  dout(3) << "..opened " << device << dendl;
 
   uint32_t c;
   ret = db->truncate (NULL, &c, 0);
   if (ret != 0)
     {
-      derr(1) << "db truncate failed: " << db_strerror (ret) << endl;
+      derr(1) << "db truncate failed: " << db_strerror (ret) << dendl;
       return -EIO; // ???
     }
 
@@ -301,15 +299,15 @@ int OSBDB::mkfs()
   sb.version = OSBDB_THIS_VERSION;
   Dbt value (&sb, sizeof (sb));
 
-  dout(3) << "..writing superblock" << endl;
+  dout(3) << "..writing superblock" << dendl;
   if ((ret = db->put (NULL, &key, &value, 0)) != 0)
     {
       derr(1) << "failed to write superblock: " << db_strerror (ret)
-              << endl;
+              << dendl;
       return -EIO;
     }
-  dout(3) << "..wrote superblock" << endl;
-  dout(4) << "..mkfs done" << endl;
+  dout(3) << "..wrote superblock" << dendl;
+  dout(4) << "..mkfs done" << dendl;
   return 0;
 }
 
@@ -318,16 +316,16 @@ int OSBDB::mkfs()
 int OSBDB::pick_object_revision_lt(object_t& oid)
 {
   // Not really needed.
-  dout(0) << "pick_object_revision_lt " << oid << endl;
+  dout(0) << "pick_object_revision_lt " << oid << dendl;
   return -ENOSYS;
 }
 
 bool OSBDB::exists(object_t oid)
 {
-  dout(2) << "exists " << oid << endl;
+  dout(2) << "exists " << oid << dendl;
   struct stat st;
   bool ret = (stat (oid, &st) == 0);
-  dout(4) << "..returns " << ret << endl;
+  dout(4) << "..returns " << ret << dendl;
   return ret;
 }
 
@@ -337,11 +335,11 @@ int OSBDB::statfs (struct statfs *st)
   if (::statfs (device.c_str(), st) != 0)
     {
       int ret = -errno;
-      derr(1) << "statfs returns " << ret << endl;
+      derr(1) << "statfs returns " << ret << dendl;
       return ret;
     }
   st->f_type = OSBDB_MAGIC;
-  dout(4) << "..statfs OK" << endl;
+  dout(4) << "..statfs OK" << dendl;
   return 0;
 }
 
@@ -349,11 +347,11 @@ int OSBDB::stat(object_t oid, struct stat *st)
 {
   if (!mounted)
     {
-      dout(4) << "not mounted!" << endl;
+      dout(4) << "not mounted!" << dendl;
       return -EINVAL;
     }
 
-  dout(2) << "stat " << oid << endl;
+  dout(2) << "stat " << oid << dendl;
 
   object_inode_key ikey = new_object_inode_key(oid);
   stored_object obj;
@@ -362,17 +360,17 @@ int OSBDB::stat(object_t oid, struct stat *st)
   value.set_flags (DB_DBT_USERMEM);
   value.set_ulen (sizeof (obj));
 
-  dout(3) << "  lookup " << ikey << endl;
+  dout(3) << "  lookup " << ikey << dendl;
   int ret;
   if ((ret = db->get (NULL, &key, &value, 0)) != 0)
     {
-      derr(1) << " get returned " << ret << endl;
+      derr(1) << " get returned " << ret << dendl;
       return -ENOENT;
     }
 
   st->st_size = obj.length;
-  dout(3) << "stat length:" << obj.length << endl;
-  dout(4) << "..stat OK" << endl;
+  dout(3) << "stat length:" << obj.length << dendl;
+  dout(4) << "..stat OK" << dendl;
   return 0;
 }
 
@@ -380,15 +378,15 @@ int OSBDB::remove(object_t oid, Context *onsafe)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   scoped_lock __lock(&lock);
-  dout(2) << "remove " << oid << endl;
+  dout(2) << "remove " << oid << dendl;
 
   DbTxn *txn = NULL;
   if (transactional)
@@ -400,7 +398,7 @@ int OSBDB::remove(object_t oid, Context *onsafe)
   int ret;
   if ((ret = db->del (txn, &key, 0)) != 0)
     {
-      derr(1) << ".del returned error: " << db_strerror (ret) << endl;
+      derr(1) << ".del returned error: " << db_strerror (ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -412,7 +410,7 @@ int OSBDB::remove(object_t oid, Context *onsafe)
   Dbt ikey (&_ikey, sizeof_object_inode_key());
   if ((ret = db->del (txn, &ikey, 0)) != 0)
     {
-      derr(1) << ".del returned error: " << db_strerror (ret) << endl;
+      derr(1) << ".del returned error: " << db_strerror (ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -435,7 +433,7 @@ int OSBDB::remove(object_t oid, Context *onsafe)
           Dbt akey (&aid, sizeof (aid));
           if ((ret = db->del (txn, &akey, 0)) != 0)
             {
-              derr(1) << ".del returns error: " << db_strerror (ret) << endl;
+              derr(1) << ".del returns error: " << db_strerror (ret) << dendl;
               if (txn != NULL)
                 txn->abort();
               if (onsafe != NULL)
@@ -445,7 +443,7 @@ int OSBDB::remove(object_t oid, Context *onsafe)
         }
       if ((ret = db->del (txn, &askey, 0)) != 0)
         {
-          derr(1) << ".del returns error: " << db_strerror (ret) << endl;
+          derr(1) << ".del returns error: " << db_strerror (ret) << dendl;
           if (txn != NULL)
             txn->abort();
           if (onsafe != NULL)
@@ -460,28 +458,28 @@ int OSBDB::remove(object_t oid, Context *onsafe)
     txn->commit (0);
   if (onsafe != NULL)
     COMMIT(onsafe);
-  dout(4) << "..remove OK" << endl;
+  dout(4) << "..remove OK" << dendl;
   return 0;
 }
 
 int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
 
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "truncate " << size << endl;
+  dout(2) << "truncate " << size << dendl;
 
   if (size > 0xFFFFFFFF)
     {
-      derr(1) << "object size too big!" << endl;
+      derr(1) << "object size too big!" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -ENOSPC;
@@ -506,7 +504,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      dout(4) << "..returns -ENOENT" << endl;
+      dout(4) << "..returns -ENOENT" << dendl;
       return -ENOENT;
     }
 
@@ -527,7 +525,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << ".updating object failed" << endl;
+          derr(1) << ".updating object failed" << dendl;
           return -EIO;
         }
 
@@ -539,7 +537,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << ".updating object info failed" << endl;
+          derr(1) << ".updating object info failed" << dendl;
           return -EIO;
         }
     }
@@ -555,7 +553,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << ".updating object info failed" << endl;
+          derr(1) << ".updating object info failed" << dendl;
           return -EIO;
         }
       if (size == 0)
@@ -571,7 +569,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
                 txn->abort();
               if (onsafe != NULL)
                 CLEANUP(onsafe);
-              derr(1) << ".updating object failed" << endl;
+              derr(1) << ".updating object failed" << dendl;
               return -EIO;
             }
         }
@@ -588,7 +586,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
                 txn->abort();
               if (onsafe != NULL)
                 CLEANUP(onsafe);
-              derr(1) << ".getting old object failed" << endl;
+              derr(1) << ".getting old object failed" << dendl;
               return -EIO;
             }
           auto_ptr<char> ovalPtr ((char *) oval.get_data());
@@ -600,7 +598,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
                 txn->abort();
               if (onsafe != NULL)
                 CLEANUP(onsafe);
-              derr(1) << ".putting new object failed" << endl;
+              derr(1) << ".putting new object failed" << dendl;
               return -EIO;
             }
         }
@@ -611,7 +609,7 @@ int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
   if (onsafe != NULL)
     COMMIT(onsafe);
 
-  dout(4) << "..truncate OK" << endl;
+  dout(4) << "..truncate OK" << dendl;
   return 0;
 }
 
@@ -619,12 +617,12 @@ int OSBDB::read(object_t oid, off_t offset, size_t len, bufferlist& bl)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       return -EINVAL;
     }
 
   dout(2) << "read " << oid << " " << offset << " "
-          << len << endl;
+          << len << dendl;
 
   if (bl.length() < len)
     {
@@ -644,32 +642,32 @@ int OSBDB::read(object_t oid, off_t offset, size_t len, bufferlist& bl)
   ival.set_flags (DB_DBT_USERMEM);
   ival.set_ulen (sizeof(obj));
 
-  dout(3) << "..get " << _ikey << endl;
+  dout(3) << "..get " << _ikey << dendl;
   int ret;
   if ((ret = db->get (txn, &ikey, &ival, 0)) != 0)
     {
       if (txn)
         txn->abort();
-      derr(1) << "get returned " << db_strerror (ret) << endl;
+      derr(1) << "get returned " << db_strerror (ret) << dendl;
       return -ENOENT;
     }
 
-  dout(3) << "..object has size " << obj.length << endl;
+  dout(3) << "..object has size " << obj.length << dendl;
 
   if (offset == 0 && len >= obj.length)
     {
       len = obj.length;
-      dout(3) << "..doing full read of " << len << endl;
+      dout(3) << "..doing full read of " << len << dendl;
       oid_t id;
       mkoid (id, oid);
       Dbt key (&id, sizeof (oid_t));
       Dbt value (bl.c_str(), len);
       value.set_ulen (len);
       value.set_flags (DB_DBT_USERMEM);
-      dout(3) << "..getting " << oid << endl;
+      dout(3) << "..getting " << oid << dendl;
       if ((ret = db->get (txn, &key, &value, 0)) != 0)
         {
-          derr(1) << ".get returned " << db_strerror (ret) << endl;
+          derr(1) << ".get returned " << db_strerror (ret) << dendl;
           if (txn)
             txn->abort();
           return -EIO;
@@ -679,27 +677,27 @@ int OSBDB::read(object_t oid, off_t offset, size_t len, bufferlist& bl)
     {
       if (offset > obj.length)
         {
-          dout(2) << "..offset out of range" << endl;
+          dout(2) << "..offset out of range" << dendl;
           return 0;
         }
       if (offset + len > obj.length)
         len = obj.length - (size_t) offset;
-      dout(3) << "..doing partial read of " << len << endl;
+      dout(3) << "..doing partial read of " << len << dendl;
       oid_t id;
       mkoid (id, oid);
       Dbt key (&id, sizeof (oid));
       Dbt value;
       char *data = bl.c_str();
-      dout(3) << ".bufferlist c_str returned " << ((void*) data) << endl;
+      dout(3) << ".bufferlist c_str returned " << ((void*) data) << dendl;
       value.set_data (data);
       value.set_doff ((size_t) offset);
       value.set_dlen (len);
       value.set_ulen (len);
       value.set_flags (DB_DBT_USERMEM | DB_DBT_PARTIAL);
-      dout(3) << "..getting " << oid << endl;
+      dout(3) << "..getting " << oid << dendl;
       if ((ret = db->get (txn, &key, &value, 0)) != 0)
         {
-          derr(1) << ".get returned " << db_strerror (ret) << endl;
+          derr(1) << ".get returned " << db_strerror (ret) << dendl;
           if (txn)
             txn->abort();
           return -EIO;
@@ -708,17 +706,17 @@ int OSBDB::read(object_t oid, off_t offset, size_t len, bufferlist& bl)
 
   if (txn)
     txn->commit (0);
-  dout(4) << "..read OK, returning " << len << endl;
+  dout(4) << "..read OK, returning " << len << dendl;
   return len;
 }
 
 int OSBDB::write(object_t oid, off_t offset, size_t len,
                  bufferlist& bl, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
@@ -726,11 +724,11 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
 
   scoped_lock __lock(&lock);
   dout(2) << "write " << oid << " " << offset << " "
-          << len << endl;
+          << len << dendl;
 
   if (offset > 0xFFFFFFFFL || offset + len > 0xFFFFFFFFL)
     {
-      derr(1) << "object too big" << endl;
+      derr(1) << "object too big" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -ENOSPC;
@@ -748,18 +746,18 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
   ival.set_flags (DB_DBT_USERMEM);
 
   int ret;
-  dout(3) << "..getting " << _ikey << endl;
+  dout(3) << "..getting " << _ikey << dendl;
   if (db->get (txn, &ikey, &ival, 0) != 0)
     {
-      dout(3) << "..writing new object" << endl;
+      dout(3) << "..writing new object" << dendl;
 
       // New object.
       obj.length = (size_t) offset + len;
       dout(3) << "..mapping " << _ikey << " => "
-              << obj << endl;
+              << obj << dendl;
       if ((ret = db->put (txn, &ikey, &ival, 0)) != 0)
         {
-          derr(1) << "..put returned " << db_strerror (ret) << endl;
+          derr(1) << "..put returned " << db_strerror (ret) << dendl;
           if (txn)
             txn->abort();
           if (onsafe != NULL)
@@ -784,10 +782,10 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
           value.set_dlen (len);
         }
       dout(3) << "..mapping " << oid << " => ("
-              << obj.length << " bytes)" << endl;
+              << obj.length << " bytes)" << dendl;
       if ((ret = db->put (txn, &key, &value, 0)) != 0)
         {
-          derr(1) << "..put returned " << db_strerror (ret) << endl;
+          derr(1) << "..put returned " << db_strerror (ret) << dendl;
           if (txn)
             txn->abort();
           if (onsafe != NULL)
@@ -800,7 +798,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
       if (onsafe != NULL)
         COMMIT(onsafe);
 
-      dout(4) << "..write OK, returning " << len << endl;
+      dout(4) << "..write OK, returning " << len << dendl;
       return len;
     }
 
@@ -811,7 +809,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
           obj.length = len;
           if ((ret = db->put (txn, &ikey, &ival, 0)) != 0)
             {
-              derr(1) << "  put returned " << db_strerror (ret) << endl;
+              derr(1) << "  put returned " << db_strerror (ret) << dendl;
               if (txn)
                 txn->abort();
               if (onsafe != NULL)
@@ -829,7 +827,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << "..writing object failed!" << endl;
+          derr(1) << "..writing object failed!" << dendl;
           return -EIO;
         }
     }
@@ -844,7 +842,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
                 txn->abort();
               if (onsafe != NULL)
                 CLEANUP(onsafe);
-              derr(1) << "..writing object info failed!" << endl;
+              derr(1) << "..writing object info failed!" << dendl;
               return -EIO;
             }
         }
@@ -862,7 +860,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << "..writing object failed!" << endl;
+          derr(1) << "..writing object failed!" << dendl;
           return -EIO;
         }
     }
@@ -872,7 +870,7 @@ int OSBDB::write(object_t oid, off_t offset, size_t len,
   if (onsafe != NULL)
     COMMIT(onsafe);
 
-  dout(4) << "..write OK, returning " << len << endl;
+  dout(4) << "..write OK, returning " << len << dendl;
   return len;
 }
 
@@ -880,15 +878,15 @@ int OSBDB::clone(object_t oid, object_t noid)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       return -EINVAL;
     }
 
-  dout(2) << "clone " << oid << ", " << noid << endl;
+  dout(2) << "clone " << oid << ", " << noid << dendl;
 
   if (exists (noid))
     {
-      dout(4) << "..target exists; returning -EEXIST" << endl;
+      dout(4) << "..target exists; returning -EEXIST" << dendl;
       return -EEXIST;
     }
 
@@ -917,14 +915,14 @@ int OSBDB::clone(object_t oid, object_t noid)
     {
       if (txn)
         txn->abort();
-      derr(1) << "..getting object info failed!" << endl;
+      derr(1) << "..getting object info failed!" << dendl;
       return -ENOENT;
     }
   if (db->get (txn, &key, &value, 0) != 0)
     {
       if (txn)
         txn->abort();
-      derr(1) << "..getting original object failed" << endl;
+      derr(1) << "..getting original object failed" << dendl;
       return -ENOENT;
     }
   auto_ptr<char> valueptr ((char *) value.get_data());
@@ -933,21 +931,21 @@ int OSBDB::clone(object_t oid, object_t noid)
     {
       if (txn)
         txn->abort();
-      derr(1) << "..putting object info failed" << endl;
+      derr(1) << "..putting object info failed" << dendl;
       return -EIO;
     }
   if (db->put (txn, &nkey, &value, 0) != 0)
     {
       if (txn)
         txn->abort();
-      derr(1) << "..putting new object failed" << endl;
+      derr(1) << "..putting new object failed" << dendl;
       return -EIO;
     }
 
   if (txn)
     txn->commit (0);
 
-  dout(4) << "..clone OK" << endl;
+  dout(4) << "..clone OK" << dendl;
   return 0;
 }
 
@@ -957,11 +955,11 @@ int OSBDB::list_collections(list<coll_t>& ls)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted!" << endl;
+      derr(1) << "not mounted!" << dendl;
       return -EINVAL;
     }
 
-  dout(2) << "list_collections" << endl;
+  dout(2) << "list_collections" << dendl;
 
   Dbt key (COLLECTIONS_KEY, 1);
   Dbt value;
@@ -969,7 +967,7 @@ int OSBDB::list_collections(list<coll_t>& ls)
 
   if (db->get (NULL, &key, &value, 0) != 0)
     {
-      dout(4) << "..no collections" << endl;
+      dout(4) << "..no collections" << dendl;
       return 0; // no collections.
     }
 
@@ -978,23 +976,23 @@ int OSBDB::list_collections(list<coll_t>& ls)
   for (uint32_t i = 0; i < sc->count; i++)
     ls.push_back (scp->colls[i]);
 
-  dout(4) << "..list_collections returns " << scp->count << endl;
+  dout(4) << "..list_collections returns " << scp->count << dendl;
   return scp->count;
 }
 
 int OSBDB::create_collection(coll_t c, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "create_collection " << hex << c << dec << endl;
+  dout(2) << "create_collection " << hex << c << dec << dendl;
 
   Dbt key (COLLECTIONS_KEY, 1);
   Dbt value;
@@ -1030,17 +1028,17 @@ int OSBDB::create_collection(coll_t c, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".collection " << c << " already exists " << endl;
+      derr(1) << ".collection " << c << " already exists " << dendl;
       return -EEXIST;
     }
 
-  dout(3) << "..insertion point: " << ins << endl;
+  dout(3) << "..insertion point: " << ins << dendl;
 
   // Make room for a new collection ID.
   if (!created)
   {
     sz += sizeof (coll_t);
-    dout(3) << "..increase size to " << sz << endl;
+    dout(3) << "..increase size to " << sz << dendl;
     stored_colls *scp2 = (stored_colls *) realloc (scp, sz);
     sc.release ();
     sc.reset (scp2);
@@ -1050,13 +1048,13 @@ int OSBDB::create_collection(coll_t c, Context *onsafe)
   int n = (scp->count - ins) * sizeof (coll_t);
   if (n > 0)
     {
-      dout(3) << "..moving " << n << " bytes up" << endl;
+      dout(3) << "..moving " << n << " bytes up" << dendl;
       memmove (&scp->colls[ins + 1], &scp->colls[ins], n);
     }
   scp->count++;
   scp->colls[ins] = c;
 
-  dout(3) << "..collections: " << scp << endl;
+  dout(3) << "..collections: " << scp << dendl;
 
   // Put the modified collection list back.
   {
@@ -1067,7 +1065,7 @@ int OSBDB::create_collection(coll_t c, Context *onsafe)
           txn->abort();
         if (onsafe != NULL)
           CLEANUP(onsafe);
-        derr(1) << ".writing new collections list failed" << endl;
+        derr(1) << ".writing new collections list failed" << dendl;
         return -EIO;
       }
   }
@@ -1084,7 +1082,7 @@ int OSBDB::create_collection(coll_t c, Context *onsafe)
           txn->abort();
         if (onsafe != NULL)
           CLEANUP(onsafe);
-        derr(1) << ".writing new collection failed" << endl;
+        derr(1) << ".writing new collection failed" << dendl;
         return -EIO;
       }
   }
@@ -1094,23 +1092,23 @@ int OSBDB::create_collection(coll_t c, Context *onsafe)
   if (onsafe != NULL)
     COMMIT(onsafe);
 
-  dout(4) << "..create_collection OK" << endl;
+  dout(4) << "..create_collection OK" << dendl;
   return 0;
 }
 
 int OSBDB::destroy_collection(coll_t c, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "destroy_collection " << hex << c << dec << endl;
+  dout(2) << "destroy_collection " << hex << c << dec << dendl;
 
   Dbt key (COLLECTIONS_KEY, 1);
   Dbt value;
@@ -1126,7 +1124,7 @@ int OSBDB::destroy_collection(coll_t c, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".collection list doesn't exist" << endl;
+      derr(1) << ".collection list doesn't exist" << dendl;
       return -ENOENT; // XXX
     }
 
@@ -1138,32 +1136,32 @@ int OSBDB::destroy_collection(coll_t c, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".collection " << c << " not listed" << endl;
+      derr(1) << ".collection " << c << " not listed" << dendl;
       return -ENOENT;
     }
   uint32_t ins = binary_search<coll_t> (scp->colls, scp->count, c);
-  dout(4) << "..insertion point is " << ins << endl;
+  dout(4) << "..insertion point is " << ins << dendl;
   if (ins >= scp->count || scp->colls[ins] != c)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".collection " << c << " not listed" << endl;
+      derr(1) << ".collection " << c << " not listed" << dendl;
       return -ENOENT;
     }
 
-  dout(4) << "..collections list is " << scp << endl;
+  dout(4) << "..collections list is " << scp << dendl;
 
   // Move the rest of the list down in memory, if needed.
   if (ins < scp->count)
     {
       size_t n = scp->count - ins - 1;
-      dout(4) << "..shift list down " << n << endl;
+      dout(4) << "..shift list down " << n << dendl;
       memmove (&scp->colls[ins], &scp->colls[ins + 1], n);
     }
 
-  dout(4) << "..collections list is " << scp << endl;
+  dout(4) << "..collections list is " << scp << dendl;
 
   // Modify the record size to be one less.
   Dbt nvalue (scp, value.get_size() - sizeof (coll_t));
@@ -1174,7 +1172,7 @@ int OSBDB::destroy_collection(coll_t c, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".putting modified collection list failed" << endl;
+      derr(1) << ".putting modified collection list failed" << dendl;
       return -EIO;
     }
 
@@ -1186,7 +1184,7 @@ int OSBDB::destroy_collection(coll_t c, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".deleting collection failed" << endl;
+      derr(1) << ".deleting collection failed" << dendl;
       return -EIO;
     }
 
@@ -1194,7 +1192,7 @@ int OSBDB::destroy_collection(coll_t c, Context *onsafe)
     txn->commit (0);
   if (onsafe != NULL)
     COMMIT(onsafe);
-  dout(4) << "..destroy_collection OK" << endl;
+  dout(4) << "..destroy_collection OK" << dendl;
   return 0;
 }
 
@@ -1202,11 +1200,11 @@ bool OSBDB::collection_exists(coll_t c)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       return -EINVAL;
     }
 
-  dout(2) << "collection_exists " << hex << c << dec << endl;
+  dout(2) << "collection_exists " << hex << c << dec << dendl;
 
   /*Dbt key (COLLECTIONS_KEY, 1);
   Dbt value;
@@ -1214,23 +1212,23 @@ bool OSBDB::collection_exists(coll_t c)
 
   if (db->get (NULL, &key, &value, 0) != 0)
     {
-      dout(4) << "..no collection list; return false" << endl;
+      dout(4) << "..no collection list; return false" << dendl;
       return false;
     }
 
   stored_colls *scp = (stored_colls *) value.get_data();
   auto_ptr<stored_colls> sc (scp);
-  dout(5) << "..collection list is " << scp << endl;
+  dout(5) << "..collection list is " << scp << dendl;
   if (scp->count == 0)
     {
-      dout(4) << "..empty collection list; return false" << endl;
+      dout(4) << "..empty collection list; return false" << dendl;
       return false;
     }
   uint32_t ins = binary_search<coll_t> (scp->colls, scp->count, c);
-  dout(4) << "..insertion point is " << ins << endl;
+  dout(4) << "..insertion point is " << ins << dendl;
 
   int ret = (scp->colls[ins] == c);
-  dout(4) << "..returns " << ret << endl;
+  dout(4) << "..returns " << ret << dendl;
   return ret;*/
 
   Dbt key (&c, sizeof (coll_t));
@@ -1238,12 +1236,12 @@ bool OSBDB::collection_exists(coll_t c)
   value.set_flags (DB_DBT_MALLOC);
   if (db->get (NULL, &key, &value, 0) != 0)
     {
-      dout(4) << "..no collection, return false" << endl;
+      dout(4) << "..no collection, return false" << dendl;
       return false;
     }
   void *val = value.get_data();
   free (val);
-  dout(4) << "..collection exists; return true" << endl;
+  dout(4) << "..collection exists; return true" << dendl;
   return true;
 }
 
@@ -1251,28 +1249,28 @@ int OSBDB::collection_stat(coll_t c, struct stat *st)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       return -EINVAL;
     }
 
-  dout(2) << "collection_stat " << c << endl;
+  dout(2) << "collection_stat " << c << dendl;
   // XXX is this needed?
   return -ENOSYS;
 }
 
 int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
-      dout(2) << "not mounted" << endl;
+      dout(2) << "not mounted" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "collection_add " << hex << c << dec << " " << o << endl;
+  dout(2) << "collection_add " << hex << c << dec << " " << o << dendl;
 
   Dbt key (&c, sizeof (coll_t));
   Dbt value;
@@ -1288,7 +1286,7 @@ int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << "failed to find collection" << endl;
+      derr(1) << "failed to find collection" << dendl;
       return -ENOENT;
     }
 
@@ -1308,7 +1306,7 @@ int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << "collection already has object" << endl;
+          derr(1) << "collection already has object" << dendl;
           return -EEXIST;
         }
     }
@@ -1318,17 +1316,17 @@ int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
   scp = (stored_coll *) realloc (scp, sz);
   sc.release();
   sc.reset (scp);
-  dout(3) << "..current collection: " << scp << endl;
+  dout(3) << "..current collection: " << scp << dendl;
   if (ins < scp->count - 1)
     {
       size_t n = (scp->count - ins) * sizeof (object_t);
-      dout(3) << "..move up " << n << " bytes" << endl;
+      dout(3) << "..move up " << n << " bytes" << dendl;
       memmove (&scp->objects[ins + 1], &scp->objects[ins], n);
     }
   scp->count++;
   scp->objects[ins] = o;
 
-  dout(3) << "..collection: " << scp << endl;
+  dout(3) << "..collection: " << scp << dendl;
 
   Dbt nvalue (scp, sz);
   if (db->put (txn, &key, &nvalue, 0) != 0)
@@ -1337,7 +1335,7 @@ int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << "..putting modified collection failed" << endl;
+      derr(1) << "..putting modified collection failed" << dendl;
       return -EIO;
     }
 
@@ -1345,23 +1343,23 @@ int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
     txn->commit (0);
   if (onsafe != NULL)
     COMMIT(onsafe);
-  dout(4) << "..collection add OK" << endl;
+  dout(4) << "..collection add OK" << dendl;
   return 0;
 }
 
 int OSBDB::collection_remove(coll_t c, object_t o, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EINVAL;
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "collection_remove " << hex << c << dec << " " << o << endl;
+  dout(2) << "collection_remove " << hex << c << dec << " " << o << dendl;
 
   Dbt key (&c, sizeof (coll_t));
   Dbt value;
@@ -1377,44 +1375,44 @@ int OSBDB::collection_remove(coll_t c, object_t o, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      dout(1) << "..collection doesn't exist" << endl;
+      dout(1) << "..collection doesn't exist" << dendl;
       return -ENOENT;
     }
 
   stored_coll *scp = (stored_coll *) value.get_data();
   auto_ptr<stored_coll> sc (scp);
 
-  dout(5) << "..collection is " << scp << endl;
+  dout(5) << "..collection is " << scp << dendl;
   if (scp->count == 0)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      dout(1) << "..collection is empty" << endl;
+      dout(1) << "..collection is empty" << dendl;
       return -ENOENT;
     }
   uint32_t ins = binary_search<object_t> (scp->objects, scp->count, o);
-  dout(4) << "..insertion point is " << ins << endl;
+  dout(4) << "..insertion point is " << ins << dendl;
   if (ins >= scp->count || scp->objects[ins] != o)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      dout(1) << "..object not in collection" << endl;
+      dout(1) << "..object not in collection" << dendl;
       return -ENOENT;
     }
 
   if (ins < scp->count - 1)
     {
       size_t n = (scp->count - ins - 1) * sizeof (object_t);
-      dout(5) << "..moving " << n << " bytes down" << endl;
+      dout(5) << "..moving " << n << " bytes down" << dendl;
       memmove (&scp->objects[ins], &scp->objects[ins + 1], n);
     }
   scp->count--;
 
-  dout(3) << "..collection " << scp << endl;
+  dout(3) << "..collection " << scp << dendl;
 
   Dbt nval (scp, value.get_size() - sizeof (object_t));
   if (db->put (txn, &key, &nval, 0) != 0)
@@ -1423,7 +1421,7 @@ int OSBDB::collection_remove(coll_t c, object_t o, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << "..putting modified collection failed" << endl;
+      derr(1) << "..putting modified collection failed" << dendl;
       return -EIO;
     }
 
@@ -1431,7 +1429,7 @@ int OSBDB::collection_remove(coll_t c, object_t o, Context *onsafe)
     txn->commit (0);
   if (onsafe != NULL)
     COMMIT(onsafe);
-  dout(4) << "..collection remove OK" << endl;
+  dout(4) << "..collection remove OK" << dendl;
   return 0;
 }
 
@@ -1439,7 +1437,7 @@ int OSBDB::collection_list(coll_t c, list<object_t>& o)
 {
   if (!mounted)
     {
-      derr(1) << "not mounted" << endl;
+      derr(1) << "not mounted" << dendl;
       return -EINVAL;
     }
 
@@ -1473,7 +1471,7 @@ int OSBDB::_setattr(object_t oid, const char *name,
                     const void *value, size_t size, Context *onsafe,
                     DbTxn *txn)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1483,7 +1481,7 @@ int OSBDB::_setattr(object_t oid, const char *name,
 
   if (strlen (name) >= OSBDB_MAX_ATTR_LEN)
     {
-      derr(1) << "name too long: " << name << endl;
+      derr(1) << "name too long: " << name << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -ENAMETOOLONG;
@@ -1499,10 +1497,10 @@ int OSBDB::_setattr(object_t oid, const char *name,
   stored_attrs *sap = NULL;
   size_t sz = 0;
 
-  dout(3) << "  getting " << aids << endl;
+  dout(3) << "  getting " << aids << dendl;
   if (db->get (txn, &attrs_key, &attrs_val, 0) != 0)
     {
-      dout(2) << "  first attribute" << endl;
+      dout(2) << "  first attribute" << dendl;
       sz = sizeof (stored_attrs);
       sap = (stored_attrs *) malloc(sz);
       sap->count = 0;
@@ -1511,7 +1509,7 @@ int OSBDB::_setattr(object_t oid, const char *name,
     {
       sz = attrs_val.get_size();
       sap = (stored_attrs *) attrs_val.get_data();
-      dout(2) << "..add to list of " << sap->count << " attrs" << endl;
+      dout(2) << "..add to list of " << sap->count << " attrs" << dendl;
     }
   auto_ptr<stored_attrs> sa (sap);
 
@@ -1521,15 +1519,15 @@ int OSBDB::_setattr(object_t oid, const char *name,
   int ins = 0;
   if (sap->count > 0)
     ins = binary_search<attr_name> (sap->names, sap->count, _name);
-  dout(3) << "..insertion point is " << ins << endl;
+  dout(3) << "..insertion point is " << ins << dendl;
   if (sap->count == 0 ||
       (ins >= sap->count || strcmp (sap->names[ins].name, name) != 0))
     {
       sz += sizeof (attr_name);
       dout(3) << "..realloc " << ((void *) sap) << " to "
-              << dec << sz << endl;
+              << dec << sz << dendl;
       sap = (stored_attrs *) realloc (sap, sz);
-      dout(3) << "..returns " << ((void *) sap) << endl;
+      dout(3) << "..returns " << ((void *) sap) << dendl;
       sa.release ();
       sa.reset (sap);
       int n = (sap->count - ins) * sizeof (attr_name);
@@ -1537,7 +1535,7 @@ int OSBDB::_setattr(object_t oid, const char *name,
         {
           dout(3) << "..move " << n  << " bytes from 0x"
                   << hex << (&sap->names[ins]) << " to 0x"
-                  << hex << (&sap->names[ins+1]) << dec << endl;
+                  << hex << (&sap->names[ins+1]) << dec << dendl;
           memmove (&sap->names[ins+1], &sap->names[ins], n);
         }
       memset (&sap->names[ins], 0, sizeof (attr_name));
@@ -1547,10 +1545,10 @@ int OSBDB::_setattr(object_t oid, const char *name,
       Dbt newAttrs_val (sap, sz);
       newAttrs_val.set_ulen (sz);
       newAttrs_val.set_flags (DB_DBT_USERMEM);
-      dout(3) << "..putting " << aids << endl;
+      dout(3) << "..putting " << aids << dendl;
       if (db->put (txn, &attrs_key, &newAttrs_val, 0) != 0)
         {
-          derr(1) << ".writing attributes list failed" << endl;
+          derr(1) << ".writing attributes list failed" << dendl;
           if (onsafe != NULL)
             CLEANUP(onsafe);
           return -EIO;
@@ -1558,25 +1556,25 @@ int OSBDB::_setattr(object_t oid, const char *name,
     }
   else
     {
-      dout(3) << "..attribute " << name << " already exists" << endl;
+      dout(3) << "..attribute " << name << " already exists" << dendl;
     }
 
-  dout(5) << "..attributes list: " << sap << endl;
+  dout(5) << "..attributes list: " << sap << dendl;
 
   // Add the attribute.
   attr_id aid = new_attr_id (oid, name);
   Dbt attr_key (&aid, sizeof (aid));
   Dbt attr_val ((void *) value, size);
-  dout(3) << "..writing attribute key " << aid << endl;
+  dout(3) << "..writing attribute key " << aid << dendl;
   if (db->put (txn, &attr_key, &attr_val, 0) != 0)
     {
-      derr(1) << ".writing attribute key failed" << endl;
+      derr(1) << ".writing attribute key failed" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -EIO;
     }
 
-  dout(4) << "..setattr OK" << endl;
+  dout(4) << "..setattr OK" << dendl;
   if (onsafe != NULL)
     COMMIT(onsafe);
   return 0;
@@ -1586,7 +1584,7 @@ int OSBDB::setattr(object_t oid, const char *name,
                    const void *value, size_t size,
                    Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1599,7 +1597,7 @@ int OSBDB::setattr(object_t oid, const char *name,
     env->txn_begin (NULL, &txn, 0);
 
   dout(2) << "setattr " << oid << ":" << name << " => ("
-          << size << " bytes)" << endl;
+          << size << " bytes)" << dendl;
   int ret = _setattr (oid, name, value, size, onsafe, txn);
   if (ret == 0)
     {
@@ -1617,7 +1615,7 @@ int OSBDB::setattr(object_t oid, const char *name,
 int OSBDB::setattrs(object_t oid, map<string,bufferptr>& aset,
                     Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1655,7 +1653,7 @@ int OSBDB::_getattr (object_t oid, const char *name, void *value, size_t size)
   if (!mounted)
     return -EINVAL;
 
-  dout(2) << "_getattr " << oid << " " << name << " " << size << endl;
+  dout(2) << "_getattr " << oid << " " << name << " " << size << dendl;
 
   attr_id aid = new_attr_id (oid, name);
   Dbt key (&aid, sizeof (aid));
@@ -1668,11 +1666,11 @@ int OSBDB::_getattr (object_t oid, const char *name, void *value, size_t size)
   int ret;
   if ((ret = db->get (NULL, &key, &val, 0)) != 0)
     {
-      derr(1) << ".getting value failed: " << db_strerror (ret) << endl; 
+      derr(1) << ".getting value failed: " << db_strerror (ret) << dendl; 
       return -ENOENT;
     }
 
-  dout(4) << ".._getattr OK; returns " << val.get_size() << endl;
+  dout(4) << ".._getattr OK; returns " << val.get_size() << dendl;
   return val.get_size();
 }
 
@@ -1703,7 +1701,7 @@ int OSBDB::getattrs(object_t oid, map<string,bufferptr>& aset)
 
 int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1712,7 +1710,7 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
     }
 
   scoped_lock __lock(&lock);
-  dout(2) << "rmattr " << oid << " " << name << endl;
+  dout(2) << "rmattr " << oid << " " << name << dendl;
 
   attrs_id aids = new_attrs_id (oid);
   Dbt askey (&aids, sizeof_attrs_id());
@@ -1736,7 +1734,7 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
   stored_attrs *sap = (stored_attrs *) asvalue.get_data();
   auto_ptr<stored_attrs> sa (sap);
 
-  dout(5) << "..attributes list " << sap << endl;
+  dout(5) << "..attributes list " << sap << dendl;
 
   if (sap->count == 0)
     {
@@ -1744,7 +1742,7 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".empty attribute list" << endl;
+      derr(1) << ".empty attribute list" << dendl;
       return -ENOENT;
     }
 
@@ -1752,14 +1750,14 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
   memset(&_name, 0, sizeof (_name));
   strncpy (_name.name, name, OSBDB_MAX_ATTR_LEN);
   int ins = binary_search<attr_name> (sap->names, sap->count, _name);
-  dout(4) << "..insertion point is " << ins << endl;
+  dout(4) << "..insertion point is " << ins << dendl;
   if (ins >= sap->count || strcmp (sap->names[ins].name, name) != 0)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".attribute not found in list" << endl;
+      derr(1) << ".attribute not found in list" << dendl;
       return -ENOENT;
     }
 
@@ -1767,17 +1765,17 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
   int n = (sap->count - ins) * sizeof (attr_name);
   if (n > 0)
     {
-      dout(4) << "..shift down by " << n << endl;
+      dout(4) << "..shift down by " << n << dendl;
       memmove (&(sap->names[ins]), &(sap->names[ins + 1]), n);
     }
   sap->count--;
-  dout(5) << "..attributes list now " << sap << endl;
+  dout(5) << "..attributes list now " << sap << dendl;
 
   asvalue.set_size(asvalue.get_size() - sizeof (attr_name));
   int ret;
   if ((ret = db->put (txn, &askey, &asvalue, 0)) != 0)
     {
-      derr(1) << "put stored_attrs " << db_strerror (ret) << endl;
+      derr(1) << "put stored_attrs " << db_strerror (ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -1790,7 +1788,7 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
   Dbt key (&aid, sizeof (aid));
   if ((ret = db->del (txn, &key, 0)) != 0)
     {
-      derr(1) << "deleting " << aid << ": " << db_strerror(ret) << endl;
+      derr(1) << "deleting " << aid << ": " << db_strerror(ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -1802,7 +1800,7 @@ int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
     txn->commit (0);
   if (onsafe != NULL)
     COMMIT(onsafe);
-  dout(4) << "..rmattr OK" << endl;
+  dout(4) << "..rmattr OK" << dendl;
   return 0;
 }
 
@@ -1811,7 +1809,7 @@ int OSBDB::listattr(object_t oid, char *attrs, size_t size)
   if (!mounted)
     return -EINVAL;
 
-  dout(2) << "listattr " << oid << endl;
+  dout(2) << "listattr " << oid << dendl;
 
   attrs_id aids = new_attrs_id (oid);
   Dbt key (&aids, sizeof_attrs_id());
@@ -1824,7 +1822,7 @@ int OSBDB::listattr(object_t oid, char *attrs, size_t size)
   if ((ret = db->get (NULL, &key, &value, 0)) != 0)
     {
       derr(1) << "fetching " << aids << ": " << db_strerror (ret)
-              << endl;
+              << dendl;
       return -ENOENT;
     }
 
@@ -1841,7 +1839,7 @@ int OSBDB::listattr(object_t oid, char *attrs, size_t size)
       p = p + n + 1;
     }
 
-  dout(4) << "listattr OK" << endl;
+  dout(4) << "listattr OK" << dendl;
   return 0;
 }
 
@@ -1851,7 +1849,7 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
                               const void *value, size_t size,
                               Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1861,10 +1859,10 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
 
   scoped_lock __lock(&lock);
   dout(2) << "collection_setattr " << hex << cid << dec << " " << name
-          << " (" << size << " bytes)" << endl;
+          << " (" << size << " bytes)" << dendl;
   if (strlen (name) >= OSBDB_MAX_ATTR_LEN)
     {
-      derr(1) << "name too long" << endl;
+      derr(1) << "name too long" << dendl;
       if (onsafe != NULL)
         CLEANUP(onsafe);
       return -ENAMETOOLONG;
@@ -1882,10 +1880,10 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
   if (transactional)
     env->txn_begin (NULL, &txn, 0);
 
-  dout(3) << "  getting " << aids << endl;
+  dout(3) << "  getting " << aids << dendl;
   if (db->get (txn, &attrs_key, &attrs_val, 0) != 0)
     {
-      dout(2) << "  first attribute" << endl;
+      dout(2) << "  first attribute" << dendl;
       sz = sizeof (stored_attrs);
       sap = (stored_attrs *) malloc(sz);
       sap->count = 0;
@@ -1894,7 +1892,7 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
     {
       sz = attrs_val.get_size();
       sap = (stored_attrs *) attrs_val.get_data();
-      dout(2) << "  add to list of " << sap->count << " attrs" << endl;
+      dout(2) << "  add to list of " << sap->count << " attrs" << dendl;
     }
   auto_ptr<stored_attrs> sa (sap);
 
@@ -1904,14 +1902,14 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
   int ins = 0;
   if (sap->count > 0)
     ins = binary_search<attr_name> (sap->names, sap->count, _name);
-  dout(3) << "  insertion point is " << ins << endl;
+  dout(3) << "  insertion point is " << ins << dendl;
   if (ins >= sap->count || strcmp (sap->names[ins].name, name) != 0)
     {
       sz += sizeof (attr_name);
       dout(3) << "  realloc " << hex << ((void *) sap) << " to "
-              << dec << sz << endl;
+              << dec << sz << dendl;
       sap = (stored_attrs *) realloc (sap, sz);
-      dout(3) << "  returns " << hex << ((void *) sap) << dec << endl;
+      dout(3) << "  returns " << hex << ((void *) sap) << dec << dendl;
       sa.release ();
       sa.reset (sap);
       int n = (sap->count - ins) * sizeof (attr_name);
@@ -1919,7 +1917,7 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
         {
           dout(3) << "  move " << n  << " bytes from 0x"
                   << hex << (&sap->names[ins]) << " to 0x"
-                  << hex << (&sap->names[ins+1]) << dec << endl;
+                  << hex << (&sap->names[ins+1]) << dec << dendl;
           memmove (&sap->names[ins+1], &sap->names[ins], n);
         }
       memset (&sap->names[ins], 0, sizeof (attr_name));
@@ -1929,36 +1927,36 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
       Dbt newAttrs_val (sap, sz);
       newAttrs_val.set_ulen (sz);
       newAttrs_val.set_flags (DB_DBT_USERMEM);
-      dout(3) << "  putting " << aids << endl;
+      dout(3) << "  putting " << aids << dendl;
       if (db->put (txn, &attrs_key, &newAttrs_val, 0) != 0)
         {
           if (txn != NULL)
             txn->abort();
           if (onsafe != NULL)
             CLEANUP(onsafe);
-          derr(1) << ".putting new attributes failed" << endl;
+          derr(1) << ".putting new attributes failed" << dendl;
           return -EIO;
         }
     }
   else
     {
-      dout(3) << "..attribute " << name << " already exists" << endl;
+      dout(3) << "..attribute " << name << " already exists" << dendl;
     }
 
-  dout(3) << "..attributes list: " << sap << endl;
+  dout(3) << "..attributes list: " << sap << dendl;
 
   // Add the attribute.
   coll_attr_id aid = new_coll_attr_id (cid, name);
   Dbt attr_key (&aid, sizeof (aid));
   Dbt attr_val ((void *) value, size);
-  dout(3) << "  writing attribute key " << aid << endl;
+  dout(3) << "  writing attribute key " << aid << dendl;
   if (db->put (txn, &attr_key, &attr_val, 0) != 0)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".putting attribute failed" << endl;
+      derr(1) << ".putting attribute failed" << dendl;
       return -EIO;
     }
 
@@ -1967,14 +1965,14 @@ int OSBDB::collection_setattr(coll_t cid, const char *name,
   if (onsafe != NULL)
     COMMIT(onsafe);
 
-  dout(4) << "..collection setattr OK" << endl;
+  dout(4) << "..collection setattr OK" << dendl;
   return 0;
 }
 
 int OSBDB::collection_rmattr(coll_t cid, const char *name,
                              Context *onsafe)
 {
-  dout(6) << "Context " << hex << onsafe << dec << endl;
+  dout(6) << "Context " << hex << onsafe << dec << dendl;
   if (!mounted)
     {
       if (onsafe != NULL)
@@ -1984,7 +1982,7 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
 
   scoped_lock __lock(&lock);
   dout(2) << "collection_rmattr " << hex << cid << dec
-          << " " << name << endl;
+          << " " << name << dendl;
 
   coll_attrs_id aids = new_coll_attrs_id (cid);
   Dbt askey (&aids, sizeof_coll_attrs_id());
@@ -2001,21 +1999,21 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".no attributes list" << endl;
+      derr(1) << ".no attributes list" << dendl;
       return -ENOENT;
     }
 
   stored_attrs *sap = (stored_attrs *) asvalue.get_data();
   auto_ptr<stored_attrs> sa (sap);
 
-  dout(5) << "..attributes list " << sap << endl;
+  dout(5) << "..attributes list " << sap << dendl;
   if (sap->count == 0)
     {
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".empty attributes list" << endl;
+      derr(1) << ".empty attributes list" << dendl;
       return -ENOENT;
     }
 
@@ -2029,7 +2027,7 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
         txn->abort();
       if (onsafe != NULL)
         CLEANUP(onsafe);
-      derr(1) << ".attribute not listed" << endl;
+      derr(1) << ".attribute not listed" << dendl;
       return -ENOENT;
     }
 
@@ -2037,17 +2035,17 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
   int n = (sap->count - ins) * sizeof (attr_name);
   if (n > 0)
     {
-      dout(4) << "..shift down by " << n << endl;
+      dout(4) << "..shift down by " << n << dendl;
       memmove (&(sap->names[ins]), &(sap->names[ins + 1]), n);
     }
   sap->count--;
-  dout(5) << "..attributes list now " << sap << endl;
+  dout(5) << "..attributes list now " << sap << dendl;
 
   asvalue.set_size(asvalue.get_size() - sizeof (attr_name));
   int ret;
   if ((ret = db->put (txn, &askey, &asvalue, 0)) != 0)
     {
-      derr(1) << "put stored_attrs " << db_strerror (ret) << endl;
+      derr(1) << "put stored_attrs " << db_strerror (ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -2060,7 +2058,7 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
   Dbt key (&aid, sizeof (aid));
   if ((ret = db->del (txn, &key, 0)) != 0)
     {
-      derr(1) << "deleting " << aid << ": " << db_strerror(ret) << endl;
+      derr(1) << "deleting " << aid << ": " << db_strerror(ret) << dendl;
       if (txn != NULL)
         txn->abort();
       if (onsafe != NULL)
@@ -2073,7 +2071,7 @@ int OSBDB::collection_rmattr(coll_t cid, const char *name,
   if (onsafe != NULL)
     COMMIT(onsafe);
 
-  dout(4) << "..collection rmattr OK" << endl;
+  dout(4) << "..collection rmattr OK" << dendl;
   return 0;
 }
 
@@ -2084,7 +2082,7 @@ int OSBDB::collection_getattr(coll_t cid, const char *name,
     return -EINVAL;
 
   dout(2) << "collection_getattr " << hex << cid << dec
-          << " " << name << endl;
+          << " " << name << dendl;
 
   // XXX transactions/read isolation?
 
@@ -2097,11 +2095,11 @@ int OSBDB::collection_getattr(coll_t cid, const char *name,
 
   if (db->get (NULL, &key, &val, 0) != 0)
     {
-      derr(1) << ".no attribute entry" << endl;
+      derr(1) << ".no attribute entry" << dendl;
       return -ENOENT;
     }
 
-  dout(4) << "..collection getattr OK; returns " << val.get_size() << endl;
+  dout(4) << "..collection getattr OK; returns " << val.get_size() << dendl;
   return val.get_size();
 }
 
@@ -2110,7 +2108,7 @@ int OSBDB::collection_listattr(coll_t cid, char *attrs, size_t size)
   if (!mounted)
     return -EINVAL;
 
-  dout(2) << "collection_listattr " << hex << cid << dec << endl;
+  dout(2) << "collection_listattr " << hex << cid << dec << dendl;
 
   // XXX transactions/read isolation?
 
@@ -2123,7 +2121,7 @@ int OSBDB::collection_listattr(coll_t cid, char *attrs, size_t size)
   if ((ret = db->get (NULL, &key, &value, 0)) != 0)
     {
       derr(1) << "fetching " << caids << ": " << db_strerror (ret)
-              << endl;
+              << dendl;
       return -ENOENT;
     }
 
index 82f035c04d1da227651e2c3cdcd89a2675e286a9..7ebaceb6fff40d225baa6f041c3c1faab4dc42d4 100644 (file)
@@ -66,9 +66,9 @@ uint64_t Ager::age_fill(float pc, utime_t until) {
     float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
     float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);  // to write to
     //float a = (float)(st.f_bfree) / (float)st.f_blocks;
-    //dout(10) << "age_fill at " << a << " / " << pc << " .. " << st.f_blocks << " " << st.f_bavail << endl;
+    //dout(10) << "age_fill at " << a << " / " << pc << " .. " << st.f_blocks << " " << st.f_bavail << dendl;
     if (free >= pc) {
-      dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << endl;
+      generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << dendl;
       break;
     }
 
@@ -88,7 +88,7 @@ uint64_t Ager::age_fill(float pc, utime_t until) {
 
 
 
-    dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
+    generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << oid << dec << " sz " << s << dendl;
     
 
     if (false && !g_conf.ebofs_verify && start_debug && wrote > 1000000ULL) { 
@@ -137,16 +137,16 @@ void Ager::age_empty(float pc) {
     store->statfs(&st);
     float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
     float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);  // to write to
-    dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << endl;//" stopping" << endl;
+    generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << dendl;//" stopping" << dendl;
     if (free <= pc) {
-      dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << endl;
+      generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << dendl;
       break;
     }
     
     int b = myrand() % 10;
     n--;
     if (n == 0 || age_objects[b].empty()) {
-      dout(2) << "age_empty sync" << endl;
+      generic_dout(2) << "age_empty sync" << dendl;
       //sync();
       //sync();
       n = nper;
@@ -155,7 +155,7 @@ void Ager::age_empty(float pc) {
     object_t oid = age_objects[b].front();
     age_objects[b].pop_front();
     
-    dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << oid << dec << endl;
+    generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << oid << dec << dendl;
     
     store->remove(oid);
     age_free_oids.push_back(oid);
@@ -219,7 +219,7 @@ void Ager::age(int time,
     high_water = (float)high_water * f;
     low_water = (float)low_water * f;
     final_water = (float)final_water * f;
-    dout(2) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << endl;
+    generic_dout(2) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << dendl;
   }
   
   // init size distn (once)
@@ -253,9 +253,9 @@ void Ager::age(int time,
     
     //if (c == 7) start_debug = true;
     
-    dout(1) << "#age " << c << "/" << count << " filling to " << high_water << endl;
+    generic_dout(1) << "#age " << c << "/" << count << " filling to " << high_water << dendl;
     uint64_t w = age_fill(high_water, until);
-    //dout(1) << "age wrote " << w << endl;
+    //dout(1) << "age wrote " << w << dendl;
     wrote += w;
     //store->sync();
     //store->_get_frag_stat(st);
@@ -263,10 +263,10 @@ void Ager::age(int time,
 
 
     if (c == count) {
-      dout(1) << "#age final empty to " << final_water << endl;
+      generic_dout(1) << "#age final empty to " << final_water << dendl;
       age_empty(final_water);    
     } else {
-      dout(1) << "#age " << c << "/" << count << " emptying to " << low_water << endl;
+      generic_dout(1) << "#age " << c << "/" << count << " emptying to " << low_water << dendl;
       age_empty(low_water);
     }
     //store->sync();
@@ -293,13 +293,13 @@ void Ager::age(int time,
   store->_fake_writes(false);
   store->sync();
   store->sync();
-  dout(1) << "age finished" << endl;
+  generic_dout(1) << "age finished" << dendl;
 }  
 
 
 void Ager::load_freelist()
 {
-  dout(1) << "load_freelist" << endl;
+  generic_dout(1) << "load_freelist" << dendl;
 
   struct stat st;
   
@@ -320,7 +320,7 @@ void Ager::load_freelist()
 
 void Ager::save_freelist(int el)
 {
-  dout(1) << "save_freelist " << el << endl;
+  generic_dout(1) << "save_freelist " << el << dendl;
   char s[100];
   sprintf(s, "ebofs.freelist.%d", el);
   bufferlist bl;
index 683c24634defd7381b8db58d7e381bb2e47777a0..a47919c95b0994dc6b6836ad008befcb62a55db0 100644 (file)
@@ -40,9 +40,9 @@
 #endif // DARWIN
 
 #include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug) cout << g_clock.now() << " osd" << whoami << ".fakestore "
-#define  derr(l)    if (l<=g_conf.debug) cerr << g_clock.now() << " osd" << whoami << ".fakestore "
+
+#define  dout(l)    if (l<=g_conf.debug) cout << dbeginl << g_clock.now() << " osd" << whoami << ".fakestore "
+#define  derr(l)    if (l<=g_conf.debug) cerr << dbeginl << g_clock.now() << " osd" << whoami << ".fakestore "
 
 #include "include/buffer.h"
 
@@ -115,18 +115,18 @@ int FakeStore::mkfs()
 {
   char cmd[200];
   if (g_conf.fakestore_dev) {
-    dout(0) << "mounting" << endl;
+    dout(0) << "mounting" << dendl;
     sprintf(cmd,"mount %s", g_conf.fakestore_dev);
     system(cmd);
   }
 
-  dout(1) << "mkfs in " << basedir << endl;
+  dout(1) << "mkfs in " << basedir << dendl;
 
   // wipe
   sprintf(cmd, "test -d %s && rm -r %s ; mkdir -p %s/collections && mkdir -p %s/objects",
          basedir.c_str(), basedir.c_str(), basedir.c_str(), basedir.c_str());
   
-  dout(5) << "wipe: " << cmd << endl;
+  dout(5) << "wipe: " << cmd << dendl;
   system(cmd);
 
   // hashed bits too
@@ -135,22 +135,22 @@ int FakeStore::mkfs()
     sprintf(s, "%02x", i);
     string subdir = basedir + "/objects/" + s;
 
-    dout(15) << " creating " << subdir << endl;
+    dout(15) << " creating " << subdir << dendl;
     int r = ::mkdir(subdir.c_str(), 0755);
     if (r != 0) {
-      derr(0) << "couldnt create subdir, r = " << r << endl;
+      derr(0) << "couldnt create subdir, r = " << r << dendl;
       return r;
     }
   }
   
   if (g_conf.fakestore_dev) {
     char cmd[100];
-    dout(0) << "umounting" << endl;
+    dout(0) << "umounting" << dendl;
     sprintf(cmd,"umount %s", g_conf.fakestore_dev);
     //system(cmd);
   }
 
-  dout(1) << "mkfs done in " << basedir << endl;
+  dout(1) << "mkfs done in " << basedir << dendl;
 
   return 0;
 }
@@ -158,24 +158,24 @@ int FakeStore::mkfs()
 int FakeStore::mount() 
 {
   if (g_conf.fakestore_dev) {
-    dout(0) << "mounting" << endl;
+    dout(0) << "mounting" << dendl;
     char cmd[100];
     sprintf(cmd,"mount %s", g_conf.fakestore_dev);
     //system(cmd);
   }
 
-  dout(5) << "basedir " << basedir << endl;
+  dout(5) << "basedir " << basedir << dendl;
   
   // make sure global base dir exists
   struct stat st;
   int r = ::stat(basedir.c_str(), &st);
   if (r != 0) {
-    derr(0) << "unable to stat basedir " << basedir << ", r = " << r << endl;
+    derr(0) << "unable to stat basedir " << basedir << ", r = " << r << dendl;
     return r;
   }
   
   if (g_conf.fakestore_fake_collections) {
-    dout(0) << "faking collections (in memory)" << endl;
+    dout(0) << "faking collections (in memory)" << dendl;
     fake_collections = true;
   }
 
@@ -184,14 +184,14 @@ int FakeStore::mount()
 #ifndef __CYGWIN__
   if (g_conf.fakestore_fake_attrs) {
 #endif
-    dout(0) << "faking attrs (in memory)" << endl;
+    dout(0) << "faking attrs (in memory)" << dendl;
     fake_attrs = true;
 #ifndef __CYGWIN__
   } else {
     char names[1000];
     r = ::listxattr(basedir.c_str(), names, 1000);
     if (r < 0) {
-      derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --fakestore_fake_attrs to fake them (in memory)." << endl;
+      derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --fakestore_fake_attrs to fake them (in memory)." << dendl;
       assert(0);
     }
   }
@@ -203,13 +203,13 @@ int FakeStore::mount()
 
 int FakeStore::umount() 
 {
-  dout(5) << "umount " << basedir << endl;
+  dout(5) << "umount " << basedir << dendl;
   
   sync();
 
   if (g_conf.fakestore_dev) {
     char cmd[100];
-    dout(0) << "umounting" << endl;
+    dout(0) << "umounting" << dendl;
     sprintf(cmd,"umount %s", g_conf.fakestore_dev);
     //system(cmd);
   }
@@ -236,7 +236,7 @@ bool FakeStore::exists(object_t oid)
 int FakeStore::stat(object_t oid,
                     struct stat *st)
 {
-  dout(20) << "stat " << oid << endl;
+  dout(20) << "stat " << oid << dendl;
   char fn[200];
   get_oname(oid,fn);
   int r = ::stat(fn, st);
@@ -247,7 +247,7 @@ int FakeStore::stat(object_t oid,
 
 int FakeStore::remove(object_t oid, Context *onsafe) 
 {
-  dout(20) << "remove " << oid << endl;
+  dout(20) << "remove " << oid << dendl;
   char fn[200];
   get_oname(oid,fn);
   int r = ::unlink(fn);
@@ -257,7 +257,7 @@ int FakeStore::remove(object_t oid, Context *onsafe)
 
 int FakeStore::truncate(object_t oid, off_t size, Context *onsafe)
 {
-  dout(20) << "truncate " << oid << " size " << size << endl;
+  dout(20) << "truncate " << oid << " size " << size << dendl;
 
   char fn[200];
   get_oname(oid,fn);
@@ -269,14 +269,14 @@ int FakeStore::truncate(object_t oid, off_t size, Context *onsafe)
 int FakeStore::read(object_t oid, 
                     off_t offset, size_t len,
                     bufferlist& bl) {
-  dout(20) << "read " << oid << " len " << len << " off " << offset << endl;
+  dout(20) << "read " << oid << " len " << len << " off " << offset << dendl;
 
   char fn[200];
   get_oname(oid,fn);
   
   int fd = ::open(fn, O_RDONLY);
   if (fd < 0) {
-    dout(10) << "read couldn't open " << fn << " errno " << errno << " " << strerror(errno) << endl;
+    dout(10) << "read couldn't open " << fn << " errno " << errno << " " << strerror(errno) << dendl;
     return fd;
   }
   ::flock(fd, LOCK_EX);    // lock for safety
@@ -310,7 +310,7 @@ int FakeStore::write(object_t oid,
   char fn[200];
   get_oname(oid,fn);
 
-  dout(20) << "write " << fn << " len " << len << " off " << offset << endl;
+  dout(20) << "write " << fn << " len " << len << " off " << offset << dendl;
 
   
   ::mknod(fn, 0644, 0);  // in case it doesn't exist yet.
@@ -318,7 +318,7 @@ int FakeStore::write(object_t oid,
   int flags = O_WRONLY;//|O_CREAT;
   int fd = ::open(fn, flags);
   if (fd < 0) {
-    derr(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror(errno) << endl;
+    derr(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror(errno) << dendl;
     return fd;
   }
   ::fchmod(fd, 0664);
@@ -337,12 +337,12 @@ int FakeStore::write(object_t oid,
     if (r > 0)
       did += r;
     else {
-      derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << endl;
+      derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << dendl;
     }
   }
   
   if (did < 0) {
-    derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << endl;
+    derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << dendl;
   }
 
   ::flock(fd, LOCK_UN);
@@ -384,7 +384,7 @@ void FakeStore::sync()
 {
   synclock.Lock();
   while (unsync > 0) {
-    dout(0) << "sync waiting for " << unsync << " items to (fake) sync" << endl;
+    dout(0) << "sync waiting for " << unsync << " items to (fake) sync" << dendl;
     synccond.Wait(synclock);
   }
   synclock.Unlock();
@@ -467,9 +467,9 @@ int FakeStore::getattrs(object_t oid, map<string,bufferptr>& aset)
   
   char *name = names;
   for (int i=0; i<num; i++) {
-    dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "'" << endl;
+    dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "'" << dendl;
     int l = ::getxattr(fn, name, val, 1000);
-    dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "' = " << l << " bytes" << endl;
+    dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "' = " << l << " bytes" << dendl;
     aset[names].append(val, l);
     name += strlen(name) + 1;
   }
@@ -650,7 +650,7 @@ int FakeStore::collection_list(coll_t c, list<object_t>& ls)
     *(((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);
-    dout(0) << " got " << o << " errno " << errno << " on " << de->d_name << endl;
+    dout(0) << " got " << o << " errno " << errno << " on " << de->d_name << dendl;
     if (errno) continue;
     ls.push_back(o);
   }
index ea5605857300a24b30a2943b0a4360edc611c732..b13171211c35d8998e84d9fb70ae994c2bca7fe2 100644 (file)
@@ -69,7 +69,6 @@
 
 #include "config.h"
 
-#include "debug.h"
 #define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
 #define  derr(l)    if (l<=g_conf.debug || l<=g_conf.debug_osd) cerr << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
 
index ac81c6a3b4ea0ea06973f177a18dedcea8137e01..14d9b62eaebca146d1d914ad406164c3589fa4a5 100644 (file)
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "common/Clock.h"
 
+#define dout(x) if (x < g_conf.debug) cout << dbeginl << g_clock.now() << " ager: " 
 
 object_t ObjectStore::age_get_oid() {
     if (!age_free_oids.empty()) {
@@ -33,7 +34,7 @@ object_t ObjectStore::age_get_oid() {
       statfs(&st);
       float a = (float)(st.f_blocks-st.f_bavail) / (float)st.f_blocks;
       if (a >= pc) {
-        dout(10) << "age_fill at " << a << " / " << pc << " stopping" << endl;
+        dout(10) << "age_fill at " << a << " / " << pc << " stopping" << dendl;
         break;
       }
 
@@ -44,7 +45,7 @@ object_t ObjectStore::age_get_oid() {
 
       ssize_t s = age_pick_size();
 
-      dout(10) << "age_fill at " << a << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
+      dout(10) << "age_fill at " << a << " / " << pc << " creating " << hex << oid << dec << " sz " << s << dendl;
 
       off_t off = 0;
       while (s) {
@@ -65,14 +66,14 @@ object_t ObjectStore::age_get_oid() {
       statfs(&st);
       float a = (float)(st.f_blocks-st.f_bavail) / (float)st.f_blocks;
       if (a <= pc) {
-        dout(10) << "age_empty at " << a << " / " << pc << " stopping" << endl;
+        dout(10) << "age_empty at " << a << " / " << pc << " stopping" << dendl;
         break;
       }
 
       int b = rand() % 10;
       n--;
       if (n == 0 || age_objects[b].empty()) {
-        dout(10) << "age_empty sync" << endl;
+        dout(10) << "age_empty sync" << dendl;
         //sync();
         sync();
         n = nper;
@@ -81,7 +82,7 @@ object_t ObjectStore::age_get_oid() {
       object_t oid = age_objects[b].front();
       age_objects[b].pop_front();
 
-      dout(10) << "age_empty at " << a << " / " << pc << " removing " << hex << oid << dec << endl;
+      dout(10) << "age_empty at " << a << " / " << pc << " removing " << hex << oid << dec << dendl;
 
       remove(oid);
       age_free_oids.push_back(oid);
@@ -108,7 +109,7 @@ object_t ObjectStore::age_get_oid() {
       high_water = (float)high_water * f;
       low_water = (float)low_water * f;
       final_water = (float)final_water * f;
-      dout(10) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << endl;
+      dout(10) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << dendl;
     }
 
     // init size distn (once)
@@ -136,16 +137,16 @@ object_t ObjectStore::age_get_oid() {
     for (int c=1; c<=count; c++) {
       if (g_clock.now() > until) break;
 
-      dout(1) << "age " << c << "/" << count << " filling to " << high_water << endl;
+      dout(1) << "age " << c << "/" << count << " filling to " << high_water << dendl;
       age_fill(high_water, until);
       if (c == count) {
-        dout(1) << "age final empty to " << final_water << endl;
+        dout(1) << "age final empty to " << final_water << dendl;
         age_empty(final_water);    
       } else {
-        dout(1) << "age " << c << "/" << count << " emptying to " << low_water << endl;
+        dout(1) << "age " << c << "/" << count << " emptying to " << low_water << dendl;
         age_empty(low_water);
       }
     }
-    dout(1) << "age finished" << endl;
+    dout(1) << "age finished" << dendl;
   }  
   
index 4367294ccab669ec73717e73be538f1f7dbe0086..b7c1a9261163f77cef66a83cec11b8ae46227834 100644 (file)
@@ -26,7 +26,6 @@
 #include "messages/MOSDPGRemove.h"
 #include "messages/MOSDPGActivateSet.h"
 
-#include "debug.h"
 #define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->whoami << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
 
 
@@ -228,9 +227,9 @@ void PG::merge_log(Log &olog, Missing &omissing, int fromosd)
   dout(10) << "merge_log " << olog << " from osd" << fromosd
            << " into " << log << dendl;
 
-  //cout << "log" << dendl;
+  //dout(0) << "log" << dendl;
   //log.print(cout);
-  //cout << "olog" << dendl;
+  //dout(0) << "olog" << dendl;
   //olog.print(cout);
   
   if (log.empty() ||
@@ -1177,7 +1176,7 @@ bool PG::block_if_wrlocked(MOSDOp* op)
 
   entity_name_t source;
   int len = osd->store->getattr(oid, "wrlock", &source, sizeof(entity_name_t));
-  //cout << "getattr returns " << len << " on " << oid << dendl;
+  //dout(0) << "getattr returns " << len << " on " << oid << dendl;
   
   if (len == sizeof(source) &&
       source != op->get_client()) {
index 0b3c9b1f0ee3436a1cad087c436a0172762b2086..6d1003ae0a1e20c000838615a4fc7c8df19c71a5 100644 (file)
@@ -23,9 +23,7 @@
 #include "messages/MOSDPGRemove.h"
 
 #include "config.h"
-#include "debug.h"
 
-#undef dout
 #define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
 
 #include <errno.h>
index a3b378cdb6706503dadaaa546e447a9f88fb8056..0493797bb0dab7800eedd8176d3831732646f260 100644 (file)
@@ -25,8 +25,6 @@
 
 #include "config.h"
 
-#include "debug.h"
-
 #define  dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
 
 #include <errno.h>
index 85f09aa0e99b454533b24101c8853a85f425f76b..b3c56dca574bfa63079bb5032b997eb23c84146c 100644 (file)
@@ -31,8 +31,8 @@
 #include "include/Context.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
+
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
 
 
 class Filer::C_Probe : public Context {
@@ -52,7 +52,7 @@ int Filer::probe_fwd(inode_t& inode,
                     off_t *end,
                     Context *onfinish) 
 {
-  dout(10) << "probe_fwd " << hex << inode.ino << dec << " starting from " << start_from << endl;
+  dout(10) << "probe_fwd " << hex << inode.ino << dec << " starting from " << start_from << dendl;
 
   Probe *probe = new Probe(inode, start_from, end, onfinish);
 
@@ -70,7 +70,7 @@ int Filer::probe_fwd(inode_t& inode,
 
 void Filer::_probe(Probe *probe)
 {
-  dout(10) << "_probe " << hex << probe->inode.ino << dec << " " << probe->from << "~" << probe->probing_len << endl;
+  dout(10) << "_probe " << hex << probe->inode.ino << dec << " " << probe->from << "~" << probe->probing_len << dendl;
   
   // map range onto objects
   file_to_extents(probe->inode, probe->from, probe->probing_len, probe->probing);
@@ -78,7 +78,7 @@ void Filer::_probe(Probe *probe)
   for (list<ObjectExtent>::iterator p = probe->probing.begin();
        p != probe->probing.end();
        p++) {
-    dout(10) << "_probe  probing " << p->oid << endl;
+    dout(10) << "_probe  probing " << p->oid << dendl;
     C_Probe *c = new C_Probe(this, probe, p->oid);
     probe->ops[p->oid] = objecter->stat(p->oid, &c->size, p->layout, c);
   }
@@ -86,7 +86,7 @@ void Filer::_probe(Probe *probe)
 
 void Filer::_probed(Probe *probe, object_t oid, off_t size)
 {
-  dout(10) << "_probed " << probe->inode.ino << " object " << hex << oid << dec << " has size " << size << endl;
+  dout(10) << "_probed " << probe->inode.ino << " object " << hex << oid << dec << " has size " << size << dendl;
 
   probe->known[oid] = size;
   assert(probe->ops.count(oid));
@@ -104,7 +104,7 @@ void Filer::_probed(Probe *probe, object_t oid, off_t size)
     dout(10) << "_probed  " << probe->inode.ino << " object " << hex << p->oid << dec
             << " should be " << shouldbe
             << ", actual is " << probe->known[p->oid]
-            << endl;
+            << dendl;
 
     if (probe->known[p->oid] < 0) { end = -1; break; } // error!
 
@@ -121,7 +121,7 @@ void Filer::_probed(Probe *probe, object_t oid, off_t size)
        end = probe->from + i->first + oleft;
        dout(10) << "_probed  end is in buffer_extent " << i->first << "~" << i->second << " off " << oleft 
                 << ", from was " << probe->from << ", end is " << end 
-                << endl;
+                << dendl;
        break;
       }
       oleft -= i->second;
@@ -131,7 +131,7 @@ void Filer::_probed(Probe *probe, object_t oid, off_t size)
 
   if (end == 0) {
     // keep probing!
-    dout(10) << "_probed didn't find end, probing further" << endl;
+    dout(10) << "_probed didn't find end, probing further" << dendl;
     off_t period = probe->inode.layout.object_size * probe->inode.layout.stripe_count;
     probe->from += probe->probing_len;
     probe->probing_len = period;
@@ -140,11 +140,11 @@ void Filer::_probed(Probe *probe, object_t oid, off_t size)
   }
 
   if (end < 0) {
-    dout(10) << "_probed encountered an error while probing" << endl;
+    dout(10) << "_probed encountered an error while probing" << dendl;
     *probe->end = -1;
   } else {
     // hooray!
-    dout(10) << "_probed found end at " << end << endl;
+    dout(10) << "_probed found end at " << end << dendl;
     *probe->end = end;
   }
 
@@ -162,7 +162,7 @@ void Filer::file_to_extents(inode_t inode,
 {
   dout(10) << "file_to_extents " << offset << "~" << len 
            << " on " << hex << inode.ino << dec
-           << endl;
+           << dendl;
 
   /* we want only one extent per object!
    * this means that each extent we read may map into different bits of the 
@@ -172,7 +172,7 @@ void Filer::file_to_extents(inode_t inode,
   
   assert(inode.layout.object_size >= inode.layout.stripe_unit);
   off_t stripes_per_object = inode.layout.object_size / inode.layout.stripe_unit;
-  dout(20) << " stripes_per_object " << stripes_per_object << endl;
+  dout(20) << " stripes_per_object " << stripes_per_object << dendl;
 
   off_t cur = offset;
   off_t left = len;
@@ -220,8 +220,8 @@ void Filer::file_to_extents(inode_t inode,
     }
     ex->buffer_extents[cur-offset] = x_len;
         
-    dout(15) << "file_to_extents  " << *ex << " in " << ex->layout << endl;
-    //cout << "map: ino " << ino << " oid " << ex.oid << " osd " << ex.osd << " offset " << ex.offset << " len " << ex.len << " ... left " << left << endl;
+    dout(15) << "file_to_extents  " << *ex << " in " << ex->layout << dendl;
+    //dout(0) << "map: ino " << ino << " oid " << ex.oid << " osd " << ex.osd << " offset " << ex.offset << " len " << ex.len << " ... left " << left << dendl;
     
     left -= x_len;
     cur += x_len;
index 73394bea64993cd429b85821d4e73105959b828c..7fd5230f0408adbf97072b3cae1027be5311cb72 100644 (file)
 #include "msg/Messenger.h"
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_journaler) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
-#define derr(x)  if (x <= g_conf.debug || x <= g_conf.debug_journaler) cerr << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
+
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_journaler) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
+#define derr(x)  if (x <= g_conf.debug || x <= g_conf.debug_journaler) cerr << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
 
 
 
 void Journaler::reset()
 {
-  dout(1) << "reset to blank journal" << endl;
+  dout(1) << "reset to blank journal" << dendl;
   state = STATE_ACTIVE;
   write_pos = flush_pos = ack_pos =
     read_pos = requested_pos = received_pos =
@@ -74,11 +74,11 @@ void Journaler::recover(Context *onread)
     waitfor_recover.push_back(onread);
   
   if (state != STATE_UNDEF) {
-    dout(1) << "recover - already recoverying" << endl;
+    dout(1) << "recover - already recoverying" << dendl;
     return;
   }
 
-  dout(1) << "read_head" << endl;
+  dout(1) << "read_head" << dendl;
   state = STATE_READHEAD;
   C_ReadHead *fin = new C_ReadHead(this);
   filer.read(inode, 0, sizeof(Header), &fin->bl, fin);
@@ -89,7 +89,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl)
   assert(state == STATE_READHEAD);
 
   if (bl.length() == 0) {
-    dout(1) << "_finish_read_head r=" << r << " read 0 bytes, assuming empty log" << endl;    
+    dout(1) << "_finish_read_head r=" << r << " read 0 bytes, assuming empty log" << dendl;    
     state = STATE_ACTIVE;
     list<Context*> ls;
     ls.swap(waitfor_recover);
@@ -107,7 +107,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl)
   expire_pos = h.expire_pos;
   trimmed_pos = trimming_pos = h.trimmed_pos;
 
-  dout(1) << "_finish_read_head " << h << ".  probing for end of log (from " << write_pos << ")..." << endl;
+  dout(1) << "_finish_read_head " << h << ".  probing for end of log (from " << write_pos << ")..." << dendl;
 
   // probe the log
   state = STATE_PROBING;
@@ -123,14 +123,14 @@ void Journaler::_finish_probe_end(int r, off_t end)
     end = write_pos;
     dout(1) << "_finish_probe_end write_pos = " << end 
            << " (header had " << write_pos << "). log was empty. recovered."
-           << endl;
+           << dendl;
     assert(0); // hrm.
   } else {
     assert(end >= write_pos);
     assert(r >= 0);
     dout(1) << "_finish_probe_end write_pos = " << end 
            << " (header had " << write_pos << "). recovered."
-           << endl;
+           << dendl;
   }
 
   write_pos = flush_pos = ack_pos = end;
@@ -162,7 +162,7 @@ void Journaler::write_head(Context *oncommit)
   last_written.expire_pos = expire_pos;
   last_written.read_pos = read_pos;
   last_written.write_pos = ack_pos; //write_pos;
-  dout(10) << "write_head " << last_written << endl;
+  dout(10) << "write_head " << last_written << dendl;
   
   last_wrote_head = g_clock.now();
 
@@ -175,7 +175,7 @@ void Journaler::write_head(Context *oncommit)
 
 void Journaler::_finish_write_head(Header &wrote, Context *oncommit)
 {
-  dout(10) << "_finish_write_head " << wrote << endl;
+  dout(10) << "_finish_write_head " << wrote << dendl;
   last_committed = wrote;
   if (oncommit) {
     oncommit->finish(0);
@@ -223,7 +223,7 @@ void Journaler::_finish_flush(int r, off_t start)
   dout(10) << "_finish_flush from " << start
           << ", pending_flush now " << pending_flush 
           << ", write positions now " << write_pos << "/" << flush_pos << "/" << ack_pos
-          << endl;
+          << dendl;
 
   // kick waiters <= ack_pos
   while (!waitfor_flush.empty()) {
@@ -257,18 +257,18 @@ off_t Journaler::append_entry(bufferlist& bl, Context *onsync)
       // now flush.
       flush();
       
-      dout(12) << "append_entry skipped " << (write_pos-owp) << " bytes to " << write_pos << " to avoid spanning stripe boundary" << endl;
+      dout(12) << "append_entry skipped " << (write_pos-owp) << " bytes to " << write_pos << " to avoid spanning stripe boundary" << dendl;
     }
   }
        
-  dout(10) << "append_entry len " << bl.length() << " to " << write_pos << "~" << (bl.length() + sizeof(uint32_t)) << endl;
+  dout(10) << "append_entry len " << bl.length() << " to " << write_pos << "~" << (bl.length() + sizeof(uint32_t)) << dendl;
   
   // cache?
   //  NOTE: this is a dumb thing to do; this is used for a benchmarking
   //   purposes only.
   if (g_conf.journaler_cache &&
       write_pos == read_pos + read_buf.length()) {
-    dout(10) << "append_entry caching in read_buf too" << endl;
+    dout(10) << "append_entry caching in read_buf too" << dendl;
     assert(requested_pos == received_pos);
     assert(requested_pos == read_pos + read_buf.length());
     read_buf.append((char*)&s, sizeof(s));
@@ -294,7 +294,7 @@ void Journaler::flush(Context *onsync)
   // all flushed and acked?
   if (write_pos == ack_pos) {
     assert(write_buf.length() == 0);
-    dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+    dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
     if (onsync) {
       onsync->finish(0);
       delete onsync;
@@ -304,12 +304,12 @@ void Journaler::flush(Context *onsync)
 
   if (write_pos == flush_pos) {
     assert(write_buf.length() == 0);
-    dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+    dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
   } else {
     // flush
     unsigned len = write_pos - flush_pos;
     assert(len == write_buf.length());
-    dout(10) << "flush flushing " << flush_pos << "~" << len << endl;
+    dout(10) << "flush flushing " << flush_pos << "~" << len << dendl;
     
     // submit write for anything pending
     // flush _start_ pos to _finish_flush
@@ -322,7 +322,7 @@ void Journaler::flush(Context *onsync)
     flush_pos = write_pos;
     write_buf.clear();  
     
-    dout(10) << "flush write pointers now at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+    dout(10) << "flush write pointers now at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
   }
 
   // queue waiter (at _new_ write_pos; will go when reached by ack_pos)
@@ -358,17 +358,17 @@ void Journaler::_finish_read(int r)
 {
   assert(r>=0);
 
-  dout(10) << "_finish_read got " << received_pos << "~" << reading_buf.length() << endl;
+  dout(10) << "_finish_read got " << received_pos << "~" << reading_buf.length() << dendl;
   received_pos += reading_buf.length();
   read_buf.claim_append(reading_buf);
   assert(received_pos <= requested_pos);
   dout(10) << "_finish_read read_buf now " << read_pos << "~" << read_buf.length() 
           << ", read pointers " << read_pos << "/" << received_pos << "/" << requested_pos
-          << endl;
+          << dendl;
   
   if (is_readable()) { // NOTE: this check may read more
     // readable!
-    dout(10) << "_finish_read now readable" << endl;
+    dout(10) << "_finish_read now readable" << dendl;
     if (on_readable) {
       Context *f = on_readable;
       on_readable = 0;
@@ -404,7 +404,7 @@ void Journaler::_issue_read(off_t len)
 {
   if (_is_reading()) {
     dout(10) << "_issue_read " << len << " waiting, already reading " 
-            << received_pos << "~" << (requested_pos-received_pos) << endl;
+            << received_pos << "~" << (requested_pos-received_pos) << dendl;
     return;
   } 
   assert(requested_pos == received_pos);
@@ -412,7 +412,7 @@ void Journaler::_issue_read(off_t len)
   // stuck at ack_pos?
   assert(requested_pos <= ack_pos);
   if (requested_pos == ack_pos) {
-    dout(10) << "_issue_read requested_pos = ack_pos = " << ack_pos << ", waiting" << endl;
+    dout(10) << "_issue_read requested_pos = ack_pos = " << ack_pos << ", waiting" << dendl;
     assert(write_pos > requested_pos);
     if (flush_pos == ack_pos)
       flush();
@@ -424,13 +424,13 @@ void Journaler::_issue_read(off_t len)
   // don't read too much
   if (requested_pos + len > ack_pos) {
     len = ack_pos - requested_pos;
-    dout(10) << "_issue_read reading only up to ack_pos " << ack_pos << endl;
+    dout(10) << "_issue_read reading only up to ack_pos " << ack_pos << dendl;
   }
 
   // go.
   dout(10) << "_issue_read reading " << requested_pos << "~" << len 
           << ", read pointers " << read_pos << "/" << received_pos << "/" << (requested_pos+len)
-          << endl;
+          << dendl;
   
   filer.read(inode, requested_pos, len, &reading_buf, 
             new C_Read(this));
@@ -445,7 +445,7 @@ void Journaler::_prefetch()
       !_is_reading() &&             // and not reading anything right now
       write_pos > requested_pos) {  // there's something more to read...
     dout(10) << "_prefetch only " << left << " < " << prefetch_from
-            << ", prefetching " << endl;
+            << ", prefetching " << dendl;
     _issue_read(fetch_len);
   }
 }
@@ -460,7 +460,7 @@ void Journaler::read_entry(bufferlist *bl, Context *onfinish)
   if (is_readable()) {
     dout(10) << "read_entry at " << read_pos << ", read_buf is " 
             << read_pos << "~" << read_buf.length() 
-            << ", readable now" << endl;
+            << ", readable now" << dendl;
 
     // nice, just do it now.
     bool r = try_read_entry(*bl);
@@ -472,7 +472,7 @@ void Journaler::read_entry(bufferlist *bl, Context *onfinish)
   } else {
     dout(10) << "read_entry at " << read_pos << ", read_buf is " 
             << read_pos << "~" << read_buf.length() 
-            << ", not readable now" << endl;
+            << ", not readable now" << dendl;
 
     bl->clear();
 
@@ -508,7 +508,7 @@ bool Journaler::is_readable()
 
   // partial fragment at the end?
   if (received_pos == write_pos) {
-    dout(10) << "is_readable() detected partial entry at tail, adjusting write_pos to " << read_pos << endl;
+    dout(10) << "is_readable() detected partial entry at tail, adjusting write_pos to " << read_pos << dendl;
     write_pos = flush_pos = ack_pos = read_pos;
     assert(write_buf.length() == 0);
 
@@ -536,7 +536,7 @@ bool Journaler::is_readable()
 bool Journaler::try_read_entry(bufferlist& bl)
 {
   if (!is_readable()) {  // this may start a read. 
-    dout(10) << "try_read_entry at " << read_pos << " not readable" << endl;
+    dout(10) << "try_read_entry at " << read_pos << " not readable" << dendl;
     return false;
   }
   
@@ -546,7 +546,7 @@ bool Journaler::try_read_entry(bufferlist& bl)
   assert(read_buf.length() >= sizeof(s) + s);
   
   dout(10) << "try_read_entry at " << read_pos << " reading " 
-          << read_pos << "~" << (sizeof(s)+s) << endl;
+          << read_pos << "~" << (sizeof(s)+s) << dendl;
 
   // do it
   assert(bl.length() == 0);
@@ -561,7 +561,7 @@ bool Journaler::try_read_entry(bufferlist& bl)
 
 void Journaler::wait_for_readable(Context *onreadable)
 {
-  dout(10) << "wait_for_readable at " << read_pos << " onreadable " << onreadable << endl;
+  dout(10) << "wait_for_readable at " << read_pos << " onreadable " << onreadable << dendl;
   assert(!is_readable());
   assert(on_readable == 0);
   on_readable = onreadable;
@@ -589,16 +589,16 @@ void Journaler::trim()
   trim_to -= trim_to % inode.layout.period();
   dout(10) << "trim last_commited head was " << last_committed
           << ", can trim to " << trim_to
-          << endl;
+          << dendl;
   if (trim_to == 0 || trim_to == trimming_pos) {
     dout(10) << "trim already trimmed/trimming to " 
-            << trimmed_pos << "/" << trimming_pos << endl;
+            << trimmed_pos << "/" << trimming_pos << dendl;
     return;
   }
 
   if (trimming_pos > trimmed_pos) {
     dout(10) << "trim already trimming atm, try again later.  trimmed/trimming is " 
-            << trimmed_pos << "/" << trimming_pos << endl;
+            << trimmed_pos << "/" << trimming_pos << dendl;
     return;
   }
   
@@ -608,7 +608,7 @@ void Journaler::trim()
   dout(10) << "trim trimming to " << trim_to 
           << ", trimmed/trimming/expire are " 
           << trimmed_pos << "/" << trimming_pos << "/" << expire_pos
-          << endl;
+          << dendl;
   
   filer.remove(inode, trimming_pos, trim_to-trimming_pos, 
               0, new C_Trim(this, trim_to));
@@ -620,7 +620,7 @@ void Journaler::_trim_finish(int r, off_t to)
   dout(10) << "_trim_finish trimmed_pos was " << trimmed_pos
           << ", trimmed/trimming/expire now "
           << to << "/" << trimming_pos << "/" << expire_pos
-          << endl;
+          << dendl;
   assert(r >= 0);
   
   assert(to <= trimming_pos);
index 9ec3df910dd084b467c5aa68cbdc18dc9cd12f1a..1bab2d4bec7ae444a9ec824bd6a48695fde98a29 100644 (file)
 
 /*** ObjectCacher::Object ***/
 
-#undef dout
-#define dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
+#define dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
 
 
 ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left, off_t off)
 {
-  dout(20) << "split " << *left << " at " << off << endl;
+  dout(20) << "split " << *left << " at " << off << dendl;
   
   // split off right
   ObjectCacher::BufferHead *right = new BufferHead(this);
@@ -52,7 +51,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left, off_t of
     p--;
     while (p != left->waitfor_read.begin()) {
       if (p->first < right->start()) break;      
-      dout(0) << "split  moving waiters at byte " << p->first << " to right bh" << endl;
+      dout(0) << "split  moving waiters at byte " << p->first << " to right bh" << dendl;
       right->waitfor_read[p->first].swap( p->second );
       o = p;
       p--;
@@ -60,8 +59,8 @@ ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left, off_t of
     }
   }
   
-  dout(20) << "split    left is " << *left << endl;
-  dout(20) << "split   right is " << *right << endl;
+  dout(20) << "split    left is " << *left << dendl;
+  dout(20) << "split   right is " << *right << dendl;
   return right;
 }
 
@@ -71,7 +70,7 @@ void ObjectCacher::Object::merge_left(BufferHead *left, BufferHead *right)
   assert(left->end() == right->start());
   assert(left->get_state() == right->get_state());
 
-  dout(10) << "merge_left " << *left << " + " << *right << endl;
+  dout(10) << "merge_left " << *left << " + " << *right << dendl;
   oc->bh_remove(this, right);
   oc->bh_stat_sub(left);
   left->set_length( left->length() + right->length());
@@ -95,12 +94,12 @@ void ObjectCacher::Object::merge_left(BufferHead *left, BufferHead *right)
   // hose right
   delete right;
 
-  dout(10) << "merge_left result " << *left << endl;
+  dout(10) << "merge_left result " << *left << dendl;
 }
 
 void ObjectCacher::Object::try_merge_bh(BufferHead *bh)
 {
-  dout(10) << "try_merge_bh " << *bh << endl;
+  dout(10) << "try_merge_bh " << *bh << dendl;
 
   // to the left?
   map<off_t,BufferHead*>::iterator p = data.find(bh->start());
@@ -140,7 +139,7 @@ int ObjectCacher::Object::map_read(Objecter::OSDRead *rd,
     if (ex_it->oid != oid) continue;
     
     dout(10) << "map_read " << ex_it->oid 
-             << " " << ex_it->start << "~" << ex_it->length << endl;
+             << " " << ex_it->start << "~" << ex_it->length << dendl;
     
     map<off_t, BufferHead*>::iterator p = data.lower_bound(ex_it->start);
     // p->first >= start
@@ -164,7 +163,7 @@ int ObjectCacher::Object::map_read(Objecter::OSDRead *rd,
         n->set_length( left );
         oc->bh_add(this, n);
         missing[cur] = n;
-        dout(20) << "map_read miss " << left << " left, " << *n << endl;
+        dout(20) << "map_read miss " << left << " left, " << *n << dendl;
         cur += left;
         left -= left;
         assert(left == 0);
@@ -180,11 +179,11 @@ int ObjectCacher::Object::map_read(Objecter::OSDRead *rd,
             e->is_dirty() ||
             e->is_tx()) {
           hits[cur] = e;     // readable!
-          dout(20) << "map_read hit " << *e << endl;
+          dout(20) << "map_read hit " << *e << dendl;
         } 
         else if (e->is_rx()) {
           rx[cur] = e;       // missing, not readable.
-          dout(20) << "map_read rx " << *e << endl;
+          dout(20) << "map_read rx " << *e << dendl;
         }
         else assert(0);
         
@@ -204,7 +203,7 @@ int ObjectCacher::Object::map_read(Objecter::OSDRead *rd,
         missing[cur] = n;
         cur += MIN(left, n->length());
         left -= MIN(left, n->length());
-        dout(20) << "map_read gap " << *n << endl;
+        dout(20) << "map_read gap " << *n << dendl;
         continue;    // more?
       }
       else 
@@ -231,7 +230,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
     if (ex_it->oid != oid) continue;
     
     dout(10) << "map_write oex " << ex_it->oid
-             << " " << ex_it->start << "~" << ex_it->length << endl;
+             << " " << ex_it->start << "~" << ex_it->length << dendl;
     
     map<off_t, BufferHead*>::iterator p = data.lower_bound(ex_it->start);
     // p->first >= start
@@ -246,7 +245,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
       /*// dirty and butts up?
       if (p->first + p->second->length() == cur &&
           p->second->is_dirty()) {
-        dout(10) << "map_write will append to tail of " << *p->second << endl;
+        dout(10) << "map_write will append to tail of " << *p->second << dendl;
         final = p->second;
       }
       */
@@ -264,7 +263,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
           final->set_start( cur );
           final->set_length( max );
           oc->bh_add(this, final);
-          dout(10) << "map_write adding trailing bh " << *final << endl;
+          dout(10) << "map_write adding trailing bh " << *final << dendl;
         } else {
           final->set_length( final->length() + max );
         }
@@ -273,11 +272,11 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
         continue;
       }
       
-      dout(10) << "p is " << *p->second << endl;
+      dout(10) << "p is " << *p->second << dendl;
 
       if (p->first <= cur) {
         BufferHead *bh = p->second;
-        dout(10) << "map_write bh " << *bh << " intersected" << endl;
+        dout(10) << "map_write bh " << *bh << " intersected" << dendl;
         
         if (p->first < cur) {
           assert(final == 0);
@@ -316,7 +315,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
         // gap!
         off_t next = p->first;
         off_t glen = MIN(next - cur, max);
-        dout(10) << "map_write gap " << cur << "~" << glen << endl;
+        dout(10) << "map_write gap " << cur << "~" << glen << dendl;
         if (final) {
           final->set_length( final->length() + glen );
         } else {
@@ -335,7 +334,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
   
   // set versoin
   assert(final);
-  dout(10) << "map_write final is " << *final << endl;
+  dout(10) << "map_write final is " << *final << dendl;
 
   return final;
 }
@@ -343,7 +342,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
 
 void ObjectCacher::Object::truncate(off_t s)
 {
-  dout(10) << "truncate to " << s << endl;
+  dout(10) << "truncate to " << s << dendl;
   
   while (!data.empty()) {
        BufferHead *bh = data.rbegin()->second;
@@ -370,7 +369,7 @@ void ObjectCacher::Object::truncate(off_t s)
 /*** ObjectCacher ***/
 
 #undef dout
-#define dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
+#define dout(l)    if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
 
 
 
@@ -378,7 +377,7 @@ void ObjectCacher::Object::truncate(off_t s)
 
 void ObjectCacher::close_object(Object *ob) 
 {
-  dout(10) << "close_object " << *ob << endl;
+  dout(10) << "close_object " << *ob << dendl;
   assert(ob->can_close());
   
   // ok!
@@ -394,7 +393,7 @@ void ObjectCacher::close_object(Object *ob)
 
 void ObjectCacher::bh_read(BufferHead *bh)
 {
-  dout(7) << "bh_read on " << *bh << endl;
+  dout(7) << "bh_read on " << *bh << dendl;
 
   mark_rx(bh);
 
@@ -413,18 +412,18 @@ void ObjectCacher::bh_read_finish(object_t oid, off_t start, size_t length, buff
           << oid 
           << " " << start << "~" << length
          << " (bl is " << bl.length() << ")"
-          << endl;
+          << dendl;
 
   if (bl.length() < length) {
     bufferptr bp(length - bl.length());
     bp.zero();
     dout(7) << "bh_read_finish " << oid << " padding " << start << "~" << length 
-           << " with " << bp.length() << " bytes of zeroes" << endl;
+           << " with " << bp.length() << " bytes of zeroes" << dendl;
     bl.push_back(bp);
   }
   
   if (objects.count(oid) == 0) {
-    dout(7) << "bh_read_finish no object cache" << endl;
+    dout(7) << "bh_read_finish no object cache" << dendl;
   } else {
     Object *ob = objects[oid];
     
@@ -439,13 +438,13 @@ void ObjectCacher::bh_read_finish(object_t oid, off_t start, size_t length, buff
       if (bh->start() > opos) {
         dout(1) << "weirdness: gap when applying read results, " 
                 << opos << "~" << bh->start() - opos 
-                << endl;
+                << dendl;
         opos = bh->start();
         continue;
       }
       
       if (!bh->is_rx()) {
-        dout(10) << "bh_read_finish skipping non-rx " << *bh << endl;
+        dout(10) << "bh_read_finish skipping non-rx " << *bh << dendl;
         opos = bh->end();
         p++;
         continue;
@@ -459,7 +458,7 @@ void ObjectCacher::bh_read_finish(object_t oid, off_t start, size_t length, buff
                        opos-bh->start(),
                        bh->length());
       mark_clean(bh);
-      dout(10) << "bh_read_finish read " << *bh << endl;
+      dout(10) << "bh_read_finish read " << *bh << dendl;
       
       opos = bh->end();
       p++;
@@ -484,7 +483,7 @@ void ObjectCacher::bh_read_finish(object_t oid, off_t start, size_t length, buff
 
 void ObjectCacher::bh_write(BufferHead *bh)
 {
-  dout(7) << "bh_write " << *bh << endl;
+  dout(7) << "bh_write " << *bh << dendl;
   
   // finishers
   C_WriteAck *onack = new C_WriteAck(this, bh->ob->get_oid(), bh->start(), bh->length());
@@ -511,7 +510,7 @@ void ObjectCacher::lock_ack(list<object_t>& oids, tid_t tid)
     object_t oid = *i;
 
     if (objects.count(oid) == 0) {
-      dout(7) << "lock_ack no object cache" << endl;
+      dout(7) << "lock_ack no object cache" << dendl;
       assert(0);
     } 
     
@@ -522,7 +521,7 @@ void ObjectCacher::lock_ack(list<object_t>& oids, tid_t tid)
     assert(tid <= ob->last_write_tid);
     if (ob->last_write_tid == tid) {
       dout(10) << "lock_ack " << *ob
-               << " tid " << tid << endl;
+               << " tid " << tid << dendl;
 
       switch (ob->lock_state) {
       case Object::LOCK_RDUNLOCKING: 
@@ -551,7 +550,7 @@ void ObjectCacher::lock_ack(list<object_t>& oids, tid_t tid)
         close_object(ob);
     } else {
       dout(10) << "lock_ack " << *ob 
-               << " tid " << tid << " obsolete" << endl;
+               << " tid " << tid << " obsolete" << dendl;
     }
 
     // waiters?
@@ -573,9 +572,9 @@ void ObjectCacher::bh_write_ack(object_t oid, off_t start, size_t length, tid_t
           << oid 
           << " tid " << tid
           << " " << start << "~" << length
-          << endl;
+          << dendl;
   if (objects.count(oid) == 0) {
-    dout(7) << "bh_write_ack no object cache" << endl;
+    dout(7) << "bh_write_ack no object cache" << dendl;
     assert(0);
   } else {
     Object *ob = objects[oid];
@@ -590,26 +589,26 @@ void ObjectCacher::bh_write_ack(object_t oid, off_t start, size_t length, tid_t
 
       if (bh->start() < start &&
           bh->end() > start+(off_t)length) {
-        dout(20) << "bh_write_ack skipping " << *bh << endl;
+        dout(20) << "bh_write_ack skipping " << *bh << dendl;
         continue;
       }
       
       // make sure bh is tx
       if (!bh->is_tx()) {
-        dout(10) << "bh_write_ack skipping non-tx " << *bh << endl;
+        dout(10) << "bh_write_ack skipping non-tx " << *bh << dendl;
         continue;
       }
       
       // make sure bh tid matches
       if (bh->last_write_tid != tid) {
         assert(bh->last_write_tid > tid);
-        dout(10) << "bh_write_ack newer tid on " << *bh << endl;
+        dout(10) << "bh_write_ack newer tid on " << *bh << dendl;
         continue;
       }
       
       // ok!  mark bh clean.
       mark_clean(bh);
-      dout(10) << "bh_write_ack clean " << *bh << endl;
+      dout(10) << "bh_write_ack clean " << *bh << dendl;
     }
     
     // update object last_ack.
@@ -636,9 +635,9 @@ void ObjectCacher::bh_write_commit(object_t oid, off_t start, size_t length, tid
           << oid 
           << " tid " << tid
           << " " << start << "~" << length
-          << endl;
+          << dendl;
   if (objects.count(oid) == 0) {
-    dout(7) << "bh_write_commit no object cache" << endl;
+    dout(7) << "bh_write_commit no object cache" << dendl;
     //assert(0);
   } else {
     Object *ob = objects[oid];
@@ -664,7 +663,7 @@ void ObjectCacher::flush(off_t amount)
   utime_t cutoff = g_clock.now();
   //cutoff.sec_ref() -= g_conf.client_oc_max_dirty_age;
 
-  dout(10) << "flush " << amount << endl;
+  dout(10) << "flush " << amount << dendl;
   
   /*
    * NOTE: we aren't actually pulling things off the LRU here, just looking at the
@@ -690,13 +689,13 @@ void ObjectCacher::trim(off_t max)
   
   dout(10) << "trim  start: max " << max 
            << "  clean " << get_stat_clean()
-           << endl;
+           << dendl;
 
   while (get_stat_clean() > max) {
     BufferHead *bh = (BufferHead*) lru_rest.lru_expire();
     if (!bh) break;
     
-    dout(10) << "trim trimming " << *bh << endl;
+    dout(10) << "trim trimming " << *bh << dendl;
     assert(bh->is_clean());
     
     Object *ob = bh->ob;
@@ -704,14 +703,14 @@ void ObjectCacher::trim(off_t max)
     delete bh;
     
     if (ob->can_close()) {
-      dout(10) << "trim trimming " << *ob << endl;
+      dout(10) << "trim trimming " << *ob << dendl;
       close_object(ob);
     }
   }
   
   dout(10) << "trim finish: max " << max 
            << "  clean " << get_stat_clean()
-           << endl;
+           << dendl;
 }
 
 
@@ -731,7 +730,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
   for (list<ObjectExtent>::iterator ex_it = rd->extents.begin();
        ex_it != rd->extents.end();
        ex_it++) {
-    dout(10) << "readx " << *ex_it << endl;
+    dout(10) << "readx " << *ex_it << dendl;
 
     // get Object cache
     Object *o = get_object(ex_it->oid, ino, ex_it->layout);
@@ -748,7 +747,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
         bh_read(bh_it->second);
         if (success) {
           dout(10) << "readx missed, waiting on " << *bh_it->second 
-                   << " off " << bh_it->first << endl;
+                   << " off " << bh_it->first << dendl;
           success = false;
           bh_it->second->waitfor_read[bh_it->first].push_back( new C_RetryRead(this, rd, ino, onfinish) );
         }
@@ -761,7 +760,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
         touch_bh(bh_it->second);        // bump in lru, so we don't lose it.
         if (success) {
           dout(10) << "readx missed, waiting on " << *bh_it->second 
-                   << " off " << bh_it->first << endl;
+                   << " off " << bh_it->first << dendl;
           success = false;
           bh_it->second->waitfor_read[bh_it->first].push_back( new C_RetryRead(this, rd, ino, onfinish) );
         }
@@ -773,7 +772,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
       for (map<off_t, BufferHead*>::iterator bh_it = hits.begin();
            bh_it != hits.end();
            bh_it++) {
-       dout(10) << "readx hit bh " << *bh_it->second << endl;
+       dout(10) << "readx hit bh " << *bh_it->second << dendl;
         hit_ls.push_back(bh_it->second);
       }
 
@@ -794,7 +793,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
         dout(10) << "readx rmap opos " << opos
                  << ": " << *bh << " +" << bhoff
                  << " frag " << f_it->first << "~" << f_it->second << " +" << foff
-                 << endl;
+                 << dendl;
 
         size_t len = MIN(f_it->second - foff,
                          bh->length() - bhoff);
@@ -834,7 +833,7 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
 
   // no misses... success!  do the read.
   assert(!hit_ls.empty());
-  dout(10) << "readx has all buffers" << endl;
+  dout(10) << "readx has all buffers" << dendl;
   
   // ok, assemble into result buffer.
   rd->bl->clear();
@@ -843,12 +842,12 @@ int ObjectCacher::readx(Objecter::OSDRead *rd, inodeno_t ino, Context *onfinish)
        i != stripe_map.end();
        i++) {
     assert(pos == i->first);
-    dout(10) << "readx  adding buffer len " << i->second.length() << " at " << pos << endl;
+    dout(10) << "readx  adding buffer len " << i->second.length() << " at " << pos << dendl;
     pos += i->second.length();
     rd->bl->claim_append(i->second);
     assert(rd->bl->length() == pos);
   }
-  dout(10) << "readx  result is " << rd->bl->length() << endl;
+  dout(10) << "readx  result is " << rd->bl->length() << dendl;
 
   // done with read.
   delete rd;
@@ -881,7 +880,7 @@ int ObjectCacher::writex(Objecter::OSDWrite *wr, inodeno_t ino)
     for (map<size_t,size_t>::iterator f_it = ex_it->buffer_extents.begin();
          f_it != ex_it->buffer_extents.end();
          f_it++) {
-      dout(10) << "writex writing " << f_it->first << "~" << f_it->second << " into " << *bh << " at " << opos << endl;
+      dout(10) << "writex writing " << f_it->first << "~" << f_it->second << " into " << *bh << " at " << opos << dendl;
       size_t bhoff = bh->start() - opos;
       assert(f_it->second <= bh->length() - bhoff);
 
@@ -919,18 +918,18 @@ int ObjectCacher::writex(Objecter::OSDWrite *wr, inodeno_t ino)
 void ObjectCacher::wait_for_write(size_t len, Mutex& lock)
 {
   while (get_stat_dirty() > g_conf.client_oc_max_dirty) {
-    dout(10) << "wait_for_write waiting" << endl;
+    dout(10) << "wait_for_write waiting" << dendl;
     flusher_cond.Signal();
     stat_waiter++;
     stat_cond.Wait(lock);
     stat_waiter--;
-    dout(10) << "wait_for_write woke up" << endl;
+    dout(10) << "wait_for_write woke up" << dendl;
   }
 }
 
 void ObjectCacher::flusher_entry()
 {
-  dout(10) << "flusher start" << endl;
+  dout(10) << "flusher start" << dendl;
   lock.Lock();
   while (!flusher_stop) {
     while (!flusher_stop) {
@@ -941,12 +940,12 @@ void ObjectCacher::flusher_entry()
                << get_stat_rx() << " rx, "
                << get_stat_clean() << " clean, "
                << get_stat_dirty() << " / " << g_conf.client_oc_max_dirty << " dirty"
-               << endl;
+               << dendl;
       if (get_stat_dirty() > g_conf.client_oc_max_dirty) {
         // flush some dirty pages
         dout(10) << "flusher " 
                  << get_stat_dirty() << " / " << g_conf.client_oc_max_dirty << " dirty,"
-                 << " flushing some dirty bhs" << endl;
+                 << " flushing some dirty bhs" << dendl;
         flush(get_stat_dirty() - g_conf.client_oc_max_dirty);
       }
       else {
@@ -956,7 +955,7 @@ void ObjectCacher::flusher_entry()
         BufferHead *bh = 0;
         while ((bh = (BufferHead*)lru_dirty.lru_get_next_expire()) != 0 &&
                bh->last_write < cutoff) {
-          dout(10) << "flusher flushing aged dirty bh " << *bh << endl;
+          dout(10) << "flusher flushing aged dirty bh " << *bh << dendl;
           bh_write(bh);
         }
         break;
@@ -966,7 +965,7 @@ void ObjectCacher::flusher_entry()
     flusher_cond.WaitInterval(lock, utime_t(1,0));
   }
   lock.Unlock();
-  dout(10) << "flusher finish" << endl;
+  dout(10) << "flusher finish" << dendl;
 }
 
 
@@ -976,7 +975,7 @@ int ObjectCacher::atomic_sync_readx(Objecter::OSDRead *rd, inodeno_t ino, Mutex&
 {
   dout(10) << "atomic_sync_readx " << rd
            << " in " << ino
-           << endl;
+           << dendl;
 
   if (rd->extents.size() == 1) {
     // single object.
@@ -1033,7 +1032,7 @@ int ObjectCacher::atomic_sync_writex(Objecter::OSDWrite *wr, inodeno_t ino, Mute
 {
   dout(10) << "atomic_sync_writex " << wr
            << " in " << ino
-           << endl;
+           << dendl;
 
   if (wr->extents.size() == 1 &&
       wr->extents.front().length <= g_conf.client_oc_max_sync_write) {
@@ -1051,7 +1050,7 @@ int ObjectCacher::atomic_sync_writex(Objecter::OSDWrite *wr, inodeno_t ino, Mute
       dout(10) << "atomic_sync_writex " << wr
                << " in " << ino
                << " doing sync write"
-               << endl;
+               << dendl;
 
       Cond cond;
       bool done = false;
@@ -1109,7 +1108,7 @@ void ObjectCacher::rdlock(Object *o)
   if (o->lock_state == Object::LOCK_NONE ||
       o->lock_state == Object::LOCK_RDUNLOCKING ||
       o->lock_state == Object::LOCK_WRUNLOCKING) {
-    dout(10) << "rdlock rdlock " << *o << endl;
+    dout(10) << "rdlock rdlock " << *o << dendl;
     
     o->lock_state = Object::LOCK_RDLOCKING;
     
@@ -1128,7 +1127,7 @@ void ObjectCacher::rdlock(Object *o)
   // wait?
   if (o->lock_state == Object::LOCK_RDLOCKING ||
       o->lock_state == Object::LOCK_WRLOCKING) {
-    dout(10) << "rdlock waiting for rdlock|wrlock on " << *o << endl;
+    dout(10) << "rdlock waiting for rdlock|wrlock on " << *o << dendl;
     Cond cond;
     bool done = false;
     o->waitfor_rd.push_back(new C_SafeCond(&lock, &cond, &done));
@@ -1146,7 +1145,7 @@ void ObjectCacher::wrlock(Object *o)
   if (o->lock_state != Object::LOCK_WRLOCK &&
       o->lock_state != Object::LOCK_WRLOCKING &&
       o->lock_state != Object::LOCK_UPGRADING) {
-    dout(10) << "wrlock wrlock " << *o << endl;
+    dout(10) << "wrlock wrlock " << *o << dendl;
     
     int op = 0;
     if (o->lock_state == Object::LOCK_RDLOCK) {
@@ -1172,7 +1171,7 @@ void ObjectCacher::wrlock(Object *o)
   // wait?
   if (o->lock_state == Object::LOCK_WRLOCKING ||
       o->lock_state == Object::LOCK_UPGRADING) {
-    dout(10) << "wrlock waiting for wrlock on " << *o << endl;
+    dout(10) << "wrlock waiting for wrlock on " << *o << dendl;
     Cond cond;
     bool done = false;
     o->waitfor_wr.push_back(new C_SafeCond(&lock, &cond, &done));
@@ -1184,7 +1183,7 @@ void ObjectCacher::wrlock(Object *o)
 
 void ObjectCacher::rdunlock(Object *o)
 {
-  dout(10) << "rdunlock " << *o << endl;
+  dout(10) << "rdunlock " << *o << dendl;
   assert(o->lock_state == Object::LOCK_RDLOCK ||
          o->lock_state == Object::LOCK_WRLOCK ||
          o->lock_state == Object::LOCK_UPGRADING ||
@@ -1194,7 +1193,7 @@ void ObjectCacher::rdunlock(Object *o)
   o->rdlock_ref--;
   if (o->rdlock_ref > 0 ||
       o->wrlock_ref > 0) {
-    dout(10) << "rdunlock " << *o << " still has rdlock|wrlock refs" << endl;
+    dout(10) << "rdunlock " << *o << " still has rdlock|wrlock refs" << dendl;
     return;
   }
 
@@ -1212,13 +1211,13 @@ void ObjectCacher::rdunlock(Object *o)
 
 void ObjectCacher::wrunlock(Object *o)
 {
-  dout(10) << "wrunlock " << *o << endl;
+  dout(10) << "wrunlock " << *o << dendl;
   assert(o->lock_state == Object::LOCK_WRLOCK);
 
   assert(o->wrlock_ref > 0);
   o->wrlock_ref--;
   if (o->wrlock_ref > 0) {
-    dout(10) << "wrunlock " << *o << " still has wrlock refs" << endl;
+    dout(10) << "wrunlock " << *o << " still has wrlock refs" << dendl;
     return;
   }
 
@@ -1226,11 +1225,11 @@ void ObjectCacher::wrunlock(Object *o)
 
   int op = 0;
   if (o->rdlock_ref > 0) {
-    dout(10) << "wrunlock rdlock " << *o << endl;
+    dout(10) << "wrunlock rdlock " << *o << dendl;
     op = OSD_OP_DNLOCK;
     o->lock_state = Object::LOCK_DOWNGRADING;
   } else {
-    dout(10) << "wrunlock wrunlock " << *o << endl;
+    dout(10) << "wrunlock wrunlock " << *o << dendl;
     op = OSD_OP_WRUNLOCK;
     o->lock_state = Object::LOCK_WRUNLOCKING;
   }
@@ -1290,20 +1289,20 @@ bool ObjectCacher::set_is_dirty_or_committing(inodeno_t ino)
 // purge.  non-blocking.  violently removes dirty buffers from cache.
 void ObjectCacher::purge(Object *ob)
 {
-  dout(10) << "purge " << *ob << endl;
+  dout(10) << "purge " << *ob << dendl;
 
   for (map<off_t,BufferHead*>::iterator p = ob->data.begin();
        p != ob->data.end();
        p++) {
     BufferHead *bh = p->second;
        if (!bh->is_clean())
-         dout(0) << "purge forcibly removing " << *ob << " " << *bh << endl;
+         dout(0) << "purge forcibly removing " << *ob << " " << *bh << dendl;
        bh_remove(ob, bh);
        delete bh;
   }
 
   if (ob->can_close()) {
-       dout(10) << "trim trimming " << *ob << endl;
+       dout(10) << "trim trimming " << *ob << dendl;
        close_object(ob);
   }
 }
@@ -1335,11 +1334,11 @@ bool ObjectCacher::flush(Object *ob)
 bool ObjectCacher::flush_set(inodeno_t ino, Context *onfinish)
 {
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "flush_set on " << ino << " dne" << endl;
+    dout(10) << "flush_set on " << ino << " dne" << dendl;
     return true;
   }
 
-  dout(10) << "flush_set " << ino << endl;
+  dout(10) << "flush_set " << ino << dendl;
 
   C_Gather *gather = 0; // we'll need to wait for all objects to flush!
 
@@ -1359,14 +1358,14 @@ bool ObjectCacher::flush_set(inodeno_t ino, Context *onfinish)
       dout(10) << "flush_set " << ino << " will wait for ack tid " 
                << ob->last_write_tid 
                << " on " << *ob
-               << endl;
+               << dendl;
       if (gather)
         ob->waitfor_ack[ob->last_write_tid].push_back(gather->new_sub());
     }
   }
   
   if (safe) {
-    dout(10) << "flush_set " << ino << " has no dirty|tx bhs" << endl;
+    dout(10) << "flush_set " << ino << " has no dirty|tx bhs" << dendl;
     return true;
   }
   return false;
@@ -1380,11 +1379,11 @@ bool ObjectCacher::commit_set(inodeno_t ino, Context *onfinish)
   assert(onfinish);  // doesn't make any sense otherwise.
 
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "commit_set on " << ino << " dne" << endl;
+    dout(10) << "commit_set on " << ino << " dne" << dendl;
     return true;
   }
 
-  dout(10) << "commit_set " << ino << endl;
+  dout(10) << "commit_set " << ino << dendl;
 
   C_Gather *gather = 0; // we'll need to wait for all objects to commit
 
@@ -1401,7 +1400,7 @@ bool ObjectCacher::commit_set(inodeno_t ino, Context *onfinish)
     if (ob->last_write_tid > ob->last_commit_tid) {
       dout(10) << "commit_set " << ino << " " << *ob 
                << " will finish on commit tid " << ob->last_write_tid
-               << endl;
+               << dendl;
       if (!gather && onfinish) gather = new C_Gather(onfinish);
       safe = false;
       if (gather)
@@ -1410,7 +1409,7 @@ bool ObjectCacher::commit_set(inodeno_t ino, Context *onfinish)
   }
 
   if (safe) {
-    dout(10) << "commit_set " << ino << " all committed" << endl;
+    dout(10) << "commit_set " << ino << " all committed" << dendl;
     return true;
   }
   return false;
@@ -1419,11 +1418,11 @@ bool ObjectCacher::commit_set(inodeno_t ino, Context *onfinish)
 void ObjectCacher::purge_set(inodeno_t ino)
 {
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "purge_set on " << ino << " dne" << endl;
+    dout(10) << "purge_set on " << ino << " dne" << dendl;
     return;
   }
 
-  dout(10) << "purge_set " << ino << endl;
+  dout(10) << "purge_set " << ino << dendl;
 
   set<Object*>& s = objects_by_ino[ino];
   for (set<Object*>::iterator i = s.begin();
@@ -1458,7 +1457,7 @@ off_t ObjectCacher::release(Object *ob)
   }
 
   if (ob->can_close()) {
-       dout(10) << "trim trimming " << *ob << endl;
+       dout(10) << "trim trimming " << *ob << dendl;
        close_object(ob);
   }
 
@@ -1471,11 +1470,11 @@ off_t ObjectCacher::release_set(inodeno_t ino)
   off_t unclean = 0;
 
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "release_set on " << ino << " dne" << endl;
+    dout(10) << "release_set on " << ino << " dne" << dendl;
     return 0;
   }
 
-  dout(10) << "release_set " << ino << endl;
+  dout(10) << "release_set " << ino << dendl;
 
   set<Object*> s = objects_by_ino[ino];
   for (set<Object*>::iterator i = s.begin();
@@ -1489,13 +1488,13 @@ off_t ObjectCacher::release_set(inodeno_t ino)
     if (o_unclean) 
       dout(10) << "release_set " << ino << " " << *ob 
                << " has " << o_unclean << " bytes left"
-               << endl;
+               << dendl;
     
   }
 
   if (unclean) {
     dout(10) << "release_set " << ino
-             << ", " << unclean << " bytes left" << endl;
+             << ", " << unclean << " bytes left" << dendl;
   }
 
   return unclean;
@@ -1504,11 +1503,11 @@ off_t ObjectCacher::release_set(inodeno_t ino)
 void ObjectCacher::truncate_set(inodeno_t ino, list<ObjectExtent>& exls)
 {
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "truncate_set on " << ino << " dne" << endl;
+    dout(10) << "truncate_set on " << ino << " dne" << dendl;
     return;
   }
   
-  dout(10) << "truncate_set " << ino << endl;
+  dout(10) << "truncate_set " << ino << dendl;
 
   for (list<ObjectExtent>::iterator p = exls.begin();
           p != exls.end();
@@ -1519,15 +1518,15 @@ void ObjectCacher::truncate_set(inodeno_t ino, list<ObjectExtent>& exls)
 
        // purge or truncate?
        if (ex.start == 0) {
-         dout(10) << "truncate_set purging " << *ob << endl;
+         dout(10) << "truncate_set purging " << *ob << dendl;
          purge(ob);
        } else {
          // hrm, truncate object
-         dout(10) << "truncate_set truncating " << *ob << " at " << ex.start << endl;
+         dout(10) << "truncate_set truncating " << *ob << " at " << ex.start << dendl;
          ob->truncate(ex.start);
 
          if (ob->can_close()) {
-               dout(10) << "truncate_set trimming " << *ob << endl;
+               dout(10) << "truncate_set trimming " << *ob << dendl;
                close_object(ob);
          }
        }
@@ -1538,11 +1537,11 @@ void ObjectCacher::truncate_set(inodeno_t ino, list<ObjectExtent>& exls)
 void ObjectCacher::kick_sync_writers(inodeno_t ino)
 {
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "kick_sync_writers on " << ino << " dne" << endl;
+    dout(10) << "kick_sync_writers on " << ino << " dne" << dendl;
     return;
   }
 
-  dout(10) << "kick_sync_writers on " << ino << endl;
+  dout(10) << "kick_sync_writers on " << ino << dendl;
 
   list<Context*> ls;
 
@@ -1561,11 +1560,11 @@ void ObjectCacher::kick_sync_writers(inodeno_t ino)
 void ObjectCacher::kick_sync_readers(inodeno_t ino)
 {
   if (objects_by_ino.count(ino) == 0) {
-    dout(10) << "kick_sync_readers on " << ino << " dne" << endl;
+    dout(10) << "kick_sync_readers on " << ino << " dne" << dendl;
     return;
   }
 
-  dout(10) << "kick_sync_readers on " << ino << endl;
+  dout(10) << "kick_sync_readers on " << ino << dendl;
 
   list<Context*> ls;
 
index 14ba733a0618304a874d65183c96dc5e7b1c8e6d..3603d102a3636f6c58ab4037dcfda198b260f037 100644 (file)
@@ -18,9 +18,9 @@
 #include <errno.h>
 
 #include "config.h"
-#undef dout
-#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << messenger->get_myname() << ".objecter "
-#define derr(x)  if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << messenger->get_myname() << ".objecter "
+
+#define dout(x)  if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
+#define derr(x)  if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
 
 
 // messages ------------------------------
@@ -37,7 +37,7 @@ void Objecter::dispatch(Message *m)
     break;
 
   default:
-    dout(1) << "don't know message type " << m->get_type() << endl;
+    dout(1) << "don't know message type " << m->get_type() << dendl;
     assert(0);
   }
 }
@@ -49,13 +49,13 @@ void Objecter::handle_osd_map(MOSDMap *m)
   if (m->get_last() <= osdmap->get_epoch()) {
     dout(3) << "handle_osd_map ignoring epochs [" 
             << m->get_first() << "," << m->get_last() 
-            << "] <= " << osdmap->get_epoch() << endl;
+            << "] <= " << osdmap->get_epoch() << dendl;
   } 
   else {
     dout(3) << "handle_osd_map got epochs [" 
             << m->get_first() << "," << m->get_last() 
             << "] > " << osdmap->get_epoch()
-            << endl;
+            << dendl;
 
     set<pg_t> changed_pgs;
 
@@ -63,7 +63,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
          e <= m->get_last();
          e++) {
       if (m->incremental_maps.count(e)) {
-        dout(3) << "handle_osd_map decoding incremental epoch " << e << endl;
+        dout(3) << "handle_osd_map decoding incremental epoch " << e << dendl;
         OSDMap::Incremental inc;
         int off = 0;
         inc.decode(m->incremental_maps[e], off);
@@ -77,11 +77,11 @@ void Objecter::handle_osd_map(MOSDMap *m)
         
       }
       else if (m->maps.count(e)) {
-        dout(3) << "handle_osd_map decoding full epoch " << e << endl;
+        dout(3) << "handle_osd_map decoding full epoch " << e << dendl;
         osdmap->decode(m->maps[e]);
       }
       else {
-        dout(3) << "handle_osd_map requesting missing epoch " << osdmap->get_epoch()+1 << endl;
+        dout(3) << "handle_osd_map requesting missing epoch " << osdmap->get_epoch()+1 << dendl;
         int mon = monmap->pick_mon();
         messenger->send_message(new MOSDGetMap(osdmap->get_epoch()+1), 
                                 monmap->get_inst(mon));
@@ -104,7 +104,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
 
 void Objecter::scan_pgs(set<pg_t>& changed_pgs)
 {
-  dout(10) << "scan_pgs" << endl;
+  dout(10) << "scan_pgs" << dendl;
 
   for (hash_map<pg_t,PG>::iterator i = pg_map.begin();
        i != pg_map.end();
@@ -144,14 +144,14 @@ void Objecter::scan_pgs(set<pg_t>& changed_pgs)
     dout(10) << "scan_pgs pg " << pgid 
              << " (" << pg.active_tids << ")"
              << " " << other << " -> " << pg.acting
-             << endl;
+             << dendl;
     changed_pgs.insert(pgid);
   }
 }
 
 void Objecter::kick_requests(set<pg_t>& changed_pgs) 
 {
-  dout(10) << "kick_requests in pgs " << changed_pgs << endl;
+  dout(10) << "kick_requests in pgs " << changed_pgs << dendl;
 
   for (set<pg_t>::iterator i = changed_pgs.begin();
        i != changed_pgs.end();
@@ -177,15 +177,15 @@ void Objecter::kick_requests(set<pg_t>& changed_pgs)
         if (wr->tid_version.count(tid)) {
           if (wr->op == OSD_OP_WRITE &&
               !g_conf.objecter_buffer_uncommitted) {
-            dout(0) << "kick_requests missing commit, cannot replay: objecter_buffer_uncommitted == FALSE" << endl;
+            dout(0) << "kick_requests missing commit, cannot replay: objecter_buffer_uncommitted == FALSE" << dendl;
           } else {
             dout(3) << "kick_requests missing commit, replay write " << tid
-                    << " v " << wr->tid_version[tid] << endl;
+                    << " v " << wr->tid_version[tid] << dendl;
             modifyx_submit(wr, wr->waitfor_commit[tid], tid);
           }
         } 
         else if (wr->waitfor_ack.count(tid)) {
-          dout(3) << "kick_requests missing ack, resub write " << tid << endl;
+          dout(3) << "kick_requests missing ack, resub write " << tid << dendl;
           modifyx_submit(wr, wr->waitfor_ack[tid], tid);
         }
       }
@@ -194,7 +194,7 @@ void Objecter::kick_requests(set<pg_t>& changed_pgs)
         // READ
         OSDRead *rd = op_read[tid];
         op_read.erase(tid);
-        dout(3) << "kick_requests resub read " << tid << endl;
+        dout(3) << "kick_requests resub read " << tid << dendl;
 
         // resubmit
         readx_submit(rd, rd->ops[tid], true);
@@ -205,7 +205,7 @@ void Objecter::kick_requests(set<pg_t>& changed_pgs)
        OSDStat *st = op_stat[tid];
        op_stat.erase(tid);
        
-       dout(3) << "kick_requests resub stat " << tid << endl;
+       dout(3) << "kick_requests resub stat " << tid << dendl;
                
         // resubmit
         stat_submit(st);
@@ -287,7 +287,7 @@ tid_t Objecter::stat_submit(OSDStat *st)
            << " oid " << ex.oid
            << " " << ex.layout
            << " osd" << pg.acker() 
-           << endl;
+           << dendl;
 
   if (pg.acker() >= 0) {
        MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, last_tid,
@@ -306,7 +306,7 @@ void Objecter::handle_osd_stat_reply(MOSDOpReply *m)
   tid_t tid = m->get_tid();
 
   if (op_stat.count(tid) == 0) {
-    dout(7) << "handle_osd_stat_reply " << tid << " ... stray" << endl;
+    dout(7) << "handle_osd_stat_reply " << tid << " ... stray" << dendl;
     delete m;
     return;
   }
@@ -314,7 +314,7 @@ void Objecter::handle_osd_stat_reply(MOSDOpReply *m)
   dout(7) << "handle_osd_stat_reply " << tid 
                  << " r=" << m->get_result()
                  << " size=" << m->get_object_size()
-                 << endl;
+                 << dendl;
   OSDStat *st = op_stat[ tid ];
   op_stat.erase( tid );
 
@@ -326,7 +326,7 @@ void Objecter::handle_osd_stat_reply(MOSDOpReply *m)
   
   // success?
   if (m->get_result() == -EAGAIN) {
-    dout(7) << " got -EAGAIN, resubmitting" << endl;
+    dout(7) << " got -EAGAIN, resubmitting" << dendl;
     stat_submit(st);
     delete m;
     return;
@@ -404,7 +404,7 @@ tid_t Objecter::readx_submit(OSDRead *rd, ObjectExtent &ex, bool retry)
            << " (" << ex.buffer_extents.size() << " buffer fragments)" 
            << " " << ex.layout
            << " osd" << pg.acker() 
-           << endl;
+           << dendl;
 
   if (pg.acker() >= 0) {
     MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, last_tid,
@@ -419,7 +419,7 @@ tid_t Objecter::readx_submit(OSDRead *rd, ObjectExtent &ex, bool retry)
       int replica = messenger->get_myname().num() % pg.acting.size();
       who = pg.acting[replica];
       dout(-10) << "readx_submit reading from random replica " << replica
-               << " = osd" << who <<  endl;
+               << " = osd" << who <<  dendl;
     }
     messenger->send_message(m, osdmap->get_inst(who));
   }
@@ -434,12 +434,12 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
   tid_t tid = m->get_tid();
 
   if (op_read.count(tid) == 0) {
-    dout(7) << "handle_osd_read_reply " << tid << " ... stray" << endl;
+    dout(7) << "handle_osd_read_reply " << tid << " ... stray" << dendl;
     delete m;
     return;
   }
 
-  dout(7) << "handle_osd_read_reply " << tid << endl;
+  dout(7) << "handle_osd_read_reply " << tid << dendl;
   OSDRead *rd = op_read[ tid ];
   op_read.erase( tid );
 
@@ -454,7 +454,7 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
 
   // success?
   if (m->get_result() == -EAGAIN) {
-    dout(7) << " got -EAGAIN, resubmitting" << endl;
+    dout(7) << " got -EAGAIN, resubmitting" << dendl;
     readx_submit(rd, rd->ops[tid], true);
     delete m;
     return;
@@ -464,14 +464,14 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
   // what buffer offset are we?
   dout(7) << " got frag from " << m->get_oid() << " "
           << m->get_offset() << "~" << m->get_length()
-          << ", still have " << rd->ops.size() << " more ops" << endl;
+          << ", still have " << rd->ops.size() << " more ops" << dendl;
   
   if (rd->ops.empty()) {
     // all done
     size_t bytes_read = 0;
     
     if (rd->read_data.size()) {
-      dout(15) << " assembling frags" << endl;
+      dout(15) << " assembling frags" << dendl;
 
       /** FIXME This doesn't handle holes efficiently.
        * It allocates zero buffers to fill whole buffer, and
@@ -501,7 +501,7 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
         for (map<size_t,size_t>::iterator bit = eit->buffer_extents.begin();
              bit != eit->buffer_extents.end();
              bit++) {
-          dout(21) << " object " << eit->oid << " extent " << eit->start << "~" << eit->length << " : ox offset " << ox_off << " -> buffer extent " << bit->first << "~" << bit->second << endl;
+          dout(21) << " object " << eit->oid << " extent " << eit->start << "~" << eit->length << " : ox offset " << ox_off << " -> buffer extent " << bit->first << "~" << bit->second << dendl;
           by_off[bit->first] = new bufferlist;
 
           if (ox_off + bit->second <= ox_len) {
@@ -516,14 +516,14 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
               bytes_read = bit->first + ox_len-ox_off;
 
             // zero end of bx
-            dout(21) << "  adding some zeros to the end " << ox_off + bit->second-ox_len << endl;
+            dout(21) << "  adding some zeros to the end " << ox_off + bit->second-ox_len << dendl;
             bufferptr z(ox_off + bit->second - ox_len);
                        z.zero();
             by_off[bit->first]->append( z );
           } else {
             // we got none of this bx.  zero whole thing.
             assert(ox_off >= ox_len);
-            dout(21) << "  adding all zeros for this bit " << bit->second << endl;
+            dout(21) << "  adding all zeros for this bit " << bit->second << dendl;
             bufferptr z(bit->second);
                        z.zero();
             by_off[bit->first]->append( z );
@@ -539,10 +539,10 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
            it++) {
         assert(it->second->length());
         if (it->first < (off_t)bytes_read) {
-          dout(21) << "  concat buffer frag off " << it->first << " len " << it->second->length() << endl;
+          dout(21) << "  concat buffer frag off " << it->first << " len " << it->second->length() << dendl;
           rd->bl->claim_append(*(it->second));
         } else {
-          dout(21) << "  NO concat zero buffer frag off " << it->first << " len " << it->second->length() << endl;          
+          dout(21) << "  NO concat zero buffer frag off " << it->first << " len " << it->second->length() << dendl;          
         }
         delete it->second;
       }
@@ -550,7 +550,7 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
       // trim trailing zeros?
       if (rd->bl->length() > bytes_read) {
         dout(10) << " trimming off trailing zeros . bytes_read=" << bytes_read 
-                 << " len=" << rd->bl->length() << endl;
+                 << " len=" << rd->bl->length() << dendl;
         rd->bl->splice(bytes_read, rd->bl->length() - bytes_read);
         assert(bytes_read == rd->bl->length());
       }
@@ -562,7 +562,7 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
         delete it->second;
       }
     } else {
-      dout(15) << "  only one frag" << endl;
+      dout(15) << "  only one frag" << dendl;
 
       // only one fragment, easy
       rd->bl->claim( m->get_data() );
@@ -574,7 +574,7 @@ void Objecter::handle_osd_read_reply(MOSDOpReply *m)
 
     dout(7) << " " << bytes_read << " bytes " 
             << rd->bl->length()
-            << endl;
+            << dendl;
     
     // done
     delete rd;
@@ -683,7 +683,7 @@ tid_t Objecter::modifyx_submit(OSDModify *wr, ObjectExtent &ex, tid_t usetid)
            << " " << ex.start << "~" << ex.length 
            << " " << ex.layout 
            << " osd" << pg.primary()
-           << endl;
+           << dendl;
   if (pg.primary() >= 0) {
     MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, tid,
                           ex.oid, ex.layout, osdmap->get_epoch(),
@@ -720,7 +720,7 @@ tid_t Objecter::modifyx_submit(OSDModify *wr, ObjectExtent &ex, tid_t usetid)
     messenger->send_message(m, osdmap->get_inst(pg.primary()));
   }
   
-  dout(5) << num_unacked << " unacked, " << num_uncommitted << " uncommitted" << endl;
+  dout(5) << num_unacked << " unacked, " << num_uncommitted << " uncommitted" << dendl;
   
   return tid;
 }
@@ -735,7 +735,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
   if (op_modify.count(tid) == 0) {
     dout(7) << "handle_osd_modify_reply " << tid 
             << (m->get_commit() ? " commit":" ack")
-            << " ... stray" << endl;
+            << " ... stray" << dendl;
     delete m;
     return;
   }
@@ -743,7 +743,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
   dout(7) << "handle_osd_modify_reply " << tid 
           << (m->get_commit() ? " commit":" ack")
           << " v " << m->get_version()
-          << endl;
+          << dendl;
   OSDModify *wr = op_modify[ tid ];
 
   Context *onack = 0;
@@ -753,7 +753,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
 
   // ignore?
   if (pg.acker() != m->get_source().num()) {
-    dout(7) << " ignoring ack|commit from non-acker" << endl;
+    dout(7) << " ignoring ack|commit from non-acker" << dendl;
     delete m;
     return;
   }
@@ -762,7 +762,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
 
   // ack or commit?
   if (m->get_commit()) {
-    //dout(15) << " handle_osd_write_reply commit on " << tid << endl;
+    //dout(15) << " handle_osd_write_reply commit on " << tid << dendl;
     assert(wr->tid_version.count(tid) == 0 ||
            m->get_version() == wr->tid_version[tid]);
 
@@ -785,7 +785,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
     }
   } else {
     // ack.
-    //dout(15) << " handle_osd_write_reply ack on " << tid << endl;
+    //dout(15) << " handle_osd_write_reply ack on " << tid << dendl;
     assert(wr->waitfor_ack.count(tid));
     wr->waitfor_ack.erase(tid);
     
@@ -794,7 +794,7 @@ void Objecter::handle_osd_modify_reply(MOSDOpReply *m)
     if (wr->tid_version.count(tid) &&
         wr->tid_version[tid].version != m->get_version().version) {
       dout(-10) << "handle_osd_modify_reply WARNING: replay of tid " << tid 
-                << " did not achieve previous ordering" << endl;
+                << " did not achieve previous ordering" << dendl;
     }
     wr->tid_version[tid] = m->get_version();
     
@@ -833,20 +833,20 @@ void Objecter::ms_handle_failure(Message *m, entity_name_t dest, const entity_in
     int mon = monmap->pick_mon(true);
     dout(0) << "ms_handle_failure " << dest << " inst " << inst 
             << ", resending to mon" << mon 
-            << endl;
+            << dendl;
     messenger->send_message(m, monmap->get_inst(mon));
   } 
   else if (dest.is_osd()) {
     int mon = monmap->pick_mon();
     dout(0) << "ms_handle_failure " << dest << " inst " << inst 
             << ", dropping and reporting to mon" << mon 
-            << endl;
+            << dendl;
     messenger->send_message(new MOSDFailure(messenger->get_myinst(), inst, osdmap->get_epoch()), 
                             monmap->get_inst(mon));
     delete m;
   } else {
     dout(0) << "ms_handle_failure " << dest << " inst " << inst 
-            << ", dropping" << endl;
+            << ", dropping" << dendl;
     delete m;
   }
 }
diff --git a/trunk/ceph/script/study_hardlink_lifetimes.pl b/trunk/ceph/script/study_hardlink_lifetimes.pl
new file mode 100755 (executable)
index 0000000..012ef60
--- /dev/null
@@ -0,0 +1,131 @@
+#!/usr/bin/perl
+
+use strict;
+
+my %ns;     # parent -> fn -> ino
+my %nlink;  # num links to each ino
+my %since;  # when it got its second link
+
+my @ignore = ('ll_getattr','ll_setattr','ll_forget','ll_fsync','ll_readlink','ll_statfs','ll_opendir','ll_releasedir','ll_flush','ll_release','ll_open','ll_read','ll_write');
+
+my $when;
+
+my $sumage;
+my $numage;
+
+sub unlink {
+    my ($p,$n) = @_;
+    my $i = $ns{$p}->{$n};
+    my $new = --$nlink{$i};
+    if ($new == 1) {
+       my $age = $when - $since{$i};
+       #print "$since{$i} to $when on $i\t$age\n";
+       delete $since{$i};
+
+       $numage++;
+       $sumage += $age;
+
+    } elsif ($new == 0) {
+       delete $nlink{$i};
+    }
+    delete $ns{$p}->{$n};      
+}
+
+
+my ($sec, $usec, $cmd);
+$_ = <>;
+while (1) {
+    # read trace record
+    chomp;
+    last unless $_ eq '@';
+
+    chomp(my $sec = <>);
+    chomp(my $usec = <>);
+    $when = sprintf("%d.%06d",$sec,$usec);# + ($usec / 1000000);
+    #$when = "$sec.$usec";
+
+    chomp($cmd = <>);
+
+    #print "cmd $cmd\n";
+
+    if ($cmd eq 'll_lookup') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       chomp(my $r = <>);
+       $ns{$p}->{$n} = $r;
+    }
+
+    elsif ($cmd eq 'll_create') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       <>; <>; <>; 
+       chomp(my $r = <>);
+       $ns{$p}->{$n} = $r;
+       $nlink{$r} = 1;
+    }
+    elsif ($cmd eq 'll_mknod') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       <>; <>; 
+       chomp(my $r = <>);
+       $ns{$p}->{$n} = $r;
+       $nlink{$r} = 1;
+    }
+    elsif ($cmd eq 'll_mkdir') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       <>;
+       chomp(my $r = <>);
+       $ns{$p}->{$n} = $r;
+       $nlink{$r} = 1;
+    }
+    elsif ($cmd eq 'll_symlink') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       <>;
+       chomp(my $r = <>);
+       $ns{$p}->{$n} = $r;
+       $nlink{$r} = 1;
+    }
+    elsif ($cmd eq 'll_link') {
+       chomp(my $i = <>);
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       $ns{$p}->{$n} = $i;
+       if (++$nlink{$i} == 2) {
+           $since{$i} = $when;
+       }
+    }
+    elsif ($cmd eq 'll_unlink' ||
+          $cmd eq 'll_rmdir') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       &unlink($p, $n);
+    }
+    elsif ($cmd eq 'll_rename') {
+       chomp(my $p = <>);
+       chomp(my $n = <>);
+       chomp(my $np = <>);
+       chomp(my $nn = <>);
+       if ($ns{$np}->{$nn}) {
+           &unlink($np, $nn);
+       }
+       $ns{$np}->{$nn} = $ns{$p}->{$n};
+       delete $ns{$p}->{$n};   
+    }
+    
+    # skip to @
+    while (<>) {
+       last if $_ eq "@\n";
+       print "$cmd: $_"
+           unless grep {$_ eq $cmd} @ignore;
+    }
+}
+
+print "num $numage .. sum $sumage .. avg lifetime " . ($sumage / $numage) . "\n";
+
+# dump hard link inos
+for my $ino (keys %nlink) {
+    next if $nlink{$ino} < 2;
+    print "$ino\t$nlink{$ino}\n";
+}