From 405a3a3845cad59979aa7cde7c3a6d742eacac11 Mon Sep 17 00:00:00 2001 From: sageweil Date: Sat, 25 Aug 2007 20:22:10 +0000 Subject: [PATCH] made conflicting endl symbol to catch dendl/endl mixups at compile time git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1693 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/cfuse.cc | 10 +- trunk/ceph/client/Client.cc | 308 +++++++++++++-------------- trunk/ceph/client/Client.h | 4 +- trunk/ceph/client/FileCache.h | 2 +- trunk/ceph/client/SyntheticClient.cc | 6 +- trunk/ceph/client/SyntheticClient.h | 6 +- trunk/ceph/client/Trace.h | 4 +- trunk/ceph/client/fuse.cc | 2 +- trunk/ceph/client/fuse_ll.cc | 6 +- trunk/ceph/cmds.cc | 4 +- trunk/ceph/cmon.cc | 16 +- trunk/ceph/common/LogType.h | 7 +- trunk/ceph/common/Logger.cc | 6 +- trunk/ceph/common/Logger.h | 5 +- trunk/ceph/common/ThreadPool.h | 16 +- trunk/ceph/common/Timer.h | 3 +- trunk/ceph/config.cc | 6 +- trunk/ceph/config.h | 21 +- trunk/ceph/cosd.cc | 16 +- trunk/ceph/crush/BinaryTree.h | 12 +- trunk/ceph/crush/crush.h | 19 +- trunk/ceph/csyn.cc | 6 +- trunk/ceph/ebofs/BlockDevice.cc | 4 +- trunk/ceph/ebofs/BufferCache.h | 28 +-- trunk/ceph/ebofs/Onode.h | 36 ++-- trunk/ceph/ebofs/Table.h | 56 ++--- trunk/ceph/ebofs/nodes.h | 24 +-- trunk/ceph/fakefuse.cc | 12 +- trunk/ceph/fakesyn.cc | 26 +-- trunk/ceph/include/buffer.h | 25 ++- trunk/ceph/include/frag.h | 18 +- trunk/ceph/include/lru.h | 2 - trunk/ceph/mds/AnchorClient.cc | 1 - trunk/ceph/mds/MDBalancer.cc | 5 +- trunk/ceph/mds/MDBalancer.h | 6 +- trunk/ceph/mds/events/EMetaBlob.h | 10 +- trunk/ceph/mkmonmap.cc | 8 +- trunk/ceph/mon/OSDMonitor.cc | 2 +- trunk/ceph/mon/Paxos.h | 1 + trunk/ceph/mon/PaxosService.cc | 30 ++- trunk/ceph/mon/PaxosService.h | 16 +- trunk/ceph/msg/msg_types.h | 2 +- trunk/ceph/msg/tcp.cc | 10 +- trunk/ceph/newsyn.cc | 44 ++-- trunk/ceph/osd/Ager.cc | 4 +- trunk/ceph/osd/ObjectStore.h | 4 +- 46 files changed, 460 insertions(+), 399 deletions(-) diff --git a/trunk/ceph/cfuse.cc b/trunk/ceph/cfuse.cc index d08898d720f63..168f8dee165d7 100644 --- a/trunk/ceph/cfuse.cc +++ b/trunk/ceph/cfuse.cc @@ -37,7 +37,7 @@ using namespace std; int main(int argc, char **argv, char *envp[]) { - //cerr << "cfuse starting " << myrank << "/" << world << endl; + //cerr << "cfuse starting " << myrank << "/" << world << std::endl; vector args; argv_to_vec(argc, argv, args); parse_config_options(args); @@ -64,18 +64,18 @@ int main(int argc, char **argv, char *envp[]) { // start up fuse // use my argc, argv (make sure you pass a mount point!) - cout << "mounting" << endl; + cout << "mounting" << std::endl; client->mount(); - cerr << "starting fuse on pid " << getpid() << endl; + cerr << "starting fuse on pid " << getpid() << std::endl; if (g_conf.fuse_ll) ceph_fuse_ll_main(client, argc, argv); else ceph_fuse_main(client, argc, argv); - cerr << "fuse finished on pid " << getpid() << endl; + cerr << "fuse finished on pid " << getpid() << std::endl; client->unmount(); - cout << "unmounted" << endl; + cout << "unmounted" << std::endl; client->shutdown(); delete client; diff --git a/trunk/ceph/client/Client.cc b/trunk/ceph/client/Client.cc index 61e290ea78d3d..90dbc8df4823a 100644 --- a/trunk/ceph/client/Client.cc +++ b/trunk/ceph/client/Client.cc @@ -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" << std::endl; + tout << existing << std::endl; + tout << newname << std::endl; return _link(existing, newname); } @@ -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" << std::endl; + tout << relpath << std::endl; string abspath; mkabspath(relpath, abspath); @@ -1601,9 +1601,9 @@ int Client::_unlink(const char *path) 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" << std::endl; + tout << relfrom << std::endl; + tout << relto << std::endl; string absfrom, absto; mkabspath(relfrom, absfrom); @@ -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" << std::endl; + tout << relpath << std::endl; + tout << mode << std::endl; string abspath; mkabspath(relpath, abspath); @@ -1677,8 +1677,8 @@ int Client::_mkdir(const char *path, mode_t mode) int Client::rmdir(const char *relpath) { Mutex::Locker lock(client_lock); - tout << "rmdir" << endl; - tout << relpath << endl; + tout << "rmdir" << std::endl; + tout << relpath << std::endl; string abspath; mkabspath(relpath, abspath); @@ -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" << std::endl; + tout << reltarget << std::endl; + tout << rellink << std::endl; string target, link; mkabspath(reltarget, target); @@ -1756,8 +1756,8 @@ int Client::_symlink(const char *target, const char *link) int Client::readlink(const char *path, char *buf, off_t size) { Mutex::Locker lock(client_lock); - tout << "readlink" << endl; - tout << path << endl; + tout << "readlink" << std::endl; + tout << path << std::endl; string abspath; mkabspath(path, abspath); @@ -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" << std::endl; + tout << relpath << std::endl; string abspath; mkabspath(relpath, abspath); @@ -1913,8 +1913,8 @@ int Client::lstatlite(const char *relpath, struct statlite *stl) const char *path = abspath.c_str(); dout(3) << "op: client->lstatlite(\"" << path << "\", &st);" << dendl; - tout << "lstatlite" << endl; - tout << path << endl; + tout << "lstatlite" << std::endl; + tout << path << std::endl; // make mask // FIXME. @@ -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" << std::endl; + tout << relpath << std::endl; + tout << mode << std::endl; string abspath; mkabspath(relpath, abspath); @@ -1975,10 +1975,10 @@ int Client::_chmod(const char *path, mode_t mode) 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" << std::endl; + tout << relpath << std::endl; + tout << uid << std::endl; + tout << gid << std::endl; string abspath; mkabspath(relpath, abspath); @@ -2013,10 +2013,10 @@ int Client::_chown(const char *path, uid_t uid, gid_t gid) 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" << std::endl; + tout << relpath << std::endl; + tout << buf->modtime << std::endl; + tout << buf->actime << std::endl; string abspath; mkabspath(relpath, abspath); @@ -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" << std::endl; + tout << relpath << std::endl; + tout << mode << std::endl; + tout << rdev << std::endl; string abspath; mkabspath(relpath, abspath); @@ -2095,8 +2095,8 @@ int Client::getdir(const char *relpath, list& contents) dout(3) << "getdir(" << relpath << ")" << dendl; { Mutex::Locker lock(client_lock); - tout << "getdir" << endl; - tout << relpath << endl; + tout << "getdir" << std::endl; + tout << relpath << std::endl; } DIR *d; @@ -2117,11 +2117,11 @@ int Client::getdir(const char *relpath, list& contents) int Client::opendir(const char *name, DIR **dirpp) { Mutex::Locker lock(client_lock); - tout << "opendir" << endl; - tout << name << endl; + tout << "opendir" << std::endl; + tout << name << std::endl; int r = _opendir(name, (DirResult**)dirpp); - tout << (unsigned long)*dirpp << endl; + tout << (unsigned long)*dirpp << std::endl; return r; } @@ -2368,8 +2368,8 @@ 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" << std::endl; + tout << (unsigned long)dir << std::endl; dout(3) << "closedir(" << dir << ") = 0" << dendl; _closedir((DirResult*)dir); @@ -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" << std::endl; + tout << relpath << std::endl; + tout << flags << std::endl; string abspath; mkabspath(relpath, abspath); @@ -2437,7 +2437,7 @@ int Client::open(const char *relpath, int flags, mode_t mode) fd_map[r] = fh; } - tout << r << endl; + tout << r << std::endl; dout(3) << "open(" << relpath << ", " << flags << ") = " << r << dendl; return r; } @@ -2568,8 +2568,8 @@ void Client::close_safe(Inode *in) int Client::close(int fd) { Mutex::Locker lock(client_lock); - tout << "close" << endl; - tout << fd << endl; + tout << "close" << std::endl; + tout << fd << std::endl; dout(3) << "close(" << fd << ")" << dendl; assert(fd_map.count(fd)); @@ -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" << std::endl; + tout << fd << std::endl; + tout << offset << std::endl; + tout << whence << std::endl; assert(fd_map.count(fd)); Fh *f = fd_map[fd]; @@ -2706,10 +2706,10 @@ 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" << std::endl; + tout << fd << std::endl; + tout << size << std::endl; + tout << offset << std::endl; assert(fd_map.count(fd)); Fh *f = fd_map[fd]; @@ -2855,10 +2855,10 @@ 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" << std::endl; + tout << fd << std::endl; + tout << size << std::endl; + tout << offset << std::endl; assert(fd_map.count(fd)); Fh *fh = fd_map[fd]; @@ -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" << std::endl; + tout << relpath << std::endl; + tout << length << std::endl; string path; mkabspath(relpath, path); @@ -3032,9 +3032,9 @@ int Client::_truncate(const char *file, off_t length) int Client::ftruncate(int fd, off_t length) { Mutex::Locker lock(client_lock); - tout << "ftruncate" << endl; - tout << fd << endl; - tout << length << endl; + tout << "ftruncate" << std::endl; + tout << fd << std::endl; + tout << length << std::endl; assert(fd_map.count(fd)); Fh *f = fd_map[fd]; @@ -3064,9 +3064,9 @@ 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" << std::endl; + tout << fd << std::endl; + tout << syncdataonly << std::endl; assert(fd_map.count(fd)); Fh *f = fd_map[fd]; @@ -3103,8 +3103,8 @@ 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" << std::endl; + tout << path << std::endl; // fake it for now! string abs; @@ -3117,14 +3117,14 @@ 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" << std::endl; 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" << std::endl; return _statfs(stbuf); } @@ -3254,9 +3254,9 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr) { Mutex::Locker lock(client_lock); dout(3) << "ll_lookup " << parent << " " << name << dendl; - tout << "ll_lookup" << endl; - tout << parent.val << endl; - tout << name << endl; + tout << "ll_lookup" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; string dname = name; Inode *diri = 0; @@ -3299,7 +3299,7 @@ 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 << ")" << dendl; - tout << attr->st_ino << endl; + tout << attr->st_ino << std::endl; return r; } @@ -3342,9 +3342,9 @@ bool Client::ll_forget(inodeno_t ino, int num) { Mutex::Locker lock(client_lock); dout(3) << "ll_forget " << ino << " " << num << dendl; - tout << "ll_forget" << endl; - tout << ino.val << endl; - tout << num << endl; + tout << "ll_forget" << std::endl; + tout << ino.val << std::endl; + tout << num << std::endl; if (ino == 1) return true; // ignore forget on root. @@ -3379,8 +3379,8 @@ int Client::ll_getattr(inodeno_t ino, struct stat *attr) { Mutex::Locker lock(client_lock); dout(3) << "ll_getattr " << ino << dendl; - tout << "ll_getattr" << endl; - tout << ino.val << endl; + tout << "ll_getattr" << std::endl; + tout << ino.val << std::endl; Inode *in = _ll_get_inode(ino); fill_stat(in, attr); @@ -3391,15 +3391,15 @@ 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 << dendl; - 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; + tout << "ll_setattr" << std::endl; + tout << ino.val << std::endl; + tout << attr->st_mode << std::endl; + tout << attr->st_uid << std::endl; + tout << attr->st_gid << std::endl; + tout << attr->st_size << std::endl; + tout << attr->st_mtime << std::endl; + tout << attr->st_atime << std::endl; + tout << mask << std::endl; Inode *in = _ll_get_inode(ino); @@ -3437,8 +3437,8 @@ int Client::ll_readlink(inodeno_t ino, const char **value) { Mutex::Locker lock(client_lock); dout(3) << "ll_readlink " << ino << dendl; - tout << "ll_readlink" << endl; - tout << ino.val << endl; + tout << "ll_readlink" << std::endl; + tout << ino.val << std::endl; Inode *in = _ll_get_inode(ino); int r = 0; @@ -3456,11 +3456,11 @@ int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev { Mutex::Locker lock(client_lock); dout(3) << "ll_mknod " << parent << " " << name << dendl; - tout << "ll_mknod" << endl; - tout << parent.val << endl; - tout << name << endl; - tout << mode << endl; - tout << rdev << endl; + tout << "ll_mknod" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; + tout << mode << std::endl; + tout << rdev << std::endl; Inode *diri = _ll_get_inode(parent); @@ -3475,7 +3475,7 @@ 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 << std::endl; dout(3) << "ll_mknod " << parent << " " << name << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl; return r; @@ -3485,10 +3485,10 @@ int Client::ll_mkdir(inodeno_t parent, const char *name, mode_t mode, struct sta { Mutex::Locker lock(client_lock); dout(3) << "ll_mkdir " << parent << " " << name << dendl; - tout << "ll_mkdir" << endl; - tout << parent.val << endl; - tout << name << endl; - tout << mode << endl; + tout << "ll_mkdir" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; + tout << mode << std::endl; Inode *diri = _ll_get_inode(parent); @@ -3503,7 +3503,7 @@ 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 << std::endl; dout(3) << "ll_mkdir " << parent << " " << name << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl; return r; @@ -3513,10 +3513,10 @@ int Client::ll_symlink(inodeno_t parent, const char *name, const char *value, st { Mutex::Locker lock(client_lock); dout(3) << "ll_symlink " << parent << " " << name << " -> " << value << dendl; - tout << "ll_symlink" << endl; - tout << parent.val << endl; - tout << name << endl; - tout << value << endl; + tout << "ll_symlink" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; + tout << value << std::endl; Inode *diri = _ll_get_inode(parent); @@ -3531,7 +3531,7 @@ 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 << std::endl; dout(3) << "ll_symlink " << parent << " " << name << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl; return r; @@ -3541,9 +3541,9 @@ int Client::ll_unlink(inodeno_t ino, const char *name) { Mutex::Locker lock(client_lock); dout(3) << "ll_unlink " << ino << " " << name << dendl; - tout << "ll_unlink" << endl; - tout << ino.val << endl; - tout << name << endl; + tout << "ll_unlink" << std::endl; + tout << ino.val << std::endl; + tout << name << std::endl; Inode *diri = _ll_get_inode(ino); @@ -3558,9 +3558,9 @@ int Client::ll_rmdir(inodeno_t ino, const char *name) { Mutex::Locker lock(client_lock); dout(3) << "ll_rmdir " << ino << " " << name << dendl; - tout << "ll_rmdir" << endl; - tout << ino.val << endl; - tout << name << endl; + tout << "ll_rmdir" << std::endl; + tout << ino.val << std::endl; + tout << name << std::endl; Inode *diri = _ll_get_inode(ino); @@ -3576,11 +3576,11 @@ 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 << dendl; - tout << "ll_rename" << endl; - tout << parent.val << endl; - tout << name << endl; - tout << newparent.val << endl; - tout << newname << endl; + tout << "ll_rename" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; + tout << newparent.val << std::endl; + tout << newname << std::endl; Inode *diri = _ll_get_inode(parent); string path; @@ -3601,10 +3601,10 @@ int Client::ll_link(inodeno_t ino, inodeno_t newparent, const char *newname, str { Mutex::Locker lock(client_lock); dout(3) << "ll_link " << ino << " to " << newparent << " " << newname << dendl; - tout << "ll_link" << endl; - tout << ino.val << endl; - tout << newparent << endl; - tout << newname << endl; + tout << "ll_link" << std::endl; + tout << ino.val << std::endl; + tout << newparent << std::endl; + tout << newname << std::endl; Inode *old = _ll_get_inode(ino); Inode *diri = _ll_get_inode(newparent); @@ -3631,8 +3631,8 @@ int Client::ll_opendir(inodeno_t ino, void **dirpp) { Mutex::Locker lock(client_lock); dout(3) << "ll_opendir " << ino << dendl; - tout << "ll_opendir" << endl; - tout << ino.val << endl; + tout << "ll_opendir" << std::endl; + tout << ino.val << std::endl; Inode *diri = inode_map[ino]; assert(diri); @@ -3641,7 +3641,7 @@ 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 << std::endl; dout(3) << "ll_opendir " << ino << " = " << r << " (" << *dirpp << ")" << dendl; return r; @@ -3651,8 +3651,8 @@ void Client::ll_releasedir(void *dirp) { Mutex::Locker lock(client_lock); dout(3) << "ll_releasedir " << dirp << dendl; - tout << "ll_releasedir" << endl; - tout << (unsigned long)dirp << endl; + tout << "ll_releasedir" << std::endl; + tout << (unsigned long)dirp << std::endl; _closedir((DirResult*)dirp); } @@ -3660,9 +3660,9 @@ int Client::ll_open(inodeno_t ino, int flags, Fh **fhp) { Mutex::Locker lock(client_lock); dout(3) << "ll_open " << ino << " " << flags << dendl; - tout << "ll_open" << endl; - tout << ino.val << endl; - tout << flags << endl; + tout << "ll_open" << std::endl; + tout << ino.val << std::endl; + tout << flags << std::endl; Inode *in = _ll_get_inode(ino); string path; @@ -3670,7 +3670,7 @@ 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; + tout << (unsigned long)*fhp << std::endl; dout(3) << "ll_open " << ino << " " << flags << " = " << r << " (" << *fhp << ")" << dendl; return r; } @@ -3680,11 +3680,11 @@ int Client::ll_create(inodeno_t parent, const char *name, mode_t mode, int flags { Mutex::Locker lock(client_lock); dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << dendl; - tout << "ll_create" << endl; - tout << parent.val << endl; - tout << name << endl; - tout << mode << endl; - tout << flags << endl; + tout << "ll_create" << std::endl; + tout << parent.val << std::endl; + tout << name << std::endl; + tout << mode << std::endl; + tout << flags << std::endl; Inode *pin = _ll_get_inode(parent); string path; @@ -3700,8 +3700,8 @@ 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 << std::endl; + tout << attr->st_ino << std::endl; dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << " = " << r << " (" << *fhp << " " << hex << attr->st_ino << dec << ")" << dendl; return 0; @@ -3711,10 +3711,10 @@ 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 << dendl; - tout << "ll_read" << endl; - tout << (unsigned long)fh << endl; - tout << off << endl; - tout << len << endl; + tout << "ll_read" << std::endl; + tout << (unsigned long)fh << std::endl; + tout << off << std::endl; + tout << len << std::endl; return _read(fh, off, len, bl); } @@ -3723,10 +3723,10 @@ 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 << dendl; - tout << "ll_write" << endl; - tout << (unsigned long)fh << endl; - tout << off << endl; - tout << len << endl; + tout << "ll_write" << std::endl; + tout << (unsigned long)fh << std::endl; + tout << off << std::endl; + tout << len << std::endl; return _write(fh, off, len, data); } @@ -3735,8 +3735,8 @@ int Client::ll_flush(Fh *fh) { Mutex::Locker lock(client_lock); dout(3) << "ll_flush " << fh << dendl; - tout << "ll_flush" << endl; - tout << (unsigned long)fh << endl; + tout << "ll_flush" << std::endl; + tout << (unsigned long)fh << std::endl; return _flush(fh); } @@ -3745,8 +3745,8 @@ int Client::ll_release(Fh *fh) { Mutex::Locker lock(client_lock); dout(3) << "ll_release " << fh << dendl; - tout << "ll_release" << endl; - tout << (unsigned long)fh << endl; + tout << "ll_release" << std::endl; + tout << (unsigned long)fh << std::endl; _release(fh); return 0; diff --git a/trunk/ceph/client/Client.h b/trunk/ceph/client/Client.h index 58a4908eebf38..f3602bbb93517 100644 --- a/trunk/ceph/client/Client.h +++ b/trunk/ceph/client/Client.h @@ -42,7 +42,9 @@ #include #include #include -using namespace std; +using std::set; +using std::map; +using std::fstream; #include using namespace __gnu_cxx; diff --git a/trunk/ceph/client/FileCache.h b/trunk/ceph/client/FileCache.h index fc4f715691b43..8d6e08146b508 100644 --- a/trunk/ceph/client/FileCache.h +++ b/trunk/ceph/client/FileCache.h @@ -16,7 +16,7 @@ #define __FILECACHE_H #include -using namespace std; +using std::iostream; #include "common/Cond.h" #include "mds/Capability.h" diff --git a/trunk/ceph/client/SyntheticClient.cc b/trunk/ceph/client/SyntheticClient.cc index 3f6dca00656a6..e97d71c1c057e 100644 --- a/trunk/ceph/client/SyntheticClient.cc +++ b/trunk/ceph/client/SyntheticClient.cc @@ -180,7 +180,7 @@ void parse_syn_options(vector& 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] << std::endl; assert(0); } } @@ -240,6 +240,8 @@ string SyntheticClient::get_sarg(int seq) int SyntheticClient::run() { + client->mount(); + //run_start = g_clock.now(); run_until = utime_t(0,0); dout(5) << "run" << dendl; @@ -626,6 +628,8 @@ int SyntheticClient::run() assert(0); } } + + client->unmount(); return 0; } diff --git a/trunk/ceph/client/SyntheticClient.h b/trunk/ceph/client/SyntheticClient.h index b8367315edbb2..74ab66dd7bd50 100644 --- a/trunk/ceph/client/SyntheticClient.h +++ b/trunk/ceph/client/SyntheticClient.h @@ -194,9 +194,9 @@ class SyntheticClient { bool time_to_stop() { utime_t now = g_clock.now(); if (0) cout << "time_to_stop .. now " << now - << " until " << run_until - << " start " << run_start - << endl; + << " until " << run_until + << " start " << run_start + << std::endl; if (run_until.sec() && now > run_until) return true; else diff --git a/trunk/ceph/client/Trace.h b/trunk/ceph/client/Trace.h index 492795ed598c9..0530efc689abb 100644 --- a/trunk/ceph/client/Trace.h +++ b/trunk/ceph/client/Trace.h @@ -20,7 +20,9 @@ #include #include #include -using namespace std; +using std::list; +using std::string; +using std::ifstream; /* diff --git a/trunk/ceph/client/fuse.cc b/trunk/ceph/client/fuse.cc index 431025a8d8f13..64198dc41df51 100644 --- a/trunk/ceph/client/fuse.cc +++ b/trunk/ceph/client/fuse.cc @@ -300,7 +300,7 @@ int ceph_fuse_main(Client *c, int argc, char *argv[]) for (int argctr = 1; argctr < argc; argctr++) newargv[newargc++] = argv[argctr]; // go fuse go - cout << "ok, calling fuse_main" << endl; + cout << "ok, calling fuse_main" << std::endl; int r = fuse_main(newargc, newargv, &ceph_oper, 0); return r; } diff --git a/trunk/ceph/client/fuse_ll.cc b/trunk/ceph/client/fuse_ll.cc index 6ad1a91455796..7dee7936746f0 100644 --- a/trunk/ceph/client/fuse_ll.cc +++ b/trunk/ceph/client/fuse_ll.cc @@ -265,7 +265,7 @@ static void ceph_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, cout << "ceph_ll_readdir added " << de.d_name << " at " << pos << " len " << entrysize << " (buffer size is " << size << ")" << " .. off = " << off - << endl; + << std::endl; */ if (entrysize > size - pos) @@ -350,7 +350,7 @@ static struct fuse_lowlevel_ops ceph_ll_oper = { int ceph_fuse_ll_main(Client *c, int argc, char *argv[]) { - cout << "ceph_fuse_ll_main starting fuse" << endl; + cout << "ceph_fuse_ll_main starting fuse" << std::endl; client = c; @@ -391,7 +391,7 @@ int ceph_fuse_ll_main(Client *c, int argc, char *argv[]) } fuse_opt_free_args(&args); - cout << "ceph_fuse_ll_main done, err=" << err << endl; + cout << "ceph_fuse_ll_main done, err=" << err << std::endl; return err ? 1 : 0; } diff --git a/trunk/ceph/cmds.cc b/trunk/ceph/cmds.cc index 743f551c4c7a3..be040d57e3362 100644 --- a/trunk/ceph/cmds.cc +++ b/trunk/ceph/cmds.cc @@ -34,7 +34,7 @@ using namespace std; class C_Die : public Context { public: void finish(int) { - cerr << "die" << endl; + cerr << "die" << std::endl; exit(1); } }; @@ -70,7 +70,7 @@ int main(int argc, char **argv) else if (strcmp(args[i], "--mds") == 0) whoami = atoi(args[++i]); else { - cerr << "unrecognized arg " << args[i] << endl; + cerr << "unrecognized arg " << args[i] << std::endl; return -1; } } diff --git a/trunk/ceph/cmon.cc b/trunk/ceph/cmon.cc index 5224400269ecd..86e7179e15e22 100644 --- a/trunk/ceph/cmon.cc +++ b/trunk/ceph/cmon.cc @@ -34,7 +34,7 @@ using namespace std; class C_Die : public Context { public: void finish(int) { - cerr << "die" << endl; + cerr << "die" << std::endl; exit(1); } }; @@ -70,7 +70,7 @@ int main(int argc, char **argv) else if (strcmp(args[i], "--monmap") == 0) monmap_fn = args[++i]; else { - cerr << "unrecognized arg " << args[i] << endl; + cerr << "unrecognized arg " << args[i] << std::endl; return -1; } } @@ -81,12 +81,12 @@ int main(int argc, char **argv) if (whoami < 0) { // let's assume a standalone monitor - cout << "starting standalone mon0" << endl; + cout << "starting standalone mon0" << std::endl; whoami = 0; // start messenger rank.start_rank(); - cout << "bound to " << rank.get_listen_addr() << endl; + cout << "bound to " << rank.get_listen_addr() << std::endl; // add single mon0 entity_inst_t inst; @@ -95,19 +95,19 @@ int main(int argc, char **argv) monmap.add_mon(inst); // write monmap - cout << "writing monmap to " << monmap_fn << endl;; + cout << "writing monmap to " << monmap_fn << std::endl;; int r = monmap.write(monmap_fn); assert(r >= 0); } else { // i am specific monitor. // read monmap - cout << "reading monmap from .ceph_monmap" << endl; + cout << "reading monmap from .ceph_monmap" << std::endl; int r = monmap.read(monmap_fn); assert(r >= 0); // bind to a specific port - cout << "starting mon" << whoami << " at " << monmap.get_inst(whoami) << endl; + cout << "starting mon" << whoami << " at " << monmap.get_inst(whoami) << std::endl; g_my_addr = monmap.get_inst(whoami).addr; rank.start_rank(); } @@ -118,7 +118,7 @@ int main(int argc, char **argv) mon->init(); // wait - cout << "waiting for shutdown ..." << endl; + cout << "waiting for shutdown ..." << std::endl; rank.wait(); // done diff --git a/trunk/ceph/common/LogType.h b/trunk/ceph/common/LogType.h index 9c45448d49590..35008e79ff045 100644 --- a/trunk/ceph/common/LogType.h +++ b/trunk/ceph/common/LogType.h @@ -20,10 +20,13 @@ #include #include -using namespace std; +using std::string; +using std::ofstream; + #include #include -using namespace __gnu_cxx; +using __gnu_cxx::hash_map; +using __gnu_cxx::hash_set; #include "Mutex.h" diff --git a/trunk/ceph/common/Logger.cc b/trunk/ceph/common/Logger.cc index 9ffab65074f1a..f7fe3fbdc4192 100644 --- a/trunk/ceph/common/Logger.cc +++ b/trunk/ceph/common/Logger.cc @@ -158,7 +158,7 @@ void Logger::flush(bool force) utime_t fromstart = g_clock.recent_now(); if (fromstart < start) { - cerr << "logger time jumped backwards from " << start << " to " << fromstart << endl; + cerr << "logger time jumped backwards from " << start << " to " << fromstart << std::endl; assert(0); start = fromstart; } @@ -185,7 +185,7 @@ void Logger::flush(bool force) out << "#" << type->keymap.size(); for (unsigned i=0; ikeys.size(); i++) out << "\t" << type->keys[i]; - out << endl; //out << "\t (" << type->keymap.size() << ")" << endl; + out << std::endl; //out << "\t (" << type->keymap.size() << ")" << endl; wrote_header = type->version; wrote_header_last = 0; } @@ -198,7 +198,7 @@ void Logger::flush(bool force) else out << "\t" << vals[i]; } - out << endl; + out << std::endl; // reset the counters for (unsigned i=0; ikeys.size(); i++) { diff --git a/trunk/ceph/common/Logger.h b/trunk/ceph/common/Logger.h index e1c2c37ed3006..393ad6068c883 100644 --- a/trunk/ceph/common/Logger.h +++ b/trunk/ceph/common/Logger.h @@ -22,10 +22,11 @@ #include #include -using namespace std; +using std::string; +using std::ofstream; #include -using namespace __gnu_cxx; +using __gnu_cxx::hash_map; #include "LogType.h" diff --git a/trunk/ceph/common/ThreadPool.h b/trunk/ceph/common/ThreadPool.h index 5bc1a7fa57b5a..06f1f46120fb5 100644 --- a/trunk/ceph/common/ThreadPool.h +++ b/trunk/ceph/common/ThreadPool.h @@ -17,7 +17,7 @@ #define THREADPOOL #include -using namespace std; +using std::list; #include @@ -62,16 +62,16 @@ class ThreadPool { void *do_ops(void *nothing) { - tpdout(DBLVL) << ".do_ops thread " << pthread_self() << " starting" << endl; + tpdout(DBLVL) << ".do_ops thread " << pthread_self() << " starting" << std::endl; while (1) { q_sem.Get(); if (q.empty()) break; T op = get_op(); - tpdout(DBLVL) << ".func thread "<< pthread_self() << " on " << op << endl; + tpdout(DBLVL) << ".func thread "<< pthread_self() << " on " << op << std::endl; func(u, op); } - tpdout(DBLVL) << ".do_ops thread " << pthread_self() << " exiting" << endl; + tpdout(DBLVL) << ".do_ops thread " << pthread_self() << " exiting" << std::endl; return 0; } @@ -86,7 +86,7 @@ class ThreadPool { num_ops--; if (prefunc && op) { - tpdout(DBLVL) << ".prefunc thread "<< pthread_self() << " on " << op << endl; + tpdout(DBLVL) << ".prefunc thread "<< pthread_self() << " on " << op << std::endl; prefunc(u, op); } } @@ -103,7 +103,7 @@ class ThreadPool { u(obj), func(f), prefunc(pf), myname(myname) { - tpdout(DBLVL) << ".cons num_threads " << num_threads << endl; + tpdout(DBLVL) << ".cons num_threads " << num_threads << std::endl; // start threads int status; @@ -120,14 +120,14 @@ class ThreadPool { // wait for them to die for(int i = 0; i < num_threads; i++) { - tpdout(DBLVL) << ".des joining thread " << thread[i] << endl; + tpdout(DBLVL) << ".des joining thread " << thread[i] << std::endl; void *rval = 0; // we don't actually care pthread_join(thread[i], &rval); } } void put_op(T op) { - tpdout(DBLVL) << ".put_op " << op << endl; + tpdout(DBLVL) << ".put_op " << op << std::endl; q_lock.Lock(); q.push_back(op); num_ops++; diff --git a/trunk/ceph/common/Timer.h b/trunk/ceph/common/Timer.h index 46095d98312e1..414ac3ad4e8eb 100644 --- a/trunk/ceph/common/Timer.h +++ b/trunk/ceph/common/Timer.h @@ -26,7 +26,8 @@ #include #include -using namespace std; +using std::map; +using std::set; #include using namespace __gnu_cxx; diff --git a/trunk/ceph/config.cc b/trunk/ceph/config.cc index 0ef744597bc1f..add92ff611895 100644 --- a/trunk/ceph/config.cc +++ b/trunk/ceph/config.cc @@ -143,6 +143,8 @@ md_config_t g_conf = { mon_stop_with_last_mds: false, mon_allow_mds_bully: true, // allow a booting mds to (forcibly) claim an mds # + paxos_propose_interval: 1.0, // gather updates for this long before proposing a map update + // --- client --- client_cache_size: 1000, client_cache_mid: .5, @@ -413,11 +415,11 @@ bool parse_ip_port(const char *s, entity_addr_t& a) //cout << "val " << val << endl; if (numdigits == 0) { - cerr << "no digits at off " << off << endl; + cerr << "no digits at off " << off << std::endl; return false; // no digits } if (count < 3 && *s != '.') { - cerr << "should period at " << off << endl; + cerr << "should period at " << off << std::endl; return false; // should have 3 periods } s++; off++; diff --git a/trunk/ceph/config.h b/trunk/ceph/config.h index 65025b10f1c5d..c5d3f50446d4a 100644 --- a/trunk/ceph/config.h +++ b/trunk/ceph/config.h @@ -127,6 +127,8 @@ struct md_config_t { bool mon_stop_with_last_mds; bool mon_allow_mds_bully; + double paxos_propose_interval; + // client int client_cache_size; float client_cache_mid; @@ -359,24 +361,28 @@ extern bool parse_ip_port(const char *s, entity_addr_t& addr); * 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) {} -}; +struct _dbeginl_t { _dbeginl_t(int) {} }; +struct _dendl_t { _dendl_t(int) {} }; static const _dbeginl_t dbeginl = 0; static const _dendl_t dendl = 0; +// intentionally conflict with std::endl +class _bad_endl_t { public: _bad_endl_t(int) {} }; +static const _bad_endl_t endl = 0; // hrm ......... FIXME .......... + inline ostream& operator<<(ostream& out, _dbeginl_t) { _dout_lock.Lock(); return out; } inline ostream& operator<<(ostream& out, _dendl_t) { - out << endl; + out << std::endl; _dout_lock.Unlock(); return out; } +inline ostream& operator<<(ostream& out, _bad_endl_t) { + assert(0 && "you are using the wrong endl.. use std::endl or dendl"); + return out; +} // generic macros #define generic_dout(x) if ((x) <= g_conf.debug) std::cout << dbeginl @@ -384,4 +390,5 @@ inline ostream& operator<<(ostream& out, _dendl_t) { #define pdout(x,p) if ((x) <= (p)) std::cout << dbeginl + #endif diff --git a/trunk/ceph/cosd.cc b/trunk/ceph/cosd.cc index 958959d090b0d..fcf7e12b008ca 100644 --- a/trunk/ceph/cosd.cc +++ b/trunk/ceph/cosd.cc @@ -36,7 +36,7 @@ using namespace std; class C_Die : public Context { public: void finish(int) { - cerr << "die" << endl; + cerr << "die" << std::endl; exit(1); } }; @@ -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); - cout << "debug_after flipping debug settings" << endl; + cout << "debug_after flipping debug settings" << std::endl; } }; @@ -75,18 +75,18 @@ int main(int argc, char **argv) else if (strcmp(args[i],"--osd") == 0) whoami = atoi(args[++i]); else { - cerr << "unrecognized arg " << args[i] << endl; + cerr << "unrecognized arg " << args[i] << std::endl; return -1; } } if (whoami < 0) { - cerr << "must specify '--osd #' where # is the osd number" << endl; + cerr << "must specify '--osd #' where # is the osd number" << std::endl; } if (!dev) { sprintf(dev_default, "dev/osd%d", whoami); dev = dev_default; } - cout << "dev " << dev << endl; + cout << "dev " << dev << std::endl; if (whoami < 0) { @@ -97,7 +97,7 @@ int main(int argc, char **argv) store->mount(); int r = store->read(object_t(0,0), 0, sizeof(sb), bl); if (r < 0) { - cerr << "couldn't read superblock object on " << dev << endl; + cerr << "couldn't read superblock object on " << dev << std::endl; exit(0); } bl.copy(0, sizeof(sb), (char*)&sb); @@ -105,9 +105,9 @@ int main(int argc, char **argv) delete store; whoami = sb.whoami; - cout << "osd fs says i am osd" << whoami << endl; + cout << "osd fs says i am osd" << whoami << std::endl; } else { - cout << "command line arg says i am osd" << whoami << endl; + cout << "command line arg says i am osd" << whoami << std::endl; } // load monmap diff --git a/trunk/ceph/crush/BinaryTree.h b/trunk/ceph/crush/BinaryTree.h index c9b91e19db970..7573fc02ed6dc 100644 --- a/trunk/ceph/crush/BinaryTree.h +++ b/trunk/ceph/crush/BinaryTree.h @@ -19,8 +19,8 @@ #include #include #include -//#include -using namespace std; +using std::map; +using std::vector; #include "include/buffer.h" @@ -95,12 +95,12 @@ namespace crush { } int left(int n) const { int h = height(n); - //cout << "left of " << n << " is " << (n - (1 << h)) << endl; + //cout << "left of " << n << " is " << (n - (1 << h)) << std::endl; return n - (1 << (h-1)); } int right(int n) const { int h = height(n); - //cout << "right of " << n << " is " << (n + (1 << h)) << endl; + //cout << "right of " << n << " is " << (n + (1 << h)) << std::endl; return n + (1 << (h-1)); } bool on_right(int n, int h = -1) const { @@ -220,7 +220,7 @@ namespace crush { } // create at n - //cout << "creating " << n << endl; + //cout << "creating " << n << std::endl; realloc(n); node_weight[n] = w; node_nested[n] = 1; @@ -264,7 +264,7 @@ namespace crush { } out << n << " : nested " << tree.nested(n) << " weight " << tree.weight(n); if (tree.complete(n)) out << " complete"; - out << endl; + out << std::endl; if (!tree.terminal(n)) { if (tree.exists(tree.left(n))) print_binary_tree_node(out, tree, tree.left(n), i+2); diff --git a/trunk/ceph/crush/crush.h b/trunk/ceph/crush/crush.h index 9432f901ceb4e..376e7d9b3fc86 100644 --- a/trunk/ceph/crush/crush.h +++ b/trunk/ceph/crush/crush.h @@ -20,7 +20,10 @@ #include #include #include -using namespace std; +using std::set; +using std::map; +using std::vector; +using std::list; #include #include using namespace __gnu_cxx; @@ -224,7 +227,7 @@ namespace crush { b->get_items(items); if (buckets.count(items[0])) { - out << endl; + out << std::endl; for (unsigned i=0; iargs[0]; - //cout << "take " << arg << endl; + //cout << "take " << arg << std::endl; if (!force_stack.empty()) { assert(force_stack.front() == arg); @@ -475,7 +478,7 @@ namespace crush { const int numrep = pc->args[0]; const int type = pc->args[1]; - //cout << "choose " << numrep << " of type " << type << endl; + //cout << "choose " << numrep << " of type " << type << std::endl; assert(!w.empty()); @@ -488,10 +491,10 @@ namespace crush { if (!force_stack.empty()) { forceval = force_stack.front(); force_stack.pop_front(); - //cout << "priming out with " << forceval << endl; + //cout << "priming out with " << forceval << std::endl; forcing = true; } else if (forcefeed >= 0 && type == 0) { - //cout << "forcing context-less " << forcefeed << endl; + //cout << "forcing context-less " << forcefeed << std::endl; forceval = forcefeed; forcefeed = -1; forcing = true; diff --git a/trunk/ceph/csyn.cc b/trunk/ceph/csyn.cc index 5ab9386eadc46..16849e69439ab 100644 --- a/trunk/ceph/csyn.cc +++ b/trunk/ceph/csyn.cc @@ -37,7 +37,7 @@ using namespace std; int main(int argc, char **argv, char *envp[]) { - //cerr << "cfuse starting " << myrank << "/" << world << endl; + //cerr << "cfuse starting " << myrank << "/" << world << std::endl; vector args; argv_to_vec(argc, argv, args); parse_config_options(args); @@ -59,7 +59,7 @@ int main(int argc, char **argv, char *envp[]) { list clients; list synclients; - cout << "mounting and starting " << g_conf.num_client << " syn client(s)" << endl; + cout << "mounting and starting " << g_conf.num_client << " syn client(s)" << std::endl; for (int i=0; ikick(); lock.Lock(); - dout(25) << "kicker_thread done kicking ebofs" << endl; + dout(25) << "kicker_thread done kicking ebofs" << dendl; } if (io_stop) break; diff --git a/trunk/ceph/ebofs/BufferCache.h b/trunk/ceph/ebofs/BufferCache.h index 6e5277b13c1ec..d712dd9c5a681 100644 --- a/trunk/ceph/ebofs/BufferCache.h +++ b/trunk/ceph/ebofs/BufferCache.h @@ -115,7 +115,7 @@ class BufferHead : public LRUObject { void set_version(version_t v) { version = v; } version_t get_last_flushed() { return last_flushed; } void set_last_flushed(version_t v) { - if (v <= last_flushed) cout << "last_flushed begin set to " << v << ", was " << last_flushed << endl; + if (v <= last_flushed) cout << "last_flushed begin set to " << v << ", was " << last_flushed << std::endl; assert(v > last_flushed); last_flushed = v; } @@ -161,7 +161,7 @@ class BufferHead : public LRUObject { for (set::iterator p = shadows.begin(); p != shadows.end(); ++p) { - //cout << "unpin shadow " << *p << endl; + //cout << "unpin shadow " << *p << std::endl; (*p)->shadow_of = 0; (*p)->put(); } @@ -245,12 +245,12 @@ class BufferHead : public LRUObject { static void apply_partial(bufferlist& bl, map& pm) { assert(bl.length() == (unsigned)EBOFS_BLOCK_SIZE); //assert(partial_is_complete()); - //cout << "apply_partial" << endl; + //cout << "apply_partial" << std::endl; for (map::iterator i = pm.begin(); i != pm.end(); i++) { int pos = i->first; - //cout << " frag at opos " << i->first << " bhpos " << pos << " len " << i->second.length() << endl; + //cout << " frag at opos " << i->first << " bhpos " << pos << " len " << i->second.length() << std::endl; bl.copy_in(pos, i->second.length(), i->second); } pm.clear(); @@ -367,13 +367,13 @@ class ObjectCache { int get() { ++ref; - //cout << "oc.get " << object_id << " " << ref << endl; + //cout << "oc.get " << object_id << " " << ref << std::endl; return ref; } int put() { assert(ref > 0); --ref; - //cout << "oc.put " << object_id << " " << ref << endl; + //cout << "oc.put " << object_id << " " << ref << std::endl; return ref; } @@ -384,18 +384,18 @@ class ObjectCache { assert(data.count(bh->start()) == 0); if (0) { // sanity check FIXME DEBUG - //cout << "add_bh " << bh->start() << "~" << bh->length() << endl; + //cout << "add_bh " << bh->start() << "~" << bh->length() << std::endl; map::iterator p = data.lower_bound(bh->start()); if (p != data.end()) { - //cout << " after " << *p->second << endl; - //cout << " after starts at " << p->first << endl; + //cout << " after " << *p->second << std::endl; + //cout << " after starts at " << p->first << std::endl; assert(p->first >= bh->end()); } if (p != data.begin()) { p--; //cout << " before starts at " << p->second->start() - //<< " and ends at " << p->second->end() << endl; - //cout << " before " << *p->second << endl; + //<< " and ends at " << p->second->end() << std::endl; + //cout << " before " << *p->second << std::endl; assert(p->second->end() <= bh->start()); } } @@ -443,7 +443,7 @@ class ObjectCache { for (map::iterator i = data.begin(); i != data.end(); i++) - cout << "dump: " << i->first << ": " << *i->second << endl; + cout << "dump: " << i->first << ": " << *i->second << std::endl; } }; @@ -583,11 +583,11 @@ class BufferCache { } void inc_unflushed(int what, version_t epoch) { epoch_unflushed[what][epoch]++; - //cout << "inc_unflushed " << epoch << " now " << epoch_unflushed[epoch] << endl; + //cout << "inc_unflushed " << epoch << " now " << epoch_unflushed[epoch] << std::endl; } void dec_unflushed(int what, version_t epoch) { epoch_unflushed[what][epoch]--; - //cout << "dec_unflushed " << epoch << " now " << epoch_unflushed[epoch] << endl; + //cout << "dec_unflushed " << epoch << " now " << epoch_unflushed[epoch] << std::endl; if (epoch_unflushed[what][epoch] == 0) flush_cond.Signal(); } diff --git a/trunk/ceph/ebofs/Onode.h b/trunk/ceph/ebofs/Onode.h index 356796063b06f..16cd3e17f9bc5 100644 --- a/trunk/ceph/ebofs/Onode.h +++ b/trunk/ceph/ebofs/Onode.h @@ -82,12 +82,12 @@ public: void get() { if (ref == 0) lru_pin(); ref++; - //cout << "ebofs.onode.get " << hex << object_id << dec << " " << ref << endl; + //cout << "ebofs.onode.get " << hex << object_id << dec << " " << ref << std::endl; } void put() { ref--; if (ref == 0) lru_unpin(); - //cout << "ebofs.onode.put " << hex << object_id << dec << " " << ref << endl; + //cout << "ebofs.onode.put " << hex << object_id << dec << " " << ref << std::endl; } void mark_dirty() { @@ -120,10 +120,10 @@ public: } void close_oc() { if (oc) { - //cout << "close_oc on " << object_id << endl; + //cout << "close_oc on " << object_id << std::endl; assert(oc->is_empty()); if (oc->put() == 0){ - //cout << "************************* hosing oc" << endl; + //cout << "************************* hosing oc" << std::endl; delete oc; } oc = 0; @@ -139,12 +139,12 @@ public: interval_set is; set s; - cout << "verifying" << endl; + cout << "verifying" << std::endl; for (map::iterator p = extent_map.begin(); p != extent_map.end(); p++) { - cout << " " << p->first << ": " << p->second << endl; + cout << " " << p->first << ": " << p->second << std::endl; assert(count == p->first); count += p->second.length; for (unsigned j=0;jsecond.length;j++) { @@ -158,15 +158,15 @@ public: } } void set_extent(block_t offset, Extent ex) { - //cout << "set_extent " << offset << " -> " << ex << " ... " << object_blocks << endl; + //cout << "set_extent " << offset << " -> " << ex << " ... " << object_blocks << std::endl; assert(offset <= object_blocks); verify_extents(); // at the end? if (offset == object_blocks) { - //cout << " appending " << ex << endl; + //cout << " appending " << ex << std::endl; if (!extent_map.empty() && extent_map.rbegin()->second.end() == ex.start) { - //cout << "appending " << ex << " to " << extent_map.rbegin()->second << endl; + //cout << "appending " << ex << " to " << extent_map.rbegin()->second << std::endl; extent_map.rbegin()->second.length += ex.length; } else extent_map[object_blocks] = ex; @@ -181,16 +181,16 @@ public: if (p != extent_map.begin()) { p--; if (p->first + p->second.length > offset) { - //cout << " preceeding was " << p->second << endl; + //cout << " preceeding was " << p->second << std::endl; if (p->first + p->second.length > offset+ex.length) { // cutting chunk out of middle, add last bit Extent &n = extent_map[offset+ex.length] = p->second; n.start += offset+ex.length - p->first; n.length -= offset+ex.length - p->first; - //cout << " tail frag is " << n << endl; + //cout << " tail frag is " << n << std::endl; } p->second.length = offset - p->first; // cut tail off preceeding extent - //cout << " preceeding now " << p->second << endl; + //cout << " preceeding now " << p->second << std::endl; } p++; } @@ -203,7 +203,7 @@ public: // completely subsumed? if (p->first + p->second.length <= offset+ex.length) { - //cout << " erasing " << p->second << endl; + //cout << " erasing " << p->second << std::endl; extent_map.erase(p); p = next; continue; @@ -215,7 +215,7 @@ public: n.start += offset+ex.length - p->first; n.length -= offset+ex.length - p->first; extent_map.erase(p); - //cout << ", now " << n << endl; + //cout << ", now " << n << std::endl; break; } } @@ -234,7 +234,7 @@ public: * map teh given page range into extents on disk. */ int map_extents(block_t start, block_t len, vector& ls) { - //cout << "map_extents " << start << " " << len << endl; + //cout << "map_extents " << start << " " << len << std::endl; verify_extents(); //assert(start+len <= object_blocks); @@ -249,7 +249,7 @@ public: ex.length = MIN(len, p->second.length - (start - p->first)); ls.push_back(ex); - //cout << " got (tail of?) " << p->second << " : " << ex << endl; + //cout << " got (tail of?) " << p->second << " : " << ex << std::endl; start += ex.length; len -= ex.length; @@ -263,7 +263,7 @@ public: Extent ex = p->second; ex.length = MIN(len, ex.length); ls.push_back(ex); - //cout << " got (head of?) " << p->second << " : " << ex << endl; + //cout << " got (head of?) " << p->second << " : " << ex << std::endl; start += ex.length; len -= ex.length; p++; @@ -288,7 +288,7 @@ public: p->second.length = len - p->first; assert(p->second.length > 0); - //cout << " got (tail of?) " << p->second << " : " << ex << endl; + //cout << " got (tail of?) " << p->second << " : " << ex << std::endl; } p++; } diff --git a/trunk/ceph/ebofs/Table.h b/trunk/ceph/ebofs/Table.h index a3a084a46315a..02e74b94f7693 100644 --- a/trunk/ceph/ebofs/Table.h +++ b/trunk/ceph/ebofs/Table.h @@ -38,7 +38,7 @@ class Table { struct ebofs_table& bts) : pool(p), root(bts.root), nkeys(bts.num_keys), depth(bts.depth) { - dbtout << "cons" << endl; + dbtout << "cons" << std::endl; } nodeid_t get_root() { return root; } @@ -313,7 +313,7 @@ class Table { parent.index_item(pos[level-1]-1).node = left.get_id(); } - dbtout << "rotating item " << here.key(0) << " left from " << here.get_id() << " to " << left.get_id() << endl; + dbtout << "rotating item " << here.key(0) << " left from " << here.get_id() << " to " << left.get_id() << std::endl; /* add */ if (here.node->is_leaf()) @@ -355,7 +355,7 @@ class Table { if (pos[level] == here.size()) { /* let's just move the cursor over! */ //if (sizeof(K) == 8) - dbtout << "shifting cursor right from " << here.get_id() << " to less-full node " << right.get_id() << endl; + dbtout << "shifting cursor right from " << here.get_id() << " to less-full node " << right.get_id() << std::endl; open[level] = right; pos[level] = 0; pos[level-1]++; @@ -364,7 +364,7 @@ class Table { //if (sizeof(K) == 8) dbtout << "rotating item " << hex << here.key(here.size()-1) << dec << " right from " - << here.get_id() << " to " << right.get_id() << endl; + << here.get_id() << " to " << right.get_id() << std::endl; /* add */ if (here.is_index()) @@ -395,7 +395,7 @@ class Table { } int find(K key, Cursor& cursor) { - dbtout << "find " << key << endl; + dbtout << "find " << key << std::endl; if (depth == 0) return Cursor::OOB; @@ -435,7 +435,7 @@ class Table { if (curnode.index_item(j+1).key > key) break; } if (i != j) { - dbtout << "btree binary search failed" << endl; + dbtout << "btree binary search failed" << std::endl; i = j; } #endif @@ -470,7 +470,7 @@ class Table { if (curnode.leaf_item(j).key >= key) break; } if (i != j) { - dbtout << "btree binary search failed" << endl; + dbtout << "btree binary search failed" << std::endl; i = j; } #endif @@ -488,7 +488,7 @@ class Table { } int lookup(K key) { - dbtout << "lookup" << endl; + dbtout << "lookup" << std::endl; Cursor cursor(this); if (find(key, cursor) == Cursor::MATCH) return 0; @@ -496,7 +496,7 @@ class Table { } int lookup(K key, V& value) { - dbtout << "lookup" << endl; + dbtout << "lookup" << std::endl; Cursor cursor(this); if (find(key, cursor) == Cursor::MATCH) { value = cursor.current().value; @@ -506,7 +506,7 @@ class Table { } int insert(K key, V value) { - dbtout << "insert " << key << " -> " << value << endl; + dbtout << "insert " << key << " -> " << value << std::endl; if (almost_full()) return -1; // empty? @@ -567,9 +567,9 @@ class Table { /** split node **/ if (cursor.level == depth-1) { - dbtout << "splitting leaf " << cursor.open[cursor.level].get_id() << endl; + dbtout << "splitting leaf " << cursor.open[cursor.level].get_id() << std::endl; } else { - dbtout << "splitting index " << cursor.open[cursor.level].get_id() << endl; + dbtout << "splitting index " << cursor.open[cursor.level].get_id() << std::endl; } cursor.dirty(); @@ -602,7 +602,7 @@ class Table { /* are we at the root? */ if (cursor.level == 0) { /* split root. */ - dbtout << "that split was the root " << root << endl; + dbtout << "that split was the root " << root << std::endl; Nodeptr newroot( pool.new_node(Node::TYPE_INDEX) ); /* new root node */ @@ -629,17 +629,17 @@ class Table { int remove(K key) { - dbtout << "remove " << key << endl; + dbtout << "remove " << key << std::endl; if (almost_full()) { - cout << "table almost full, failing" << endl; + cout << "table almost full, failing" << std::endl; assert(0); return -1; } Cursor cursor(this); if (find(key, cursor) <= 0) { - cerr << "remove " << key << " 0x" << hex << key << dec << " .. dne" << endl; + cerr << "remove " << key << " 0x" << hex << key << dec << " .. dne" << std::endl; g_conf.debug_ebofs = 33; g_conf.ebofs_verify = true; verify("remove dne"); @@ -728,7 +728,7 @@ class Table { * (this makes it so our next delete will be in the index * interior, which is less scary.) */ - dbtout << "combining nodes " << left.get_id() << " and " << right.get_id() << endl; + dbtout << "combining nodes " << left.get_id() << " and " << right.get_id() << std::endl; left.merge(right); @@ -747,7 +747,7 @@ class Table { } void clear(Cursor& cursor, int node_loc, int level) { - dbtout << "clear" << endl; + dbtout << "clear" << std::endl; Nodeptr node = pool.get_node( node_loc ); cursor.open[level] = node; @@ -788,7 +788,7 @@ class Table { for (int i=0; i max) @@ -811,7 +811,7 @@ class Table { dbtout << ":: key in index node " << cursor.open[level-1].get_id() << " != min in child " << node_loc << "(key is " << hex << cursor.open[level-1].index_item(cursor.pos[level-1]).key - << ", min is " << min << ")" << dec << endl; + << ", min is " << min << ")" << dec << std::endl; err++; } if (cursor.pos[level-1] < cursor.open[level-1].size()-1) { @@ -819,7 +819,7 @@ class Table { dbtout << ":: next key in index node " << cursor.open[level-1].get_id() << " < max in child " << node_loc << "(key is " << hex << cursor.open[level-1].index_item(1+cursor.pos[level-1]).key - << ", max is " << max << ")" << dec << endl; + << ", max is " << max << ")" << dec << std::endl; err++; } } @@ -834,21 +834,21 @@ class Table { if (1) { if (root == node_loc) { dbtout << s << "root " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << std::endl; } else if (level == depth-1) { dbtout << s << "leaf " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << std::endl; } else { dbtout << s << "indx " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << std::endl; } if (0) { for (int i=0; i " << node.leaf_item(i).value << dec << endl; + dbtout << s << " " << hex << node.key(i) << " -> " << node.leaf_item(i).value << dec << std::endl; } } } @@ -874,7 +874,7 @@ class Table { int err = verify_sub(cursor, root, 0, count, last, on); if (count != nkeys) { - cerr << "** count " << count << " != nkeys " << nkeys << endl; + cerr << "** count " << count << " != nkeys " << nkeys << std::endl; err++; } @@ -882,7 +882,7 @@ class Table { // ok? if (err) { - cerr << "verify failure, called by '" << on << "'" << endl; + cerr << "verify failure, called by '" << on << "'" << std::endl; g_conf.debug_ebofs = 30; // do it again, so we definitely get the dump. int count = 0; diff --git a/trunk/ceph/ebofs/nodes.h b/trunk/ceph/ebofs/nodes.h index 765a3fe546900..fcdffa657c257 100644 --- a/trunk/ceph/ebofs/nodes.h +++ b/trunk/ceph/ebofs/nodes.h @@ -198,7 +198,7 @@ class NodePool { assert(region_loc.empty()); num_nodes = 0; for (int i=0; inum_regions; i++) { - debofs(3) << "init region " << i << " at " << np->region_loc[i] << endl; + debofs(3) << "init region " << i << " at " << np->region_loc[i] << std::endl; region_loc.push_back( np->region_loc[i] ); num_nodes += np->region_loc[i].length; } @@ -206,8 +206,8 @@ class NodePool { // usemap usemap_even = np->node_usemap_even; usemap_odd = np->node_usemap_odd; - debofs(3) << "init even map at " << usemap_even << endl; - debofs(3) << "init odd map at " << usemap_odd << endl; + debofs(3) << "init even map at " << usemap_even << std::endl; + debofs(3) << "init odd map at " << usemap_odd << std::endl; return 0; } @@ -274,13 +274,13 @@ class NodePool { to read. so it only really works when called from mount()! */ for (unsigned r=0; ropen_node(nid); - dbtout << "pool.open_node " << n->get_id() << endl; + dbtout << "pool.open_node " << n->get_id() << std::endl; node_map[n->get_id()] = n; return n; } @@ -505,7 +505,7 @@ class NodePool { // new node Node* new_node(int type) { nodeid_t nid = alloc_id(); - debofs(15) << "ebofs.nodepool.new_node " << nid << endl; + debofs(15) << "ebofs.nodepool.new_node " << nid << std::endl; // alloc node bufferptr bp = buffer::create_page_aligned(EBOFS_NODE_BYTES); @@ -520,7 +520,7 @@ class NodePool { void release(Node *n) { const nodeid_t nid = n->get_id(); - debofs(15) << "ebofs.nodepool.release on " << nid << endl; + debofs(15) << "ebofs.nodepool.release on " << nid << std::endl; node_map.erase(nid); if (n->is_dirty()) { @@ -543,7 +543,7 @@ class NodePool { void release_all() { while (!node_map.empty()) { map::iterator i = node_map.begin(); - debofs(2) << "ebofs.nodepool.release_all leftover " << i->first << " " << i->second << endl; + debofs(2) << "ebofs.nodepool.release_all leftover " << i->first << " " << i->second << std::endl; release( i->second ); } assert(node_map.empty()); @@ -553,7 +553,7 @@ class NodePool { // get new node id? nodeid_t oldid = n->get_id(); nodeid_t newid = alloc_id(); - debofs(15) << "ebofs.nodepool.dirty_node on " << oldid << " now " << newid << endl; + debofs(15) << "ebofs.nodepool.dirty_node on " << oldid << " now " << newid << std::endl; // release old block if (n->is_clean()) { diff --git a/trunk/ceph/fakefuse.cc b/trunk/ceph/fakefuse.cc index 663a16b84d5c6..a7d2c1995d933 100644 --- a/trunk/ceph/fakefuse.cc +++ b/trunk/ceph/fakefuse.cc @@ -44,13 +44,13 @@ using namespace std; class C_Test : public Context { public: void finish(int r) { - cout << "C_Test->finish(" << r << ")" << endl; + cout << "C_Test->finish(" << r << ")" << std::endl; } }; class C_Test2 : public Context { public: void finish(int r) { - cout << "C_Test2->finish(" << r << ")" << endl; + cout << "C_Test2->finish(" << r << ")" << std::endl; g_timer.add_event_after(2, new C_Test); } }; @@ -58,7 +58,7 @@ public: int main(int argc, char **argv) { - cerr << "fakefuse starting" << endl; + cerr << "fakefuse starting" << std::endl; // stop on our own (by default) g_conf.mon_stop_on_last_unmount = true; @@ -132,12 +132,12 @@ int main(int argc, char **argv) { client[i]->mount(); char *oldcwd = get_current_dir_name(); // note previous wd - cout << "starting fuse on pid " << getpid() << endl; + cout << "starting fuse on pid " << getpid() << std::endl; if (g_conf.fuse_ll) ceph_fuse_ll_main(client[i], argc, argv); else ceph_fuse_main(client[i], argc, argv); - cout << "fuse finished on pid " << getpid() << endl; + cout << "fuse finished on pid " << getpid() << std::endl; ::chdir(oldcwd); // return to previous wd free(oldcwd); @@ -148,7 +148,7 @@ int main(int argc, char **argv) { // wait for it to finish - cout << "DONE -----" << endl; + cout << "DONE -----" << std::endl; fakemessenger_wait(); // blocks until messenger stops diff --git a/trunk/ceph/fakesyn.cc b/trunk/ceph/fakesyn.cc index 35bf22bf1c953..b74fcfee84fa0 100644 --- a/trunk/ceph/fakesyn.cc +++ b/trunk/ceph/fakesyn.cc @@ -36,14 +36,14 @@ using namespace std; class C_Test : public Context { public: void finish(int r) { - cout << "C_Test->finish(" << r << ")" << endl; + cout << "C_Test->finish(" << r << ")" << std::endl; } }; class C_Die : public Context { public: void finish(int) { - cerr << "die" << endl; + cerr << "die" << std::endl; exit(1); } }; @@ -51,9 +51,9 @@ public: int main(int argc, char **argv) { - cerr << "fakesyn start" << endl; + cerr << "fakesyn start" << std::endl; - //cerr << "inode_t " << sizeof(inode_t) << endl; + //cerr << "inode_t " << sizeof(inode_t) << std::endl; vector args; argv_to_vec(argc, argv, args); @@ -72,7 +72,7 @@ int main(int argc, char **argv) for (unsigned i=0; iinit(); // use my argc, argv (make sure you pass a mount point!) - //cout << "mounting" << endl; + //cout << "mounting" << std::endl; client[i]->mount(); - //cout << "starting synthetic client " << endl; + //cout << "starting synthetic client " << std::endl; syn[i] = new SyntheticClient(client[i]); syn[i]->start_thread(); @@ -165,12 +165,12 @@ int main(int argc, char **argv) for (int i=0; ijoin_thread(); delete syn[i]; client[i]->unmount(); - //cout << "unmounted" << endl; + //cout << "unmounted" << std::endl; client[i]->shutdown(); } @@ -192,7 +192,7 @@ int main(int argc, char **argv) delete client[i]; } - cout << "fakesyn done" << endl; + cout << "fakesyn done" << std::endl; return 0; } diff --git a/trunk/ceph/include/buffer.h b/trunk/ceph/include/buffer.h index 24518dd9c621c..034e7580199c0 100644 --- a/trunk/ceph/include/buffer.h +++ b/trunk/ceph/include/buffer.h @@ -30,7 +30,6 @@ #include using std::cout; -using std::endl; #ifndef __CYGWIN__ # include @@ -179,7 +178,7 @@ private: inc_total_alloc(len+4095); //cout << "hack aligned " << (unsigned)data //<< " in raw " << (unsigned)realdata - //<< " off " << off << endl; + //<< " off " << off << std::endl; assert(((unsigned)data & 4095) == 0); } ~raw_hack_aligned() { @@ -659,12 +658,12 @@ public: assert(curbuf != _buffers.end()); if (off >= (*curbuf).length()) { // skip this buffer - //cout << "skipping over " << *curbuf << endl; + //cout << "skipping over " << *curbuf << std::endl; off -= (*curbuf).length(); curbuf++; } else { // somewhere in this buffer! - //cout << "somewhere in " << *curbuf << endl; + //cout << "somewhere in " << *curbuf << std::endl; break; } } @@ -672,14 +671,14 @@ public: while (len > 0) { // partial? if (off + len < (*curbuf).length()) { - //cout << "copying partial of " << *curbuf << endl; + //cout << "copying partial of " << *curbuf << std::endl; _buffers.push_back( ptr( *curbuf, off, len ) ); _len += len; break; } // through end - //cout << "copying end (all?) of " << *curbuf << endl; + //cout << "copying end (all?) of " << *curbuf << std::endl; unsigned howmuch = (*curbuf).length() - off; _buffers.push_back( ptr( *curbuf, off, howmuch ) ); _len += howmuch; @@ -694,7 +693,7 @@ public: void splice(unsigned off, unsigned len, list *claim_by=0 /*, bufferlist& replace_with */) { // fixme? assert(off < length()); assert(len > 0); - //cout << "splice off " << off << " len " << len << " ... mylen = " << length() << endl; + //cout << "splice off " << off << " len " << len << " ... mylen = " << length() << std::endl; // skip off std::list::iterator curbuf = _buffers.begin(); @@ -702,12 +701,12 @@ public: assert(curbuf != _buffers.end()); if (off >= (*curbuf).length()) { // skip this buffer - //cout << "off = " << off << " skipping over " << *curbuf << endl; + //cout << "off = " << off << " skipping over " << *curbuf << std::endl; off -= (*curbuf).length(); curbuf++; } else { // somewhere in this buffer! - //cout << "off = " << off << " somewhere in " << *curbuf << endl; + //cout << "off = " << off << " somewhere in " << *curbuf << std::endl; break; } } @@ -716,7 +715,7 @@ public: if (off) { // add a reference to the front bit // insert it before curbuf (which we'll hose) - //cout << "keeping front " << off << " of " << *curbuf << endl; + //cout << "keeping front " << off << " of " << *curbuf << std::endl; _buffers.insert( curbuf, ptr( *curbuf, 0, off ) ); _len += off; } @@ -724,19 +723,19 @@ public: while (len > 0) { // partial? if (off + len < (*curbuf).length()) { - //cout << "keeping end of " << *curbuf << ", losing first " << off+len << endl; + //cout << "keeping end of " << *curbuf << ", losing first " << off+len << std::endl; if (claim_by) claim_by->append( *curbuf, off, len ); (*curbuf).set_offset( off+len + (*curbuf).offset() ); // ignore beginning big (*curbuf).set_length( (*curbuf).length() - (len+off) ); _len -= off+len; - //cout << " now " << *curbuf << endl; + //cout << " now " << *curbuf << std::endl; break; } // hose though the end unsigned howmuch = (*curbuf).length() - off; - //cout << "discarding " << howmuch << " of " << *curbuf << endl; + //cout << "discarding " << howmuch << " of " << *curbuf << std::endl; if (claim_by) claim_by->append( *curbuf, off, howmuch ); _len -= (*curbuf).length(); diff --git a/trunk/ceph/include/frag.h b/trunk/ceph/include/frag.h index db8fec1ebfa8c..a6f5fdbde4b52 100644 --- a/trunk/ceph/include/frag.h +++ b/trunk/ceph/include/frag.h @@ -190,7 +190,7 @@ class fragtree_t { bool is_leaf(frag_t x) const { std::list ls; get_leaves_under(x, ls); - //cout << "is_leaf(" << x << ") -> " << ls << endl; + //cout << "is_leaf(" << x << ") -> " << ls << std::endl; if (!ls.empty() && ls.front() == x && ls.size() == 1) @@ -383,20 +383,20 @@ class fragtree_t { if (is_leaf(x)) return false; - cout << "force_to_leaf " << x << " on " << _splits << endl; + cout << "force_to_leaf " << x << " on " << _splits << std::endl; frag_t parent = get_branch_or_leaf(x); assert(parent.bits() <= x.bits()); - cout << "parent is " << parent << endl; + cout << "parent is " << parent << std::endl; // do we need to split from parent to x? if (parent.bits() < x.bits()) { int spread = x.bits() - parent.bits(); int nb = get_split(parent); - cout << "spread " << spread << ", parent splits by " << nb << endl; + cout << "spread " << spread << ", parent splits by " << nb << std::endl; if (nb == 0) { // easy: split parent (a leaf) by the difference - cout << "splitting parent " << parent << " by spread " << spread << endl; + cout << "splitting parent " << parent << " by spread " << spread << std::endl; split(parent, spread); assert(is_leaf(x)); return true; @@ -412,7 +412,7 @@ class fragtree_t { for (std::list::iterator p = subs.begin(); p != subs.end(); ++p) { - cout << "splitting intermediate " << *p << " by " << (nb-spread) << endl; + cout << "splitting intermediate " << *p << " by " << (nb-spread) << std::endl; split(*p, nb - spread); } } @@ -426,13 +426,13 @@ class fragtree_t { q.pop_front(); int nb = get_split(t); if (nb) { - cout << "merging child " << t << " by " << nb << endl; + cout << "merging child " << t << " by " << nb << std::endl; merge(t, nb); // merge this point, and t.split(nb, q); // queue up children } } - cout << "force_to_leaf done" << endl; + cout << "force_to_leaf done" << std::endl; assert(is_leaf(x)); return true; } @@ -472,7 +472,7 @@ class fragtree_t { q.pop_front(); // newline + indent? if (t.bits()) { - out << endl; + out << std::endl; for (unsigned i=0; i #include -#include -using namespace std; #include "config.h" diff --git a/trunk/ceph/mds/AnchorClient.cc b/trunk/ceph/mds/AnchorClient.cc index f2f1f17e37a4f..aa9f71131cdf5 100644 --- a/trunk/ceph/mds/AnchorClient.cc +++ b/trunk/ceph/mds/AnchorClient.cc @@ -15,7 +15,6 @@ #include using std::cout; using std::cerr; -using std::endl; #include "Anchor.h" #include "AnchorClient.h" diff --git a/trunk/ceph/mds/MDBalancer.cc b/trunk/ceph/mds/MDBalancer.cc index 78a5f95f2f400..da2f084976c2d 100644 --- a/trunk/ceph/mds/MDBalancer.cc +++ b/trunk/ceph/mds/MDBalancer.cc @@ -28,7 +28,8 @@ #include #include -using namespace std; +using std::map; +using std::vector; #include "config.h" @@ -941,7 +942,7 @@ void MDBalancer::dump_pop_map() myfile << "." << p; if (dir->get_frag() != frag_t()) myfile << "___" << (unsigned)dir->get_frag(); - myfile << endl; //"/" << dir->get_frag() << dendl; + myfile << std::endl; //"/" << dir->get_frag() << dendl; // add contents for (map::iterator q = dir->items.begin(); diff --git a/trunk/ceph/mds/MDBalancer.h b/trunk/ceph/mds/MDBalancer.h index bdc61c2abed37..6e7e76aa6d403 100644 --- a/trunk/ceph/mds/MDBalancer.h +++ b/trunk/ceph/mds/MDBalancer.h @@ -17,11 +17,11 @@ #ifndef __MDBALANCER_H #define __MDBALANCER_H -#include #include -using namespace std; - #include +using std::list; +using std::map; + #include using namespace __gnu_cxx; diff --git a/trunk/ceph/mds/events/EMetaBlob.h b/trunk/ceph/mds/events/EMetaBlob.h index 9a904be05fe73..d7e7e9a98f135 100644 --- a/trunk/ceph/mds/events/EMetaBlob.h +++ b/trunk/ceph/mds/events/EMetaBlob.h @@ -17,7 +17,7 @@ #include #include -using namespace std; +using std::string; #include "../CInode.h" #include "../CDir.h" @@ -79,7 +79,7 @@ class EMetaBlob { void print(ostream& out) { out << " fullbit dn " << dn << " dnv " << dnv << " inode " << inode.ino - << " dirty=" << dirty << endl; + << " dirty=" << dirty << std::endl; } }; @@ -112,7 +112,7 @@ class EMetaBlob { void print(ostream& out) { out << " remotebit dn " << dn << " dnv " << dnv << " ino " << ino - << " dirty=" << dirty << endl; + << " dirty=" << dirty << std::endl; } }; @@ -137,7 +137,7 @@ class EMetaBlob { } void print(ostream& out) { out << " nullbit dn " << dn << " dnv " << dnv - << " dirty=" << dirty << endl; + << " dirty=" << dirty << std::endl; } }; @@ -176,7 +176,7 @@ public: out << "dirlump " << dirfrag << " dirv " << dirv << " state " << state << " num " << nfull << "/" << nremote << "/" << nnull - << endl; + << std::endl; _decode_bits(); for (list::iterator p = dfull.begin(); p != dfull.end(); ++p) p->print(out); diff --git a/trunk/ceph/mkmonmap.cc b/trunk/ceph/mkmonmap.cc index 0b0813cb3cfea..3ed5d0c7b863f 100644 --- a/trunk/ceph/mkmonmap.cc +++ b/trunk/ceph/mkmonmap.cc @@ -45,22 +45,22 @@ int main(int argc, char **argv) // parse ip:port entity_inst_t inst; if (!parse_ip_port(args[i], inst.addr)) { - cerr << "mkmonmap: invalid ip:port '" << args[i] << "'" << endl; + cerr << "mkmonmap: invalid ip:port '" << args[i] << "'" << std::endl; return -1; } inst.name = MSG_ADDR_MON(monmap.num_mon); - cout << "mkmonmap: adding " << inst << endl; + cout << "mkmonmap: adding " << inst << std::endl; monmap.add_mon(inst); } } if (monmap.num_mon == 0) { - cerr << "usage: mkmonmap ip:port [...]" << endl; + cerr << "usage: mkmonmap ip:port [...]" << std::endl; return -1; } // write it out - cout << "mkmonmap: writing monmap to " << outfn << " (" << monmap.num_mon << " monitors)" << endl; + cout << "mkmonmap: writing monmap to " << outfn << " (" << monmap.num_mon << " monitors)" << std::endl; int r = monmap.write(outfn); assert(r >= 0); diff --git a/trunk/ceph/mon/OSDMonitor.cc b/trunk/ceph/mon/OSDMonitor.cc index c8f8f6da481a2..ec30070ed7a07 100644 --- a/trunk/ceph/mon/OSDMonitor.cc +++ b/trunk/ceph/mon/OSDMonitor.cc @@ -576,7 +576,7 @@ void OSDMonitor::send_to_waiting() dout(10) << "send_to_waiting skipping " << i->first << " has " << i->second.first << " wants " << i->second.second - << endl; + << dendl; i++; continue; } diff --git a/trunk/ceph/mon/Paxos.h b/trunk/ceph/mon/Paxos.h index 403e6d6eeaf96..a6d28dd1cea9a 100644 --- a/trunk/ceph/mon/Paxos.h +++ b/trunk/ceph/mon/Paxos.h @@ -164,6 +164,7 @@ private: public: C_LeaseRenew(Paxos *p) : paxos(p) {} void finish(int r) { + std::cout << "HI MOM" << std::endl; paxos->lease_renew_timeout(); } }; diff --git a/trunk/ceph/mon/PaxosService.cc b/trunk/ceph/mon/PaxosService.cc index 1666d683a40de..bc57537b283dc 100644 --- a/trunk/ceph/mon/PaxosService.cc +++ b/trunk/ceph/mon/PaxosService.cc @@ -60,9 +60,29 @@ void PaxosService::dispatch(Message *m) } // update - if (prepare_update(m) && - should_propose_now()) - propose_pending(); + if (prepare_update(m)) { + if (should_propose_now()) + propose_pending(); + else { + // delay a bit + if (!proposal_timer_set) { + dout(10) << " will propose shortly" << dendl; + proposal_timer_set = true; + mon->timer.add_event_after(g_conf.paxos_propose_interval, new C_Propose(this)); + } else { + dout(10) << " propose timer already set" << dendl; + } + } + } +} + +bool PaxosService::should_propose_now() +{ + // simple default policy: quick startup, then some damping. + if (paxos->last_committed < 3) + return true; + else + return false; } void PaxosService::_commit() @@ -95,6 +115,8 @@ void PaxosService::propose_pending() } + + void PaxosService::election_finished() { dout(10) << "election_finished" << dendl; @@ -134,3 +156,5 @@ void PaxosService::_active() } } } + + diff --git a/trunk/ceph/mon/PaxosService.h b/trunk/ceph/mon/PaxosService.h index 32bcb3e4b11fb..587a7e82f85d5 100644 --- a/trunk/ceph/mon/PaxosService.h +++ b/trunk/ceph/mon/PaxosService.h @@ -55,11 +55,25 @@ protected: }; friend class C_Update; + class C_Propose : public Context { + PaxosService *ps; + public: + C_Propose(PaxosService *p) : ps(p) { } + void finish(int r) { + ps->proposal_timer_set = false; + ps->propose_pending(); + } + }; + friend class C_Propose; + + private: + bool proposal_timer_set; bool have_pending; public: PaxosService(Monitor *mn, Paxos *p) : mon(mn), paxos(p), + proposal_timer_set(false), have_pending(false) { } // i implement and you ignore @@ -83,7 +97,7 @@ public: virtual bool preprocess_query(Message *m) = 0; // true if processed (e.g., read-only) virtual bool prepare_update(Message *m) = 0; - virtual bool should_propose_now() { return true; } + virtual bool should_propose_now(); }; diff --git a/trunk/ceph/msg/msg_types.h b/trunk/ceph/msg/msg_types.h index 48d8af6955f70..0287382e7a6ce 100644 --- a/trunk/ceph/msg/msg_types.h +++ b/trunk/ceph/msg/msg_types.h @@ -50,7 +50,7 @@ public: } } - bool is_new() const { return num() == NEW; } + bool is_new() const { return num() < 0; } bool is_client() const { return type() == TYPE_CLIENT; } bool is_mds() const { return type() == TYPE_MDS; } diff --git a/trunk/ceph/msg/tcp.cc b/trunk/ceph/msg/tcp.cc index 13fb52fb72d10..a131e3d6dd7dc 100644 --- a/trunk/ceph/msg/tcp.cc +++ b/trunk/ceph/msg/tcp.cc @@ -64,22 +64,22 @@ int tcp_hostlookup(char *str, tcpaddr_t& ta) } } if (!port) { - cerr << "addr '" << str << "' doesn't look like 'host:port'" << endl; + cerr << "addr '" << str << "' doesn't look like 'host:port'" << std::endl; return -1; } - //cout << "host '" << host << "' port '" << port << "'" << endl; + //cout << "host '" << host << "' port '" << port << "'" << std::endl; int iport = atoi(port); struct hostent *myhostname = gethostbyname( host ); if (!myhostname) { - cerr << "host " << host << " not found" << endl; + cerr << "host " << host << " not found" << std::endl; return -1; } memset(&ta, 0, sizeof(ta)); - //cout << "addrtype " << myhostname->h_addrtype << " len " << myhostname->h_length << endl; + //cout << "addrtype " << myhostname->h_addrtype << " len " << myhostname->h_length << std::endl; ta.sin_family = myhostname->h_addrtype; memcpy((char *)&ta.sin_addr, @@ -87,7 +87,7 @@ int tcp_hostlookup(char *str, tcpaddr_t& ta) myhostname->h_length); ta.sin_port = iport; - cout << "lookup '" << host << ":" << port << "' -> " << ta << endl; + cout << "lookup '" << host << ":" << port << "' -> " << ta << std::endl; return 0; } diff --git a/trunk/ceph/newsyn.cc b/trunk/ceph/newsyn.cc index 475803d719f3f..012762ca116c7 100644 --- a/trunk/ceph/newsyn.cc +++ b/trunk/ceph/newsyn.cc @@ -36,7 +36,7 @@ using namespace std; class C_Test : public Context { public: void finish(int r) { - cout << "C_Test->finish(" << r << ")" << endl; + cout << "C_Test->finish(" << r << ")" << std::endl; } }; @@ -67,7 +67,7 @@ pair mpi_bootstrap_new(int& argc, char**& argv, MonMap *monmap) utime_t z = g_clock.now(); MPI_Bcast( &z, sizeof(z), MPI_CHAR, 0, MPI_COMM_WORLD); - cout << "z is " << z << endl; + cout << "z is " << z << std::endl; g_clock.tare(z); } } @@ -81,7 +81,7 @@ pair mpi_bootstrap_new(int& argc, char**& argv, MonMap *monmap) moninst[mpi_rank].addr = rank.my_addr; moninst[mpi_rank].name = MSG_ADDR_MON(mpi_rank); - //cerr << mpi_rank << " at " << rank.get_listen_addr() << endl; + //cerr << mpi_rank << " at " << rank.get_listen_addr() << std::endl; } MPI_Gather( &moninst[mpi_rank], sizeof(entity_inst_t), MPI_CHAR, @@ -90,7 +90,7 @@ pair mpi_bootstrap_new(int& argc, char**& argv, MonMap *monmap) if (mpi_rank == 0) { for (int i=0; imon_inst[i] = moninst[i]; } } @@ -127,7 +127,7 @@ class C_Tick : public Context { public: void finish(int) { utime_t now = g_clock.now() - tick_start; - cout << "tick +" << g_conf.tick << " -> " << now << " (" << tick_count << ")" << endl; + cout << "tick +" << g_conf.tick << " -> " << now << " (" << tick_count << ")" << std::endl; tick_count += g_conf.tick; utime_t next = tick_start; next.sec_ref() += tick_count; @@ -138,7 +138,7 @@ public: class C_Die : public Context { public: void finish(int) { - cerr << "die" << endl; + cerr << "die" << std::endl; exit(1); } }; @@ -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); - cout << "debug_after flipping debug settings" << endl; + cout << "debug_after flipping debug settings" << std::endl; } }; @@ -205,7 +205,7 @@ int main(int argc, char **argv) vector nargs; for (unsigned i=0; iinit(); started++; @@ -296,7 +296,7 @@ int main(int argc, char **argv) g_timer.add_event_after(kill_osd_after[i], new C_Die); Messenger *m = rank.register_entity(MSG_ADDR_OSD(i)); - cerr << "osd" << i << " at " << rank.my_addr << " " << hostname << "." << pid << endl; + cerr << "osd" << i << " at " << rank.my_addr << " " << hostname << "." << pid << std::endl; osd[i] = new OSD(i, m, monmap); osd[i]->init(); started++; @@ -319,7 +319,8 @@ int main(int argc, char **argv) //if (myrank != start_mds + start_osd + i % client_nodes) continue; if (myrank != g_conf.ms_skip_rank0+start_mds + skip_osd + i / clients_per_node) continue; clientlist.insert(i); - client[i] = new Client(rank.register_entity(MSG_ADDR_CLIENT_NEW), monmap); + client[i] = new Client(rank.register_entity(entity_name_t(entity_name_t::TYPE_CLIENT, -1-i)), //MSG_ADDR_CLIENT_NEW), + monmap); // logger? if (client_logger == 0) { @@ -350,7 +351,7 @@ int main(int argc, char **argv) syn[i] = new SyntheticClient(client[i]); - client[i]->mount(); + //client[i]->mount(); nclients++; } @@ -361,12 +362,11 @@ int main(int argc, char **argv) it++) { int i = *it; - //cerr << "starting synthetic client" << i << " on rank " << myrank << endl; + //cerr << "starting synthetic client" << i << " on rank " << myrank << std::endl; syn[i]->start_thread(); - } if (nclients) { - cerr << nclients << " clients at " << rank.my_addr << " " << hostname << "." << pid << endl; + cerr << nclients << " clients at " << rank.my_addr << " " << hostname << "." << pid << std::endl; } for (set::iterator it = clientlist.begin(); @@ -374,12 +374,12 @@ int main(int argc, char **argv) it++) { int i = *it; - // cout << "waiting for synthetic client" << i << " to finish" << endl; + // cout << "waiting for synthetic client" << i << " to finish" << std::endl; syn[i]->join_thread(); delete syn[i]; - client[i]->unmount(); - //cout << "client" << i << " unmounted" << endl; + //client[i]->unmount(); + //cout << "client" << i << " unmounted" << std::endl; client[i]->shutdown(); delete client[i]; @@ -388,14 +388,14 @@ int main(int argc, char **argv) if (myrank && !started) { //dout(1) << "IDLE" << dendl; - cerr << "idle at " << rank.my_addr << " " << hostname << "." << pid << endl; + cerr << "idle at " << rank.my_addr << " " << hostname << "." << pid << std::endl; //rank.stop_rank(); } // wait for everything to finish rank.wait(); - if (started) cerr << "newsyn finishing" << endl; + if (started) cerr << "newsyn finishing" << std::endl; // cd on exit, so that gmon.out (if any) goes into a separate directory for each node. char s[20]; diff --git a/trunk/ceph/osd/Ager.cc b/trunk/ceph/osd/Ager.cc index 7ebaceb6fff40..fb777238da8fb 100644 --- a/trunk/ceph/osd/Ager.cc +++ b/trunk/ceph/osd/Ager.cc @@ -167,7 +167,7 @@ void Ager::age_empty(float pc) { void pfrag(uint64_t written, ObjectStore::FragmentationStat &st) { cout << "#gb wr\ttotal\tn x\tavg x\tavg per\tavg j\tfree\tn fr\tavg fr\tnum<2\tsum<2\tnum<4\tsum<4\t..." - << endl; + << std::endl; cout << written << "\t" << st.total << "\t" << st.num_extent @@ -186,7 +186,7 @@ void pfrag(uint64_t written, ObjectStore::FragmentationStat &st) n -= st.extent_dist[i]; if (n == 0) break; } - cout << endl; + cout << std::endl; } diff --git a/trunk/ceph/osd/ObjectStore.h b/trunk/ceph/osd/ObjectStore.h index 1bdb9955b4237..14c1e19af2d58 100644 --- a/trunk/ceph/osd/ObjectStore.h +++ b/trunk/ceph/osd/ObjectStore.h @@ -32,7 +32,7 @@ #endif /* DARWIN */ #include -using namespace std; +using std::list; #ifndef MIN # define MIN(a,b) ((a) < (b) ? (a):(b)) @@ -497,7 +497,7 @@ public: default: - cerr << "bad op " << op << endl; + cerr << "bad op " << op << std::endl; assert(0); } } -- 2.39.5