common/Finisher.cc \
common/sctp_crc32.c\
common/assert.cc \
+ common/debug.cc \
mon/MonMap.cc \
mon/MonClient.cc \
osd/OSDMap.cc \
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_client) *_dout << dbeginl << g_clock.now() << " client" << whoami /*<< "." << pthread_self() */ << " "
+#define DOUT_SUBSYS client
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "client" << whoami << " "
#define tout if (g_conf.client_trace) traceout
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_client) *_dout << dbeginl << g_clock.now() << " synthetic" << (this->whoami >= 0 ? this->whoami:client->get_nodeid()) << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_client) *_derr << dbeginl << g_clock.now() << " synthetic" << (this->whoami >= 0 ? this->whoami:client->get_nodeid()) << " "
+#define DOUT_SUBSYS client
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "client" << whoami << " "
// traces
//void trace_include(SyntheticClient *syn, Client *cl, string& prefix);
if (err < 0)
return 1;
- create_courtesy_output_symlink("mon", whoami);
+ _dout_create_courtesy_output_symlink("mon", whoami);
// start monitor
Messenger *m = rank.register_entity(entity_name_t::MON(whoami));
#include "config.h"
+#undef dout
+#undef derr
#define dout(l) if (l<=g_conf.debug_lockdep) *_dout << g_clock.now() << " " << pthread_self() << " lockdep: "
#define derr(l) if (l<=g_conf.debug_lockdep) *_derr << g_clock.now() << " " << pthread_self() << " lockdep: "
#include "config.h"
#include "include/Context.h"
-#define dout(x) if (x <= g_conf.debug_timer) *_dout << dbeginl << g_clock.now() << " TIMER "
-#define derr(x) if (x <= g_conf.debug_timer) *_derr << dbeginl << g_clock.now() << " TIMER "
+#define DOUT_SUBSYS timer
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << " TIMER "
#define DBL 10
--- /dev/null
+
+#include "include/types.h"
+#include "config.h"
+#include "debug.h"
+#include "Mutex.h"
+#include "Clock.h"
+
+#include <fstream>
+#include <iostream>
+using namespace std;
+
+// debug output
+Mutex _dout_lock("_dout_lock", false, false /* no lockdep */);
+ostream *_dout = &std::cout;
+ostream *_derr = &std::cerr;
+char _dout_file[100] = {0};
+char _dout_dir[1000] = {0};
+char _dout_symlink_path[1000] = {0};
+bool _dout_is_open = false;
+bool _dout_need_open = true;
+
+void _dout_open_log()
+{
+ char fn[80];
+
+ // logging enabled?
+ if (!(g_conf.dout_dir && g_conf.file_logs)) {
+ _dout_need_open = false;
+ return;
+ }
+
+ // calculate log dir, filename, etc.
+ if (!_dout_file[0]) {
+ char hostname[80];
+ gethostname(hostname, 79);
+
+ if (g_conf.dout_dir[0] == '/')
+ strcpy(_dout_dir, g_conf.dout_dir);
+ else {
+ getcwd(_dout_dir, 100);
+ strcat(_dout_dir, "/");
+ strcat(_dout_dir, g_conf.dout_dir);
+ }
+ sprintf(_dout_file, "%s.%d", hostname, getpid());
+ }
+
+ if (_dout && _dout_is_open)
+ delete _dout;
+
+ sprintf(fn, "%s/%s", _dout_dir, _dout_file);
+ std::ofstream *out = new std::ofstream(fn, ios::trunc|ios::out);
+ if (!out->is_open()) {
+ std::cerr << "error opening output file " << fn << std::endl;
+ delete out;
+ _dout = &std::cout;
+ } else {
+ _dout_need_open = false;
+ _dout_is_open = true;
+ _dout = out;
+ *_dout << g_clock.now() << " --- opened log " << fn << " ---" << std::endl;
+ }
+}
+
+int _dout_rename_output_file() // after calling daemon()
+{
+ if (g_conf.dout_dir && g_conf.file_logs) {
+ char oldfn[100];
+ char newfn[100];
+ char hostname[80];
+ gethostname(hostname, 79);
+
+ sprintf(oldfn, "%s/%s", _dout_dir, _dout_file);
+ sprintf(newfn, "%s/%s.%d", _dout_dir, hostname, getpid());
+ dout(0) << "---- renamed log " << oldfn << " -> " << newfn << " ----" << dendl;
+ ::rename(oldfn, newfn);
+ sprintf(_dout_file, "%s.%d", hostname, getpid());
+
+ if (_dout_symlink_path[0]) {
+ ::unlink(_dout_symlink_path);
+ ::symlink(_dout_file, _dout_symlink_path);
+ }
+ }
+ return 0;
+}
+
+int _dout_create_courtesy_output_symlink(const char *type, int n)
+{
+ if (g_conf.dout_dir && g_conf.file_logs) {
+ if (_dout_need_open)
+ _dout_open_log();
+
+ sprintf(_dout_symlink_path, "%s/%s%d", _dout_dir, type, n);
+ ::unlink(_dout_symlink_path);
+ ::symlink(_dout_file, _dout_symlink_path);
+ dout(0) << "---- creating symlink " << _dout_symlink_path
+ << " -> " << _dout_file << " ----" << dendl;
+ }
+ return 0;
+}
+
+
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef __CEPH_DEBUG_H
+#define __CEPH_DEBUG_H
+
+#include "include/assert.h"
+#include "Mutex.h"
+#include "Clock.h"
+
+#include <ostream>
+using std::ostream;
+
+// the streams
+extern ostream *_dout;
+extern ostream *_derr;
+
+extern Mutex _dout_lock;
+
+extern bool _dout_need_open;
+extern char _dout_file[100];
+extern char _dout_dir[1000];
+extern char _dout_symlink_path[1000];
+extern bool _dout_is_open;
+
+extern void _dout_open_log();
+extern int _dout_rename_output_file(); // after calling daemon()
+extern int _dout_create_courtesy_output_symlink(const char *type, int n);
+
+
+static inline void _dout_begin_line() {
+ _dout_lock.Lock();
+ if (_dout_need_open)
+ _dout_open_log();
+ *_dout << g_clock.now() << " ";
+}
+static void _dout_begin_line_static() {
+ _dout_begin_line();
+}
+
+static inline void _dout_end_line() {
+ _dout_lock.Unlock();
+}
+
+struct _dbeginl_t { _dbeginl_t(int) {} };
+static const _dbeginl_t dbeginl = 0;
+inline ostream& operator<<(ostream& out, _dbeginl_t) {
+ _dout_begin_line();
+ return out;
+}
+
+struct _dbeginlstatic_t { _dbeginlstatic_t(int) {} };
+static const _dbeginlstatic_t dbeginlstatic = 0;
+inline ostream& operator<<(ostream& out, _dbeginlstatic_t) {
+ _dout_begin_line_static();
+ return out;
+}
+
+// intentionally conflict with endl
+class _bad_endl_use_dendl_t { public: _bad_endl_use_dendl_t(int) {} };
+static const _bad_endl_use_dendl_t endl = 0;
+inline ostream& operator<<(ostream& out, _bad_endl_use_dendl_t) {
+ assert(0 && "you are using the wrong endl.. use std::endl or dendl");
+ return out;
+}
+
+
+// generic macros
+#define generic_dout(x) do { if ((x) <= g_conf.debug) { *_dout << dbeginl
+#define generic_derr(x) do { if ((x) <= g_conf.debug) { *_derr << dbeginl
+
+#define pdout(x,p) do { if ((x) <= (p)) { *_dout << dbeginl
+
+#define debug_DOUT_SUBSYS debug
+#define dout_prefix *_dout << dbeginlstatic
+#define DOUT_CONDVAR(x) g_conf.debug_ ## x
+#define XDOUT_CONDVAR(x) DOUT_CONDVAR(x)
+#define DOUT_COND(l) l <= XDOUT_CONDVAR(DOUT_SUBSYS)
+
+#define dout(l) do { if (DOUT_COND(l)) { dout_prefix
+#define derr(l) do { if (DOUT_COND(l)) { dout_prefix
+
+#define dendl std::endl; _dout_end_line(); } } while (0)
+
+
+#endif
#include "config.h"
+#undef dout
#define dout(l) if (l<=g_conf.debug_lockdep) *_dout << g_clock.now() << " " << pthread_self() << " lockdep: "
-#define derr(l) if (l<=g_conf.debug_lockdep) *_derr << g_clock.now() << " " << pthread_self() << " lockdep: "
pthread_mutex_t lockdep_mutex = PTHREAD_MUTEX_INITIALIZER;
#include "config.h"
#include "include/types.h"
+#include "common/Clock.h"
+
#include <fstream>
#include <stdlib.h>
#include <errno.h>
-// debug output
-Mutex _dout_lock("_dout_lock", false, false /* no lockdep */);
-ostream *_dout = &std::cout;
-ostream *_derr = &std::cerr;
-char _dout_file[100] = {0};
-char _dout_dir[1000] = {0};
-char _dout_symlink_path[1000] = {0};
-bool _dout_is_open;
-bool _dout_need_open;
-
// page size crap, see page.h
int _get_bits_of(int v) {
int n = 0;
}
}
- // redirect dout?
- /*
- if (g_conf.dout_dir) {
- struct stat st;
- int r = ::stat(g_conf.dout_dir, &st);
- if (r != 0)
- g_conf.dout_dir = 0;
- }
- */
- if (g_conf.dout_dir && g_conf.file_logs && open) {
- char hostname[80];
- gethostname(hostname, 79);
-
- if (g_conf.dout_dir[0] == '/')
- strcpy(_dout_dir, g_conf.dout_dir);
- else {
- getcwd(_dout_dir, 100);
- strcat(_dout_dir, "/");
- strcat(_dout_dir, g_conf.dout_dir);
- }
- sprintf(_dout_file, "%s.%d", hostname, getpid());
-
- _dout_is_open = false;
- _dout_need_open = true;
-
- open_dout_file();
- }
-
+ // open log file?
+ if (open)
+ _dout_open_log();
+
signal(SIGHUP, sighup_handler);
args = nargs;
}
-void open_dout_file()
-{
- char fn[80];
- if (_dout && _dout_is_open) {
- delete _dout;
- }
-
- sprintf(fn, "%s/%s", _dout_dir, _dout_file);
- std::ofstream *out = new std::ofstream(fn, ios::trunc|ios::out);
- if (!out->is_open()) {
- std::cerr << "error opening output file " << fn << std::endl;
- delete out;
- } else {
- _dout_need_open = false;
- _dout_is_open = true;
- _dout = out;
- }
-}
-
-int rename_output_file() // after calling daemon()
-{
- if (g_conf.dout_dir) {
- char oldfn[100];
- char newfn[100];
- char hostname[80];
- gethostname(hostname, 79);
-
- sprintf(oldfn, "%s/%s", _dout_dir, _dout_file);
- sprintf(newfn, "%s/%s.%d", _dout_dir, hostname, getpid());
- ::rename(oldfn, newfn);
- sprintf(_dout_file, "%s.%d", hostname, getpid());
-
- if (_dout_symlink_path[0]) {
- ::unlink(_dout_symlink_path);
- ::symlink(_dout_file, _dout_symlink_path);
- }
- }
- return 0;
-}
-
-int create_courtesy_output_symlink(const char *type, int n)
-{
- if (g_conf.dout_dir) {
- sprintf(_dout_symlink_path, "%s/%s%d", _dout_dir, type, n);
- ::unlink(_dout_symlink_path);
- ::symlink(_dout_file, _dout_symlink_path);
- }
- return 0;
-}
-
extern md_config_t g_debug_after_conf;
+
+
/**
* command line / environment argument parsing
*/
extern bool parse_ip_port(const char *s, entity_addr_t& addr);
-int create_courtesy_output_symlink(const char *type, int n);
-int rename_output_file();
-/**
- * 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;
-
-// intentionally conflict with endl
-class _bad_endl_use_dendl_t { public: _bad_endl_use_dendl_t(int) {} };
-static const _bad_endl_use_dendl_t endl = 0;
-
-// the streams
-extern ostream *_dout;
-extern ostream *_derr;
-extern bool _dout_need_open;
-extern bool _dout_is_open;
-
-extern void open_dout_file();
-
-inline ostream& operator<<(ostream& out, _dbeginl_t) {
- _dout_lock.Lock();
-
- if (_dout_need_open) {
- if (_dout && _dout_is_open) {
- delete _dout;
- }
- open_dout_file();
- }
-
- return out;
-}
-inline ostream& operator<<(ostream& out, _dendl_t) {
- out << std::endl;
- _dout_lock.Unlock();
- return out;
-}
-inline ostream& operator<<(ostream& out, _bad_endl_use_dendl_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) *_dout << dbeginl
-#define generic_derr(x) if ((x) <= g_conf.debug) *_derr << dbeginl
-
-#define pdout(x,p) if ((x) <= (p)) *_dout << dbeginl
+#include "common/debug.h"
+
#endif
}
}
- create_courtesy_output_symlink("osd", whoami);
+ _dout_create_courtesy_output_symlink("osd", whoami);
// start up network
rank.bind();
#include "Ebofs.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << g_clock.now() << " ebofs(" << fs->dev.get_device_name() << ").allocator."
+#define DOUT_SUBSYS ebofs
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "ebofs(" << fs->dev.get_device_name() << ").allocator."
void Allocator::dump_freelist()
#endif
#endif
+#define DOUT_SUBSYS bdev
/*******************************************
* ElevatorQueue
*/
-#define dout(x) if (x <= g_conf.debug_bdev) *_dout << dbeginl << g_clock.now() << " bdev(" << dev << ").elevatorq."
-#define derr(x) if (x <= g_conf.debug_bdev) *_derr << dbeginl << g_clock.now() << " bdev(" << dev << ").elevatorq."
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "bdev(" << dev << ").elevatorq."
int BlockDevice::ElevatorQueue::dequeue_io(list<biovec*>& biols,
/*******************************************
* BarrierQueue
*/
-#undef dout
-#define dout(x) if (x <= g_conf.debug_bdev) *_dout << dbeginl << g_clock.now() << " bdev(" << dev << ").barrierq."
-#undef derr
-#define derr(x) if (x <= g_conf.debug_bdev) *_derr << dbeginl << g_clock.now() << " bdev(" << dev << ").barrierq."
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "bdev(" << dev << ").barrierq."
void BlockDevice::BarrierQueue::barrier()
{
* BlockDevice
*/
-#undef dout
-#define dout(x) if (x <= g_conf.debug_bdev) *_dout << dbeginl << g_clock.now() << " bdev(" << dev << ")."
-#undef derr
-#define derr(x) if (x <= g_conf.debug_bdev) *_derr << dbeginl << g_clock.now() << " bdev(" << dev << ")."
-
-
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "bdev(" << dev << ")."
block_t BlockDevice::get_num_blocks()
{
#include "BufferCache.h"
#include "Onode.h"
+#define DOUT_SUBSYS ebofs
void do_apply_partial(bufferlist& bl, map<__u64, bufferlist>& pm)
{
/*********** BufferHead **************/
-
-#undef dout
-#undef derr
-#define dout(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << g_clock.now() << " ebofs." << *this << "."
-#define derr(x) if (x <= g_conf.debug_ebofs) *_derr << dbeginl << g_clock.now() << " ebofs." << *this << "."
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "ebofs." << *this << "."
void BufferHead::add_partial(__u64 off, bufferlist& p)
/************ ObjectCache **************/
-
-#undef dout
-#undef derr
-#define dout(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << g_clock.now() << " ebofs.oc."
-#define derr(x) if (x <= g_conf.debug_ebofs) *_derr << dbeginl << g_clock.now() << " ebofs.oc."
-
-
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "ebofs.oc."
void ObjectCache::rx_finish(ioh_t ioh, block_t start, block_t length, bufferlist& bl)
{
/************** BufferCache ***************/
-#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << g_clock.now() << " ebofs.bc."
-
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "ebofs.bc."
BufferHead *BufferCache::split(BufferHead *orig, block_t after)
// *******************
-#define dout(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
-#define derr(x) if (x <= g_conf.debug_ebofs) *_derr << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
+#define DOUT_SUBSYS ebofs
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "ebofs(" << dev.get_device_name() << ")."
char *nice_blocks(block_t b)
/** table **/
-#define dbtout if (25 <= g_conf.debug_ebofs) *_dout << dbeginl << "ebofs.table(" << this << ")."
+#define dbtout do { if (25 <= g_conf.debug_ebofs) { *_dout << dbeginl << "ebofs.table(" << this << ")."
template<class K, class V>
*/
#undef debofs
-#define debofs(x) if (x <= g_conf.debug_ebofs) *_dout << dbeginl << "ebofs.nodepool."
+#define debofs(x) do { if (x <= g_conf.debug_ebofs) { *_dout << dbeginl << "ebofs.nodepool."
class Node {
q.pop_front();
// newline + indent?
if (t.bits()) {
- out << dendl;
+ out << std::endl;
for (unsigned i=0; i<t.bits(); i++) out << ' ';
}
int nb = get_split(t);
void lru_status() {
- generic_dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << dendl;
+ //generic_dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << dendl;
}
};
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
-#define derr(x) if (x <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".anchorclient "
#include "msg/Messenger.h"
#include "messages/MMDSTableRequest.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorserver "
-#define derr(x) if (x <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorserver "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".anchorserver "
// table
#include "messages/MLock.h"
-
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
-
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
ostream& CDentry::print_db_line_prefix(ostream& out)
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
-
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
+
//int cinode_pins[CINODE_NUM_PINS]; // counts
#include "Locker.h"
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " " << this << " "
-#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " " << this << " "
+
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << *this << " "
ClientLease *MDSCacheObject::add_client_lease(int c, int mask)
{
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".inotable: "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << "." << table_name << ": "
void InoTable::init_inode()
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".locker "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix _prefix(mds)
+static ostream& _prefix(MDS *mds) {
+ return *_dout << dbeginl << " mds" << mds->get_nodeid() << ".locker ";
+}
void Locker::dispatch(Message *m)
#include "config.h"
-#define dout(l) if (l<=g_conf.debug_mds || l<=g_conf.debug_mds_balancer) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".bal "
+#define DOUT_SUBSYS mds
+#undef DOUT_COND
+#define DOUT_COND(l) l<=g_conf.debug_mds || l <= g_conf.debug_mds_balancer
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".bal "
#define MIN_LOAD 50 // ??
#define MIN_REEXPORT 5 // will automatically reexport
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".cache "
-
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix _prefix(mds)
+static ostream& _prefix(MDS *mds) {
+ return *_dout << dbeginl << " mds" << mds->get_nodeid() << ".cache ";
+}
MDCache::MDCache(MDS *m)
#include "config.h"
-#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
-#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) *_derr << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
+#define DOUT_SUBSYS mds
+#undef DOUT_COND
+#define DOUT_COND(l) l<=g_conf.debug_mds || l <= g_conf.debug_mds_log
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".log "
// cons/des
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << whoami << " "
-#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " mds" << whoami << " "
-
-
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << whoami << " "
if (whoami >= 0 &&
mdsmap->is_up(whoami) &&
(oldwhoami != whoami || !logger)) {
- create_courtesy_output_symlink("mds", whoami);
+ _dout_create_courtesy_output_symlink("mds", whoami);
reopen_logger(mdsmap->get_created()); // adopt mds cluster timeline
}
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << "." << table_name << ": "
+
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << "." << table_name << ": "
+
class C_MT_Save : public Context {
MDSTable *ida;
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".tableclient "
-#define derr(x) if (x <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".tableclient "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".tableclient(" << get_mdstable_name(table) << ") "
void MDSTableClient::handle_request(class MMDSTableRequest *m)
#include "messages/MMDSTableRequest.h"
#include "events/ETableServer.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".tableserver(" << get_mdstable_name(table) << ") "
-#define derr(x) if (x <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".tableserver(" << get_mdstable_name(table) << ") "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".tableserver(" << get_mdstable_name(table) << ") "
void MDSTableServer::handle_request(MMDSTableRequest *req)
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".migrator "
+#define DOUT_SUBSYS mds
+#undef DOUT_COND
+#define DOUT_COND(l) l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".migrator "
void Migrator::dispatch(Message *m)
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
-#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) *_derr << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".server "
void Server::reopen_logger(utime_t start, bool append)
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".sessionmap "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".sessionmap "
+
void SessionMap::init_inode()
{
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".snap: "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".snap "
+
void SnapServer::init_inode()
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log || l <= g_conf.debug_mds_log_expire) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
-#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log || l <= g_conf.debug_mds_log_expire) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+#define DOUT_SUBSYS mds
+#undef DOUT_COND
+#define DOUT_COND(l) l<=g_conf.debug_mds || l <= g_conf.debug_mds_log || l <= g_conf.debug_mds_log_expire
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "mds" << mds->get_nodeid() << ".journal "
// -----------------------
}
-
-#undef dout
-#undef derr
-#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
-#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) *_dout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+#undef DOUT_COND
+#define DOUT_COND(l) l<=g_conf.debug_mds || l <= g_conf.debug_mds_log
// -----------------------
* SnapRealm
*/
-#define dout(x) if (x <= g_conf.debug_mds) *_dout << dbeginl << g_clock.now() \
- << " mds" << mdcache->mds->get_nodeid() \
- << ".cache.snaprealm(" << inode->ino() \
- << " seq " << seq << " " << this << ") "
+#define DOUT_SUBSYS mds
+#undef dout_prefix
+#define dout_prefix _prefix(mdcache->mds->get_nodeid(), inode, seq, this)
+static ostream& _prefix(int whoami, CInode *inode, __u64 seq, SnapRealm *realm) {
+ return *_dout << dbeginl << g_clock.now()
+ << " mds" << whoami
+ << ".cache.snaprealm(" << inode->ino()
+ << " seq " << seq << " " << realm << ") ";
+}
ostream& operator<<(ostream& out, const SnapRealm& realm)
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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 v" << client_map.version << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_derr << 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 v" << client_map.version << " "
-
+#define DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(mon, client_map)
+static ostream& _prefix(Monitor *mon, ClientMonitor::Map& client_map) {
+ return *_dout << dbeginl
+ << "mon" << mon->whoami
+ << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)")))
+ << ".client v" << client_map.version << " ";
+}
ostream& operator<<(ostream& out, ClientMonitor& om)
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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 derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_derr << 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_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(mon, epoch)
+static ostream& _prefix(Monitor *mon, epoch_t epoch) {
+ return *_dout << dbeginl
+ << "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()
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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) *_derr << 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 DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(mon, mdsmap)
+static ostream& _prefix(Monitor *mon, MDSMap& mdsmap) {
+ return *_dout << dbeginl
+ << "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() << " ";
+}
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mon) *_dout << dbeginl << g_clock.now() << " monclient "
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_mon) *_derr << dbeginl << g_clock.now() << " monclient "
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << " monclient "
Mutex monmap_lock("monmap_lock");
Cond monmap_cond;
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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) *_derr << dbeginl << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
+#define DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(this)
+static ostream& _prefix(Monitor *mon) {
+ return *_dout << dbeginl
+ << " mon" << mon->whoami
+ << (mon->is_starting() ?
+ (const char*)"(starting)" :
+ (mon->is_leader() ?
+ (const char*)"(leader)" :
+ (mon->is_peon() ?
+ (const char*)"(peon)" :
+ (const char*)"(?\?)")))
+ << " ";
+}
Monitor::Monitor(int w, MonitorStore *s, Messenger *m, MonMap *map) :
whoami(w),
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << dbeginl << g_clock.now() << " store(" << dir <<") "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_derr << dbeginl << g_clock.now() << " store(" << dir <<") "
+#define DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(dir)
+static ostream& _prefix(const string& dir) {
+ return *_dout << dbeginl << "store(" << dir << ") ";
+}
+
#include <stdio.h>
#include <sys/types.h>
#include <sstream>
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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) *_derr << 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 DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(mon, osdmap)
+static ostream& _prefix(Monitor *mon, OSDMap& osdmap) {
+ return *_dout << dbeginl
+ << "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
#include "config.h"
#include <sstream>
-
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_dout << 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 v" << pg_map.version << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) *_derr << 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 v" << pg_map.version << " "
+#define DOUT_SUBSYS mon
+#undef dout_prefix
+#define dout_prefix _prefix(mon, pg_map)
+static ostream& _prefix(Monitor *mon, PGMap& pg_map) {
+ return *_dout << dbeginl
+ << "mon" << mon->whoami
+ << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)")))
+ << ".pg v" << pg_map.version << " ";
+}
struct kb_t {
uint64_t v;
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) *_dout << 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 derr(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) *_derr << 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_SUBSYS paxos
+#undef dout_prefix
+#define dout_prefix _prefix(mon, whoami, machine_name, state, last_committed)
+static ostream& _prefix(Monitor *mon, int whoami, const char *machine_name, int state, version_t last_committed) {
+ return *_dout << dbeginl
+ << "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 << " " << Paxos::get_statename(state) << " lc " << last_committed
+ << ") ";
+}
void Paxos::init()
const static int STATE_RECOVERING = 1; // leader|peon: recovering paxos state
const static int STATE_ACTIVE = 2; // leader|peon: idle. peon may or may not have valid lease
const static int STATE_UPDATING = 3; // leader|peon: updating to new value
- const char *get_statename(int s) {
+ static const char *get_statename(int s) {
switch (s) {
case STATE_RECOVERING: return "recovering";
case STATE_ACTIVE: return "active";
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) *_dout << 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 DOUT_SUBSYS paxos
+#undef dout_prefix
+#define dout_prefix _prefix(mon, paxos, paxos->machine_id)
+static ostream& _prefix(Monitor *mon, Paxos *paxos, int machine_id) {
+ return *_dout << dbeginl
+ << "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(machine_id) << ") ";
+}
const char *PaxosService::get_machine_name()
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug) *_dout << dbeginl << g_clock.now() << " MESSENGER: "
#define DEBUGLVL 10 // debug level of output
#include "common/Timer.h"
-#define dout(l) if (l<=g_conf.debug_ms) *_dout << dbeginl << g_clock.now() << " " << pthread_self() << " -- " << rank.rank_addr << " "
-#define derr(l) if (l<=g_conf.debug_ms) *_derr << dbeginl << g_clock.now() << " " << pthread_self() << " -- " << rank.rank_addr << " "
-
+#define DOUT_SUBSYS ms
+#undef dout_prefix
+#define dout_prefix _prefix()
+static ostream& _prefix() {
+ return *_dout << dbeginl << pthread_self() << " -- " << rank.rank_addr << " ";
+}
#include "tcp.cc"
}
dout(1) << "rank.start daemonizing" << dendl;
daemon(1, 0); /* fixme.. we should chdir(/) too! */
- rename_output_file();
+ _dout_rename_output_file();
}
// some debug hackery?
* Pipe
*/
-#undef dout
-#undef derr
-#define dout(l) if (l<=g_conf.debug_ms) *_dout << dbeginl << g_clock.now() << " " << pthread_self() << " -- " << rank.rank_addr << " >> " << peer_addr << " pipe(" << this << ")."
-#define derr(l) if (l<=g_conf.debug_ms) *_derr << dbeginl << g_clock.now() << " " << pthread_self() << " -- " << rank.rank_addr << " >> " << peer_addr << " pipe(" << this << ")."
+#undef dout_prefix
+#define dout_prefix _pipe_prefix()
+ostream& Rank::Pipe::_pipe_prefix() {
+ return *_dout << dbeginl << pthread_self()
+ << " -- " << rank.rank_addr << " >> " << peer_addr << " pipe(" << this << ").";
+}
int Rank::Pipe::accept()
{
// pipe
class Pipe {
public:
+ ostream& _pipe_prefix();
+
enum {
STATE_ACCEPTING,
STATE_CONNECTING,
#include <fcntl.h>
-
-#define dout(x) if (x <= g_conf.debug_journal) *_dout << dbeginl << g_clock.now() << " journal "
-#define derr(x) if (x <= g_conf.debug_journal) *_derr << dbeginl << g_clock.now() << " journal "
+#define DOUT_SUBSYS journal
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "journal "
int FileJournal::_open(bool forwrite)
#include "config.h"
-#define dout(l) if (l<=g_conf.debug_filestore) *_dout << dbeginl << g_clock.now() << " filestore(" << basedir << ") "
-#define derr(l) if (l<=g_conf.debug_filestore) *_derr << dbeginl << g_clock.now() << " filestore(" << basedir << ") "
+#define DOUT_SUBSYS filestore
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "filestore(" << basedir << ") "
#include "include/buffer.h"
#include "config.h"
-#define dout(x) if (x <= g_conf.debug_journal) *_dout << dbeginl << g_clock.now() << " journal "
-#define derr(x) if (x <= g_conf.debug_journal) *_derr << dbeginl << g_clock.now() << " journal "
+#define DOUT_SUBSYS journal
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << "journal "
+
int JournalingObjectStore::journal_replay()
{
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_dout << dbeginl << g_clock.now() << " " << pthread_self() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_derr << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
+#define DOUT_SUBSYS osd
+#undef dout_prefix
+#define dout_prefix _prefix(*_dout, whoami, osdmap)
+
+static ostream& _prefix(ostream& out, int whoami, OSDMap *osdmap) {
+ return out << dbeginl << pthread_self()
+ << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " ";
+}
+
#include "OSDMap.h"
#include "config.h"
-#define dout generic_dout
-#define derr generic_derr
void OSDMap::build_simple(epoch_t e, ceph_fsid &fsid,
#include "messages/MOSDPGRemove.h"
#include "messages/MOSDPGInfo.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_dout << dbeginl << g_clock.now() << " " << pthread_self() << " osd" << osd->whoami << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
+#define DOUT_SUBSYS osd
+#undef dout_prefix
+#define dout_prefix _prefix(this, osd->whoami, osd->osdmap)
+static ostream& _prefix(PG *pg, int whoami, OSDMap *osdmap) {
+ return *_dout << dbeginl<< pthread_self() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " " << *pg << " ";
+}
/******* PGLog ********/
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_dout << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
+#define DOUT_SUBSYS osd
+#undef dout_prefix
+#define dout_prefix _prefix(this, osd->whoami, osd->osdmap)
+static ostream& _prefix(PG *pg, int whoami, OSDMap *osdmap) {
+ return *_dout << dbeginl << pthread_self()
+ << " osd" << whoami
+ << " " << (osdmap ? osdmap->get_epoch():0) << " "
+ << *pg << " ";
+}
+
#include <errno.h>
#include <sys/stat.h>
#include "config.h"
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_dout << dbeginl << g_clock.now() << " " << pthread_self() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) *_derr << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
+#define DOUT_SUBSYS osd
+#define DOUT_PREFIX_ARGS this, osd->whoami, osd->osdmap
+#undef dout_prefix
+#define dout_prefix _prefix(this, osd->whoami, osd->osdmap)
+static ostream& _prefix(PG *pg, int whoami, OSDMap *osdmap) {
+ return *_dout << dbeginl<< pthread_self() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " " << *pg << " ";
+}
+
+
#include <errno.h>
#include <sys/stat.h>
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_filer) *_dout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
+#define DOUT_SUBSYS filer
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << objecter->messenger->get_myname() << ".filer "
class Filer::C_Probe : public Context {
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) *_dout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) *_derr << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
+#define DOUT_SUBSYS journaler
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << objecter->messenger->get_myname() << ".journaler "
/*** ObjectCacher::Object ***/
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) *_dout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
+#define DOUT_SUBSYS objectcacher
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
+
ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left, loff_t off)
/*** ObjectCacher ***/
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) *_dout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
-
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << objecter->messenger->get_myname() << ".objectcacher "
/* private */
#include "config.h"
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) *_dout << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) *_derr << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
+#define DOUT_SUBSYS objecter
+#undef dout_prefix
+#define dout_prefix *_dout << dbeginl << messenger->get_myname() << ".objecter "
// messages ------------------------------