#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs(" << fs->dev.get_device_name() << ").allocator."
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs(" << fs->dev.get_device_name() << ").allocator."
void Allocator::dump_freelist()
*/
#undef dout
-#define dout(x) if (x <= g_conf.debug_bdev) cout << "bdev(" << dev << ").elevatorq."
-#define derr(x) if (x <= g_conf.debug_bdev) cerr << "bdev(" << dev << ").elevatorq."
+#define dout(x) if (x <= g_conf.debug_bdev) cout << g_clock.now() << " bdev(" << dev << ").elevatorq."
+#define derr(x) if (x <= g_conf.debug_bdev) cerr << g_clock.now() << " bdev(" << dev << ").elevatorq."
int BlockDevice::ElevatorQueue::dequeue_io(list<biovec*>& biols,
* BarrierQueue
*/
#undef dout
-#define dout(x) if (x <= g_conf.debug_bdev) cout << "bdev(" << dev << ").barrierq."
+#define dout(x) if (x <= g_conf.debug_bdev) cout << g_clock.now() << " bdev(" << dev << ").barrierq."
void BlockDevice::BarrierQueue::barrier()
{
*/
#undef dout
-#define dout(x) if (x <= g_conf.debug_bdev) cout << "bdev(" << dev << ")."
+#define dout(x) if (x <= g_conf.debug_bdev) cout << g_clock.now() << " bdev(" << dev << ")."
r = ioctl(fd, BLKGETSIZE64, &bytes);
num_blocks = bytes / (uint64_t)EBOFS_BLOCK_SIZE;
if (r == 0) {
- dout(1) << "get_num_blocks ioctl BLKGETSIZE64 reports "
- << num_blocks << " 4k blocks, "
- << bytes << " bytes"
- << endl;
+ dout(10) << "get_num_blocks ioctl BLKGETSIZE64 reports "
+ << num_blocks << " 4k blocks, "
+ << bytes << " bytes"
+ << endl;
#else
// hrm, try the 32 bit ioctl?
unsigned long sectors = 0;
num_blocks = sectors/8ULL;
bytes = sectors*512ULL;
if (r == 0) {
- dout(1) << "get_num_blocks ioctl BLKGETSIZE reports " << sectors << " sectors, "
- << num_blocks << " 4k blocks, " << bytes << " bytes" << endl;
+ dout(10) << "get_num_blocks ioctl BLKGETSIZE reports " << sectors << " sectors, "
+ << num_blocks << " 4k blocks, " << bytes << " bytes" << endl;
#endif
} else {
// hmm, try stat!
fstat(fd, &st);
uint64_t bytes = st.st_size;
num_blocks = bytes / EBOFS_BLOCK_SIZE;
- dout(1) << "get_num_blocks stat reports " << num_blocks << " 4k blocks, " << bytes << " bytes" << endl;
+ dout(10) << "get_num_blocks stat reports " << num_blocks << " 4k blocks, " << bytes << " bytes" << endl;
}
if (g_conf.bdev_fake_mb) {
#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs.bh."
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs.bh."
#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs.oc."
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs.oc."
/************** BufferCache ***************/
#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs.bc."
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs.bc."
// *******************
#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs(" << dev.get_device_name() << ")."
-#define derr(x) if (x <= g_conf.debug_ebofs) cerr << "ebofs(" << dev.get_device_name() << ")."
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
+#define derr(x) if (x <= g_conf.debug_ebofs) cerr << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
char *nice_blocks(block_t b)
if (journalfn) {
journal = new FileJournal(this, journalfn);
if (journal->open() < 0) {
- dout(-3) << "mount journal " << journalfn << " open failed" << endl;
+ dout(3) << "mount journal " << journalfn << " open failed" << endl;
delete journal;
journal = 0;
} else {
- dout(-3) << "mount journal " << journalfn << " opened, replaying" << endl;
+ dout(3) << "mount journal " << journalfn << " opened, replaying" << endl;
while (1) {
bufferlist bl;
epoch_t e;
if (!journal->read_entry(bl, e)) {
- dout(-3) << "mount replay: end of journal, done." << endl;
+ dout(3) << "mount replay: end of journal, done." << endl;
break;
}
if (e < super_epoch) {
- dout(-3) << "mount replay: skipping old entry in epoch " << e << " < " << super_epoch << endl;
+ dout(3) << "mount replay: skipping old entry in epoch " << e << " < " << super_epoch << endl;
continue;
}
if (e == super_epoch+1) {
super_epoch++;
- dout(-3) << "mount replay: jumped to next epoch " << super_epoch << endl;
+ dout(3) << "mount replay: jumped to next epoch " << super_epoch << endl;
}
assert(e == super_epoch);
- dout(-3) << "mount replay: applying transaction in epoch " << e << endl;
+ dout(3) << "mount replay: applying transaction in epoch " << e << endl;
Transaction t;
int off = 0;
t._decode(bl, off);
commit_thread.create();
finisher_thread.create();
- dout(1) << "mounted " << dev.get_device_name() << " " << dev.get_num_blocks() << " blocks, " << nice_blocks(dev.get_num_blocks()) << endl;
+ dout(1) << "mounted " << dev.get_device_name() << " " << dev.get_num_blocks() << " blocks, " << nice_blocks(dev.get_num_blocks())
+ << (journal ? ", with journal":", no journal")
+ << endl;
mounted = true;
#include "config.h"
#undef dout
-#define dout(x) if (x <= g_conf.debug_ebofs) cout << "ebofs(" << ebofs->dev.get_device_name() << ").journal "
-#define derr(x) if (x <= g_conf.debug_ebofs) cerr << "ebofs(" << ebofs->dev.get_device_name() << ").journal "
+#define dout(x) if (x <= g_conf.debug_ebofs) cout << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
+#define derr(x) if (x <= g_conf.debug_ebofs) cerr << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
int FileJournal::create()
{
- dout(1) << "create " << fn << endl;
+ dout(2) << "create " << fn << endl;
// open/create
fd = ::open(fn.c_str(), O_RDWR|O_SYNC);
if (fd < 0) {
- dout(1) << "create failed " << errno << " " << strerror(errno) << endl;
+ dout(2) << "create failed " << errno << " " << strerror(errno) << endl;
return -errno;
}
assert(fd > 0);
// get size
struct stat st;
::fstat(fd, &st);
- dout(1) << "open " << fn << " " << st.st_size << " bytes" << endl;
+ dout(2) << "create " << fn << " " << st.st_size << " bytes" << endl;
// write empty header
memset(&header, 0, sizeof(header));
assert(fd == 0);
fd = ::open(fn.c_str(), O_RDWR|O_SYNC);
if (fd < 0) {
- dout(1) << "open failed " << errno << " " << strerror(errno) << endl;
+ dout(2) << "open failed " << errno << " " << strerror(errno) << endl;
return -errno;
}
assert(fd > 0);
// read header?
read_header();
if (header.fsid != ebofs->get_fsid()) {
- dout(2) << "journal fsid doesn't match, invalid (someone else's?) journal" << endl;
+ dout(2) << "open journal fsid doesn't match, invalid (someone else's?) journal" << endl;
}
else if (header.num > 0) {
// valid header, pick an offset