Client* startCephClient()
{
- dout(3) << "ActiveMaster: Initializing Ceph client:" << endl;
+ cout << "ActiveMaster: Initializing Ceph client:" << endl;
// parse args from CEPH_ARGS, not command line
vector<char*> args;
MonMap* monmap = new MonMap();
int r = monmap->read(".ceph_monmap");
if (r < 0) {
- dout(0) << "ActiveMaster: could not find .ceph_monmap" << endl;
+ cout << "ActiveMaster: could not find .ceph_monmap" << endl;
return 0;
}
assert(r >= 0);
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_client) cout << g_clock.now() << " client" << whoami /*<< "." << pthread_self() */ << " "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " client" << whoami /*<< "." << pthread_self() */ << " "
#define tout if (g_conf.client_trace) traceout
it != fd_map.end();
it++) {
Fh *fh = it->second;
- dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << endl;
+ dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << dendl;
put_inode(fh->inode);
delete fh;
}
void Client::dump_inode(Inode *in, set<Inode*>& did)
{
- dout(1) << "dump_inode: inode " << in->ino() << " ref " << in->ref << " dir " << in->dir << endl;
+ dout(1) << "dump_inode: inode " << in->ino() << " ref " << in->ref << " dir " << in->dir << dendl;
if (in->dir) {
- dout(1) << " dir size " << in->dir->dentries.size() << endl;
+ dout(1) << " dir size " << in->dir->dentries.size() << dendl;
//for (hash_map<const char*, Dentry*, hash<const char*>, eqstr>::iterator it = in->dir->dentries.begin();
for (hash_map<string, Dentry*>::iterator it = in->dir->dentries.begin();
it != in->dir->dentries.end();
it++) {
- dout(1) << " dn " << it->first << " ref " << it->second->ref << endl;
+ dout(1) << " dn " << it->first << " ref " << it->second->ref << dendl;
dump_inode(it->second->inode, did);
}
}
dout(1) << "dump_cache: inode " << it->first
<< " ref " << it->second->ref
- << " dir " << it->second->dir << endl;
+ << " dir " << it->second->dir << dendl;
if (it->second->dir) {
- dout(1) << " dir size " << it->second->dir->dentries.size() << endl;
+ dout(1) << " dir size " << it->second->dir->dentries.size() << dendl;
}
}
}
void Client::shutdown() {
- dout(1) << "shutdown" << endl;
+ dout(1) << "shutdown" << dendl;
messenger->shutdown();
}
dout(15) << "trim_cache unlinking dn " << dn->name
<< " in dir " << hex << dn->dir->parent_inode->inode.ino
- << endl;
+ << dendl;
unlink(dn);
}
// hose root?
if (lru.lru_get_size() == 0 && root && root->ref == 0 && inode_map.size() == 1) {
- dout(15) << "trim_cache trimmed root " << root << endl;
+ dout(15) << "trim_cache trimmed root " << root << dendl;
delete root;
root = 0;
inode_map.clear();
<< " mtime " << st->inode.mtime
<< " mask " << st->mask
<< " in dir " << dir->parent_inode->inode.ino
- << endl;
+ << dendl;
if (dn) {
if (dn->inode->inode.ino == st->inode.ino) {
touch_dn(dn);
dout(12) << " had dentry " << dname
<< " with correct ino " << dn->inode->inode.ino
- << endl;
+ << dendl;
} else {
dout(12) << " had dentry " << dname
<< " with WRONG ino " << dn->inode->inode.ino
- << endl;
+ << dendl;
unlink(dn);
dn = NULL;
}
if (in->dn) {
dout(12) << " had ino " << in->inode.ino
<< " not linked or linked at the right position, relinking"
- << endl;
+ << dendl;
dn = relink(dir, dname, in);
} else {
// link
dout(12) << " had ino " << in->inode.ino
- << " unlinked, linking" << endl;
+ << " unlinked, linking" << dendl;
dn = link(dir, dname, in);
}
}
Inode *in = new Inode(st->inode, objectcacher);
inode_map[st->inode.ino] = in;
dn = link(dir, dname, in);
- dout(12) << " new dentry+node with ino " << st->inode.ino << endl;
+ dout(12) << " new dentry+node with ino " << st->inode.ino << dendl;
} else {
// actually update info
- dout(12) << " stat inode mask is " << st->mask << endl;
+ dout(12) << " stat inode mask is " << st->mask << dendl;
if (st->mask & STAT_MASK_BASE) {
dn->inode->inode = st->inode;
dn->inode->dirfragtree = st->dirfragtree; // FIXME look at the mask!
set<int> dist = st->dirfrag_dist.begin()->second;
if (dist.empty() && !in->dir_contacts.empty())
dout(9) << "lost dist spec for " << in->inode.ino
- << " " << dist << endl;
+ << " " << dist << dendl;
if (!dist.empty() && in->dir_contacts.empty())
dout(9) << "got dist spec for " << in->inode.ino
- << " " << dist << endl;
+ << " " << dist << dendl;
in->dir_contacts = dist;
}
}
Inode *cur = root;
utime_t now = g_clock.real_now();
- dout(10) << "insert_trace got " << reply->get_trace_in().size() << " inodes" << endl;
+ dout(10) << "insert_trace got " << reply->get_trace_in().size() << " inodes" << dendl;
list<string>::const_iterator pdn = reply->get_trace_dn().begin();
if (pin == reply->get_trace_in().begin()) {
// root
- dout(10) << "insert_trace root" << endl;
+ dout(10) << "insert_trace root" << dendl;
if (!root) {
// create
cur = root = new Inode((*pin)->inode, objectcacher);
- dout(10) << "insert_trace new root is " << root << endl;
+ dout(10) << "insert_trace new root is " << root << dendl;
inode_map[root->inode.ino] = root;
}
} else {
// not root.
Dir *dir = cur->open_dir();
cur = this->insert_inode(dir, *pin, *pdn);
- dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << " -> " << cur << endl;
+ dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << " -> " << cur << dendl;
++pdn;
// move to top of lru!
Dentry *Client::lookup(filepath& path)
{
- dout(14) << "lookup " << path << endl;
+ dout(14) << "lookup " << path << dendl;
Inode *cur = root;
if (!cur) return NULL;
Dentry *dn = 0;
for (unsigned i=0; i<path.depth(); i++) {
- dout(14) << " seg " << i << " = " << path[i] << endl;
+ dout(14) << " seg " << i << " = " << path[i] << dendl;
if (cur->inode.mode & INODE_MODE_DIR &&
cur->dir) {
// dir, we can descend
Dir *dir = cur->dir;
if (dir->dentries.count(path[i])) {
dn = dir->dentries[path[i]];
- dout(14) << " hit dentry " << path[i] << " inode is " << dn->inode << " valid_until " << dn->inode->valid_until << endl;
+ dout(14) << " hit dentry " << path[i] << " inode is " << dn->inode << " valid_until " << dn->inode->valid_until << dendl;
} else {
- dout(14) << " dentry " << path[i] << " dne" << endl;
+ dout(14) << " dentry " << path[i] << " dne" << dendl;
return NULL;
}
cur = dn->inode;
}
if (dn) {
- dout(11) << "lookup '" << path << "' found " << dn->name << " inode " << dn->inode->inode.ino << " valid_until " << dn->inode->valid_until<< endl;
+ dout(11) << "lookup '" << path << "' found " << dn->name << " inode " << dn->inode->inode.ino << " valid_until " << dn->inode->valid_until<< dendl;
}
return dn;
break;
}
- dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << diri->inode.ino << " " << req->get_filepath()[i] << endl;
+ dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << diri->inode.ino << " " << req->get_filepath()[i] << dendl;
if (i == depth-1) { // last one!
item = dir->dentries[ req->get_filepath()[i] ]->inode;
if (0) {
mds = 0;
- dout(0) << "hack: sending all requests to mds" << mds << endl;
+ dout(0) << "hack: sending all requests to mds" << mds << dendl;
}
} else {
if (req->auth_is_best()) {
mds = diri->pick_replica(mdsmap);
}
}
- dout(20) << "mds is " << mds << endl;
+ dout(20) << "mds is " << mds << dendl;
return mds;
}
if (request.resend_mds >= 0) {
mds = request.resend_mds;
request.resend_mds = -1;
- dout(10) << "target resend_mds specified as mds" << mds << endl;
+ dout(10) << "target resend_mds specified as mds" << mds << dendl;
} else {
mds = choose_target_mds(req);
if (mds >= 0) {
- dout(10) << "chose target mds" << mds << " based on hierarchy" << endl;
+ dout(10) << "chose target mds" << mds << " based on hierarchy" << dendl;
} else {
mds = mdsmap->get_random_in_mds();
if (mds < 0) mds = 0; // hrm.
- dout(10) << "chose random target mds" << mds << " for lack of anything better" << endl;
+ dout(10) << "chose random target mds" << mds << " for lack of anything better" << dendl;
}
}
Cond cond;
if (!mdsmap->have_inst(mds)) {
- dout(10) << "no address for mds" << mds << ", requesting new mdsmap" << endl;
+ dout(10) << "no address for mds" << mds << ", requesting new mdsmap" << dendl;
int mon = monmap->pick_mon();
messenger->send_message(new MMDSGetMap(),
monmap->get_inst(mon));
cond.Wait(client_lock);
if (!mdsmap->have_inst(mds)) {
- dout(10) << "hmm, still have no address for mds" << mds << ", trying a random mds" << endl;
+ dout(10) << "hmm, still have no address for mds" << mds << ", trying a random mds" << dendl;
request.resend_mds = mdsmap->get_random_in_mds();
continue;
}
}
if (waiting_for_session.count(mds) == 0) {
- dout(10) << "opening session to mds" << mds << endl;
+ dout(10) << "opening session to mds" << mds << dendl;
messenger->send_message(new MClientSession(MClientSession::OP_REQUEST_OPEN),
mdsmap->get_inst(mds), MDS_PORT_SERVER);
}
// wait
waiting_for_session[mds].push_back(&cond);
while (waiting_for_session.count(mds)) {
- dout(10) << "waiting for session to mds" << mds << " to open" << endl;
+ dout(10) << "waiting for session to mds" << mds << " to open" << dendl;
cond.Wait(client_lock);
}
}
send_request(&request, mds);
// wait for signal
- dout(20) << "awaiting kick on " << &cond << endl;
+ dout(20) << "awaiting kick on " << &cond << dendl;
cond.Wait(client_lock);
// did we get a reply?
// kick dispatcher (we've got it!)
assert(request.dispatch_cond);
request.dispatch_cond->Signal();
- dout(20) << "sendrecv kickback on tid " << tid << " " << request.dispatch_cond << endl;
+ dout(20) << "sendrecv kickback on tid " << tid << " " << request.dispatch_cond << dendl;
// clean up.
mds_requests.erase(tid);
if (client_logger) {
utime_t lat = g_clock.real_now();
lat -= start;
- dout(20) << "lat " << lat << endl;
+ dout(20) << "lat " << lat << dendl;
client_logger->finc("lsum",(double)lat);
client_logger->inc("lnum");
void Client::handle_client_session(MClientSession *m)
{
- dout(10) << "handle_client_session " << *m << endl;
+ dout(10) << "handle_client_session " << *m << dendl;
int from = m->get_source().num();
switch (m->op) {
if (!r) {
// make a new one
dout(10) << "send_request rebuilding request " << request->tid
- << " for mds" << mds << endl;
+ << " for mds" << mds << dendl;
r = new MClientRequest;
r->copy_payload(request->request_payload);
r->decode_payload();
}
request->request = 0;
- dout(10) << "send_request " << *r << " to mds" << mds << endl;
+ dout(10) << "send_request " << *r << " to mds" << mds << dendl;
messenger->send_message(r, mdsmap->get_inst(mds), MDS_PORT_SERVER);
request->mds.insert(mds);
tid_t tid = fwd->get_tid();
if (mds_requests.count(tid) == 0) {
- dout(10) << "handle_client_request_forward no pending request on tid " << tid << endl;
+ dout(10) << "handle_client_request_forward no pending request on tid " << tid << dendl;
delete fwd;
return;
}
<< " fwd " << fwd->get_num_fwd()
<< " to mds" << fwd->get_dest_mds()
<< ", mds set now " << request->mds
- << endl;
+ << dendl;
} else {
dout(10) << "handle_client_request tid " << tid
<< " previously forwarded to mds" << fwd->get_dest_mds()
<< ", mds still " << request->mds
- << endl;
+ << dendl;
}
} else {
// request not forwarded, or dest mds has no session.
<< " fwd " << fwd->get_num_fwd()
<< " to mds" << fwd->get_dest_mds()
<< ", non-idempotent, resending to " << fwd->get_dest_mds()
- << endl;
+ << dendl;
request->mds.clear();
request->num_fwd = fwd->get_num_fwd();
tid_t tid = reply->get_tid();
if (mds_requests.count(tid) == 0) {
- dout(10) << "handle_client_reply no pending request on tid " << tid << endl;
+ dout(10) << "handle_client_reply no pending request on tid " << tid << dendl;
delete reply;
return;
}
Cond cond;
request->dispatch_cond = &cond;
while (mds_requests.count(tid)) {
- dout(20) << "handle_client_reply awaiting kickback on tid " << tid << " " << &cond << endl;
+ dout(20) << "handle_client_reply awaiting kickback on tid " << tid << " " << &cond << dendl;
cond.Wait(client_lock);
}
}
break;
default:
- cout << "dispatch doesn't recognize message type " << m->get_type() << endl;
+ dout(10) << "dispatch doesn't recognize message type " << m->get_type() << dendl;
assert(0); // fail loudly
break;
}
// unmounting?
if (unmounting) {
dout(10) << "unmounting: trim pass, size was " << lru.lru_get_size()
- << "+" << inode_map.size() << endl;
+ << "+" << inode_map.size() << dendl;
trim_cache();
if (lru.lru_get_size() == 0 && inode_map.empty()) {
- dout(10) << "unmounting: trim pass, cache now empty, waking unmount()" << endl;
+ dout(10) << "unmounting: trim pass, cache now empty, waking unmount()" << dendl;
mount_cond.Signal();
} else {
dout(10) << "unmounting: trim pass, size still " << lru.lru_get_size()
- << "+" << inode_map.size() << endl;
+ << "+" << inode_map.size() << dendl;
dump_cache();
}
}
assert(m->get_source().is_mon());
whoami = m->get_dest().num();
- dout(1) << "handle_mds_map i am now " << m->get_dest() << endl;
+ dout(1) << "handle_mds_map i am now " << m->get_dest() << dendl;
messenger->reset_myname(m->get_dest());
mount_cond.Signal(); // mount might be waiting for this.
}
- dout(1) << "handle_mds_map epoch " << m->get_epoch() << endl;
+ dout(1) << "handle_mds_map epoch " << m->get_epoch() << dendl;
epoch_t was = mdsmap->get_epoch();
mdsmap->decode(m->get_encoded());
assert(mdsmap->get_epoch() >= was);
void Client::send_reconnect(int mds)
{
- dout(10) << "send_reconnect to mds" << mds << endl;
+ dout(10) << "send_reconnect to mds" << mds << dendl;
MClientReconnect *m = new MClientReconnect;
dout(10) << " caps on " << p->first
<< " " << cap_string(p->second->caps[mds].caps)
<< " wants " << cap_string(p->second->file_caps_wanted())
- << endl;
+ << dendl;
p->second->caps[mds].seq = 0; // reset seq.
m->add_inode_caps(p->first, // ino
p->second->file_caps_wanted(), // wanted
p->second->inode.size, p->second->inode.mtime, p->second->inode.atime);
string path;
p->second->make_path(path);
- dout(10) << " path on " << p->first << " is " << path << endl;
+ dout(10) << " path on " << p->first << " is " << path << dendl;
m->add_inode_path(p->first, path);
}
if (p->second->stale_caps.count(mds)) {
- dout(10) << " clearing stale caps on " << p->first << endl;
+ dout(10) << " clearing stale caps on " << p->first << dendl;
p->second->stale_caps.erase(mds); // hrm, is this right?
}
}
void Client::kick_requests(int mds)
{
- dout(10) << "kick_requests for mds" << mds << endl;
+ dout(10) << "kick_requests for mds" << mds << dendl;
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
p != mds_requests.end();
int other = m->get_mds();
if (in && in->stale_caps.count(other)) {
- dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " reap on mds" << other << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " reap on mds" << other << dendl;
// fresh from new mds?
if (!in->caps.count(mds)) {
// fall-thru!
} else {
- dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " premature (!!) reap on mds" << other << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " premature (!!) reap on mds" << other << dendl;
// delay!
cap_reap_queue[in->ino()][other] = m;
return;
// stale?
if (m->get_op() == MClientFileCaps::OP_STALE) {
- dout(5) << "handle_file_caps on ino " << m->get_ino() << " seq " << m->get_seq() << " from mds" << mds << " now stale" << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " seq " << m->get_seq() << " from mds" << mds << " now stale" << dendl;
// move to stale list
assert(in->caps.count(mds));
// delayed reap?
if (cap_reap_queue.count(in->ino()) &&
cap_reap_queue[in->ino()].count(mds)) {
- dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " delayed reap on mds" << m->get_mds() << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " delayed reap on mds" << m->get_mds() << dendl;
// process delayed reap
handle_file_caps( cap_reap_queue[in->ino()][mds] );
// release?
if (m->get_op() == MClientFileCaps::OP_RELEASE) {
- dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " release" << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " release" << dendl;
assert(in->caps.count(mds));
in->caps.erase(mds);
for (map<int,InodeCap>::iterator p = in->caps.begin();
p++)
dout(20) << " left cap " << p->first << " "
<< cap_string(p->second.caps) << " "
- << p->second.seq << endl;
+ << p->second.seq << dendl;
for (map<int,InodeCap>::iterator p = in->stale_caps.begin();
p != in->stale_caps.end();
p++)
dout(20) << " left stale cap " << p->first << " "
<< cap_string(p->second.caps) << " "
- << p->second.seq << endl;
+ << p->second.seq << dendl;
if (in->caps.empty()) {
- //dout(0) << "did put_inode" << endl;
+ //dout(0) << "did put_inode" << dendl;
put_inode(in);
} else {
- //dout(0) << "didn't put_inode" << endl;
+ //dout(0) << "didn't put_inode" << dendl;
}
delete m;
return;
dout(5) << "handle_file_caps on ino " << m->get_ino()
<< " seq " << m->get_seq()
<< " " << cap_string(m->get_caps())
- << ", which we don't want caps for, releasing." << endl;
+ << ", which we don't want caps for, releasing." << dendl;
m->set_caps(0);
m->set_wanted(0);
messenger->send_message(m, m->get_source_inst(), MDS_PORT_LOCKER);
dout(5) << "handle_file_caps on in " << m->get_ino()
<< " mds" << mds << " seq " << m->get_seq()
<< " caps now " << cap_string(new_caps)
- << " was " << cap_string(old_caps) << endl;
+ << " was " << cap_string(old_caps) << dendl;
// did file size decrease?
if ((old_caps & (CAP_FILE_RD|CAP_FILE_WR)) == 0 &&
(new_caps & (CAP_FILE_RD|CAP_FILE_WR)) != 0 &&
in->inode.size > m->get_inode().size) {
- dout(10) << "*** file size decreased from " << in->inode.size << " to " << m->get_inode().size << endl;
+ dout(10) << "*** file size decreased from " << in->inode.size << " to " << m->get_inode().size << dendl;
// trim filecache?
if (g_conf.client_oc)
for (list<Cond*>::iterator it = in->waitfor_read.begin();
it != in->waitfor_read.end();
it++) {
- dout(5) << "signaling read waiter " << *it << endl;
+ dout(5) << "signaling read waiter " << *it << dendl;
(*it)->Signal();
}
in->waitfor_read.clear();
for (list<Cond*>::iterator it = in->waitfor_write.begin();
it != in->waitfor_write.end();
it++) {
- dout(5) << "signaling write waiter " << *it << endl;
+ dout(5) << "signaling write waiter " << *it << dendl;
(*it)->Signal();
}
in->waitfor_write.clear();
for (list<Cond*>::iterator it = in->waitfor_lazy.begin();
it != in->waitfor_lazy.end();
it++) {
- dout(5) << "signaling lazy waiter " << *it << endl;
+ dout(5) << "signaling lazy waiter " << *it << dendl;
(*it)->Signal();
}
in->waitfor_lazy.clear();
if (old_caps & ~new_caps) {
if (in->sync_writes) {
// wait for sync writes to finish
- dout(5) << "sync writes in progress, will ack on finish" << endl;
+ dout(5) << "sync writes in progress, will ack on finish" << dendl;
in->waitfor_no_write.push_back(new C_Client_ImplementedCaps(this, m, in));
} else {
// ok now
void Client::implemented_caps(MClientFileCaps *m, Inode *in)
{
dout(5) << "implemented_caps " << cap_string(m->get_caps())
- << ", acking to " << m->get_source() << endl;
+ << ", acking to " << m->get_source() << dendl;
if (in->file_caps() == 0) {
in->file_wr_mtime = utime_t();
<< " had " << cap_string(in->file_caps())
<< " retaining " << cap_string(retain)
<< " want " << cap_string(in->file_caps_wanted())
- << endl;
+ << dendl;
for (map<int,InodeCap>::iterator it = in->caps.begin();
it != in->caps.end();
{
dout(5) << "updating caps wanted on ino " << in->inode.ino
<< " to " << cap_string(in->file_caps_wanted())
- << endl;
+ << dendl;
// FIXME: pick a single mds and let the others off the hook..
for (map<int,InodeCap>::iterator it = in->caps.begin();
void Client::_try_mount()
{
- dout(10) << "_try_mount" << endl;
+ dout(10) << "_try_mount" << dendl;
int mon = monmap->pick_mon();
- dout(2) << "sending client_mount to mon" << mon << endl;
+ dout(2) << "sending client_mount to mon" << mon << dendl;
messenger->send_message(new MClientMount(messenger->get_myaddr(),
client_instance_this_process),
monmap->get_inst(mon));
void Client::_mount_timeout()
{
- dout(10) << "_mount_timeout" << endl;
+ dout(10) << "_mount_timeout" << dendl;
mount_timeout_event = 0;
_try_mount();
}
dout(2) << "mounted: have osdmap " << osdmap->get_epoch()
<< " and mdsmap " << mdsmap->get_epoch()
- << endl;
+ << dendl;
// hack: get+pin root inode.
// fuse assumes it's always there.
if (g_conf.client_trace) {
traceout.open(g_conf.client_trace);
if (traceout.is_open()) {
- dout(1) << "opened trace file '" << g_conf.client_trace << "'" << endl;
+ dout(1) << "opened trace file '" << g_conf.client_trace << "'" << dendl;
} else {
- dout(1) << "FAILED to open trace file '" << g_conf.client_trace << "'" << endl;
+ dout(1) << "FAILED to open trace file '" << g_conf.client_trace << "'" << dendl;
}
}
client_lock.Unlock();
/*
- dout(3) << "op: // client trace data structs" << endl;
- dout(3) << "op: struct stat st;" << endl;
- dout(3) << "op: struct utimbuf utim;" << endl;
- dout(3) << "op: int readlinkbuf_len = 1000;" << endl;
- dout(3) << "op: char readlinkbuf[readlinkbuf_len];" << endl;
- dout(3) << "op: map<string, inode_t*> dir_contents;" << endl;
- dout(3) << "op: map<int, int> open_files;" << endl;
- dout(3) << "op: int fd;" << endl;
+ dout(3) << "op: // client trace data structs" << dendl;
+ dout(3) << "op: struct stat st;" << dendl;
+ dout(3) << "op: struct utimbuf utim;" << dendl;
+ dout(3) << "op: int readlinkbuf_len = 1000;" << dendl;
+ dout(3) << "op: char readlinkbuf[readlinkbuf_len];" << dendl;
+ dout(3) << "op: map<string, inode_t*> dir_contents;" << dendl;
+ dout(3) << "op: map<int, int> open_files;" << dendl;
+ dout(3) << "op: int fd;" << dendl;
*/
return 0;
}
assert(mounted); // caller is confused?
- dout(2) << "unmounting" << endl;
+ dout(2) << "unmounting" << dendl;
unmounting = true;
// NOTE: i'm assuming all caches are already flushing (because all files are closed).
assert(fd_map.empty());
- dout(10) << "a" << endl;
+ dout(10) << "a" << dendl;
_ll_drop_pins();
- dout(10) << "b" << endl;
+ dout(10) << "b" << dendl;
// empty lru cache
lru.lru_set_max(0);
if (!in->caps.empty()) {
in->fc.release_clean();
if (in->fc.is_dirty()) {
- dout(10) << "unmount residual caps on " << in->ino() << ", flushing" << endl;
+ dout(10) << "unmount residual caps on " << in->ino() << ", flushing" << dendl;
in->fc.empty(new C_Client_CloseRelease(this, in));
} else {
- dout(10) << "unmount residual caps on " << in->ino() << ", releasing" << endl;
+ dout(10) << "unmount residual caps on " << in->ino() << ", releasing" << dendl;
release_caps(in);
}
}
dout(2) << "cache still has " << lru.lru_get_size()
<< "+" << inode_map.size() << " items"
<< ", waiting (for caps to release?)"
- << endl;
+ << dendl;
dump_cache();
mount_cond.Wait(client_lock);
}
if (!g_conf.client_oc) {
while (unsafe_sync_write > 0) {
dout(0) << unsafe_sync_write << " unsafe_sync_writes, waiting"
- << endl;
+ << dendl;
mount_cond.Wait(client_lock);
}
}
// stop tracing
if (g_conf.client_trace) {
- dout(1) << "closing trace file '" << g_conf.client_trace << "'" << endl;
+ dout(1) << "closing trace file '" << g_conf.client_trace << "'" << dendl;
traceout.close();
}
for (map<int,version_t>::iterator p = mds_sessions.begin();
p != mds_sessions.end();
++p) {
- dout(2) << "sending client_session close to mds" << p->first << " seq " << p->second << endl;
+ dout(2) << "sending client_session close to mds" << p->first << " seq " << p->second << dendl;
messenger->send_message(new MClientSession(MClientSession::OP_REQUEST_CLOSE,
p->second),
mdsmap->get_inst(p->first), MDS_PORT_SERVER);
// send unmount!
int mon = monmap->pick_mon();
- dout(2) << "sending client_unmount to mon" << mon << endl;
+ dout(2) << "sending client_unmount to mon" << mon << dendl;
messenger->send_message(new MClientUnmount(messenger->get_myinst()),
monmap->get_inst(mon));
while (mounted)
mount_cond.Wait(client_lock);
- dout(2) << "unmounted." << endl;
+ dout(2) << "unmounted." << dendl;
client_lock.Unlock();
return 0;
void Client::handle_unmount(Message* m)
{
- dout(1) << "handle_unmount got ack" << endl;
+ dout(1) << "handle_unmount got ack" << dendl;
mounted = false;
int Client::link(const char *existing, const char *newname)
{
Mutex::Locker lock(client_lock);
- tout << "link" << endl;
- tout << existing << endl;
- tout << newname << endl;
+ tout << "link" << dendl;
+ tout << existing << dendl;
+ tout << newname << dendl;
return _link(existing, newname);
}
insert_trace(reply);
delete reply;
- dout(10) << "link result is " << res << endl;
+ dout(10) << "link result is " << res << dendl;
trim_cache();
- dout(3) << "link(\"" << existing << "\", \"" << newname << "\") = " << res << endl;
+ dout(3) << "link(\"" << existing << "\", \"" << newname << "\") = " << res << dendl;
return res;
}
int Client::unlink(const char *relpath)
{
Mutex::Locker lock(client_lock);
- tout << "unlink" << endl;
- tout << relpath << endl;
+ tout << "unlink" << dendl;
+ tout << relpath << dendl;
string abspath;
mkabspath(relpath, abspath);
}
insert_trace(reply);
delete reply;
- dout(10) << "unlink result is " << res << endl;
+ dout(10) << "unlink result is " << res << dendl;
trim_cache();
- dout(3) << "unlink(\"" << path << "\") = " << res << endl;
+ dout(3) << "unlink(\"" << path << "\") = " << res << dendl;
return res;
}
int Client::rename(const char *relfrom, const char *relto)
{
Mutex::Locker lock(client_lock);
- tout << "rename" << endl;
- tout << relfrom << endl;
- tout << relto << endl;
+ tout << "rename" << dendl;
+ tout << relfrom << dendl;
+ tout << relto << dendl;
string absfrom, absto;
mkabspath(relfrom, absfrom);
int res = reply->get_result();
insert_trace(reply);
delete reply;
- dout(10) << "rename result is " << res << endl;
+ dout(10) << "rename result is " << res << dendl;
// renamed item from our cache
trim_cache();
- dout(3) << "rename(\"" << from << "\", \"" << to << "\") = " << res << endl;
+ dout(3) << "rename(\"" << from << "\", \"" << to << "\") = " << res << dendl;
return res;
}
int Client::mkdir(const char *relpath, mode_t mode)
{
Mutex::Locker lock(client_lock);
- tout << "mkdir" << endl;
- tout << relpath << endl;
- tout << mode << endl;
+ tout << "mkdir" << dendl;
+ tout << relpath << dendl;
+ tout << mode << dendl;
string abspath;
mkabspath(relpath, abspath);
int res = reply->get_result();
insert_trace(reply);
delete reply;
- dout(10) << "mkdir result is " << res << endl;
+ dout(10) << "mkdir result is " << res << dendl;
trim_cache();
- dout(3) << "mkdir(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+ dout(3) << "mkdir(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
return res;
}
int Client::rmdir(const char *relpath)
{
Mutex::Locker lock(client_lock);
- tout << "rmdir" << endl;
- tout << relpath << endl;
+ tout << "rmdir" << dendl;
+ tout << relpath << dendl;
string abspath;
mkabspath(relpath, abspath);
delete reply;
trim_cache();
- dout(3) << "rmdir(\"" << path << "\") = " << res << endl;
+ dout(3) << "rmdir(\"" << path << "\") = " << res << dendl;
return res;
}
int Client::symlink(const char *reltarget, const char *rellink)
{
Mutex::Locker lock(client_lock);
- tout << "symlink" << endl;
- tout << reltarget << endl;
- tout << rellink << endl;
+ tout << "symlink" << dendl;
+ tout << reltarget << dendl;
+ tout << rellink << dendl;
string target, link;
mkabspath(reltarget, target);
delete reply;
trim_cache();
- dout(3) << "symlink(\"" << target << "\", \"" << link << "\") = " << res << endl;
+ dout(3) << "symlink(\"" << target << "\", \"" << link << "\") = " << res << dendl;
return res;
}
int Client::readlink(const char *path, char *buf, off_t size)
{
Mutex::Locker lock(client_lock);
- tout << "readlink" << endl;
- tout << path << endl;
+ tout << "readlink" << dendl;
+ tout << path << dendl;
string abspath;
mkabspath(path, abspath);
}
trim_cache();
- dout(3) << "readlink(\"" << path << "\", \"" << buf << "\", " << size << ") = " << r << endl;
+ dout(3) << "readlink(\"" << path << "\", \"" << buf << "\", " << size << ") = " << r << dendl;
return r;
}
if (dn &&
now <= dn->inode->valid_until)
- dout(10) << "_lstat has inode " << path << " with mask " << dn->inode->mask << ", want " << mask << endl;
+ dout(10) << "_lstat has inode " << path << " with mask " << dn->inode->mask << ", want " << mask << dendl;
if (dn && dn->inode &&
((mask & ~STAT_MASK_BASE) || now <= dn->inode->valid_until) &&
((dn->inode->mask & mask) == mask)) {
inode = dn->inode->inode;
- dout(10) << "lstat cache hit w/ sufficient mask, valid until " << dn->inode->valid_until << endl;
+ dout(10) << "lstat cache hit w/ sufficient mask, valid until " << dn->inode->valid_until << dendl;
if (g_conf.client_cache_stat_ttl == 0)
dn->inode->valid_until = utime_t(); // only one stat allowed after each readdir
MClientReply *reply = make_request(req);
res = reply->get_result();
- dout(10) << "lstat res is " << res << endl;
+ dout(10) << "lstat res is " << res << dendl;
if (res == 0) {
//Transfer information from reply to stbuf
inode = reply->get_inode();
int Client::fill_stat(Inode *in, struct stat *st)
{
dout(10) << "fill_stat on " << in->inode.ino << " mode 0" << oct << in->inode.mode << dec
- << " mtime " << in->inode.mtime << " ctime " << in->inode.ctime << endl;
+ << " mtime " << in->inode.mtime << " ctime " << in->inode.ctime << dendl;
memset(st, 0, sizeof(struct stat));
st->st_ino = in->inode.ino;
st->st_mode = in->inode.mode;
int Client::lstat(const char *relpath, struct stat *stbuf)
{
Mutex::Locker lock(client_lock);
- tout << "lstat" << endl;
- tout << relpath << endl;
+ tout << "lstat" << dendl;
+ tout << relpath << dendl;
string abspath;
mkabspath(relpath, abspath);
if (res == 0) {
assert(in);
fill_stat(in, stbuf);
- dout(10) << "stat sez size = " << in->inode.size << " mode = 0" << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << endl;
+ dout(10) << "stat sez size = " << in->inode.size << " mode = 0" << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << dendl;
}
trim_cache();
- dout(3) << "lstat(\"" << path << "\", " << stbuf << ") = " << res << endl;
+ dout(3) << "lstat(\"" << path << "\", " << stbuf << ") = " << res << dendl;
return res;
}
mkabspath(relpath, abspath);
const char *path = abspath.c_str();
- dout(3) << "op: client->lstatlite(\"" << path << "\", &st);" << endl;
- tout << "lstatlite" << endl;
- tout << path << endl;
+ dout(3) << "op: client->lstatlite(\"" << path << "\", &st);" << dendl;
+ tout << "lstatlite" << dendl;
+ tout << path << dendl;
// make mask
// FIXME.
if (res == 0) {
fill_statlite(in->inode,stl);
- dout(10) << "stat sez size = " << in->inode.size << " ino = " << in->inode.ino << endl;
+ dout(10) << "stat sez size = " << in->inode.size << " ino = " << in->inode.ino << dendl;
}
trim_cache();
int Client::chmod(const char *relpath, mode_t mode)
{
Mutex::Locker lock(client_lock);
- tout << "chmod" << endl;
- tout << relpath << endl;
- tout << mode << endl;
+ tout << "chmod" << dendl;
+ tout << relpath << dendl;
+ tout << mode << dendl;
string abspath;
mkabspath(relpath, abspath);
int Client::_chmod(const char *path, mode_t mode)
{
- dout(3) << "_chmod(" << path << ", 0" << oct << mode << dec << ")" << endl;
+ dout(3) << "_chmod(" << path << ", 0" << oct << mode << dec << ")" << dendl;
MClientRequest *req = new MClientRequest(MDS_OP_CHMOD, messenger->get_myinst());
req->set_path(path);
req->args.chmod.mode = mode;
delete reply;
trim_cache();
- dout(3) << "_chmod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+ dout(3) << "_chmod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
return res;
}
int Client::chown(const char *relpath, uid_t uid, gid_t gid)
{
Mutex::Locker lock(client_lock);
- tout << "chown" << endl;
- tout << relpath << endl;
- tout << uid << endl;
- tout << gid << endl;
+ tout << "chown" << dendl;
+ tout << relpath << dendl;
+ tout << uid << dendl;
+ tout << gid << dendl;
string abspath;
mkabspath(relpath, abspath);
int Client::_chown(const char *path, uid_t uid, gid_t gid)
{
- dout(3) << "_chown(" << path << ", " << uid << ", " << gid << ")" << endl;
+ dout(3) << "_chown(" << path << ", " << uid << ", " << gid << ")" << dendl;
MClientRequest *req = new MClientRequest(MDS_OP_CHOWN, messenger->get_myinst());
req->set_path(path);
req->args.chown.uid = uid;
int res = reply->get_result();
insert_trace(reply);
delete reply;
- dout(10) << "chown result is " << res << endl;
+ dout(10) << "chown result is " << res << dendl;
trim_cache();
- dout(3) << "chown(\"" << path << "\", " << uid << ", " << gid << ") = " << res << endl;
+ dout(3) << "chown(\"" << path << "\", " << uid << ", " << gid << ") = " << res << dendl;
return res;
}
int Client::utime(const char *relpath, struct utimbuf *buf)
{
Mutex::Locker lock(client_lock);
- tout << "utime" << endl;
- tout << relpath << endl;
- tout << buf->modtime << endl;
- tout << buf->actime << endl;
+ tout << "utime" << dendl;
+ tout << relpath << dendl;
+ tout << buf->modtime << dendl;
+ tout << buf->actime << dendl;
string abspath;
mkabspath(relpath, abspath);
int Client::_utimes(const char *path, utime_t mtime, utime_t atime)
{
- dout(3) << "_utimes(" << path << ", " << mtime << ", " << atime << ")" << endl;
+ dout(3) << "_utimes(" << path << ", " << mtime << ", " << atime << ")" << dendl;
MClientRequest *req = new MClientRequest(MDS_OP_UTIME, messenger->get_myinst());
req->set_path(path);
req->args.utime.mtime = mtime.tv_ref();
insert_trace(reply);
delete reply;
- dout(3) << "utimes(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << endl;
+ dout(3) << "utimes(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << dendl;
trim_cache();
return res;
}
int Client::mknod(const char *relpath, mode_t mode, dev_t rdev)
{
Mutex::Locker lock(client_lock);
- tout << "mknod" << endl;
- tout << relpath << endl;
- tout << mode << endl;
- tout << rdev << endl;
+ tout << "mknod" << dendl;
+ tout << relpath << dendl;
+ tout << mode << dendl;
+ tout << rdev << dendl;
string abspath;
mkabspath(relpath, abspath);
int Client::_mknod(const char *path, mode_t mode, dev_t rdev)
{
- dout(3) << "_mknod(" << path << ", 0" << oct << mode << dec << ", " << rdev << ")" << endl;
+ dout(3) << "_mknod(" << path << ", 0" << oct << mode << dec << ", " << rdev << ")" << dendl;
MClientRequest *req = new MClientRequest(MDS_OP_MKNOD, messenger->get_myinst());
req->set_path(path);
trim_cache();
- dout(3) << "mknod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
+ dout(3) << "mknod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << dendl;
return res;
}
int Client::getdir(const char *relpath, list<string>& contents)
{
- dout(3) << "getdir(" << relpath << ")" << endl;
+ dout(3) << "getdir(" << relpath << ")" << dendl;
{
Mutex::Locker lock(client_lock);
- tout << "getdir" << endl;
- tout << relpath << endl;
+ tout << "getdir" << dendl;
+ tout << relpath << dendl;
}
DIR *d;
int Client::opendir(const char *name, DIR **dirpp)
{
Mutex::Locker lock(client_lock);
- tout << "opendir" << endl;
- tout << name << endl;
+ tout << "opendir" << dendl;
+ tout << name << dendl;
int r = _opendir(name, (DirResult**)dirpp);
tout << (unsigned long)*dirpp;
if (dn && dn->inode) {
(*dirpp)->inode = dn->inode;
(*dirpp)->inode->get();
- dout(10) << "had inode " << dn->inode << " " << dn->inode->inode.ino << " ref now " << dn->inode->ref << endl;
+ dout(10) << "had inode " << dn->inode << " " << dn->inode->inode.ino << " ref now " << dn->inode->ref << dendl;
(*dirpp)->set_frag(dn->inode->dirfragtree[0]);
- dout(10) << "_opendir " << name << ", our cache says the first dirfrag is " << (*dirpp)->frag() << endl;
+ dout(10) << "_opendir " << name << ", our cache says the first dirfrag is " << (*dirpp)->frag() << dendl;
}
// get the first frag
} else {
r = 0;
}
- dout(3) << "_opendir(" << name << ") = " << r << " (" << *dirpp << ")" << endl;
+ dout(3) << "_opendir(" << name << ") = " << r << " (" << *dirpp << ")" << dendl;
return r;
}
frag_t fg = dirp->frag();
dirp->buffer[fg].push_back(DirEntry(name, st, stmask));
dout(10) << "_readdir_add_dirent " << dirp << " added '" << name << "' -> " << in->inode.ino
- << ", size now " << dirp->buffer[fg].size() << endl;
+ << ", size now " << dirp->buffer[fg].size() << dendl;
}
//struct dirent {
de->d_type = MODE_TO_DT(entry->st.st_mode);
strncpy(de->d_name, entry->d_name.c_str(), 256);
dout(10) << "_readdir_fill_dirent '" << de->d_name << "' -> " << de->d_ino
- << " type " << (int)de->d_type << " at off " << off << endl;
+ << " type " << (int)de->d_type << " at off " << off << dendl;
}
void Client::_readdir_next_frag(DirResult *dirp)
// advance
dirp->next_frag();
if (dirp->at_end()) {
- dout(10) << "_readdir_next_frag advance from " << fg << " to END" << endl;
+ dout(10) << "_readdir_next_frag advance from " << fg << " to END" << dendl;
} else {
- dout(10) << "_readdir_next_frag advance from " << fg << " to " << dirp->frag() << endl;
+ dout(10) << "_readdir_next_frag advance from " << fg << " to " << dirp->frag() << dendl;
_readdir_rechoose_frag(dirp);
}
}
frag_t cur = dirp->frag();
frag_t f = dirp->inode->dirfragtree[cur.value()];
if (f != cur) {
- dout(10) << "_readdir_rechoose_frag frag " << cur << " maps to " << f << endl;
+ dout(10) << "_readdir_rechoose_frag frag " << cur << " maps to " << f << dendl;
dirp->set_frag(f);
}
}
frag_t fg = dirp->frag();
assert(dirp->buffer.count(fg) == 0);
- dout(10) << "_readdir_get_frag " << dirp << " on " << dirp->path << " fg " << fg << endl;
+ dout(10) << "_readdir_get_frag " << dirp << " on " << dirp->path << " fg " << fg << dendl;
MClientRequest *req = new MClientRequest(MDS_OP_READDIR, messenger->get_myinst());
req->set_path(dirp->path);
if ((res == -EAGAIN || res == 0) &&
inode_map.count(ino)) {
diri = inode_map[ino];
- dout(10) << "_readdir_get_frag got diri " << diri << " " << diri->inode.ino << endl;
+ dout(10) << "_readdir_get_frag got diri " << diri << " " << diri->inode.ino << dendl;
assert(diri);
assert(diri->inode.mode & INODE_MODE_DIR);
}
if (!dirp->inode && diri) {
- dout(10) << "_readdir_get_frag attaching inode" << endl;
+ dout(10) << "_readdir_get_frag attaching inode" << dendl;
dirp->inode = inode_map[ino];
diri->get();
}
if (res == -EAGAIN) {
- dout(10) << "_readdir_get_frag got EAGAIN, retrying" << endl;
+ dout(10) << "_readdir_get_frag got EAGAIN, retrying" << dendl;
_readdir_rechoose_frag(dirp);
return _readdir_get_frag(dirp);
}
}
// contents to caller too!
- dout(15) << "_readdir_get_frag got " << *pdn << " to " << in->inode.ino << endl;
+ dout(15) << "_readdir_get_frag got " << *pdn << " to " << in->inode.ino << dendl;
_readdir_add_dirent(dirp, *pdn, in);
}
// FIXME: remove items in cache that weren't in my readdir?
// ***
} else {
- dout(10) << "_readdir_get_frag got error " << res << ", setting end flag" << endl;
+ dout(10) << "_readdir_get_frag got error " << res << ", setting end flag" << dendl;
dirp->set_end();
}
vector<DirEntry> &ent = dirp->buffer[fg];
if (ent.empty()) {
- dout(10) << "empty frag " << fg << ", moving on to next" << endl;
+ dout(10) << "empty frag " << fg << ", moving on to next" << dendl;
_readdir_next_frag(dirp);
continue;
}
int Client::closedir(DIR *dir)
{
Mutex::Locker lock(client_lock);
- tout << "closedir" << endl;
- tout << (unsigned long)dir << endl;
+ tout << "closedir" << dendl;
+ tout << (unsigned long)dir << dendl;
- dout(3) << "closedir(" << dir << ") = 0" << endl;
+ dout(3) << "closedir(" << dir << ") = 0" << dendl;
_closedir((DirResult*)dir);
return 0;
}
void Client::_closedir(DirResult *dirp)
{
- dout(10) << "_closedir(" << dirp << ")" << endl;
+ dout(10) << "_closedir(" << dirp << ")" << dendl;
if (dirp->inode) {
- dout(10) << "_closedir detaching inode " << dirp->inode << endl;
+ dout(10) << "_closedir detaching inode " << dirp->inode << dendl;
put_inode(dirp->inode);
dirp->inode = 0;
}
void Client::rewinddir(DIR *dirp)
{
- dout(3) << "rewinddir(" << dirp << ")" << endl;
+ dout(3) << "rewinddir(" << dirp << ")" << dendl;
DirResult *d = (DirResult*)dirp;
d->offset = 0;
d->buffer.clear();
off_t Client::telldir(DIR *dirp)
{
DirResult *d = (DirResult*)dirp;
- dout(3) << "telldir(" << dirp << ") = " << d->offset << endl;
+ dout(3) << "telldir(" << dirp << ") = " << d->offset << dendl;
return d->offset;
}
void Client::seekdir(DIR *dirp, off_t offset)
{
- dout(3) << "seekdir(" << dirp << ", " << offset << ")" << endl;
+ dout(3) << "seekdir(" << dirp << ", " << offset << ")" << dendl;
DirResult *d = (DirResult*)dirp;
d->offset = offset;
}
int Client::open(const char *relpath, int flags, mode_t mode)
{
Mutex::Locker lock(client_lock);
- tout << "open" << endl;
- tout << relpath << endl;
- tout << flags << endl;
+ tout << "open" << dendl;
+ tout << relpath << dendl;
+ tout << flags << dendl;
string abspath;
mkabspath(relpath, abspath);
fd_map[r] = fh;
}
- tout << r << endl;
- dout(3) << "open(" << relpath << ", " << flags << ") = " << r << endl;
+ tout << r << dendl;
+ dout(3) << "open(" << relpath << ", " << flags << ") = " << r << dendl;
return r;
}
int mds = reply->get_source().num();
if (in->caps.empty()) {// first caps?
- dout(7) << " first caps on " << in->inode.ino << endl;
+ dout(7) << " first caps on " << in->inode.ino << dendl;
in->get();
}
<< " for " << in->ino()
<< " seq " << reply->get_file_caps_seq()
<< " from mds" << mds
- << endl;
+ << dendl;
in->caps[mds].caps = new_caps;
in->caps[mds].seq = reply->get_file_caps_seq();
<< " for " << in->ino()
<< " seq " << reply->get_file_caps_seq()
<< " from mds" << mds
- << endl;
+ << dendl;
}
- dout(5) << "open success, fh is " << f << " combined caps " << cap_string(in->file_caps()) << endl;
+ dout(5) << "open success, fh is " << f << " combined caps " << cap_string(in->file_caps()) << dendl;
}
delete reply;
void Client::close_release(Inode *in)
{
- dout(10) << "close_release on " << in->ino() << endl;
+ dout(10) << "close_release on " << in->ino() << dendl;
dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd
- << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << endl;
+ << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << dendl;
if (!in->num_open_rd)
in->fc.release_clean();
void Client::close_safe(Inode *in)
{
- dout(10) << "close_safe on " << in->ino() << endl;
+ dout(10) << "close_safe on " << in->ino() << dendl;
put_inode(in);
if (unmounting)
mount_cond.Signal();
int Client::close(int fd)
{
Mutex::Locker lock(client_lock);
- tout << "close" << endl;
- tout << fd << endl;
+ tout << "close" << dendl;
+ tout << fd << dendl;
- dout(3) << "close(" << fd << ")" << endl;
+ dout(3) << "close(" << fd << ")" << dendl;
assert(fd_map.count(fd));
Fh *fh = fd_map[fd];
_release(fh);
int Client::_release(Fh *f)
{
- //dout(3) << "op: client->close(open_files[ " << fh << " ]);" << endl;
- //dout(3) << "op: open_files.erase( " << fh << " );" << endl;
- dout(5) << "_release " << f << endl;
+ //dout(3) << "op: client->close(open_files[ " << fh << " ]);" << dendl;
+ //dout(3) << "op: open_files.erase( " << fh << " );" << dendl;
+ dout(5) << "_release " << f << dendl;
Inode *in = f->inode;
// update inode rd/wr counts
update_caps_wanted(in);
// release caps right away?
- dout(10) << "num_open_rd " << in->num_open_rd << " num_open_wr " << in->num_open_wr << endl;
+ dout(10) << "num_open_rd " << in->num_open_rd << " num_open_wr " << in->num_open_wr << dendl;
if (g_conf.client_oc) {
// caching on.
// pin until safe?
if (in->num_open_wr == 0 && !in->fc.all_safe()) {
- dout(10) << "pinning ino " << in->ino() << " until safe" << endl;
+ dout(10) << "pinning ino " << in->ino() << " until safe" << dendl;
in->get();
in->fc.add_safe_waiter(new C_Client_CloseSafe(this, in));
}
} else {
// caching off.
if (in->num_open_rd == 0 && in->num_open_wr == 0) {
- dout(10) << " releasing caps on " << in->ino() << endl;
+ dout(10) << " releasing caps on " << in->ino() << dendl;
release_caps(in); // release caps now.
}
}
off_t Client::lseek(int fd, off_t offset, int whence)
{
Mutex::Locker lock(client_lock);
- tout << "lseek" << endl;
- tout << fd << endl;
- tout << offset << endl;
- tout << whence << endl;
+ tout << "lseek" << dendl;
+ tout << fd << dendl;
+ tout << offset << dendl;
+ tout << whence << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
off_t pos = f->pos;
- dout(3) << "lseek(" << fd << ", " << offset << ", " << whence << ") = " << pos << endl;
+ dout(3) << "lseek(" << fd << ", " << offset << ", " << whence << ") = " << pos << dendl;
return pos;
}
void Client::lock_fh_pos(Fh *f)
{
- dout(10) << "lock_fh_pos " << f << endl;
+ dout(10) << "lock_fh_pos " << f << dendl;
if (f->pos_locked || !f->pos_waiters.empty()) {
Cond cond;
f->pos_waiters.push_back(&cond);
- dout(10) << "lock_fh_pos BLOCKING on " << f << endl;
+ dout(10) << "lock_fh_pos BLOCKING on " << f << dendl;
while (f->pos_locked || f->pos_waiters.front() != &cond)
cond.Wait(client_lock);
- dout(10) << "lock_fh_pos UNBLOCKING on " << f << endl;
+ dout(10) << "lock_fh_pos UNBLOCKING on " << f << dendl;
assert(f->pos_waiters.front() == &cond);
f->pos_waiters.pop_front();
}
void Client::unlock_fh_pos(Fh *f)
{
- dout(10) << "unlock_fh_pos " << f << endl;
+ dout(10) << "unlock_fh_pos " << f << dendl;
f->pos_locked = false;
}
int Client::read(int fd, char *buf, off_t size, off_t offset)
{
Mutex::Locker lock(client_lock);
- tout << "read" << endl;
- tout << fd << endl;
- tout << size << endl;
- tout << offset << endl;
+ tout << "read" << dendl;
+ tout << fd << dendl;
+ tout << size << dendl;
+ tout << offset << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
bufferlist bl;
int r = _read(f, offset, size, &bl);
- dout(3) << "read(" << fd << ", " << buf << ", " << size << ", " << offset << ") = " << r << endl;
+ dout(3) << "read(" << fd << ", " << buf << ", " << size << ", " << offset << ") = " << r << dendl;
if (r >= 0) {
bl.copy(0, bl.length(), buf);
r = bl.length();
if (!lazy && (in->file_caps() & (CAP_FILE_WRBUFFER|CAP_FILE_RDCACHE))) {
// we're doing buffered i/o. make sure we're inside the file.
// we can trust size info bc we get accurate info when buffering/caching caps are issued.
- dout(10) << "file size: " << in->inode.size << endl;
+ dout(10) << "file size: " << in->inode.size << dendl;
if (offset > 0 && offset >= in->inode.size) {
if (movepos) unlock_fh_pos(f);
return 0;
size = (off_t)in->inode.size - offset;
if (size == 0) {
- dout(10) << "read is size=0, returning 0" << endl;
+ dout(10) << "read is size=0, returning 0" << dendl;
if (movepos) unlock_fh_pos(f);
return 0;
}
if (v[a] != hackbuf[offset+a])
dout(1) << "** hackbuf differs from read value at offset " << a
<< " hackbuf[a] = " << (int)hackbuf[a] << ", read got " << (int)v[a]
- << endl;
+ << dendl;
}
*/
// do we have read file cap?
while (!lazy && (in->file_caps() & CAP_FILE_RD) == 0) {
- dout(7) << " don't have read cap, waiting" << endl;
+ dout(7) << " don't have read cap, waiting" << dendl;
Cond cond;
in->waitfor_read.push_back(&cond);
cond.Wait(client_lock);
}
// lazy cap?
while (lazy && (in->file_caps() & CAP_FILE_LAZYIO) == 0) {
- dout(7) << " don't have lazy cap, waiting" << endl;
+ dout(7) << " don't have lazy cap, waiting" << dendl;
Cond cond;
in->waitfor_lazy.push_back(&cond);
cond.Wait(client_lock);
assert(unsafe_sync_write > 0);
unsafe_sync_write--;
if (unsafe_sync_write == 0 && unmounting) {
- dout(10) << "hack_sync_write_safe -- no more unsafe writes, unmount can proceed" << endl;
+ dout(10) << "hack_sync_write_safe -- no more unsafe writes, unmount can proceed" << dendl;
mount_cond.Signal();
}
client_lock.Unlock();
int Client::write(int fd, const char *buf, off_t size, off_t offset)
{
Mutex::Locker lock(client_lock);
- tout << "write" << endl;
- tout << fd << endl;
- tout << size << endl;
- tout << offset << endl;
+ tout << "write" << dendl;
+ tout << fd << dendl;
+ tout << size << dendl;
+ tout << offset << dendl;
assert(fd_map.count(fd));
Fh *fh = fd_map[fd];
int r = _write(fh, offset, size, buf);
- dout(3) << "write(" << fd << ", \"...\", " << size << ", " << offset << ") = " << r << endl;
+ dout(3) << "write(" << fd << ", \"...\", " << size << ", " << offset << ") = " << r << dendl;
return r;
}
int Client::_write(Fh *f, off_t offset, off_t size, const char *buf)
{
- //dout(7) << "write fh " << fh << " size " << size << " offset " << offset << endl;
+ //dout(7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
Inode *in = f->inode;
// use/adjust fd pos?
bool lazy = f->mode == FILE_MODE_LAZY;
- dout(10) << "cur file size is " << in->inode.size << " wr size " << in->file_wr_size << endl;
+ dout(10) << "cur file size is " << in->inode.size << " wr size " << in->file_wr_size << dendl;
// time it.
utime_t start = g_clock.real_now();
/*
if (f->inode->inode.ino == 0x10000000075) {
if (!hackbuf) {
- dout(7) << "alloc and zero new hackbuf" << endl;
+ dout(7) << "alloc and zero new hackbuf" << dendl;
hackbuf = new char[16384];
memset(hackbuf, 0, 16384);
}
- dout(7) << "hackbuf copying " << offset << "~" << size << " first is " << (int)buf[0] << endl;
+ dout(7) << "hackbuf copying " << offset << "~" << size << " first is " << (int)buf[0] << dendl;
memcpy(hackbuf+offset, buf, size);
for (int a=0; a<size; a++)
- dout(10) << "hackbuf[" << (a+offset) << " = " << (int)hackbuf[a+offset] << " = " << (int)buf[a] << endl;
+ dout(10) << "hackbuf[" << (a+offset) << " = " << (int)hackbuf[a+offset] << " = " << (int)buf[a] << dendl;
}
*/
} else {
// legacy, inconsistent synchronous write.
- dout(7) << "synchronous write" << endl;
+ dout(7) << "synchronous write" << dendl;
// do we have write file cap?
while (!lazy && (in->file_caps() & CAP_FILE_WR) == 0) {
- dout(7) << " don't have write cap, waiting" << endl;
+ dout(7) << " don't have write cap, waiting" << dendl;
Cond cond;
in->waitfor_write.push_back(&cond);
cond.Wait(client_lock);
}
while (lazy && (in->file_caps() & CAP_FILE_LAZYIO) == 0) {
- dout(7) << " don't have lazy cap, waiting" << endl;
+ dout(7) << " don't have lazy cap, waiting" << dendl;
Cond cond;
in->waitfor_lazy.push_back(&cond);
cond.Wait(client_lock);
unsafe_sync_write++;
in->sync_writes++;
- dout(20) << " sync write start " << onfinish << endl;
+ dout(20) << " sync write start " << onfinish << dendl;
filer->write(in->inode, offset, size, blist, 0,
onfinish, onsafe
while (!done) {
cond.Wait(client_lock);
- dout(20) << " sync write bump " << onfinish << endl;
+ dout(20) << " sync write bump " << onfinish << dendl;
}
in->sync_writes--;
in->waitfor_no_write.clear();
}
- dout(20) << " sync write done " << onfinish << endl;
+ dout(20) << " sync write done " << onfinish << dendl;
}
// time
// extend file?
if (totalwritten + offset > in->inode.size) {
in->inode.size = in->file_wr_size = totalwritten + offset;
- dout(7) << "wrote to " << totalwritten+offset << ", extending file size" << endl;
+ dout(7) << "wrote to " << totalwritten+offset << ", extending file size" << dendl;
} else {
- dout(7) << "wrote to " << totalwritten+offset << ", leaving file size at " << in->inode.size << endl;
+ dout(7) << "wrote to " << totalwritten+offset << ", leaving file size at " << in->inode.size << dendl;
}
// mtime
int Client::truncate(const char *relpath, off_t length)
{
Mutex::Locker lock(client_lock);
- tout << "truncate" << endl;
- tout << relpath << endl;
- tout << length << endl;
+ tout << "truncate" << dendl;
+ tout << relpath << dendl;
+ tout << length << dendl;
string path;
mkabspath(relpath, path);
insert_trace(reply);
delete reply;
- dout(3) << "truncate(\"" << file << "\", " << length << ") = " << res << endl;
+ dout(3) << "truncate(\"" << file << "\", " << length << ") = " << res << dendl;
return res;
}
int Client::ftruncate(int fd, off_t length)
{
Mutex::Locker lock(client_lock);
- tout << "ftruncate" << endl;
- tout << fd << endl;
- tout << length << endl;
+ tout << "ftruncate" << dendl;
+ tout << fd << dendl;
+ tout << length << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
insert_trace(reply);
delete reply;
- dout(3) << "ftruncate(\"" << fh << "\", " << length << ") = " << res << endl;
+ dout(3) << "ftruncate(\"" << fh << "\", " << length << ") = " << res << dendl;
return res;
}
int Client::fsync(int fd, bool syncdataonly)
{
Mutex::Locker lock(client_lock);
- tout << "fsync" << endl;
- tout << fd << endl;
- tout << syncdataonly << endl;
+ tout << "fsync" << dendl;
+ tout << fd << dendl;
+ tout << syncdataonly << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
int r = _fsync(f, syncdataonly);
- dout(3) << "fsync(" << fd << ", " << syncdataonly << ") = " << r << endl;
+ dout(3) << "fsync(" << fd << ", " << syncdataonly << ") = " << r << dendl;
return r;
}
// metadata?
if (!syncdataonly) {
- dout(0) << "fsync - not syncing metadata yet.. implement me" << endl;
+ dout(0) << "fsync - not syncing metadata yet.. implement me" << dendl;
}
// data?
int Client::chdir(const char *path)
{
Mutex::Locker lock(client_lock);
- tout << "chdir" << endl;
- tout << path << endl;
+ tout << "chdir" << dendl;
+ tout << path << dendl;
// fake it for now!
string abs;
mkabspath(path, abs);
- dout(3) << "chdir " << path << " -> cwd now " << abs << endl;
+ dout(3) << "chdir " << path << " -> cwd now " << abs << dendl;
cwd = abs;
return 0;
}
int Client::statfs(const char *path, struct statvfs *stbuf)
{
Mutex::Locker lock(client_lock);
- tout << "statfs" << endl;
+ tout << "statfs" << dendl;
return _statfs(stbuf);
}
int Client::ll_statfs(inodeno_t ino, struct statvfs *stbuf)
{
Mutex::Locker lock(client_lock);
- tout << "ll_statfs" << endl;
+ tout << "ll_statfs" << dendl;
return _statfs(stbuf);
}
int Client::_statfs(struct statvfs *stbuf)
{
- dout(3) << "_statfs" << endl;
+ dout(3) << "_statfs" << dendl;
Cond cond;
tid_t tid = ++last_tid;
delete req;
int r = 0;
- dout(3) << "_statfs = " << r << endl;
+ dout(3) << "_statfs = " << r << dendl;
return r;
}
{
if (statfs_requests.count(reply->tid) &&
statfs_requests[reply->tid]->reply == 0) {
- dout(10) << "handle_statfs_reply " << *reply << ", kicking waiter" << endl;
+ dout(10) << "handle_statfs_reply " << *reply << ", kicking waiter" << dendl;
statfs_requests[reply->tid]->reply = reply;
statfs_requests[reply->tid]->caller_cond->Signal();
} else {
- dout(10) << "handle_statfs_reply " << *reply << ", dup or old, dropping" << endl;
+ dout(10) << "handle_statfs_reply " << *reply << ", dup or old, dropping" << dendl;
delete reply;
}
}
{
client_lock.Lock();
dout(3) << "op: client->lazyio_propogate(" << fd
- << ", " << offset << ", " << count << ")" << endl;
+ << ", " << offset << ", " << count << ")" << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
if (f->mode & FILE_MODE_LAZY) {
// wait for lazy cap
while ((in->file_caps() & CAP_FILE_LAZYIO) == 0) {
- dout(7) << " don't have lazy cap, waiting" << endl;
+ dout(7) << " don't have lazy cap, waiting" << dendl;
Cond cond;
in->waitfor_lazy.push_back(&cond);
cond.Wait(client_lock);
{
client_lock.Lock();
dout(3) << "op: client->lazyio_synchronize(" << fd
- << ", " << offset << ", " << count << ")" << endl;
+ << ", " << offset << ", " << count << ")" << dendl;
assert(fd_map.count(fd));
Fh *f = fd_map[fd];
if (f->mode & FILE_MODE_LAZY) {
// wait for lazy cap
while ((in->file_caps() & CAP_FILE_LAZYIO) == 0) {
- dout(7) << " don't have lazy cap, waiting" << endl;
+ dout(7) << " don't have lazy cap, waiting" << dendl;
Cond cond;
in->waitfor_lazy.push_back(&cond);
cond.Wait(client_lock);
int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_lookup " << parent << " " << name << endl;
- tout << "ll_lookup" << endl;
- tout << parent.val << endl;
- tout << name << endl;
+ dout(3) << "ll_lookup " << parent << " " << name << dendl;
+ tout << "ll_lookup" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
string dname = name;
Inode *diri = 0;
int r = 0;
if (inode_map.count(parent) == 0) {
- dout(1) << "ll_lookup " << parent << " " << name << " -> ENOENT (parent DNE... WTF)" << endl;
+ dout(1) << "ll_lookup " << parent << " " << name << " -> ENOENT (parent DNE... WTF)" << dendl;
r = -ENOENT;
attr->st_ino = 0;
goto out;
}
diri = inode_map[parent];
if (!diri->inode.is_dir()) {
- dout(1) << "ll_lookup " << parent << " " << name << " -> ENOTDIR (parent not a dir... WTF)" << endl;
+ dout(1) << "ll_lookup " << parent << " " << name << " -> ENOTDIR (parent not a dir... WTF)" << dendl;
r = -ENOTDIR;
attr->st_ino = 0;
goto out;
out:
dout(3) << "ll_lookup " << parent << " " << name
- << " -> " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
- tout << attr->st_ino << endl;
+ << " -> " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
+ tout << attr->st_ino << dendl;
return r;
}
if (in->ll_ref == 0)
in->get();
in->ll_get();
- dout(20) << "_ll_get " << in << " " << in->inode.ino << " -> " << in->ll_ref << endl;
+ dout(20) << "_ll_get " << in << " " << in->inode.ino << " -> " << in->ll_ref << dendl;
}
int Client::_ll_put(Inode *in, int num)
{
in->ll_put(num);
- dout(20) << "_ll_put " << in << " " << in->inode.ino << " " << num << " -> " << in->ll_ref << endl;
+ dout(20) << "_ll_put " << in << " " << in->inode.ino << " " << num << " -> " << in->ll_ref << dendl;
if (in->ll_ref == 0) {
put_inode(in);
return 0;
void Client::_ll_drop_pins()
{
- dout(10) << "_ll_drop_pins" << endl;
+ dout(10) << "_ll_drop_pins" << dendl;
hash_map<inodeno_t, Inode*>::iterator next;
for (hash_map<inodeno_t, Inode*>::iterator it = inode_map.begin();
it != inode_map.end();
bool Client::ll_forget(inodeno_t ino, int num)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_forget " << ino << " " << num << endl;
- tout << "ll_forget" << endl;
- tout << ino.val << endl;
- tout << num << endl;
+ dout(3) << "ll_forget " << ino << " " << num << dendl;
+ tout << "ll_forget" << dendl;
+ tout << ino.val << dendl;
+ tout << num << dendl;
if (ino == 1) return true; // ignore forget on root.
bool last = false;
if (inode_map.count(ino) == 0) {
dout(1) << "WARNING: ll_forget on " << ino << " " << num
- << ", which I don't have" << endl;
+ << ", which I don't have" << dendl;
} else {
Inode *in = inode_map[ino];
assert(in);
int Client::ll_getattr(inodeno_t ino, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_getattr " << ino << endl;
- tout << "ll_getattr" << endl;
- tout << ino.val << endl;
+ dout(3) << "ll_getattr " << ino << dendl;
+ tout << "ll_getattr" << dendl;
+ tout << ino.val << dendl;
Inode *in = _ll_get_inode(ino);
fill_stat(in, attr);
int Client::ll_setattr(inodeno_t ino, struct stat *attr, int mask)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_setattr " << ino << " mask " << hex << mask << dec << endl;
- tout << "ll_setattr" << endl;
- tout << ino.val << endl;
- tout << attr->st_mode << endl;
- tout << attr->st_uid << endl;
- tout << attr->st_gid << endl;
- tout << attr->st_size << endl;
- tout << attr->st_mtime << endl;
- tout << attr->st_atime << endl;
- tout << mask << endl;
+ dout(3) << "ll_setattr " << ino << " mask " << hex << mask << dec << dendl;
+ tout << "ll_setattr" << dendl;
+ tout << ino.val << dendl;
+ tout << attr->st_mode << dendl;
+ tout << attr->st_uid << dendl;
+ tout << attr->st_gid << dendl;
+ tout << attr->st_size << dendl;
+ tout << attr->st_mtime << dendl;
+ tout << attr->st_atime << dendl;
+ tout << mask << dendl;
Inode *in = _ll_get_inode(ino);
assert(r == 0);
fill_stat(in, attr);
- dout(3) << "ll_setattr " << ino << " = " << r << endl;
+ dout(3) << "ll_setattr " << ino << " = " << r << dendl;
return 0;
}
int Client::ll_readlink(inodeno_t ino, const char **value)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_readlink " << ino << endl;
- tout << "ll_readlink" << endl;
- tout << ino.val << endl;
+ dout(3) << "ll_readlink " << ino << dendl;
+ tout << "ll_readlink" << dendl;
+ tout << ino.val << dendl;
Inode *in = _ll_get_inode(ino);
int r = 0;
*value = "";
r = -EINVAL;
}
- dout(3) << "ll_readlink " << ino << " = " << r << " (" << *value << ")" << endl;
+ dout(3) << "ll_readlink " << ino << " = " << r << " (" << *value << ")" << dendl;
return r;
}
int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_mknod " << parent << " " << name << endl;
- tout << "ll_mknod" << endl;
- tout << parent.val << endl;
- tout << name << endl;
- tout << mode << endl;
- tout << rdev << endl;
+ dout(3) << "ll_mknod " << parent << " " << name << dendl;
+ tout << "ll_mknod" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
+ tout << mode << dendl;
+ tout << rdev << dendl;
Inode *diri = _ll_get_inode(parent);
fill_stat(in, attr);
_ll_get(in);
}
- tout << attr->st_ino << endl;
+ tout << attr->st_ino << dendl;
dout(3) << "ll_mknod " << parent << " " << name
- << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+ << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
return r;
}
int Client::ll_mkdir(inodeno_t parent, const char *name, mode_t mode, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_mkdir " << parent << " " << name << endl;
- tout << "ll_mkdir" << endl;
- tout << parent.val << endl;
- tout << name << endl;
- tout << mode << endl;
+ dout(3) << "ll_mkdir " << parent << " " << name << dendl;
+ tout << "ll_mkdir" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
+ tout << mode << dendl;
Inode *diri = _ll_get_inode(parent);
fill_stat(in, attr);
_ll_get(in);
}
- tout << attr->st_ino << endl;
+ tout << attr->st_ino << dendl;
dout(3) << "ll_mkdir " << parent << " " << name
- << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+ << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
return r;
}
int Client::ll_symlink(inodeno_t parent, const char *name, const char *value, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_symlink " << parent << " " << name << " -> " << value << endl;
- tout << "ll_symlink" << endl;
- tout << parent.val << endl;
- tout << name << endl;
- tout << value << endl;
+ dout(3) << "ll_symlink " << parent << " " << name << " -> " << value << dendl;
+ tout << "ll_symlink" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
+ tout << value << dendl;
Inode *diri = _ll_get_inode(parent);
fill_stat(in, attr);
_ll_get(in);
}
- tout << attr->st_ino << endl;
+ tout << attr->st_ino << dendl;
dout(3) << "ll_symlink " << parent << " " << name
- << " = " << r << " (" << hex << attr->st_ino << dec << ")" << endl;
+ << " = " << r << " (" << hex << attr->st_ino << dec << ")" << dendl;
return r;
}
int Client::ll_unlink(inodeno_t ino, const char *name)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_unlink " << ino << " " << name << endl;
- tout << "ll_unlink" << endl;
- tout << ino.val << endl;
- tout << name << endl;
+ dout(3) << "ll_unlink " << ino << " " << name << dendl;
+ tout << "ll_unlink" << dendl;
+ tout << ino.val << dendl;
+ tout << name << dendl;
Inode *diri = _ll_get_inode(ino);
int Client::ll_rmdir(inodeno_t ino, const char *name)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_rmdir " << ino << " " << name << endl;
- tout << "ll_rmdir" << endl;
- tout << ino.val << endl;
- tout << name << endl;
+ dout(3) << "ll_rmdir " << ino << " " << name << dendl;
+ tout << "ll_rmdir" << dendl;
+ tout << ino.val << dendl;
+ tout << name << dendl;
Inode *diri = _ll_get_inode(ino);
{
Mutex::Locker lock(client_lock);
dout(3) << "ll_rename " << parent << " " << name << " to "
- << newparent << " " << newname << endl;
- tout << "ll_rename" << endl;
- tout << parent.val << endl;
- tout << name << endl;
- tout << newparent.val << endl;
- tout << newname << endl;
+ << newparent << " " << newname << dendl;
+ tout << "ll_rename" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
+ tout << newparent.val << dendl;
+ tout << newname << dendl;
Inode *diri = _ll_get_inode(parent);
string path;
int Client::ll_link(inodeno_t ino, inodeno_t newparent, const char *newname, struct stat *attr)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_link " << ino << " to " << newparent << " " << newname << endl;
- tout << "ll_link" << endl;
- tout << ino.val << endl;
- tout << newparent << endl;
- tout << newname << endl;
+ dout(3) << "ll_link " << ino << " to " << newparent << " " << newname << dendl;
+ tout << "ll_link" << dendl;
+ tout << ino.val << dendl;
+ tout << newparent << dendl;
+ tout << newname << dendl;
Inode *old = _ll_get_inode(ino);
Inode *diri = _ll_get_inode(newparent);
int Client::ll_opendir(inodeno_t ino, void **dirpp)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_opendir " << ino << endl;
- tout << "ll_opendir" << endl;
- tout << ino.val << endl;
+ dout(3) << "ll_opendir " << ino << dendl;
+ tout << "ll_opendir" << dendl;
+ tout << ino.val << dendl;
Inode *diri = inode_map[ino];
assert(diri);
int r = _opendir(path.c_str(), (DirResult**)dirpp);
- tout << (unsigned long)*dirpp << endl;
+ tout << (unsigned long)*dirpp << dendl;
- dout(3) << "ll_opendir " << ino << " = " << r << " (" << *dirpp << ")" << endl;
+ dout(3) << "ll_opendir " << ino << " = " << r << " (" << *dirpp << ")" << dendl;
return r;
}
void Client::ll_releasedir(void *dirp)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_releasedir " << dirp << endl;
- tout << "ll_releasedir" << endl;
- tout << (unsigned long)dirp << endl;
+ dout(3) << "ll_releasedir " << dirp << dendl;
+ tout << "ll_releasedir" << dendl;
+ tout << (unsigned long)dirp << dendl;
_closedir((DirResult*)dirp);
}
int Client::ll_open(inodeno_t ino, int flags, Fh **fhp)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_open " << ino << " " << flags << endl;
- tout << "ll_open" << endl;
- tout << ino.val << endl;
- tout << flags << endl;
+ dout(3) << "ll_open " << ino << " " << flags << dendl;
+ tout << "ll_open" << dendl;
+ tout << ino.val << dendl;
+ tout << flags << dendl;
Inode *in = _ll_get_inode(ino);
string path;
int r = _open(path.c_str(), flags, 0, fhp);
- tout << (unsigned long)*fhp << endl;
- dout(3) << "ll_open " << ino << " " << flags << " = " << r << " (" << *fhp << ")" << endl;
+ tout << (unsigned long)*fhp << dendl;
+ dout(3) << "ll_open " << ino << " " << flags << " = " << r << " (" << *fhp << ")" << dendl;
return r;
}
struct stat *attr, Fh **fhp)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << endl;
- tout << "ll_create" << endl;
- tout << parent.val << endl;
- tout << name << endl;
- tout << mode << endl;
- tout << flags << endl;
+ dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << dendl;
+ tout << "ll_create" << dendl;
+ tout << parent.val << dendl;
+ tout << name << dendl;
+ tout << mode << dendl;
+ tout << flags << dendl;
Inode *pin = _ll_get_inode(parent);
string path;
} else {
attr->st_ino = 0;
}
- tout << (unsigned long)*fhp << endl;
- tout << attr->st_ino << endl;
+ tout << (unsigned long)*fhp << dendl;
+ tout << attr->st_ino << dendl;
dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags
- << " = " << r << " (" << *fhp << " " << hex << attr->st_ino << dec << ")" << endl;
+ << " = " << r << " (" << *fhp << " " << hex << attr->st_ino << dec << ")" << dendl;
return 0;
}
int Client::ll_read(Fh *fh, off_t off, off_t len, bufferlist *bl)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_read " << fh << " " << off << "~" << len << endl;
- tout << "ll_read" << endl;
- tout << (unsigned long)fh << endl;
- tout << off << endl;
- tout << len << endl;
+ dout(3) << "ll_read " << fh << " " << off << "~" << len << dendl;
+ tout << "ll_read" << dendl;
+ tout << (unsigned long)fh << dendl;
+ tout << off << dendl;
+ tout << len << dendl;
return _read(fh, off, len, bl);
}
int Client::ll_write(Fh *fh, off_t off, off_t len, const char *data)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_write " << fh << " " << off << "~" << len << endl;
- tout << "ll_write" << endl;
- tout << (unsigned long)fh << endl;
- tout << off << endl;
- tout << len << endl;
+ dout(3) << "ll_write " << fh << " " << off << "~" << len << dendl;
+ tout << "ll_write" << dendl;
+ tout << (unsigned long)fh << dendl;
+ tout << off << dendl;
+ tout << len << dendl;
return _write(fh, off, len, data);
}
int Client::ll_flush(Fh *fh)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_flush " << fh << endl;
- tout << "ll_flush" << endl;
- tout << (unsigned long)fh << endl;
+ dout(3) << "ll_flush " << fh << dendl;
+ tout << "ll_flush" << dendl;
+ tout << (unsigned long)fh << dendl;
return _flush(fh);
}
int Client::ll_release(Fh *fh)
{
Mutex::Locker lock(client_lock);
- dout(3) << "ll_release " << fh << endl;
- tout << "ll_release" << endl;
- tout << (unsigned long)fh << endl;
+ dout(3) << "ll_release " << fh << dendl;
+ tout << "ll_release" << dendl;
+ tout << (unsigned long)fh << dendl;
_release(fh);
return 0;
*lp = in->inode.layout;
- dout(3) << "describe_layout(" << fd << ") = 0" << endl;
+ dout(3) << "describe_layout(" << fd << ") = 0" << dendl;
return 0;
}
// map to a list of extents
filer->file_to_extents(in->inode, offset, length, result);
- dout(3) << "enumerate_layout(" << fd << ", " << length << ", " << offset << ") = 0" << endl;
+ dout(3) << "enumerate_layout(" << fd << ", " << length << ", " << offset << ") = 0" << dendl;
return 0;
}
int mon = monmap->pick_mon(true);
dout(0) << "ms_handle_failure " << *m << " to " << inst
<< ", resending to mon" << mon
- << endl;
+ << dendl;
messenger->send_message(m, monmap->get_inst(mon));
}
else if (dest.is_osd()) {
objecter->ms_handle_failure(m, dest, inst);
}
else if (dest.is_mds()) {
- dout(0) << "ms_handle_failure " << *m << " to " << inst << endl;
+ dout(0) << "ms_handle_failure " << *m << " to " << inst << dendl;
//failed_mds.insert(dest.num());
}
else {
// client?
- dout(0) << "ms_handle_failure " << *m << " to " << inst << ", dropping" << endl;
+ dout(0) << "ms_handle_failure " << *m << " to " << inst << ", dropping" << dendl;
delete m;
}
}
*
*/
-#include "config.h"
#include "include/types.h"
#include "FileCache.h"
#include "msg/Messenger.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_client) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
-#define derr(x) if (x <= g_conf.debug_client) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+#include "config.h"
+#define dout(x) if (x <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+#define derr(x) if (x <= g_conf.debug_client) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".filecache "
+
// flush/release/clean
{
off_t unclean = release_clean();
if (unclean) {
- dout(0) << "tear_down " << unclean << " unclean bytes, purging" << endl;
+ dout(0) << "tear_down " << unclean << " unclean bytes, purging" << dendl;
oc->purge_set(inode.ino);
}
}
void FileCache::truncate(off_t olds, off_t news)
{
- dout(5) << "truncate " << olds << " -> " << news << endl;
+ dout(5) << "truncate " << olds << " -> " << news << dendl;
// map range to objects
list<ObjectExtent> ls;
void FileCache::set_caps(int caps, Context *onimplement)
{
if (onimplement) {
- dout(10) << "set_caps setting onimplement context for " << cap_string(caps) << endl;
+ dout(10) << "set_caps setting onimplement context for " << cap_string(caps) << dendl;
assert(latest_caps & ~caps); // we should be losing caps.
caps_callbacks[caps].push_back(onimplement);
}
{
// calc used
int used = get_used_caps();
- dout(10) << "check_caps used was " << cap_string(used) << endl;
+ dout(10) << "check_caps used was " << cap_string(used) << dendl;
// try to implement caps?
// BUG? latest_caps, not least caps i've seen?
flush_dirty(new C_FC_CheckCaps(this));
used = get_used_caps();
- dout(10) << "check_caps used now " << cap_string(used) << endl;
+ dout(10) << "check_caps used now " << cap_string(used) << dendl;
// check callbacks
map<int, list<Context*> >::iterator p = caps_callbacks.begin();
if (used == 0 || (~(p->first) & used) == 0) {
// implemented.
dout(10) << "used is " << cap_string(used)
- << ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << endl;
+ << ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << dendl;
finish_contexts(p->second);
map<int, list<Context*> >::iterator o = p;
p++;
caps_callbacks.erase(o);
} else {
dout(10) << "used is " << cap_string(used)
- << ", caps " << cap_string(p->first) << " not yet implemented" << endl;
+ << ", caps " << cap_string(p->first) << " not yet implemented" << dendl;
p++;
}
}
// can i read?
while ((latest_caps & CAP_FILE_RD) == 0) {
- dout(10) << "read doesn't have RD cap, blocking" << endl;
+ dout(10) << "read doesn't have RD cap, blocking" << dendl;
Cond c;
waitfor_read.insert(&c);
c.Wait(client_lock);
{
// can i write
while ((latest_caps & CAP_FILE_WR) == 0) {
- dout(10) << "write doesn't have WR cap, blocking" << endl;
+ dout(10) << "write doesn't have WR cap, blocking" << dendl;
Cond c;
waitfor_write.insert(&c);
c.Wait(client_lock);
#include <sys/statvfs.h>
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_client) cout << g_clock.now() << " synthetic" << client->get_nodeid() << " "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_client) cout << dbeginl << g_clock.now() << " synthetic" << client->get_nodeid() << " "
// traces
//void trace_include(SyntheticClient *syn, Client *cl, string& prefix);
syn_sargs.push_back(args[++i]);
syn_iargs.push_back(atoi(args[++i]));
} else {
- cerr << "unknown syn arg " << args[i] << endl;
+ cerr << "unknown syn arg " << args[i] << dendl;
assert(0);
}
}
sprintf(s,"syn.%d.%d", client->whoami, seq);
a = s;
}
- //cout << "a is " << a << endl;
return a;
}
{
//run_start = g_clock.now();
run_until = utime_t(0,0);
- dout(5) << "run" << endl;
+ dout(5) << "run" << dendl;
for (list<int>::iterator it = modes.begin();
it != modes.end();
it++) {
int mode = *it;
- dout(3) << "mode " << mode << endl;
+ dout(3) << "mode " << mode << dendl;
switch (mode) {
case SYNCLIENT_MODE_FOO:
int iarg1 = iargs.front();
iargs.pop_front();
if (run_me()) {
- dout(2) << "sleep " << iarg1 << endl;
+ dout(2) << "sleep " << iarg1 << dendl;
sleep(iarg1);
}
}
run_only = iargs.front();
iargs.pop_front();
if (run_only == client->get_nodeid())
- dout(2) << "only " << run_only << endl;
+ dout(2) << "only " << run_only << dendl;
}
break;
case SYNCLIENT_MODE_EXCLUDE:
exclude = iargs.front();
iargs.pop_front();
if (exclude == client->get_nodeid())
- dout(2) << "not running " << exclude << endl;
+ dout(2) << "not running " << exclude << dendl;
}
break;
int iarg1 = iargs.front();
iargs.pop_front();
if (iarg1) {
- dout(2) << "until " << iarg1 << endl;
+ dout(2) << "until " << iarg1 << dendl;
utime_t dur(iarg1,0);
run_until = run_start + dur;
} else {
- dout(2) << "until " << iarg1 << " (no limit)" << endl;
+ dout(2) << "until " << iarg1 << " (no limit)" << dendl;
run_until = utime_t(0,0);
}
}
int iarg1 = iargs.front();
iargs.pop_front();
if (iarg1) {
- dout(2) << "sleepuntil " << iarg1 << endl;
+ dout(2) << "sleepuntil " << iarg1 << dendl;
utime_t at = g_clock.now() - run_start;
if (at.sec() < iarg1)
sleep(iarg1 - at.sec());
int iarg1 = iargs.front();
iargs.pop_front();
if (run_me()) {
- dout(2) << "randomwalk " << iarg1 << endl;
+ dout(2) << "randomwalk " << iarg1 << dendl;
random_walk(iarg1);
}
}
string sarg1 = get_sarg(0);
int iarg1 = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "makedirmess " << sarg1 << " " << iarg1 << endl;
+ dout(2) << "makedirmess " << sarg1 << " " << iarg1 << dendl;
make_dir_mess(sarg1.c_str(), iarg1);
}
}
int iarg2 = iargs.front(); iargs.pop_front();
int iarg3 = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "makedirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+ dout(2) << "makedirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
make_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
}
}
int iarg2 = iargs.front(); iargs.pop_front();
int iarg3 = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "statdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+ dout(2) << "statdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
stat_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
}
}
int iarg2 = iargs.front(); iargs.pop_front();
int iarg3 = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "readdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+ dout(2) << "readdirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
read_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
}
}
int iarg3 = iargs.front(); iargs.pop_front();
int iarg4 = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "thrashlinks " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+ dout(2) << "thrashlinks " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << dendl;
thrash_links(sarg1.c_str(), iarg1, iarg2, iarg3, iarg4);
}
}
int count = iargs.front(); iargs.pop_front();
int priv = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "makefiles " << num << " " << count << " " << priv << endl;
+ dout(2) << "makefiles " << num << " " << count << " " << priv << dendl;
make_files(num, count, priv, false);
}
}
int count = iargs.front(); iargs.pop_front();
int priv = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "makefiles2 " << num << " " << count << " " << priv << endl;
+ dout(2) << "makefiles2 " << num << " " << count << " " << priv << dendl;
make_files(num, count, priv, true);
}
}
string sarg1 = get_sarg(0);
int num = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "createshared " << num << endl;
+ dout(2) << "createshared " << num << dendl;
create_shared(num);
}
}
int num = iargs.front(); iargs.pop_front();
int count = iargs.front(); iargs.pop_front();
if (run_me()) {
- dout(2) << "openshared " << num << endl;
+ dout(2) << "openshared " << num << dendl;
open_shared(num, count);
}
}
{
string sarg1;// = get_sarg(0);
if (run_me()) {
- dout(2) << "fullwalk" << sarg1 << endl;
+ dout(2) << "fullwalk" << sarg1 << dendl;
full_walk(sarg1);
}
}
{
string sarg1 = get_sarg(0);
if (run_me()) {
- dout(2) << "repeatwalk " << sarg1 << endl;
+ dout(2) << "repeatwalk " << sarg1 << dendl;
while (full_walk(sarg1) == 0) ;
}
}
string sarg1 = get_sarg(0);
int iarg1 = iargs.front(); iargs.pop_front();
int iarg2 = iargs.front(); iargs.pop_front();
- cout << "WRITING SYN CLIENT" << endl;
+ dout(1) << "WRITING SYN CLIENT" << dendl;
if (run_me())
write_file(sarg1, iarg1, iarg2);
}
int iarg1 = iargs.front(); iargs.pop_front();
int iarg2 = iargs.front(); iargs.pop_front();
- cout << "READING SYN CLIENT" << endl;
+ dout(1) << "READING SYN CLIENT" << dendl;
if (run_me())
read_file(sarg1, iarg1, iarg2);
}
int iarg1 = iargs.front(); iargs.pop_front();
int iarg2 = iargs.front(); iargs.pop_front();
- cout << "RANDOM READ WRITE SYN CLIENT" << endl;
+ dout(1) << "RANDOM READ WRITE SYN CLIENT" << dendl;
if (run_me())
read_random(sarg1, iarg1, iarg2);
}
int iarg1 = iargs.front(); iargs.pop_front();
int iarg2 = iargs.front(); iargs.pop_front();
- cout << "RANDOM READ WRITE SYN CLIENT" << endl;
+ dout(1) << "RANDOM READ WRITE SYN CLIENT" << dendl;
if (run_me())
read_random_ex(sarg1, iarg1, iarg2);
}
string prefix = get_sarg(0);
if (run_me()) {
- dout(2) << "trace " << tfile << " prefix " << prefix << " ... " << iarg1 << " times" << endl;
+ dout(2) << "trace " << tfile << " prefix " << prefix << " ... " << iarg1 << " times" << dendl;
Trace t(tfile.c_str());
utime_t lat = g_clock.now();
lat -= start;
- dout(1) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << endl;
+ dout(1) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << dendl;
if (client_logger
&& i > 0
&& i < iarg1-1
void SyntheticClient::up()
{
cwd = cwd.prefixpath(cwd.depth()-1);
- dout(DBL) << "cd .. -> " << cwd << endl;
+ dout(DBL) << "cd .. -> " << cwd << dendl;
clear_dir();
}
int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
{
- dout(4) << "play trace" << endl;
+ dout(4) << "play trace" << dendl;
t.start();
char buf[1024];
utime_t now = last_status;
if (now - last_status > 1.0) {
last_status = now;
- dout(1) << "play_trace at line " << t.get_line() << endl;
+ dout(1) << "play_trace at line " << t.get_line() << dendl;
}
}
// op
const char *op = t.get_string(buf, 0);
- dout(4) << (t.get_line()-1) << ": trace op " << op << endl;
+ dout(4) << (t.get_line()-1) << ": trace op " << op << dendl;
if (op[0] == '@') {
// timestamp... ignore it!
if (client->ll_symlink(ll_inos[i], n, v, &attr) == 0)
ll_inos[ri] = attr.st_ino;
else
- cout << "**** symlink returned an error ****" << endl;
+ dout(0) << "**** symlink returned an error ****" << dendl;
} else if (strcmp(op, "ll_unlink") == 0) {
int64_t i = t.get_int();
const char *n = t.get_string(buf, p);
}
else {
- cout << (t.get_line()-1) << ": *** trace hit unrecognized symbol '" << op << "' " << endl;
+ dout(0) << (t.get_line()-1) << ": *** trace hit unrecognized symbol '" << op << "' " << dendl;
assert(0);
}
}
for (hash_map<int64_t, int64_t>::iterator fi = open_files.begin();
fi != open_files.end();
fi++) {
- dout(1) << "leftover close " << fi->second << endl;
+ dout(1) << "leftover close " << fi->second << dendl;
if (fi->second > 0) client->close(fi->second);
}
for (hash_map<int64_t, DIR*>::iterator fi = open_dirs.begin();
fi != open_dirs.end();
fi++) {
- dout(1) << "leftover closedir " << fi->second << endl;
+ dout(1) << "leftover closedir " << fi->second << dendl;
if (fi->second != 0) client->closedir(fi->second);
}
for (hash_map<int64_t,Fh*>::iterator fi = ll_files.begin();
fi != ll_files.end();
fi++) {
- dout(1) << "leftover ll_release " << fi->second << endl;
+ dout(1) << "leftover ll_release " << fi->second << dendl;
if (fi->second > 0) client->ll_release(fi->second);
}
for (hash_map<int64_t,void*>::iterator fi = ll_dirs.begin();
fi != ll_dirs.end();
fi++) {
- dout(1) << "leftover ll_releasedir " << fi->second << endl;
+ dout(1) << "leftover ll_releasedir " << fi->second << dendl;
if (fi->second > 0) client->ll_releasedir(fi->second);
}
list<string> contents;
int r = client->getdir(basedir.c_str(), contents);
if (r < 0) {
- dout(1) << "readdir on " << basedir << " returns " << r << endl;
+ dout(1) << "readdir on " << basedir << " returns " << r << dendl;
return r;
}
struct stat st;
int r = client->lstat(file.c_str(), &st);
if (r < 0) {
- dout(1) << "stat error on " << file << " r=" << r << endl;
+ dout(1) << "stat error on " << file << " r=" << r << dendl;
continue;
}
list<string> contents;
int r = client->getdir(dir.c_str(), contents);
if (r < 0) {
- dout(1) << "readdir on " << dir << " returns " << r << endl;
+ dout(1) << "readdir on " << dir << " returns " << r << dendl;
continue;
}
struct stat st;
int r = client->lstat(file.c_str(), &st);
if (r < 0) {
- dout(1) << "stat error on " << file << " r=" << r << endl;
+ dout(1) << "stat error on " << file << " r=" << r << dendl;
continue;
}
// make sure base dir exists
int r = client->mkdir(basedir, 0755);
if (r != 0) {
- dout(1) << "can't make base dir? " << basedir << endl;
+ dout(1) << "can't make base dir? " << basedir << dendl;
return -1;
}
// children
char d[500];
- dout(3) << "make_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+ dout(3) << "make_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
for (int i=0; i<files; i++) {
sprintf(d,"%s/file.%d", basedir, i);
client->mknod(d, 0644);
struct stat st;
int r = client->lstat(basedir, &st);
if (r != 0) {
- dout(1) << "can't make base dir? " << basedir << endl;
+ dout(1) << "can't make base dir? " << basedir << dendl;
return -1;
}
// children
char d[500];
- dout(3) << "stat_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+ dout(3) << "stat_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
for (int i=0; i<files; i++) {
sprintf(d,"%s/file.%d", basedir, i);
client->lstat(d, &st);
// children
char d[500];
- dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << endl;
+ dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
list<string> contents;
utime_t s = g_clock.now();
e -= s;
if (client_logger) client_logger->finc("readdir", e);
if (r < 0) {
- dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << endl;
+ dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << dendl;
return -1;
}
sprintf(d,"%s/file.%d", basedir, i);
utime_t s = g_clock.now();
if (client->lstat(d, &st) < 0) {
- dout(2) << "read_dirs failed stat on " << d << ", stopping" << endl;
+ dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
return -1;
}
utime_t e = g_clock.now();
uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)wrsize;
int fd = client->open(fn.c_str(), O_RDWR|O_CREAT);
- dout(5) << "writing to " << fn << " fd " << fd << endl;
+ dout(5) << "writing to " << fn << " fd " << fd << dendl;
if (fd < 0) return fd;
for (unsigned i=0; i<chunks; i++) {
if (time_to_stop()) {
- dout(0) << "stopping" << endl;
+ dout(0) << "stopping" << dendl;
break;
}
- dout(2) << "writing block " << i << "/" << chunks << endl;
+ dout(2) << "writing block " << i << "/" << chunks << dendl;
// fill buf with a 16 byte fingerprint
// 64 bits : file offset
{
for (int i=0; i<nfile; i++) {
string sarg1 = get_sarg(i);
- dout(0) << "Write file " << sarg1 << endl;
+ dout(0) << "Write file " << sarg1 << dendl;
write_file(sarg1, size, wrsize);
}
return 0;
uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)rdsize;
int fd = client->open(fn.c_str(), O_RDONLY);
- dout(5) << "reading from " << fn << " fd " << fd << endl;
+ dout(5) << "reading from " << fn << " fd " << fd << dendl;
if (fd < 0) return fd;
for (unsigned i=0; i<chunks; i++) {
if (time_to_stop()) break;
- dout(2) << "reading block " << i << "/" << chunks << endl;
+ dout(2) << "reading block " << i << "/" << chunks << dendl;
int r = client->read(fd, buf, rdsize, i*rdsize);
if (r < rdsize) {
- dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+ dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
break;
}
if (!bad && !ignoreprint)
dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
<< ", should be offset " << wantoff << " clietn " << client->get_nodeid()
- << endl;
+ << dendl;
bad++;
}
}
if (bad && !ignoreprint)
- dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+ dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
}
client->close(fd);
__uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize;
int fd = client->open(fn.c_str(), O_RDWR);
- dout(5) << "reading from " << fn << " fd " << fd << endl;
+ dout(5) << "reading from " << fn << " fd " << fd << dendl;
- // cout << "READING FROM " << fn << " fd " << fd << endl;
+ // dout(0) << "READING FROM " << fn << " fd " << fd << dendl;
- // cout << "filename " << fn << " size:" << size << " read size|" << rdsize << "|" << "\ chunks: |" << chunks <<"|" << endl;
+ // dout(0) << "filename " << fn << " size:" << size << " read size|" << rdsize << "|" << "\ chunks: |" << chunks <<"|" << dendl;
if (fd < 0) return fd;
int offset;
// use rand instead ??
double x = drand48();
- //cout << "RANDOM NUMBER RETURN |" << x << "|" << endl;
+ //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
if ( x < 0.5)
{
- //cout << "DECIDED TO READ " << x << endl;
+ //dout(0) << "DECIDED TO READ " << x << dendl;
buf = new char[rdsize];
memset(buf, 1, rdsize);
read=true;
}
else
{
- // cout << "DECIDED TO WRITE " << x << endl;
+ // dout(0) << "DECIDED TO WRITE " << x << dendl;
buf = new char[rdsize+100]; // 1 MB
memset(buf, 7, rdsize);
}
//double y = drand48() ;
- //cout << "OFFSET is |" << offset << "| chunks |" << chunks<< endl;
+ //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<< dendl;
if ( read)
{
offset=(rand())%(chunks+1);
- dout(2) << "reading block " << offset << "/" << chunks << endl;
+ dout(2) << "reading block " << offset << "/" << chunks << dendl;
int r = client->read(fd, buf, rdsize,
offset*rdsize);
if (r < rdsize) {
- dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+ dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
}
}
else
{
- dout(2) << "writing block " << offset << "/" << chunks << endl;
+ dout(2) << "writing block " << offset << "/" << chunks << dendl;
// fill buf with a 16 byte fingerprint
// 64 bits : file offset
if (!bad)
dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
<< ", should be offset " << wantoff << " clietn " << client->get_nodeid()
- << endl;
+ << dendl;
bad++;
}
}
if (bad)
- dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+ dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
}
}
__uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize;
int fd = client->open(fn.c_str(), O_RDWR);
- dout(5) << "reading from " << fn << " fd " << fd << endl;
+ dout(5) << "reading from " << fn << " fd " << fd << dendl;
- // cout << "READING FROM " << fn << " fd " << fd << endl;
+ // dout(0) << "READING FROM " << fn << " fd " << fd << dendl;
- // cout << "filename " << fn << " size:" << size << " read size|" << rdsize << "|" << "\ chunks: |" << chunks <<"|" << endl;
+ // dout(0) << "filename " << fn << " size:" << size << " read size|" << rdsize << "|" << "\ chunks: |" << chunks <<"|" << dendl;
if (fd < 0) return fd;
int offset;
// use rand instead ??
double x = drand48();
- //cout << "RANDOM NUMBER RETURN |" << x << "|" << endl;
+ //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
if ( x < 0.5)
{
- //cout << "DECIDED TO READ " << x << endl;
+ //dout(0) << "DECIDED TO READ " << x << dendl;
buf = new char[rdsize];
memset(buf, 1, rdsize);
read=true;
}
else
{
- // cout << "DECIDED TO WRITE " << x << endl;
+ // dout(0) << "DECIDED TO WRITE " << x << dendl;
buf = new char[rdsize+100]; // 1 MB
memset(buf, 7, rdsize);
}
//double y = drand48() ;
- //cout << "OFFSET is |" << offset << "| chunks |" << chunks<< endl;
+ //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<< dendl;
if ( read)
{
offset= normdist( 0 , chunks/20 , 5 )*20;*/
- dout(2) << "reading block " << offset << "/" << chunks << endl;
+ dout(2) << "reading block " << offset << "/" << chunks << dendl;
int r = client->read(fd, buf, rdsize,
offset*rdsize);
if (r < rdsize) {
- dout(1) << "read_file got r = " << r << ", probably end of file" << endl;
+ dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
}
}
else
{
- dout(2) << "writing block " << offset << "/" << chunks << endl;
+ dout(2) << "writing block " << offset << "/" << chunks << dendl;
// fill buf with a 16 byte fingerprint
// 64 bits : file offset
if (!bad)
dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
<< ", should be offset " << wantoff << " clietn " << client->get_nodeid()
- << endl;
+ << dendl;
bad++;
}
}
if (bad)
- dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << endl;
+ dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
}
}
{
int left = num_req;
- //dout(1) << "random_walk() will do " << left << " ops" << endl;
+ //dout(1) << "random_walk() will do " << left << " ops" << dendl;
init_op_dist(); // set up metadata op distribution
// ascend?
if (cwd.depth() && !roll_die(::pow((double).9, (double)cwd.depth()))) {
- dout(DBL) << "die says up" << endl;
+ dout(DBL) << "die says up" << dendl;
up();
continue;
}
if (.9*roll_die(::pow((double).9,(double)cwd.depth())) && subdirs.size()) {
string s = get_random_subdir();
cwd.push_dentry( s );
- dout(DBL) << "cd " << s << " -> " << cwd << endl;
+ dout(DBL) << "cd " << s << " -> " << cwd << dendl;
clear_dir();
continue;
}
if (contents.empty() && roll_die(.3)) {
if (did_readdir) {
- dout(DBL) << "empty dir, up" << endl;
+ dout(DBL) << "empty dir, up" << dendl;
up();
} else
op = MDS_OP_READDIR;
} else {
op = op_dist.sample();
}
- //dout(DBL) << "op is " << op << endl;
+ //dout(DBL) << "op is " << op << dendl;
int r = 0;
if (contents.empty()) {
if (did_readdir) {
if (roll_die(.1)) {
- dout(DBL) << "stat in empty dir, up" << endl;
+ dout(DBL) << "stat in empty dir, up" << dendl;
up();
} else {
op = MDS_OP_MKNOD;
for (list<string>::iterator it = c.begin();
it != c.end();
it++) {
- //dout(DBL) << " got " << *it << endl;
+ //dout(DBL) << " got " << *it << dendl;
assert(0);
/*contents[*it] = it->second;
if (it->second &&
//while (cwd.depth()) {
//if (client->lookup(cwd)) break; // it's in the cache
- //dout(DBL) << "r = " << r << ", client doesn't have " << cwd << ", cd .." << endl;
- dout(DBL) << "r = " << r << ", client may not have " << cwd << ", cd .." << endl;
+ //dout(DBL) << "r = " << r << ", client doesn't have " << cwd << ", cd .." << dendl;
+ dout(DBL) << "r = " << r << ", client may not have " << cwd << ", cd .." << dendl;
up();
//}
}
}
// close files
- dout(DBL) << "closing files" << endl;
+ dout(DBL) << "closing files" << dendl;
while (!open_files.empty()) {
int fh = get_random_fh();
int r = client->close( fh );
if (r == 0) open_files.erase(fh);
}
- dout(DBL) << "done" << endl;
+ dout(DBL) << "done" << dendl;
return 0;
}
{
dout(1) << "thrash_links " << basedir << " " << dirs << " " << files << " " << depth
<< " links " << n
- << endl;
+ << dendl;
if (time_to_stop()) return 0;
void SyntheticClient::import_find(const char *base, const char *find, bool data)
{
- dout(1) << "import_find " << base << " from " << find << " data=" << data << endl;
+ dout(1) << "import_find " << base << " from " << find << " data=" << data << dendl;
/* use this to gather the static trace:
*
if (modestring[8] == 'w') mode |= 02;
if (modestring[9] == 'x') mode |= 01;
- dout(20) << " mode " << modestring << " to " << oct << mode << dec << endl;
+ dout(20) << " mode " << modestring << " to " << oct << mode << dec << dendl;
if (S_ISLNK(mode)) {
// target vs destination
} else {
target = filename.substr(pos + 4);
}
- dout(10) << "symlink from '" << link << "' -> '" << target << "'" << endl;
+ dout(10) << "symlink from '" << link << "' -> '" << target << "'" << dendl;
client->symlink(target.c_str(), link.c_str());
} else {
string f = base;
if (S_ISDIR(mode)) {
client->mkdir(f.c_str(), mode);
} else {
- int fd = client->open(f.c_str(), O_WRONLY|O_CREAT);
+ int fd = client->open(f.c_str(), O_WRONLY|O_CREAT, mode & 0777);
assert(fd > 0);
client->write(fd, "", 0, size);
client->close(fd);
- client->chmod(f.c_str(), mode & 0777);
+ //client->chmod(f.c_str(), mode & 0777);
client->chown(f.c_str(), uid, gid);
struct utimbuf ut;
+
//
Trace::Trace(const char* f)
{
fs.open(f);
if (!fs.is_open()) {
- dout(0) << "** unable to open trace file " << f << endl;
+ generic_dout(0) << "** unable to open trace file " << f << dendl;
assert(0);
}
- dout(2) << "opened traced file '" << f << "'" << endl;
+ generic_dout(2) << "opened traced file '" << f << "'" << dendl;
}
Trace::~Trace()
void finish(int) {
int size = &g_conf.debug_after - &g_conf.debug;
memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
- dout(0) << "debug_after flipping debug settings" << endl;
+ generic_dout(0) << "debug_after flipping debug settings" << dendl;
}
};
void finish(int) {
int size = &g_conf.debug_after - &g_conf.debug;
memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
- dout(0) << "debug_after flipping debug settings" << endl;
+ generic_dout(0) << "debug_after flipping debug settings" << dendl;
}
};
void dispatch(Message *m) {
switch (m->get_type()) {
case MSG_MON_COMMAND_ACK:
- dout(0) << m->get_source() << " -> '"
- << ((MMonCommandAck*)m)->rs << "' (" << ((MMonCommandAck*)m)->r << ")"
- << endl;
+ generc_dout(0) << m->get_source() << " -> '"
+ << ((MMonCommandAck*)m)->rs << "' (" << ((MMonCommandAck*)m)->r << ")"
+ << dendl;
messenger->shutdown();
break;
}
}
int mon = monmap.pick_mon();
- dout(0) << "mon" << mon << " <- '" << cmd << "'" << endl;
+ generic_dout(0) << "mon" << mon << " <- '" << cmd << "'" << dendl;
// send it
messenger->send_message(m, monmap.get_inst(mon));
}
int join(void **prval = 0) {
if (thread_id == 0) {
- cerr << "WARNING: join on thread that was never started" << endl;
+ generic_derr(0) << "WARNING: join on thread that was never started" << dendl;
//assert(0);
return -EINVAL; // never started.
}
if (status != 0) {
switch (status) {
case -EINVAL:
- cerr << "thread " << thread_id << " join status = EINVAL" << endl;
+ generic_derr(0) << "thread " << thread_id << " join status = EINVAL" << dendl;
break;
case -ESRCH:
- cerr << "thread " << thread_id << " join status = ESRCH" << endl;
+ generic_derr(0) << "thread " << thread_id << " join status = ESRCH" << dendl;
assert(0);
break;
case -EDEADLK:
- cerr << "thread " << thread_id << " join status = EDEADLK" << endl;
+ generic_derr(0) << "thread " << thread_id << " join status = EDEADLK" << dendl;
break;
default:
- cerr << "thread " << thread_id << " join status = " << status << endl;
+ generic_derr(0) << "thread " << thread_id << " join status = " << status << dendl;
}
assert(0); // none of these should happen.
}
#include "config.h"
#include "include/Context.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_timer) cout << g_clock.now() << " TIMER "
-#define derr(x) if (x <= g_conf.debug_timer) cerr << g_clock.now() << " TIMER "
+#define dout(x) if (x <= g_conf.debug_timer) cout << dbeginl << g_clock.now() << " TIMER "
+#define derr(x) if (x <= g_conf.debug_timer) cerr << dbeginl << g_clock.now() << " TIMER "
#define DBL 10
bool Timer::get_next_due(utime_t& when)
{
if (scheduled.empty()) {
- dout(10) << "get_next_due - nothing scheduled" << endl;
+ dout(10) << "get_next_due - nothing scheduled" << dendl;
return false;
} else {
map< utime_t, set<Context*> >::iterator it = scheduled.begin();
when = it->first;
- dout(10) << "get_next_due - " << when << endl;
+ dout(10) << "get_next_due - " << when << dendl;
return true;
}
}
if (it->first > now) break;
utime_t t = it->first;
- dout(DBL) << "queueing event(s) scheduled at " << t << endl;
+ dout(DBL) << "queueing event(s) scheduled at " << t << dendl;
for (set<Context*>::iterator cit = it->second.begin();
cit != it->second.end();
for (list<Context*>::iterator cit = pending.begin();
cit != pending.end();
cit++) {
- dout(DBL) << "start callback " << *cit << endl;
+ dout(DBL) << "start callback " << *cit << dendl;
(*cit)->finish(0);
- dout(DBL) << "finish callback " << *cit << endl;
+ dout(DBL) << "finish callback " << *cit << dendl;
delete *cit;
}
pending.clear();
else {
// sleep
if (next_due) {
- dout(DBL) << "sleeping until " << next << endl;
+ dout(DBL) << "sleeping until " << next << dendl;
timed_sleep = true;
sleeping = true;
timeout_cond.WaitUntil(lock, next); // wait for waker or time
utime_t now = g_clock.now();
- dout(DBL) << "kicked or timed out at " << now << endl;
+ dout(DBL) << "kicked or timed out at " << now << dendl;
} else {
- dout(DBL) << "sleeping" << endl;
+ dout(DBL) << "sleeping" << dendl;
timed_sleep = false;
sleeping = true;
sleep_cond.Wait(lock); // wait for waker
utime_t now = g_clock.now();
- dout(DBL) << "kicked at " << now << endl;
+ dout(DBL) << "kicked at " << now << dendl;
}
}
}
{
if (timer_thread.is_started()) {
if (sleeping) {
- dout(DBL) << "register_timer kicking thread" << endl;
+ dout(DBL) << "register_timer kicking thread" << dendl;
if (timed_sleep)
timeout_cond.SignalAll();
else
sleep_cond.SignalAll();
} else {
- dout(DBL) << "register_timer doing nothing; thread is awake" << endl;
+ dout(DBL) << "register_timer doing nothing; thread is awake" << dendl;
// it's probably doing callbacks.
}
} else {
- dout(DBL) << "register_timer starting thread" << endl;
+ dout(DBL) << "register_timer starting thread" << dendl;
timer_thread.create();
}
}
{
// clear my callback pointers
if (timer_thread.is_started()) {
- dout(10) << "setting thread_stop flag" << endl;
+ dout(10) << "setting thread_stop flag" << dendl;
lock.Lock();
thread_stop = true;
if (timed_sleep)
sleep_cond.SignalAll();
lock.Unlock();
- dout(10) << "waiting for thread to finish" << endl;
+ dout(10) << "waiting for thread to finish" << dendl;
void *ptr;
timer_thread.join(&ptr);
- dout(10) << "thread finished, exit code " << ptr << endl;
+ dout(10) << "thread finished, exit code " << ptr << dendl;
}
}
{
lock.Lock();
- dout(DBL) << "add_event " << callback << " at " << when << endl;
+ dout(DBL) << "add_event " << callback << " at " << when << dendl;
// insert
scheduled[when].insert(callback);
{
lock.Lock();
- dout(DBL) << "cancel_event " << callback << endl;
+ dout(DBL) << "cancel_event " << callback << dendl;
if (!event_times.count(callback)) {
- dout(DBL) << "cancel_event " << callback << " isn't scheduled (probably executing)" << endl;
+ dout(DBL) << "cancel_event " << callback << " isn't scheduled (probably executing)" << dendl;
lock.Unlock();
return false; // wasn't scheduled.
}
{
assert(lock.is_locked());
Context *w = new EventWrapper(this, c);
- dout(DBL) << "SafeTimer.add_event_after wrapping " << c << " with " << w << endl;
+ dout(DBL) << "SafeTimer.add_event_after wrapping " << c << " with " << w << dendl;
scheduled[c] = w;
g_timer.add_event_after(seconds, w);
}
{
assert(lock.is_locked());
Context *w = new EventWrapper(this, c);
- dout(DBL) << "SafeTimer.add_event_at wrapping " << c << " with " << w << endl;
+ dout(DBL) << "SafeTimer.add_event_at wrapping " << c << " with " << w << dendl;
scheduled[c] = w;
g_timer.add_event_at(when, w);
}
while (!canceled.empty()) {
// wait
- dout(-10) << "SafeTimer.join waiting for " << canceled.size() << " to join" << endl;
- dout(-10) << canceled << endl;
+ dout(-10) << "SafeTimer.join waiting for " << canceled.size() << " to join" << dendl;
+ dout(-10) << canceled << dendl;
cond.Wait(lock);
}
}
if (!scheduled.empty() && !canceled.empty()) {
derr(0) << "SafeTimer.~SafeTimer " << scheduled.size() << " events scheduled, "
<< canceled.size() << " canceled but unflushed"
- << endl;
+ << dendl;
}
}
Mutex bufferlock;
#include "osd/osd_types.h"
+
+// debug output lock
Mutex _dout_lock;
FileLayout g_OSD_FileLayout( 1<<23, 1, 1<<23, pg_t::TYPE_REP, 2 ); // 8M objects, 2x replication
extern md_config_t g_debug_after_conf;
-/**
- * debug output framework
- */
-#define dout(x) if ((x) <= g_conf.debug) std::cout
-#define dout2(x) if ((x) <= g_conf.debug) std::cout
-
-#define pdout(x,p) if ((x) <= (p)) std::cout
-
-
/**
* command line / environment argument parsing
*/
extern bool parse_ip_port(const char *s, entity_addr_t& addr);
+/**
+ * for cleaner output, bracket each line with
+ * dbeginl (in the dout macro) and dendl (in place of endl).
+ */
+extern Mutex _dout_lock;
+struct _dbeginl_t {
+ _dbeginl_t(int) {}
+};
+struct _dendl_t {
+ _dendl_t(int) {}
+};
+static const _dbeginl_t dbeginl = 0;
+static const _dendl_t dendl = 0;
+
+inline ostream& operator<<(ostream& out, _dbeginl_t) {
+ _dout_lock.Lock();
+ return out;
+}
+inline ostream& operator<<(ostream& out, _dendl_t) {
+ out << endl;
+ _dout_lock.Unlock();
+ return out;
+}
+
+// generic macros
+#define generic_dout(x) if ((x) <= g_conf.debug) std::cout << dbeginl
+#define generic_derr(x) if ((x) <= g_conf.debug) std::cerr << dbeginl
+
+#define pdout(x,p) if ((x) <= (p)) std::cout << dbeginl
#endif
void finish(int) {
int size = &g_conf.debug_after - &g_conf.debug;
memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
- dout(0) << "debug_after flipping debug settings" << endl;
+ cout << "debug_after flipping debug settings" << endl;
}
};
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-#ifndef __DEBUG_H
-#define __DEBUG_H
-
-#include "config.h"
-
-#undef dout
-
-/**
- * for cleaner output, bracket each line with
- * dbeginl (in the dout macro) and dendl (in place of endl).
- */
-extern Mutex _dout_lock;
-struct _dbeginl_t {
- _dbeginl_t(int) {}
-};
-struct _dendl_t {
- _dendl_t(int) {}
-};
-static const _dbeginl_t dbeginl = 0;
-static const _dendl_t dendl = 0;
-
-inline ostream& operator<<(ostream& out, _dbeginl_t) {
- _dout_lock.Lock();
- return out;
-}
-inline ostream& operator<<(ostream& out, _dendl_t) {
- out << endl;
- _dout_lock.Unlock();
- return out;
-}
-
-#endif
#include "Allocator.h"
#include "Ebofs.h"
-#include "debug.h"
#undef dout
#define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << fs->dev.get_device_name() << ").allocator."
if (cursor.move_right() <= 0) break;
}
} else {
- //cout << " empty" << dendl;
+ //dout(0) << " empty" << dendl;
}
}
#endif
#endif
-#include "debug.h"
/*******************************************
#include "BufferCache.h"
#include "Onode.h"
-#include "debug.h"
/*********** BufferHead **************/
// *******************
-#include "debug.h"
#define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
#define derr(x) if (x <= g_conf.debug_ebofs) cerr << dbeginl << g_clock.now() << " ebofs(" << dev.get_device_name() << ")."
// yay
Onode *on = onode_map[oid];
on->get();
- //cout << "get_onode " << *on << dendl;
+ //dout(0) << "get_onode " << *on << dendl;
return on;
}
waitfor_onode.erase(oid); // remove Cond list
on->get();
- //cout << "get_onode " << *on << " (loaded)" << dendl;
+ //dout(0) << "get_onode " << *on << " (loaded)" << dendl;
return on;
}
}
void Ebofs::put_onode(Onode *on)
{
on->put();
- //cout << "put_onode " << *on << dendl;
+ //dout(0) << "put_onode " << *on << dendl;
if (on->get_ref_count() == 0 && on->dangling) {
- //cout << " *** hosing on " << *on << dendl;
+ //dot(0) << " *** hosing on " << *on << dendl;
delete on;
}
}
// verify
interval_set<block_t> ta;
ta.intersection_of(on->uncommitted, alloc);
- cout << " ta " << ta << dendl;
+ dout(0) << " ta " << ta << dendl;
assert(alloc == ta);
interval_set<block_t> tb;
tb.intersection_of(on->uncommitted, old);
- cout << " tb " << tb << dendl;
+ dout(0) << " tb " << tb << dendl;
assert(old == tb);
}
#include "config.h"
-#include "debug.h"
-#undef dout
#define dout(x) if (x <= g_conf.debug_ebofs) cout << dbeginl << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
#define derr(x) if (x <= g_conf.debug_ebofs) cerr << dbeginl << g_clock.now() << " ebofs(" << ebofs->dev.get_device_name() << ").journal "
utime_t end = g_clock.now();
end -= start;
- dout(1) << "elapsed " << end << endl;
+ cout << "elapsed " << end << endl;
float mbs = (float)megs / (float)end;
- dout(1) << "mb/s " << mbs << endl;
+ cout << "mb/s " << mbs << endl;
}
if (0) { // test
public:
void commit_start(BlockDevice& dev, version_t version) {
- dout(20) << "ebofs.nodepool.commit_start start" << endl;
+ generic_dout(20) << "ebofs.nodepool.commit_start start" << dendl;
assert(flushing == 0);
/*if (0)
for (unsigned i=0; i<region_loc.size(); i++) {
int c = dev.count_io(region_loc[i].start, region_loc[i].length);
- dout(20) << "ebofs.nodepool.commit_start region " << region_loc[i] << " has " << c << " ios" << endl;
+ generic_dout(20) << "ebofs.nodepool.commit_start region " << region_loc[i] << " has " << c << " ios" << dendl;
assert(c == 0);
}
*/
}
limbo.clear();
- dout(20) << "ebofs.nodepool.commit_start finish" << endl;
+ generic_dout(20) << "ebofs.nodepool.commit_start finish" << dendl;
}
void commit_wait() {
while (flushing > 0)
commit_cond.Wait(ebofs_lock);
- dout(20) << "ebofs.nodepool.commit_wait finish" << endl;
+ generic_dout(20) << "ebofs.nodepool.commit_wait finish" << dendl;
}
ls.swap(finished); // swap out of place to avoid weird loops
- dout(10) << ls.size() << " contexts to finish with " << result << endl;
+ generic_dout(10) << ls.size() << " contexts to finish with " << result << dendl;
for (std::list<Context*>::iterator it = ls.begin();
it != ls.end();
it++) {
Context *c = *it;
- dout(10) << "---- " << c << endl;
+ generic_dout(10) << "---- " << c << dendl;
c->finish(result);
delete c;
}
void lru_status() {
- dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << endl;
+ generic_dout(10) << "lru: " << lru_num << " items, " << lru_top.get_length() << " top, " << lru_bot.get_length() << " bot, " << lru_pintail.get_length() << " pintail" << dendl;
}
};
#include "messages/MAnchor.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
-#define derr(x) if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
+
+#define dout(x) if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
+#define derr(x) if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchorclient "
void AnchorClient::dispatch(Message *m)
inodeno_t ino = m->get_ino();
version_t atid = m->get_atid();
- dout(10) << "handle_anchor_reply " << *m << endl;
+ dout(10) << "handle_anchor_reply " << *m << dendl;
switch (m->get_op()) {
// prepare -> agree
case ANCHOR_OP_CREATE_AGREE:
if (pending_create_prepare.count(ino)) {
- dout(10) << "got create_agree on " << ino << " atid " << atid << endl;
+ dout(10) << "got create_agree on " << ino << " atid " << atid << dendl;
Context *onfinish = pending_create_prepare[ino].onfinish;
*pending_create_prepare[ino].patid = atid;
pending_create_prepare.erase(ino);
dout(10) << "stray create_agree on " << ino
<< " atid " << atid
<< ", already committing, resending COMMIT"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
dout(10) << "stray create_agree on " << ino
<< " atid " << atid
<< ", sending ROLLBACK"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
case ANCHOR_OP_DESTROY_AGREE:
if (pending_destroy_prepare.count(ino)) {
- dout(10) << "got destroy_agree on " << ino << " atid " << atid << endl;
+ dout(10) << "got destroy_agree on " << ino << " atid " << atid << dendl;
Context *onfinish = pending_destroy_prepare[ino].onfinish;
*pending_destroy_prepare[ino].patid = atid;
pending_destroy_prepare.erase(ino);
dout(10) << "stray destroy_agree on " << ino
<< " atid " << atid
<< ", already committing, resending COMMIT"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
dout(10) << "stray destroy_agree on " << ino
<< " atid " << atid
<< ", sending ROLLBACK"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
case ANCHOR_OP_UPDATE_AGREE:
if (pending_update_prepare.count(ino)) {
- dout(10) << "got update_agree on " << ino << " atid " << atid << endl;
+ dout(10) << "got update_agree on " << ino << " atid " << atid << dendl;
Context *onfinish = pending_update_prepare[ino].onfinish;
*pending_update_prepare[ino].patid = atid;
pending_update_prepare.erase(ino);
dout(10) << "stray update_agree on " << ino
<< " atid " << atid
<< ", already committing, resending COMMIT"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
dout(10) << "stray update_agree on " << ino
<< " atid " << atid
<< ", sending ROLLBACK"
- << endl;
+ << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_ROLLBACK, 0, atid);
mds->messenger->send_message(req,
mds->mdsmap->get_inst(mds->mdsmap->get_anchortable()),
// commit -> ack
case ANCHOR_OP_ACK:
{
- dout(10) << "got ack on atid " << atid << ", logging" << endl;
+ dout(10) << "got ack on atid " << atid << ", logging" << dendl;
// remove from committing list
assert(pending_commit.count(atid));
// kick any waiters
if (ack_waiters.count(atid)) {
- dout(15) << "kicking waiters on atid " << atid << endl;
+ dout(15) << "kicking waiters on atid " << atid << dendl;
mds->queue_waiters(ack_waiters[atid]);
ack_waiters.erase(atid);
}
void AnchorClient::prepare_create(inodeno_t ino, vector<Anchor>& trace,
version_t *patid, Context *onfinish)
{
- dout(10) << "prepare_create " << ino << " " << trace << endl;
+ dout(10) << "prepare_create " << ino << " " << trace << dendl;
// send message
MAnchor *req = new MAnchor(ANCHOR_OP_CREATE_PREPARE, ino);
void AnchorClient::prepare_destroy(inodeno_t ino,
version_t *patid, Context *onfinish)
{
- dout(10) << "prepare_destroy " << ino << endl;
+ dout(10) << "prepare_destroy " << ino << dendl;
// send message
MAnchor *req = new MAnchor(ANCHOR_OP_DESTROY_PREPARE, ino);
void AnchorClient::prepare_update(inodeno_t ino, vector<Anchor>& trace,
version_t *patid, Context *onfinish)
{
- dout(10) << "prepare_update " << ino << " " << trace << endl;
+ dout(10) << "prepare_update " << ino << " " << trace << dendl;
// send message
MAnchor *req = new MAnchor(ANCHOR_OP_UPDATE_PREPARE, ino);
void AnchorClient::commit(version_t atid)
{
- dout(10) << "commit " << atid << endl;
+ dout(10) << "commit " << atid << dendl;
assert(pending_commit.count(atid));
pending_commit.insert(atid);
void AnchorClient::finish_recovery()
{
- dout(7) << "finish_recovery" << endl;
+ dout(7) << "finish_recovery" << dendl;
resend_commits();
}
for (set<version_t>::iterator p = pending_commit.begin();
p != pending_commit.end();
++p) {
- dout(10) << "resending commit on " << *p << endl;
+ dout(10) << "resending commit on " << *p << dendl;
MAnchor *req = new MAnchor(ANCHOR_OP_COMMIT, 0, *p);
mds->send_message_mds(req,
mds->mdsmap->get_anchortable(),
for (hash_map<inodeno_t, _pending_prepare>::iterator p = prepares.begin();
p != prepares.end();
p++) {
- dout(10) << "resending " << get_anchor_opname(op) << " on " << p->first << endl;
+ dout(10) << "resending " << get_anchor_opname(op) << " on " << p->first << dendl;
MAnchor *req = new MAnchor(op, p->first);
req->set_trace(p->second.trace);
mds->send_message_mds(req,
void AnchorClient::handle_mds_recovery(int who)
{
- dout(7) << "handle_mds_recovery mds" << who << endl;
+ dout(7) << "handle_mds_recovery mds" << who << dendl;
if (who != mds->mdsmap->get_anchortable())
return; // do nothing.
for (hash_map<inodeno_t, _pending_lookup>::iterator p = pending_lookup.begin();
p != pending_lookup.end();
p++) {
- dout(10) << "resending lookup on " << p->first << endl;
+ dout(10) << "resending lookup on " << p->first << dendl;
mds->send_message_mds(new MAnchor(ANCHOR_OP_LOOKUP, p->first),
mds->mdsmap->get_anchortable(),
MDS_PORT_ANCHORTABLE, MDS_PORT_ANCHORCLIENT);
#include "events/EAnchor.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_mds) cout << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
-#define derr(x) if (x <= g_conf.debug_mds) cerr << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
+
+#define dout(x) if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
+#define derr(x) if (x <= g_conf.debug_mds) cerr << dbeginl << g_clock.now() << " " << mds->messenger->get_myname() << ".anchortable "
void AnchorTable::dump()
{
- dout(7) << "dump v " << version << endl;
+ dout(7) << "dump v " << version << dendl;
for (hash_map<inodeno_t, Anchor>::iterator it = anchor_map.begin();
it != anchor_map.end();
it++)
- dout(15) << "dump " << it->second << endl;
+ dout(15) << "dump " << it->second << dendl;
}
bool AnchorTable::add(inodeno_t ino, dirfrag_t dirfrag)
{
- //dout(17) << "add " << ino << " dirfrag " << dirfrag << endl;
+ //dout(17) << "add " << ino << " dirfrag " << dirfrag << dendl;
// parent should be there
assert(dirfrag.ino < MDS_INO_BASE || // system dirino
if (anchor_map.count(ino) == 0) {
// new item
anchor_map[ino] = Anchor(ino, dirfrag);
- dout(7) << "add added " << anchor_map[ino] << endl;
+ dout(7) << "add added " << anchor_map[ino] << dendl;
return true;
} else {
- dout(7) << "add had " << anchor_map[ino] << endl;
+ dout(7) << "add had " << anchor_map[ino] << dendl;
return false;
}
}
void AnchorTable::inc(inodeno_t ino)
{
- dout(7) << "inc " << ino << endl;
+ dout(7) << "inc " << ino << dendl;
assert(anchor_map.count(ino));
Anchor &anchor = anchor_map[ino];
anchor.nref++;
- dout(10) << "inc now " << anchor << endl;
+ dout(10) << "inc now " << anchor << dendl;
ino = anchor.dirfrag.ino;
if (ino == 0) break;
void AnchorTable::dec(inodeno_t ino)
{
- dout(7) << "dec " << ino << endl;
+ dout(7) << "dec " << ino << dendl;
assert(anchor_map.count(ino));
while (true) {
anchor.nref--;
if (anchor.nref == 0) {
- dout(10) << "dec removing " << anchor << endl;
+ dout(10) << "dec removing " << anchor << dendl;
dirfrag_t dirfrag = anchor.dirfrag;
anchor_map.erase(ino);
ino = dirfrag.ino;
} else {
- dout(10) << "dec now " << anchor << endl;
+ dout(10) << "dec now " << anchor << dendl;
ino = anchor.dirfrag.ino;
}
void AnchorTable::handle_lookup(MAnchor *req)
{
inodeno_t ino = req->get_ino();
- dout(7) << "handle_lookup " << ino << endl;
+ dout(7) << "handle_lookup " << ino << dendl;
assert(anchor_map.count(ino) == 1);
Anchor &anchor = anchor_map[ino];
vector<Anchor> trace;
while (true) {
- dout(10) << "handle_lookup adding " << anchor << endl;
+ dout(10) << "handle_lookup adding " << anchor << dendl;
trace.insert(trace.begin(), anchor); // lame FIXME
if (anchor.dirfrag.ino < MDS_INO_BASE) break;
void AnchorTable::commit(version_t atid)
{
if (pending_create.count(atid)) {
- dout(7) << "commit " << atid << " create " << pending_create[atid] << endl;
+ dout(7) << "commit " << atid << " create " << pending_create[atid] << dendl;
pending_create.erase(atid);
}
else if (pending_destroy.count(atid)) {
inodeno_t ino = pending_destroy[atid];
- dout(7) << "commit " << atid << " destroy " << ino << endl;
+ dout(7) << "commit " << atid << " destroy " << ino << dendl;
dec(ino); // destroy
inodeno_t ino = pending_update[atid].first;
vector<Anchor> &trace = pending_update[atid].second;
- dout(7) << "commit " << atid << " update " << ino << endl;
+ dout(7) << "commit " << atid << " update " << ino << dendl;
// remove old
dec(ino);
{
if (pending_create.count(atid)) {
inodeno_t ino = pending_create[atid];
- dout(7) << "rollback " << atid << " create " << ino << endl;
+ dout(7) << "rollback " << atid << " create " << ino << dendl;
dec(ino);
pending_create.erase(atid);
}
else if (pending_destroy.count(atid)) {
inodeno_t ino = pending_destroy[atid];
- dout(7) << "rollback " << atid << " destroy " << ino << endl;
+ dout(7) << "rollback " << atid << " destroy " << ino << dendl;
pending_destroy.erase(atid);
}
else if (pending_update.count(atid)) {
inodeno_t ino = pending_update[atid].first;
- dout(7) << "rollback " << atid << " update " << ino << endl;
+ dout(7) << "rollback " << atid << " update " << ino << dendl;
pending_update.erase(atid);
}
else
inodeno_t ino = req->get_ino();
vector<Anchor>& trace = req->get_trace();
- dout(7) << "handle_create_prepare " << ino << endl;
+ dout(7) << "handle_create_prepare " << ino << dendl;
create_prepare(ino, trace, req->get_source().num());
void AnchorTable::_create_prepare_logged(MAnchor *req, version_t atid)
{
inodeno_t ino = req->get_ino();
- dout(7) << "_create_prepare_logged " << ino << " atid " << atid << endl;
+ dout(7) << "_create_prepare_logged " << ino << " atid " << atid << dendl;
// reply
MAnchor *reply = new MAnchor(ANCHOR_OP_CREATE_AGREE, ino, atid);
void AnchorTable::handle_destroy_prepare(MAnchor *req)
{
inodeno_t ino = req->get_ino();
- dout(7) << "handle_destroy_prepare " << ino << endl;
+ dout(7) << "handle_destroy_prepare " << ino << dendl;
destroy_prepare(ino, req->get_source().num());
void AnchorTable::_destroy_prepare_logged(MAnchor *req, version_t atid)
{
inodeno_t ino = req->get_ino();
- dout(7) << "_destroy_prepare_logged " << ino << " atid " << atid << endl;
+ dout(7) << "_destroy_prepare_logged " << ino << " atid " << atid << dendl;
// reply
MAnchor *reply = new MAnchor(ANCHOR_OP_DESTROY_AGREE, ino, atid);
inodeno_t ino = req->get_ino();
vector<Anchor>& trace = req->get_trace();
- dout(7) << "handle_update_prepare " << ino << endl;
+ dout(7) << "handle_update_prepare " << ino << dendl;
update_prepare(ino, trace, req->get_source().num());
void AnchorTable::_update_prepare_logged(MAnchor *req, version_t atid)
{
inodeno_t ino = req->get_ino();
- dout(7) << "_update_prepare_logged " << ino << " atid " << atid << endl;
+ dout(7) << "_update_prepare_logged " << ino << " atid " << atid << dendl;
// reply
MAnchor *reply = new MAnchor(ANCHOR_OP_UPDATE_AGREE, ino, atid);
void AnchorTable::handle_commit(MAnchor *req)
{
version_t atid = req->get_atid();
- dout(7) << "handle_commit " << atid << endl;
+ dout(7) << "handle_commit " << atid << dendl;
if (pending_create.count(atid) ||
pending_destroy.count(atid) ||
else if (atid <= version) {
dout(0) << "got commit for atid " << atid << " <= " << version
<< ", already committed, sending ack."
- << endl;
+ << dendl;
MAnchor *reply = new MAnchor(ANCHOR_OP_ACK, 0, atid);
mds->messenger->send_message(reply, req->get_source_inst(), req->get_source_port());
delete req;
}
else {
// wtf.
- dout(0) << "got commit for atid " << atid << " > " << version << endl;
+ dout(0) << "got commit for atid " << atid << " > " << version << dendl;
assert(atid <= version);
}
void AnchorTable::_commit_logged(MAnchor *req)
{
- dout(7) << "_commit_logged, sending ACK" << endl;
+ dout(7) << "_commit_logged, sending ACK" << dendl;
MAnchor *reply = new MAnchor(ANCHOR_OP_ACK, req->get_ino(), req->get_atid());
mds->messenger->send_message(reply, req->get_source_inst(), req->get_source_port());
delete req;
void AnchorTable::handle_rollback(MAnchor *req)
{
version_t atid = req->get_atid();
- dout(7) << "handle_rollback " << atid << endl;
+ dout(7) << "handle_rollback " << atid << dendl;
rollback(atid);
delete req;
}
{
// make sure i'm open!
if (!opened) {
- dout(7) << "not open yet" << endl;
+ dout(7) << "not open yet" << dendl;
waiting_for_open.push_back(new C_MDS_RetryMessage(mds, req));
return;
}
- dout(10) << "handle_anchor_request " << *req << endl;
+ dout(10) << "handle_anchor_request " << *req << dendl;
// go
switch (req->get_op()) {
void AnchorTable::save(Context *onfinish)
{
- dout(7) << "save v " << version << endl;
+ dout(7) << "save v " << version << dendl;
if (!opened) {
assert(!onfinish);
return;
waiting_for_save[version].push_back(onfinish);
if (committing_version == version) {
- dout(7) << "save already committing v " << version << endl;
+ dout(7) << "save already committing v " << version << dendl;
return;
}
committing_version = version;
it != anchor_map.end();
it++) {
it->second._encode(bl);
- dout(15) << "save encoded " << it->second << endl;
+ dout(15) << "save encoded " << it->second << dendl;
}
// pending
void AnchorTable::_saved(version_t v)
{
- dout(7) << "_saved v " << v << endl;
+ dout(7) << "_saved v " << v << dendl;
assert(v <= committing_version);
assert(committed_version < v);
void AnchorTable::load(Context *onfinish)
{
- dout(7) << "load" << endl;
+ dout(7) << "load" << dendl;
assert(!opened);
waiting_for_open.push_back(onfinish);
void AnchorTable::_loaded(bufferlist& bl)
{
- dout(10) << "_loaded got " << bl.length() << " bytes" << endl;
+ dout(10) << "_loaded got " << bl.length() << " bytes" << dendl;
int off = 0;
bl.copy(off, sizeof(version), (char*)&version);
Anchor a;
a._decode(bl, off);
anchor_map[a.ino] = a;
- dout(15) << "load_2 decoded " << a << endl;
+ dout(15) << "load_2 decoded " << a << dendl;
}
::_decode(pending_reqmds, bl, off);
void AnchorTable::finish_recovery()
{
- dout(7) << "finish_recovery" << endl;
+ dout(7) << "finish_recovery" << dendl;
// resend agrees for everyone.
for (map<version_t,int>::iterator p = pending_reqmds.begin();
void AnchorTable::handle_mds_recovery(int who)
{
- dout(7) << "handle_mds_recovery mds" << who << endl;
+ dout(7) << "handle_mds_recovery mds" << who << dendl;
// resend agrees for recovered mds
for (map<version_t,int>::iterator p = pending_reqmds.begin();
#include <cassert>
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << dir->cache->mds->get_nodeid() << ".cache.den(" << dir->dirfrag() << " " << name << ") "
+
+
ostream& CDentry::print_db_line_prefix(ostream& out)
{
version_t CDentry::pre_dirty(version_t min)
{
projected_version = dir->pre_dirty(min);
- dout(10) << " pre_dirty " << *this << endl;
+ dout(10) << " pre_dirty " << *this << dendl;
return projected_version;
}
void CDentry::mark_dirty(version_t pv)
{
- dout(10) << " mark_dirty " << *this << endl;
+ dout(10) << " mark_dirty " << *this << dendl;
// i now live in this new dir version
assert(pv <= projected_version);
void CDentry::mark_clean()
{
- dout(10) << " mark_clean " << *this << endl;
+ dout(10) << " mark_clean " << *this << dendl;
assert(is_dirty());
assert(version <= dir->get_version());
void CDentry::mark_new()
{
- dout(10) << " mark_new " << *this << endl;
+ dout(10) << " mark_new " << *this << dendl;
state_set(STATE_NEW);
}
// add this inode (in my dirfrag) to the end
trace.push_back(Anchor(in->ino(), dir->dirfrag()));
- dout(10) << "make_anchor_trace added " << trace.back() << endl;
+ dout(10) << "make_anchor_trace added " << trace.back() << dendl;
}
// newly linked?
if (is_null() && !is_auth()) {
// force trim from cache!
- dout(10) << "decode_lock_state replica dentry null -> non-null, must trim" << endl;
+ dout(10) << "decode_lock_state replica dentry null -> non-null, must trim" << dendl;
//assert(get_num_ref() == 0);
} else {
// verify?
#include <cassert>
+#include "config.h"
+
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
+//#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache." << *this << " "
+
+
+
// PINS
//int cdir_pins[CDIR_NUM_PINS] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
}
-#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache.dir(" << this->dirfrag() << ") "
-//#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << cache->mds->get_nodeid() << ".cache." << *this << " "
ostream& CDir::print_db_line_prefix(ostream& out)
items[dn->name] = dn;
nnull++;
- dout(12) << "add_null_dentry " << *dn << endl;
+ dout(12) << "add_null_dentry " << *dn << dendl;
// pin?
if (nnull + nitems == 1) get(PIN_CHILD);
items[dn->name] = dn;
link_inode_work( dn, in );
- dout(12) << "add_primary_dentry " << *dn << endl;
+ dout(12) << "add_primary_dentry " << *dn << dendl;
// pin?
if (nnull + nitems == 1) get(PIN_CHILD);
items[dn->name] = dn;
nitems++;
- dout(12) << "add_remote_dentry " << *dn << endl;
+ dout(12) << "add_remote_dentry " << *dn << dendl;
// pin?
if (nnull + nitems == 1) get(PIN_CHILD);
void CDir::remove_dentry(CDentry *dn)
{
- dout(12) << "remove_dentry " << *dn << endl;
+ dout(12) << "remove_dentry " << *dn << dendl;
if (dn->inode) {
// detach inode and dentry
void CDir::link_remote_inode(CDentry *dn, inodeno_t ino, unsigned char d_type)
{
- dout(12) << "link_inode " << *dn << " remote " << ino << endl;
+ dout(12) << "link_inode " << *dn << " remote " << ino << dendl;
assert(dn->is_null());
dn->set_remote(ino, d_type);
void CDir::link_primary_inode(CDentry *dn, CInode *in)
{
- dout(12) << "link_primary_inode " << *dn << " " << *in << endl;
+ dout(12) << "link_primary_inode " << *dn << " " << *in << dendl;
assert(!dn->is_remote());
link_inode_work(dn,in);
void CDir::unlink_inode( CDentry *dn )
{
if (dn->is_remote()) {
- dout(12) << "unlink_inode " << *dn << endl;
+ dout(12) << "unlink_inode " << *dn << dendl;
} else {
- dout(12) << "unlink_inode " << *dn << " " << *dn->inode << endl;
+ dout(12) << "unlink_inode " << *dn << " " << *dn->inode << dendl;
}
dn->clear_dir_offset();
// was the dn new? or is the dir complete (i.e. we don't need negatives)?
if (dn->is_new() || is_complete()) {
- dout(10) << "try_remove_unlinked_dn " << *dn << " in " << *this << endl;
+ dout(10) << "try_remove_unlinked_dn " << *dn << " in " << *this << dendl;
dn->mark_clean();
remove_dentry(dn);
num_dirty == 0) {
dout(10) << "try_remove_unlinked_dn committed_equivalent now " << version
<< " vs committed " << committed_version
- << endl;
+ << dendl;
committed_version_equivalent = committed_version;
}
}
}
void CDir::remove_null_dentries() {
- dout(12) << "remove_null_dentries " << *this << endl;
+ dout(12) << "remove_null_dentries " << *this << dendl;
list<CDentry*> dns;
for (CDir_map_t::iterator it = items.begin();
*/
void CDir::steal_dentry(CDentry *dn)
{
- dout(15) << "steal_dentry " << *dn << endl;
+ dout(15) << "steal_dentry " << *dn << dendl;
items[dn->name] = dn;
void CDir::split(int bits, list<CDir*>& subs, list<Context*>& waiters)
{
- dout(10) << "split by " << bits << " bits on " << *this << endl;
+ dout(10) << "split by " << bits << " bits on " << *this << dendl;
if (cache->mds->logger) cache->mds->logger->inc("dir_sp");
f->init_fragment_pins();
f->version = version;
f->projected_version = projected_version;
- dout(10) << " subfrag " << *p << " " << *f << endl;
+ dout(10) << " subfrag " << *p << " " << *f << dendl;
subfrags[n++] = f;
subs.push_back(f);
inode->add_dirfrag(f);
CDentry *dn = p->second;
frag_t subfrag = inode->pick_dirfrag(p->first);
int n = subfrag.value() >> frag.bits();
- dout(15) << " subfrag " << subfrag << " n=" << n << " for " << p->first << endl;
+ dout(15) << " subfrag " << subfrag << " n=" << n << " for " << p->first << dendl;
CDir *f = subfrags[n];
f->steal_dentry(dn);
}
void CDir::merge(int bits, list<Context*>& waiters)
{
- dout(10) << "merge by " << bits << " bits" << endl;
+ dout(10) << "merge by " << bits << " bits" << dendl;
list<frag_t> frags;
frag.split(bits, frags);
for (list<frag_t>::iterator p = frags.begin(); p != frags.end(); ++p) {
CDir *dir = inode->get_or_open_dirfrag(cache, *p);
assert(dir->is_complete());
- dout(10) << " subfrag " << *p << " " << *dir << endl;
+ dout(10) << " subfrag " << *p << " " << *dir << dendl;
// steal dentries
while (!dir->items.empty())
if (waiting_on_dentry.empty())
get(PIN_DNWAITER);
waiting_on_dentry[dname].push_back(c);
- dout(10) << "add_dentry_waiter dentry " << dname << " " << c << " on " << *this << endl;
+ dout(10) << "add_dentry_waiter dentry " << dname << " " << c << " on " << *this << dendl;
}
void CDir::take_dentry_waiting(const string& dname, list<Context*>& ls)
if (waiting_on_dentry.count(dname) == 0) return;
dout(10) << "take_dentry_waiting dentry " << dname
<< " x " << waiting_on_dentry[dname].size()
- << " on " << *this << endl;
+ << " on " << *this << dendl;
ls.splice(ls.end(), waiting_on_dentry[dname]);
waiting_on_dentry.erase(dname);
if (waiting_on_dentry.empty())
if (!(is_freezing_tree_root() || is_frozen_tree_root() ||
is_freezing_dir() || is_frozen_dir())) {
// try parent
- dout(10) << "add_waiter " << tag << " " << c << " should be ATFREEZEROOT, " << *this << " is not root, trying parent" << endl;
+ dout(10) << "add_waiter " << tag << " " << c << " should be ATFREEZEROOT, " << *this << " is not root, trying parent" << dendl;
inode->parent->dir->add_waiter(tag, c);
return;
}
if (tag & WAIT_ATSUBTREEROOT) {
if (!is_subtree_root()) {
// try parent
- dout(10) << "add_waiter " << tag << " " << c << " should be ATSUBTREEROOT, " << *this << " is not root, trying parent" << endl;
+ dout(10) << "add_waiter " << tag << " " << c << " should be ATSUBTREEROOT, " << *this << " is not root, trying parent" << dendl;
inode->parent->dir->add_waiter(tag, c);
return;
}
void CDir::finish_waiting(int mask, int result)
{
- dout(11) << "finish_waiting mask " << hex << mask << dec << " result " << result << " on " << *this << endl;
+ dout(11) << "finish_waiting mask " << hex << mask << dec << " result " << result << " on " << *this << dendl;
list<Context*> finished;
take_waiting(mask, finished);
if (min > projected_version)
projected_version = min;
++projected_version;
- dout(10) << "pre_dirty " << projected_version << endl;
+ dout(10) << "pre_dirty " << projected_version << dendl;
return projected_version;
}
{
if (!state_test(STATE_DIRTY)) {
state_set(STATE_DIRTY);
- dout(10) << "mark_dirty (was clean) " << *this << " version " << version << endl;
+ dout(10) << "mark_dirty (was clean) " << *this << " version " << version << dendl;
get(PIN_DIRTY);
} else {
- dout(10) << "mark_dirty (already dirty) " << *this << " version " << version << endl;
+ dout(10) << "mark_dirty (already dirty) " << *this << " version " << version << dendl;
}
}
void CDir::mark_clean()
{
- dout(10) << "mark_clean " << *this << " version " << version << endl;
+ dout(10) << "mark_clean " << *this << " version " << version << dendl;
if (state_test(STATE_DIRTY)) {
state_clear(STATE_DIRTY);
put(PIN_DIRTY);
void CDir::fetch(Context *c, bool ignore_authpinnability)
{
- dout(10) << "fetch on " << *this << endl;
+ dout(10) << "fetch on " << *this << dendl;
assert(is_auth());
assert(!is_complete());
if (!can_auth_pin() && !ignore_authpinnability) {
- dout(7) << "fetch waiting for authpinnable" << endl;
+ dout(7) << "fetch waiting for authpinnable" << dendl;
add_waiter(WAIT_AUTHPINNABLE, c);
return;
}
// already fetching?
if (state_test(CDir::STATE_FETCHING)) {
- dout(7) << "already fetching; waiting" << endl;
+ dout(7) << "already fetching; waiting" << dendl;
return;
}
{
dout(10) << "_fetched " << bl.length()
<< " bytes for " << *this
- << endl;
+ << dendl;
assert(is_auth());
assert(!is_frozen());
dout(10) << "_fetched version " << got_version
<< ", " << len << " bytes"
- << endl;
+ << dendl;
int32_t n;
::_decode(n, bl, off);
// dname
string dname;
::_decode(dname, bl, off);
- dout(24) << "_fetched parsed marker '" << type << "' dname '" << dname << endl;
+ dout(24) << "_fetched parsed marker '" << type << "' dname '" << dname << dendl;
CDentry *dn = lookup(dname); // existing dentry?
if (dn) {
if (dn->get_inode() == 0) {
- dout(12) << "_fetched had NEG dentry " << *dn << endl;
+ dout(12) << "_fetched had NEG dentry " << *dn << dendl;
} else {
- dout(12) << "_fetched had dentry " << *dn << endl;
+ dout(12) << "_fetched had dentry " << *dn << dendl;
}
} else {
// (remote) link
CInode *in = cache->get_inode(ino); // we may or may not have it.
if (in) {
dn->link_remote(in);
- dout(12) << "_fetched got remote link " << ino << " which we have " << *in << endl;
+ dout(12) << "_fetched got remote link " << ino << " which we have " << *in << dendl;
} else {
- dout(12) << "_fetched got remote link " << ino << " (dont' have it)" << endl;
+ dout(12) << "_fetched got remote link " << ino << " (dont' have it)" << dendl;
}
}
}
if (dn) {
if (dn->get_inode() == 0) {
- dout(12) << "_fetched had NEG dentry " << *dn << endl;
+ dout(12) << "_fetched had NEG dentry " << *dn << dendl;
} else {
- dout(12) << "_fetched had dentry " << *dn << endl;
+ dout(12) << "_fetched had dentry " << *dn << dendl;
}
} else {
// add inode
in = cache->get_inode(inode.ino);
dout(12) << "_fetched got (but i already had) " << *in
<< " mode " << in->inode.mode
- << " mtime " << in->inode.mtime << endl;
+ << " mtime " << in->inode.mtime << dendl;
assert(0); // this shouldn't happen!!
} else {
// inode
// link
dn = add_primary_dentry(dname, in);
- dout(12) << "_fetched got " << *dn << " " << *in << endl;
+ dout(12) << "_fetched got " << *dn << " " << *in << dendl;
}
}
} else {
dout(1) << "corrupt directory, i got tag char '" << type << "' val " << (int)(type)
- << " at pos " << off << endl;
+ << " at pos " << off << dendl;
assert(0);
}
dn &&
dn->get_version() <= got_version &&
dn->is_dirty()) {
- dout(10) << "_fetched had underwater dentry " << *dn << ", marking clean" << endl;
+ dout(10) << "_fetched had underwater dentry " << *dn << ", marking clean" << dendl;
dn->mark_clean();
if (dn->get_inode()) {
assert(dn->get_inode()->get_version() <= got_version);
- dout(10) << "_fetched had underwater inode " << *dn->get_inode() << ", marking clean" << endl;
+ dout(10) << "_fetched had underwater inode " << *dn->get_inode() << ", marking clean" << dendl;
dn->get_inode()->mark_clean();
}
}
*/
void CDir::commit(version_t want, Context *c)
{
- dout(10) << "commit want " << want << " on " << *this << endl;
+ dout(10) << "commit want " << want << " on " << *this << dendl;
if (want == 0) want = version;
// preconditions
void CDir::_commit(version_t want)
{
- dout(10) << "_commit want " << want << " on " << *this << endl;
+ dout(10) << "_commit want " << want << " on " << *this << dendl;
// we can't commit things in the future.
// (even the projected future.)
// already committed?
if (committed_version >= want) {
- dout(10) << "already committed " << committed_version << " >= " << want << endl;
+ dout(10) << "already committed " << committed_version << " >= " << want << dendl;
return;
}
// already committing >= want?
if (committing_version >= want) {
- dout(10) << "already committing " << committing_version << " >= " << want << endl;
+ dout(10) << "already committing " << committing_version << " >= " << want << dendl;
assert(state_test(STATE_COMMITTING));
return;
}
// complete?
if (!is_complete()) {
- dout(7) << "commit not complete, fetching first" << endl;
+ dout(7) << "commit not complete, fetching first" << dendl;
if (cache->mds->logger) cache->mds->logger->inc("dir_ffc");
fetch(new C_Dir_RetryCommit(this, want));
return;
// mark committing (if not already)
if (!state_test(STATE_COMMITTING)) {
- dout(10) << "marking committing" << endl;
+ dout(10) << "marking committing" << dendl;
state_set(STATE_COMMITTING);
}
// primary or remote?
if (dn->is_remote()) {
inodeno_t ino = dn->get_remote_ino();
- dout(14) << " pos " << bl.length() << " dn '" << it->first << "' remote ino " << ino << endl;
+ dout(14) << " pos " << bl.length() << " dn '" << it->first << "' remote ino " << ino << dendl;
// marker, name, ino
bl.append( "L", 1 ); // remote link
CInode *in = dn->get_inode();
assert(in);
- dout(14) << " pos " << bl.length() << " dn '" << it->first << "' inode " << *in << endl;
+ dout(14) << " pos " << bl.length() << " dn '" << it->first << "' inode " << *in << dendl;
// marker, name, inode, [symlink string]
bl.append( "I", 1 ); // inode
if (in->is_symlink()) {
// include symlink destination!
- dout(18) << " inlcuding symlink ptr " << in->symlink << endl;
+ dout(18) << " inlcuding symlink ptr " << in->symlink << dendl;
::_encode(in->symlink, bl);
}
*/
void CDir::_committed(version_t v)
{
- dout(10) << "_committed v " << v << " on " << *this << endl;
+ dout(10) << "_committed v " << v << " on " << *this << dendl;
assert(is_auth());
// take note.
// dentry
if (committed_version >= dn->get_version()) {
if (dn->is_dirty()) {
- dout(15) << " dir " << committed_version << " >= dn " << dn->get_version() << " now clean " << *dn << endl;
+ dout(15) << " dir " << committed_version << " >= dn " << dn->get_version() << " now clean " << *dn << dendl;
dn->mark_clean();
}
} else {
- dout(15) << " dir " << committed_version << " < dn " << dn->get_version() << " still dirty " << *dn << endl;
+ dout(15) << " dir " << committed_version << " < dn " << dn->get_version() << " still dirty " << *dn << dendl;
}
// inode?
if (committed_version >= in->get_version()) {
if (in->is_dirty()) {
- dout(15) << " dir " << committed_version << " >= inode " << in->get_version() << " now clean " << *in << endl;
+ dout(15) << " dir " << committed_version << " >= inode " << in->get_version() << " now clean " << *in << dendl;
in->mark_clean();
}
} else {
- dout(15) << " dir " << committed_version << " < inode " << in->get_version() << " still dirty " << *in << endl;
+ dout(15) << " dir " << committed_version << " < inode " << in->get_version() << " still dirty " << *in << dendl;
assert(in->is_dirty());
}
}
{
if (dir_auth == CDIR_AUTH_DEFAULT) {
//dout(10) << "is_subtree_root false " << dir_auth << " != " << CDIR_AUTH_DEFAULT
- //<< " on " << ino() << endl;
+ //<< " on " << ino() << dendl;
return false;
} else {
//dout(10) << "is_subtree_root true " << dir_auth << " != " << CDIR_AUTH_DEFAULT
- //<< " on " << ino() << endl;
+ //<< " on " << ino() << dendl;
return true;
}
}
{
dout(10) << "setting dir_auth=" << a
<< " from " << dir_auth
- << " on " << *this << endl;
+ << " on " << *this << dendl;
bool was_subtree = is_subtree_root();
bool was_ambiguous = dir_auth.second >= 0;
// new subtree root?
if (!was_subtree && is_subtree_root()) {
- dout(10) << " new subtree root, adjusting auth_pins" << endl;
+ dout(10) << " new subtree root, adjusting auth_pins" << dendl;
// adjust nested auth pins
inode->adjust_nested_auth_pins(-get_cum_auth_pins());
inode->auth_unpin();
}
if (was_subtree && !is_subtree_root()) {
- dout(10) << " old subtree root, adjusting auth_pins" << endl;
+ dout(10) << " old subtree root, adjusting auth_pins" << dendl;
// adjust nested auth pins
inode->adjust_nested_auth_pins(get_cum_auth_pins());
get(PIN_AUTHPIN);
auth_pins++;
- dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+ dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
// nest pins?
if (is_subtree_root()) return; // no.
if (auth_pins == 0)
put(PIN_AUTHPIN);
- dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+ dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
assert(auth_pins >= 0);
// pending freeze?
nested_auth_pins += inc;
dout(10) << "adjust_nested_auth_pins " << inc << " on " << *this
- << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+ << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
assert(nested_auth_pins >= 0);
// pending freeze?
}
} else {
state_set(STATE_FREEZINGTREE);
- dout(10) << "freeze_tree waiting " << *this << endl;
+ dout(10) << "freeze_tree waiting " << *this << dendl;
add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeTree(this, c));
}
}
void CDir::_freeze_tree()
{
- dout(10) << "_freeze_tree " << *this << endl;
+ dout(10) << "_freeze_tree " << *this << dendl;
// there shouldn't be any conflicting auth_pins (except the 'freezing' one)
assert(is_freezeable(true));
{
// still freezing? (we may have been canceled)
if (!is_freezing()) {
- dout(10) << "freeze_tree_finish no longer freezing, done on " << *this << endl;
+ dout(10) << "freeze_tree_finish no longer freezing, done on " << *this << dendl;
c->finish(-1);
delete c;
return;
// freezeable now?
if (!is_freezeable(true)) {
- dout(10) << "freeze_tree_finish still waiting " << *this << endl;
+ dout(10) << "freeze_tree_finish still waiting " << *this << dendl;
assert(state_test(STATE_FREEZINGTREE));
add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeTree(this, c));
return;
}
- dout(10) << "freeze_tree_finish " << *this << endl;
+ dout(10) << "freeze_tree_finish " << *this << dendl;
_freeze_tree();
auth_unpin();
if (c) {
void CDir::unfreeze_tree()
{
- dout(10) << "unfreeze_tree " << *this << endl;
+ dout(10) << "unfreeze_tree " << *this << dendl;
if (state_test(STATE_FROZENTREE)) {
// frozen. unfreeze.
}
} else {
state_set(STATE_FREEZINGDIR);
- dout(10) << "freeze_dir + wait " << *this << endl;
+ dout(10) << "freeze_dir + wait " << *this << dendl;
add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeDir(this, c));
}
}
void CDir::_freeze_dir()
{
- dout(10) << "_freeze_dir " << *this << endl;
+ dout(10) << "_freeze_dir " << *this << dendl;
assert(is_freezeable_dir(true));
{
// still freezing? (we may have been canceled)
if (!is_freezing()) {
- dout(10) << "freeze_dir_finish no longer freezing, done on " << *this << endl;
+ dout(10) << "freeze_dir_finish no longer freezing, done on " << *this << dendl;
c->finish(-1);
delete c;
return;
// freezeable now?
if (!is_freezeable_dir(true)) {
- dout(10) << "freeze_dir_finish still waiting " << *this << endl;
+ dout(10) << "freeze_dir_finish still waiting " << *this << dendl;
state_set(STATE_FREEZINGDIR);
add_waiter(WAIT_FREEZEABLE, new C_MDS_FreezeDir(this, c));
return;
}
// freeze now
- dout(10) << "freeze_dir_finish " << *this << endl;
+ dout(10) << "freeze_dir_finish " << *this << dendl;
_freeze_dir();
auth_unpin();
if (c) {
void CDir::unfreeze_dir()
{
- dout(10) << "unfreeze_dir " << *this << endl;
+ dout(10) << "unfreeze_dir " << *this << dendl;
if (state_test(STATE_FROZENDIR)) {
state_clear(STATE_FROZENDIR);
void get_dist_spec(set<int>& ls, int auth) {
if (( pop_auth_subtree.get(META_POP_IRD).get() >
g_conf.mds_bal_replicate_threshold)) {
- //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << endl;
+ //if (!cached_by.empty() && inode.ino > 1) generic_dout(1) << "distributed spec for " << *this << endl;
for (map<int,int>::iterator p = replicas_begin();
p != replicas_end();
++p)
dir->replica_nonce = 0; // no longer defined
if (!dir->replica_map.empty())
- dout(0) << "replicas not empty non import, " << *dir << ", " << dir->replica_map << endl;
+ generic_dout(0) << "replicas not empty non import, " << *dir << ", " << dir->replica_map << dendl;
dir->dir_rep_by = rep_by;
dir->replica_map = replicas;
- dout(12) << "replicas in export is " << replicas << ", dir now " << dir->replica_map << endl;
+ generic_dout(12) << "replicas in export is " << replicas << ", dir now " << dir->replica_map << dendl;
if (!replicas.empty())
dir->get(CDir::PIN_REPLICATED);
if (dir->is_dirty()) {
#include <stdio.h>
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
+
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mdcache->mds->get_nodeid() << ".cache.ino(" << inode.ino << ") "
//int cinode_pins[CINODE_NUM_PINS]; // counts
} else {
projected_inode.push_back(new inode_t(*projected_inode.back()));
}
- dout(15) << "project_inode " << projected_inode.back() << endl;
+ dout(15) << "project_inode " << projected_inode.back() << dendl;
return projected_inode.back();
}
{
assert(!projected_inode.empty());
dout(15) << "pop_and_dirty_projected_inode " << projected_inode.front()
- << " v" << projected_inode.front()->version << endl;
+ << " v" << projected_inode.front()->version << dendl;
mark_dirty(projected_inode.front()->version);
inode = *projected_inode.front();
delete projected_inode.front();
void CInode::close_dirfrag(frag_t fg)
{
- dout(14) << "close_dirfrag " << fg << endl;
+ dout(14) << "close_dirfrag " << fg << dendl;
assert(dirfrags.count(fg));
CDir *dir = dirfrags[fg];
for (map<string,CDentry*>::iterator p = dir->items.begin();
p != dir->items.end();
++p)
- dout(14) << "close_dirfrag LEFTOVER dn " << *p->second << endl;
+ dout(14) << "close_dirfrag LEFTOVER dn " << *p->second << dendl;
assert(dir->get_num_ref() == 0);
delete dir;
if (parent) {
parent->dir->inode->make_anchor_trace(trace);
trace.push_back(Anchor(ino(), parent->dir->dirfrag()));
- dout(10) << "make_anchor_trace added " << trace.back() << endl;
+ dout(10) << "make_anchor_trace added " << trace.back() << dendl;
}
else
assert(is_root() || is_stray());
void CInode::mark_dirty(version_t pv) {
- dout(10) << "mark_dirty " << *this << endl;
+ dout(10) << "mark_dirty " << *this << dendl;
assert(parent);
void CInode::mark_clean()
{
- dout(10) << " mark_clean " << *this << endl;
+ dout(10) << " mark_clean " << *this << dendl;
if (state_test(STATE_DIRTY)) {
state_clear(STATE_DIRTY);
put(PIN_DIRTY);
get(PIN_AUTHPIN);
auth_pins++;
- dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+ dout(7) << "auth_pin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
if (parent)
parent->adjust_nested_auth_pins( 1 );
if (auth_pins == 0)
put(PIN_AUTHPIN);
- dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << endl;
+ dout(7) << "auth_unpin on " << *this << " count now " << auth_pins << " + " << nested_auth_pins << dendl;
assert(auth_pins >= 0);
void replicate_relax_locks() {
- dout(10) << " relaxing locks on " << *this << endl;
+ //dout(10) << " relaxing locks on " << *this << dendl;
assert(is_auth());
assert(!is_replicated());
// -- reference counting --
void bad_put(int by) {
- dout(7) << " bad put " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << endl;
+ generic_dout(7) << " bad put " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << dendl;
assert(ref_set.count(by) == 1);
assert(ref > 0);
}
void bad_get(int by) {
- dout(7) << " bad get " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << endl;
+ generic_dout(7) << " bad get " << *this << " by " << by << " " << pin_name(by) << " was " << ref << " (" << ref_set << ")" << dendl;
assert(ref_set.count(by) == 0);
}
void first_get();
void get_dist_spec(set<int>& ls, int auth, timepair_t& now) {
if (( is_dir() && popularity[MDS_POP_CURDOM].get(now) > g_conf.mds_bal_replicate_threshold) ||
(!is_dir() && popularity[MDS_POP_JUSTME].get(now) > g_conf.mds_bal_replicate_threshold)) {
- //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << endl;
+ //if (!cached_by.empty() && inode.ino > 1) dout(1) << "distributed spec for " << *this << dendl;
ls = cached_by;
}
}
for (capseq_t seq = last_recv; seq <= last_sent; seq++) {
if (cap_history.count(seq)) {
c |= cap_history[seq];
- dout(10) << " cap issued: seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(c) << endl;
+ generic_dout(10) << " cap issued: seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(c) << dendl;
}
}
return c;
// old seqs
while (last_recv < seq) {
- dout(10) << " cap.confirm_receipt forgetting seq " << last_recv << " " << cap_string(cap_history[last_recv]) << endl;
+ generic_dout(10) << " cap.confirm_receipt forgetting seq " << last_recv << " " << cap_string(cap_history[last_recv]) << dendl;
r |= cap_history[last_recv];
cap_history.erase(last_recv);
++last_recv;
// release current?
if (cap_history.count(seq) &&
cap_history[seq] != caps) {
- dout(10) << " cap.confirm_receipt revising seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(caps) << endl;
+ generic_dout(10) << " cap.confirm_receipt revising seq " << seq << " " << cap_string(cap_history[seq]) << " -> " << cap_string(caps) << dendl;
// note what we're releasing..
assert(cap_history[seq] & ~caps);
r |= cap_history[seq] & ~caps;
#include "osdc/Filer.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".clientmap "
+
+#define dout(x) if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".clientmap "
void ClientMap::load(Context *onload)
{
- dout(10) << "load" << endl;
+ dout(10) << "load" << dendl;
init_inode();
dout(10) << "_load_finish v " << version
<< ", " << client_inst.size() << " clients, "
<< bl.length() << " bytes"
- << endl;
+ << dendl;
projected = committing = committed = version;
finish_contexts(waiting_for_load);
}
void ClientMap::save(Context *onsave, version_t needv)
{
- dout(10) << "save needv " << needv << ", v " << version << endl;
+ dout(10) << "save needv " << needv << ", v " << version << dendl;
commit_waiters[version].push_back(onsave);
if (needv && committing >= needv) return;
void ClientMap::_save_finish(version_t v)
{
- dout(10) << "_save_finish v" << v << endl;
+ dout(10) << "_save_finish v" << v << dendl;
committed = v;
finish_contexts(commit_waiters[v]);
#include "include/types.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".idalloc: "
+
+#define dout(x) if (x <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".idalloc: "
void IdAllocator::init_inode()
// pick one
inodeno_t id = free.start();
free.erase(id);
- dout(10) << "idalloc " << this << ": alloc id " << id << endl;
+ dout(10) << "idalloc " << this << ": alloc id " << id << dendl;
version++;
{
assert(is_active());
- dout(10) << "idalloc " << this << ": reclaim id " << id << endl;
+ dout(10) << "idalloc " << this << ": reclaim id " << id << dendl;
free.insert(id);
version++;
{
if (v > 0 && v <= committing_version) {
dout(10) << "save v " << version << " - already saving "
- << committing_version << " >= needed " << v << endl;
+ << committing_version << " >= needed " << v << dendl;
waitfor_save[v].push_back(onfinish);
return;
}
- dout(10) << "save v " << version << endl;
+ dout(10) << "save v " << version << dendl;
assert(is_active());
bufferlist bl;
void IdAllocator::save_2(version_t v)
{
- dout(10) << "save_2 v " << v << endl;
+ dout(10) << "save_2 v " << v << dendl;
committed_version = v;
void IdAllocator::load(Context *onfinish)
{
- dout(10) << "load" << endl;
+ dout(10) << "load" << dendl;
init_inode();
state = STATE_ACTIVE;
if (r > 0) {
- dout(10) << "load_2 got " << bl.length() << " bytes" << endl;
+ dout(10) << "load_2 got " << bl.length() << " bytes" << dendl;
int off = 0;
bl.copy(off, sizeof(version), (char*)&version);
off += sizeof(version);
committed_version = version;
}
else {
- dout(10) << "load_2 found no alloc file" << endl;
+ dout(10) << "load_2 found no alloc file" << dendl;
assert(0); // this shouldn't happen if mkfs finished.
reset();
}
#include <assert.h>
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".locker "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".locker "
set<SimpleLock*> &xlocks)
{
if (mdr->done_locking) {
- dout(10) << "acquire_locks " << *mdr << " -- done locking" << endl;
+ dout(10) << "acquire_locks " << *mdr << " -- done locking" << dendl;
return true; // at least we had better be!
}
- dout(10) << "acquire_locks " << *mdr << endl;
+ dout(10) << "acquire_locks " << *mdr << dendl;
set<SimpleLock*, SimpleLock::ptr_lt> sorted; // sort everything we will lock
set<SimpleLock*> mustpin = xlocks; // items to authpin
// xlocks
for (set<SimpleLock*>::iterator p = xlocks.begin(); p != xlocks.end(); ++p) {
- dout(20) << " must xlock " << **p << " " << *(*p)->get_parent() << endl;
+ dout(20) << " must xlock " << **p << " " << *(*p)->get_parent() << dendl;
sorted.insert(*p);
// augment xlock with a versionlock?
// wrlocks
for (set<SimpleLock*>::iterator p = wrlocks.begin(); p != wrlocks.end(); ++p) {
- dout(20) << " must wrlock " << **p << " " << *(*p)->get_parent() << endl;
+ dout(20) << " must wrlock " << **p << " " << *(*p)->get_parent() << dendl;
sorted.insert(*p);
if ((*p)->get_parent()->is_auth())
mustpin.insert(*p);
else if ((*p)->get_type() == LOCK_OTYPE_IDIR &&
!(*p)->get_parent()->is_auth() && !((ScatterLock*)(*p))->can_wrlock()) { // we might have to request a scatter
- dout(15) << " will also auth_pin " << *(*p)->get_parent() << " in case we need to request a scatter" << endl;
+ dout(15) << " will also auth_pin " << *(*p)->get_parent() << " in case we need to request a scatter" << dendl;
mustpin.insert(*p);
}
}
for (set<SimpleLock*>::iterator p = rdlocks.begin();
p != rdlocks.end();
++p) {
- dout(20) << " must rdlock " << **p << " " << *(*p)->get_parent() << endl;
+ dout(20) << " must rdlock " << **p << " " << *(*p)->get_parent() << dendl;
sorted.insert(*p);
}
++p) {
MDSCacheObject *object = (*p)->get_parent();
- dout(10) << " must authpin " << *object << endl;
+ dout(10) << " must authpin " << *object << dendl;
if (mdr->is_auth_pinned(object))
continue;
if (!object->is_auth()) {
if (object->is_ambiguous_auth()) {
// wait
- dout(10) << " ambiguous auth, waiting to authpin " << *object << endl;
+ dout(10) << " ambiguous auth, waiting to authpin " << *object << dendl;
object->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
mds->locker->drop_locks(mdr);
mdr->drop_local_auth_pins();
}
if (!object->can_auth_pin()) {
// wait
- dout(10) << " can't auth_pin (freezing?), waiting to authpin " << *object << endl;
+ dout(10) << " can't auth_pin (freezing?), waiting to authpin " << *object << dendl;
object->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
mds->locker->drop_locks(mdr);
mdr->drop_local_auth_pins();
++p) {
MDSCacheObject *object = (*p)->get_parent();
if (mdr->is_auth_pinned(object)) {
- dout(10) << " already auth_pinned " << *object << endl;
+ dout(10) << " already auth_pinned " << *object << dendl;
} else if (object->is_auth()) {
- dout(10) << " auth_pinning " << *object << endl;
+ dout(10) << " auth_pinning " << *object << dendl;
mdr->auth_pin(object);
}
}
for (map<int, set<MDSCacheObject*> >::iterator p = mustpin_remote.begin();
p != mustpin_remote.end();
++p) {
- dout(10) << "requesting remote auth_pins from mds" << p->first << endl;
+ dout(10) << "requesting remote auth_pins from mds" << p->first << dendl;
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_AUTHPIN);
for (set<MDSCacheObject*>::iterator q = p->second.begin();
q != p->second.end();
++q) {
- dout(10) << " req remote auth_pin of " << **q << endl;
+ dout(10) << " req remote auth_pin of " << **q << dendl;
MDSCacheObjectInfo info;
(*q)->set_object_info(info);
req->get_authpins().push_back(info);
SimpleLock *have = *existing;
existing++;
if (xlocks.count(*p) && mdr->xlocks.count(*p)) {
- dout(10) << " already xlocked " << *have << " " << *have->get_parent() << endl;
+ dout(10) << " already xlocked " << *have << " " << *have->get_parent() << dendl;
}
else if (wrlocks.count(*p) && mdr->wrlocks.count(*p)) {
- dout(10) << " already wrlocked " << *have << " " << *have->get_parent() << endl;
+ dout(10) << " already wrlocked " << *have << " " << *have->get_parent() << dendl;
}
else if (rdlocks.count(*p) && mdr->rdlocks.count(*p)) {
- dout(10) << " already rdlocked " << *have << " " << *have->get_parent() << endl;
+ dout(10) << " already rdlocked " << *have << " " << *have->get_parent() << dendl;
}
else assert(0);
continue;
while (existing != mdr->locks.end()) {
SimpleLock *stray = *existing;
existing++;
- dout(10) << " unlocking out-of-order " << *stray << " " << *stray->get_parent() << endl;
+ dout(10) << " unlocking out-of-order " << *stray << " " << *stray->get_parent() << dendl;
if (mdr->xlocks.count(stray))
xlock_finish(stray, mdr);
else if (mdr->wrlocks.count(stray))
if (xlocks.count(*p)) {
if (!xlock_start(*p, mdr))
return false;
- dout(10) << " got xlock on " << **p << " " << *(*p)->get_parent() << endl;
+ dout(10) << " got xlock on " << **p << " " << *(*p)->get_parent() << dendl;
} else if (wrlocks.count(*p)) {
if (!wrlock_start(*p, mdr))
return false;
- dout(10) << " got wrlock on " << **p << " " << *(*p)->get_parent() << endl;
+ dout(10) << " got wrlock on " << **p << " " << *(*p)->get_parent() << dendl;
} else {
if (!rdlock_start(*p, mdr))
return false;
- dout(10) << " got rdlock on " << **p << " " << *(*p)->get_parent() << endl;
+ dout(10) << " got rdlock on " << **p << " " << *(*p)->get_parent() << dendl;
}
}
while (existing != mdr->locks.end()) {
SimpleLock *stray = *existing;
existing++;
- dout(10) << " unlocking extra " << *stray << " " << *stray->get_parent() << endl;
+ dout(10) << " unlocking extra " << *stray << " " << *stray->get_parent() << dendl;
if (mdr->xlocks.count(stray))
xlock_finish(stray, mdr);
else if (mdr->wrlocks.count(stray))
version_t Locker::issue_file_data_version(CInode *in)
{
- dout(7) << "issue_file_data_version on " << *in << endl;
+ dout(7) << "issue_file_data_version on " << *in << dendl;
return in->inode.file_data_version;
}
int mode,
MClientRequest *req)
{
- dout(7) << "issue_new_caps for mode " << mode << " on " << *in << endl;
+ dout(7) << "issue_new_caps for mode " << mode << " on " << *in << dendl;
// my needs
int my_client = req->get_client();
if ((before & CAP_FILE_WRBUFFER) == 0 &&
(now & CAP_FILE_WRBUFFER)) {
in->inode.file_data_version++;
- dout(7) << " incrementing file_data_version, now " << in->inode.file_data_version << " for " << *in << endl;
+ dout(7) << " incrementing file_data_version, now " << in->inode.file_data_version << " for " << *in << dendl;
}
return cap;
// allowed caps are determined by the lock mode.
int allowed = in->filelock.caps_allowed();
dout(7) << "issue_caps filelock allows=" << cap_string(allowed)
- << " on " << *in << endl;
+ << " on " << *in << dendl;
// count conflicts with
int nissued = 0;
// twiddle file_data_version?
if (!(before & CAP_FILE_WRBUFFER) &&
(after & CAP_FILE_WRBUFFER)) {
- dout(7) << " incrementing file_data_version for " << *in << endl;
+ dout(7) << " incrementing file_data_version for " << *in << dendl;
in->inode.file_data_version++;
}
if (seq > 0 &&
!it->second.is_suppress()) {
- dout(7) << " sending MClientFileCaps to client" << it->first << " seq " << it->second.get_last_seq() << " new pending " << cap_string(it->second.pending()) << " was " << cap_string(before) << endl;
+ dout(7) << " sending MClientFileCaps to client" << it->first << " seq " << it->second.get_last_seq() << " new pending " << cap_string(it->second.pending()) << " was " << cap_string(before) << dendl;
mds->send_message_client(new MClientFileCaps(MClientFileCaps::OP_GRANT,
in->inode,
it->second.get_last_seq(),
<< " was " << cap_string(in->replica_caps_wanted)
<< " no keeping anymore "
<< " on " << *in
- << endl;
+ << dendl;
}
else if (in->replica_caps_wanted_keep_until.sec() == 0) {
in->replica_caps_wanted_keep_until = g_clock.recent_now();
<< " was " << cap_string(in->replica_caps_wanted)
<< " keeping until " << in->replica_caps_wanted_keep_until
<< " on " << *in
- << endl;
+ << dendl;
return;
} else {
// wait longer
int auth = in->authority().first;
dout(7) << "request_inode_file_caps " << cap_string(wanted)
<< " was " << cap_string(in->replica_caps_wanted)
- << " on " << *in << " to mds" << auth << endl;
+ << " on " << *in << " to mds" << auth << dendl;
assert(!in->is_auth());
in->replica_caps_wanted = wanted;
if (mds->is_rejoin() &&
in->is_rejoining()) {
- dout(7) << "handle_inode_file_caps still rejoining " << *in << ", dropping " << *m << endl;
+ dout(7) << "handle_inode_file_caps still rejoining " << *in << ", dropping " << *m << dendl;
delete m;
return;
}
- dout(7) << "handle_inode_file_caps replica mds" << m->get_from() << " wants caps " << cap_string(m->get_caps()) << " on " << *in << endl;
+ dout(7) << "handle_inode_file_caps replica mds" << m->get_from() << " wants caps " << cap_string(m->get_caps()) << " on " << *in << dendl;
if (m->get_caps())
in->mds_caps_wanted[m->get_from()] = m->get_caps();
if (!in || !cap) {
if (!in) {
- dout(7) << "handle_client_file_caps on unknown ino " << m->get_ino() << ", dropping" << endl;
+ dout(7) << "handle_client_file_caps on unknown ino " << m->get_ino() << ", dropping" << dendl;
} else {
- dout(7) << "handle_client_file_caps no cap for client" << client << " on " << *in << endl;
+ dout(7) << "handle_client_file_caps no cap for client" << client << " on " << *in << dendl;
}
delete m;
return;
<< " wants " << cap_string(wanted)
<< " from client" << client
<< " on " << *in
- << endl;
+ << dendl;
// update wanted
if (cap->wanted() != wanted) {
sure the client has seen all the latest caps.
*/
dout(10) << "handle_client_file_caps ignoring wanted " << cap_string(m->get_wanted())
- << " bc seq " << m->get_seq() << " < " << cap->get_last_seq() << endl;
+ << " bc seq " << m->get_seq() << " < " << cap->get_last_seq() << dendl;
} else {
cap->set_wanted(wanted);
}
int had = cap->confirm_receipt(m->get_seq(), m->get_caps());
int has = cap->confirmed();
if (cap->is_null()) {
- dout(7) << " cap for client" << client << " is now null, removing from " << *in << endl;
+ dout(7) << " cap for client" << client << " is now null, removing from " << *in << dendl;
in->remove_client_cap(client);
if (!in->is_auth())
request_inode_file_caps(in);
// merge in atime?
if (m->get_inode().atime > in->inode.atime) {
dout(7) << " taking atime " << m->get_inode().atime << " > "
- << in->inode.atime << " for " << *in << endl;
+ << in->inode.atime << " for " << *in << dendl;
in->inode.atime = m->get_inode().atime;
}
// mtime
if (m->get_inode().mtime > in->inode.mtime) {
dout(7) << " taking mtime " << m->get_inode().mtime << " > "
- << in->inode.mtime << " for " << *in << endl;
+ << in->inode.mtime << " for " << *in << dendl;
in->inode.mtime = m->get_inode().mtime;
dirty = true;
}
// size
if (m->get_inode().size > in->inode.size) {
dout(7) << " taking size " << m->get_inode().size << " > "
- << in->inode.size << " for " << *in << endl;
+ << in->inode.size << " for " << *in << dendl;
in->inode.size = m->get_inode().size;
dirty = true;
}
dn = dir->lookup(info.dname);
}
if (!dn) {
- dout(7) << "get_lock don't have dn " << info.dirfrag.ino << " " << info.dname << endl;
+ dout(7) << "get_lock don't have dn " << info.dirfrag.ino << " " << info.dname << dendl;
return 0;
}
return &dn->lock;
{
CInode *in = mdcache->get_inode(info.ino);
if (!in) {
- dout(7) << "get_lock don't have ino " << info.ino << endl;
+ dout(7) << "get_lock don't have ino " << info.ino << dendl;
return 0;
}
switch (lock_type) {
}
default:
- dout(7) << "get_lock don't know lock_type " << lock_type << endl;
+ dout(7) << "get_lock don't know lock_type " << lock_type << dendl;
assert(0);
break;
}
SimpleLock *lock = get_lock(m->get_lock_type(), m->get_object_info());
if (!lock) {
- dout(10) << "don't have object " << m->get_object_info() << ", must have trimmed, dropping" << endl;
+ dout(10) << "don't have object " << m->get_object_info() << ", must have trimmed, dropping" << dendl;
delete m;
return;
}
break;
default:
- dout(7) << "handle_lock got otype " << m->get_lock_type() << endl;
+ dout(7) << "handle_lock got otype " << m->get_lock_type() << dendl;
assert(0);
break;
}
if (mds->is_rejoin()) {
if (lock->get_parent()->is_rejoining()) {
dout(7) << "handle_simple_lock still rejoining " << *lock->get_parent()
- << ", dropping " << *m << endl;
+ << ", dropping " << *m << dendl;
delete m;
return;
}
CDentry *dn = (CDentry*)lock->get_parent();
if (dn->is_null() && m->get_data().length() > 0) {
dout(10) << "handle_simple_lock replica dentry null -> non-null, must trim "
- << *dn << endl;
+ << *dn << dendl;
assert(dn->get_num_ref() == 0);
map<int, MCacheExpire*> expiremap;
mdcache->trim_dentry(dn, expiremap);
// wait for readers to finish?
if (lock->is_rdlocked()) {
dout(7) << "handle_simple_lock has reader, waiting before ack on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_GLOCKR);
} else {
// update lock and reply
if (lock->is_gathering()) {
dout(7) << "handle_simple_lock " << *lock << " on " << *lock->get_parent() << " from " << from
- << ", still gathering " << lock->get_gather_set() << endl;
+ << ", still gathering " << lock->get_gather_set() << dendl;
} else {
dout(7) << "handle_simple_lock " << *lock << " on " << *lock->get_parent() << " from " << from
- << ", last one" << endl;
+ << ", last one" << dendl;
simple_eval_gather(lock);
}
break;
// unstable and ambiguous auth?
if (!lock->is_stable() &&
lock->get_parent()->is_ambiguous_auth()) {
- dout(7) << "simple_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
+ dout(7) << "simple_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_SimpleEval(this, lock));
return;
}
if (!lock->get_parent()->is_auth()) {
- dout(7) << "try_simple_eval not auth for " << *lock->get_parent() << endl;
+ dout(7) << "try_simple_eval not auth for " << *lock->get_parent() << dendl;
return;
}
if (!lock->get_parent()->can_auth_pin()) {
- dout(7) << "try_simple_eval can't auth_pin, waiting on " << *lock->get_parent() << endl;
+ dout(7) << "try_simple_eval can't auth_pin, waiting on " << *lock->get_parent() << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
lock->get_parent()->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_Locker_SimpleEval(this, lock));
return;
void Locker::simple_eval_gather(SimpleLock *lock)
{
- dout(10) << "simple_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "simple_eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
// finished gathering?
if (lock->get_state() == LOCK_GLOCKR &&
!lock->is_gathering() &&
!lock->is_rdlocked()) {
- dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_eval finished gather on " << *lock << " on " << *lock->get_parent() << dendl;
// replica: tell auth
if (!lock->get_parent()->is_auth()) {
void Locker::simple_eval(SimpleLock *lock)
{
- dout(10) << "simple_eval " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "simple_eval " << *lock << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
lock->get_state() != LOCK_SYNC &&
!lock->is_waiter_for(SimpleLock::WAIT_WR)) {
dout(7) << "simple_eval stable, syncing " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
simple_sync(lock);
}
void Locker::simple_sync(SimpleLock *lock)
{
- dout(7) << "simple_sync on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_sync on " << *lock << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
void Locker::simple_lock(SimpleLock *lock)
{
- dout(7) << "simple_lock on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_lock on " << *lock << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
bool Locker::simple_rdlock_try(SimpleLock *lock, Context *con)
{
- dout(7) << "simple_rdlock_try on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_rdlock_try on " << *lock << " on " << *lock->get_parent() << dendl;
// can read? grab ref.
if (lock->can_rdlock(0))
assert(!lock->get_parent()->is_auth());
// wait!
- dout(7) << "simple_rdlock_try waiting on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_rdlock_try waiting on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_RD, con);
return false;
}
bool Locker::simple_rdlock_start(SimpleLock *lock, MDRequest *mdr)
{
- dout(7) << "simple_rdlock_start on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_rdlock_start on " << *lock << " on " << *lock->get_parent() << dendl;
// can read? grab ref.
if (lock->can_rdlock(mdr)) {
}
// wait!
- dout(7) << "simple_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
mdr->locks.erase(lock);
}
- dout(7) << "simple_rdlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_rdlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
// last one?
if (!lock->is_rdlocked())
bool Locker::simple_xlock_start(SimpleLock *lock, MDRequest *mdr)
{
- dout(7) << "simple_xlock_start on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_xlock_start on " << *lock << " on " << *lock->get_parent() << dendl;
// xlock by me?
if (lock->is_xlocked() &&
void Locker::simple_xlock_finish(SimpleLock *lock, MDRequest *mdr)
{
- dout(7) << "simple_xlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "simple_xlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
// drop ref
assert(lock->can_xlock(mdr));
// remote xlock?
if (!lock->get_parent()->is_auth()) {
// tell auth
- dout(7) << "simple_xlock_finish releasing remote xlock on " << *lock->get_parent() << endl;
+ dout(7) << "simple_xlock_finish releasing remote xlock on " << *lock->get_parent() << dendl;
int auth = lock->get_parent()->authority().first;
if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
MMDSSlaveRequest *slavereq = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_UNXLOCK);
it++) {
CDentry *dn = *it;
if (!dn->lock.can_rdlock(0)) {
- dout(10) << "can_rdlock_trace can't rdlock " << *dn << endl;
+ dout(10) << "can_rdlock_trace can't rdlock " << *dn << dendl;
return false;
}
}
for (vector<CDentry*>::iterator it = trace.begin();
it != trace.end();
it++) {
- dout(10) << "dentry_anon_rdlock_trace_start rdlocking " << (*it)->lock << " " << **it << endl;
+ dout(10) << "dentry_anon_rdlock_trace_start rdlocking " << (*it)->lock << " " << **it << dendl;
(*it)->lock.get_rdlock();
}
}
bool Locker::scatter_rdlock_start(ScatterLock *lock, MDRequest *mdr)
{
dout(7) << "scatter_rdlock_start on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
// read on stable scattered replica?
if (lock->get_state() == LOCK_SCATTER &&
!lock->get_parent()->is_auth()) {
- dout(7) << "scatter_rdlock_start scatterlock read on a stable scattered replica, fw to auth" << endl;
+ dout(7) << "scatter_rdlock_start scatterlock read on a stable scattered replica, fw to auth" << dendl;
mdcache->request_forward(mdr, lock->get_parent()->authority().first);
return false;
}
void Locker::scatter_rdlock_finish(ScatterLock *lock, MDRequest *mdr)
{
dout(7) << "scatter_rdlock_finish on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->put_rdlock();
if (mdr) {
mdr->rdlocks.erase(lock);
bool Locker::scatter_wrlock_start(ScatterLock *lock, MDRequest *mdr)
{
dout(7) << "scatter_wrlock_start on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
// pre-twiddle?
if (lock->get_parent()->is_auth() &&
// auth should be auth_pinned (see acquire_locks wrlock weird mustpin case).
int auth = lock->get_parent()->authority().first;
dout(10) << "requesting scatter from auth on "
- << *lock << " on " << *lock->get_parent() << endl;
+ << *lock << " on " << *lock->get_parent() << dendl;
mds->send_message_mds(new MLock(lock, LOCK_AC_REQSCATTER, mds->get_nodeid()),
auth, MDS_PORT_LOCKER);
}
void Locker::scatter_wrlock_finish(ScatterLock *lock, MDRequest *mdr)
{
dout(7) << "scatter_wrlock_finish on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->put_wrlock();
if (mdr) {
mdr->wrlocks.erase(lock);
// unstable and ambiguous auth?
if (!lock->is_stable() &&
lock->get_parent()->is_ambiguous_auth()) {
- dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << endl;
+ dout(7) << "scatter_eval not stable and ambiguous auth, waiting on " << *lock->get_parent() << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
lock->get_parent()->add_waiter(MDSCacheObject::WAIT_SINGLEAUTH, new C_Locker_ScatterEval(this, lock));
return;
}
if (!lock->get_parent()->is_auth()) {
- dout(7) << "try_scatter_eval not auth for " << *lock->get_parent() << endl;
+ dout(7) << "try_scatter_eval not auth for " << *lock->get_parent() << dendl;
return;
}
if (!lock->get_parent()->can_auth_pin()) {
- dout(7) << "try_scatter_eval can't auth_pin, waiting on " << *lock->get_parent() << endl;
+ dout(7) << "try_scatter_eval can't auth_pin, waiting on " << *lock->get_parent() << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
lock->get_parent()->add_waiter(MDSCacheObject::WAIT_AUTHPINNABLE, new C_Locker_ScatterEval(this, lock));
return;
void Locker::scatter_eval_gather(ScatterLock *lock)
{
- dout(10) << "scatter_eval_gather " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "scatter_eval_gather " << *lock << " on " << *lock->get_parent() << dendl;
if (!lock->get_parent()->is_auth()) {
// REPLICA
if (lock->get_state() == LOCK_GLOCKC &&
!lock->is_wrlocked()) {
- dout(10) << "scatter_eval no wrlocks, acking lock" << endl;
+ dout(10) << "scatter_eval no wrlocks, acking lock" << dendl;
int auth = lock->get_parent()->authority().first;
if (mds->mdsmap->get_state(auth) >= MDSMap::STATE_REJOIN) {
bufferlist data;
!lock->is_gathering() &&
!lock->is_rdlocked()) {
dout(7) << "scatter_eval finished lock gather/un-rdlock on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_LOCK);
lock->finish_waiters(ScatterLock::WAIT_XLOCK|ScatterLock::WAIT_STABLE);
lock->get_parent()->auth_unpin();
scatter_writebehind(lock);
} else {
dout(7) << "scatter_eval finished lock gather/un-wrlock on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_LOCK);
//lock->get_parent()->put(CInode::PIN_SCATTERED);
lock->finish_waiters(ScatterLock::WAIT_XLOCK|ScatterLock::WAIT_STABLE);
else if (lock->get_state() == LOCK_GSYNCL &&
!lock->is_wrlocked()) {
dout(7) << "scatter_eval finished sync un-wrlock on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
if (lock->get_parent()->is_replicated()) {
// encode and bcast
bufferlist data;
!lock->is_gathering() &&
!lock->is_rdlocked()) {
dout(7) << "scatter_eval finished scatter un-rdlock(/gather) on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
if (lock->get_parent()->is_replicated()) {
// encode and bcast
bufferlist data;
scatter_writebehind(lock);
} else {
dout(7) << "scatter_eval finished tempsync gather/un-wrlock on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_TEMPSYNC);
lock->finish_waiters(ScatterLock::WAIT_RD|ScatterLock::WAIT_STABLE);
lock->get_parent()->auth_unpin();
void Locker::scatter_writebehind(ScatterLock *lock)
{
CInode *in = (CInode*)lock->get_parent();
- dout(10) << "scatter_writebehind on " << *lock << " on " << *in << endl;
+ dout(10) << "scatter_writebehind on " << *lock << " on " << *in << dendl;
// journal write-behind.
inode_t *pi = in->project_inode();
void Locker::scatter_writebehind_finish(ScatterLock *lock)
{
CInode *in = (CInode*)lock->get_parent();
- dout(10) << "scatter_writebehind_finish on " << *lock << " on " << *in << endl;
+ dout(10) << "scatter_writebehind_finish on " << *lock << " on " << *in << dendl;
in->pop_and_dirty_projected_inode();
lock->clear_updated();
scatter_eval_gather(lock);
void Locker::scatter_eval(ScatterLock *lock)
{
- dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "scatter_eval " << *lock << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
// i _should_ be scattered.
if (!lock->is_rdlocked() &&
!lock->is_xlocked()) {
- dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << endl;
+ dout(10) << "scatter_eval no rdlocks|xlocks, am subtree root inode, scattering" << dendl;
scatter_scatter(lock);
}
} else {
// i _should_ be sync.
if (!lock->is_wrlocked() &&
!lock->is_xlocked()) {
- dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << endl;
+ dout(10) << "scatter_eval no wrlocks|xlocks, not subtree root inode, syncing" << dendl;
scatter_sync(lock);
}
}
void Locker::scatter_sync(ScatterLock *lock)
{
dout(10) << "scatter_sync " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
void Locker::scatter_scatter(ScatterLock *lock)
{
dout(10) << "scatter_scatter " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
void Locker::scatter_lock(ScatterLock *lock)
{
dout(10) << "scatter_lock " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
void Locker::scatter_tempsync(ScatterLock *lock)
{
dout(10) << "scatter_tempsync " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
void Locker::handle_scatter_lock(ScatterLock *lock, MLock *m)
{
int from = m->get_asker();
- dout(10) << "handle_scatter_lock " << *m << " on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "handle_scatter_lock " << *m << " on " << *lock << " on " << *lock->get_parent() << dendl;
if (mds->is_rejoin()) {
if (lock->get_parent()->is_rejoining()) {
dout(7) << "handle_scatter_lock still rejoining " << *lock->get_parent()
- << ", dropping " << *m << endl;
+ << ", dropping " << *m << dendl;
delete m;
return;
}
if (lock->is_wrlocked()) {
assert(lock->get_state() == LOCK_SCATTER);
dout(7) << "handle_scatter_lock has wrlocks, waiting on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_GLOCKC);
} else if (lock->is_rdlocked()) {
assert(lock->get_state() == LOCK_SYNC);
dout(7) << "handle_scatter_lock has rdlocks, waiting on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->set_state(LOCK_GLOCKS);
} else {
//if (lock->get_state() == LOCK_SCATTER)
if (lock->is_gathering()) {
dout(7) << "handle_scatter_lock " << *lock << " on " << *lock->get_parent()
<< " from " << from << ", still gathering " << lock->get_gather_set()
- << endl;
+ << dendl;
} else {
dout(7) << "handle_scatter_lock " << *lock << " on " << *lock->get_parent()
<< " from " << from << ", last one"
- << endl;
+ << dendl;
scatter_eval_gather(lock);
}
break;
case LOCK_AC_REQSCATTER:
if (lock->is_stable()) {
dout(7) << "handle_scatter_lock got scatter request on " << *lock << " on " << *lock->get_parent()
- << endl;
+ << dendl;
scatter_scatter(lock);
} else {
dout(7) << "handle_scatter_lock ignoring scatter request on " << *lock << " on " << *lock->get_parent()
- << endl;
+ << dendl;
}
break;
bool Locker::local_wrlock_start(LocalLock *lock, MDRequest *mdr)
{
dout(7) << "local_wrlock_start on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
if (lock->can_wrlock()) {
lock->get_wrlock();
void Locker::local_wrlock_finish(LocalLock *lock, MDRequest *mdr)
{
dout(7) << "local_wrlock_finish on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->put_wrlock();
mdr->wrlocks.erase(lock);
mdr->locks.erase(lock);
bool Locker::local_xlock_start(LocalLock *lock, MDRequest *mdr)
{
dout(7) << "local_xlock_start on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
if (lock->is_xlocked_by_other(mdr)) {
lock->add_waiter(SimpleLock::WAIT_WR|SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
void Locker::local_xlock_finish(LocalLock *lock, MDRequest *mdr)
{
dout(7) << "local_xlock_finish on " << *lock
- << " on " << *lock->get_parent() << endl;
+ << " on " << *lock->get_parent() << dendl;
lock->put_xlock();
mdr->xlocks.erase(lock);
mdr->locks.erase(lock);
bool Locker::file_rdlock_start(FileLock *lock, MDRequest *mdr)
{
- dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << dendl;
// can read? grab ref.
if (lock->can_rdlock(mdr)) {
// can't read, and replicated.
if (lock->can_rdlock_soon()) {
// wait
- dout(7) << "file_rdlock_start can_rdlock_soon " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_rdlock_start can_rdlock_soon " << *lock << " on " << *lock->get_parent() << dendl;
} else {
if (lock->get_parent()->is_auth()) {
// auth
return true;
}
} else {
- dout(7) << "file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
// fw to auth
CInode *in = (CInode*)lock->get_parent();
int auth = in->authority().first;
- dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << " on replica and async, fw to auth " << auth << endl;
+ dout(7) << "file_rdlock_start " << *lock << " on " << *lock->get_parent() << " on replica and async, fw to auth " << auth << dendl;
assert(auth != mds->get_nodeid());
mdcache->request_forward(mdr, auth);
return false;
} else {
// wait until stable
- dout(7) << "inode_file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "inode_file_rdlock_start waiting until stable on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
}
// wait
- dout(7) << "file_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_rdlock_start waiting on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
return false;
void Locker::file_rdlock_finish(FileLock *lock, MDRequest *mdr)
{
- dout(7) << "rdlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "rdlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
// drop ref
lock->put_rdlock();
bool Locker::file_xlock_start(FileLock *lock, MDRequest *mdr)
{
- dout(7) << "file_xlock_start on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_xlock_start on " << *lock << " on " << *lock->get_parent() << dendl;
assert(lock->get_parent()->is_auth()); // remote file xlock not implemented
// auth
if (!lock->can_xlock_soon()) {
if (!lock->is_stable()) {
- dout(7) << "file_xlock_start on auth, waiting for stable on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_xlock_start on auth, waiting for stable on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_STABLE, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
mdr->xlocks.insert(lock);
return true;
} else {
- dout(7) << "file_xlock_start on auth, waiting for write on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_xlock_start on auth, waiting for write on " << *lock << " on " << *lock->get_parent() << dendl;
lock->add_waiter(SimpleLock::WAIT_WR, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
void Locker::file_xlock_finish(FileLock *lock, MDRequest *mdr)
{
- dout(7) << "file_xlock_finish on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_xlock_finish on " << *lock << " on " << *lock->get_parent() << dendl;
// drop ref
assert(lock->can_xlock(mdr));
// unstable and ambiguous auth?
if (!lock->is_stable() &&
in->is_ambiguous_auth()) {
- dout(7) << "try_file_eval not stable and ambiguous auth, waiting on " << *in << endl;
+ dout(7) << "try_file_eval not stable and ambiguous auth, waiting on " << *in << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
in->add_waiter(CInode::WAIT_SINGLEAUTH, new C_Locker_FileEval(this, lock));
return;
}
if (!lock->get_parent()->is_auth()) {
- dout(7) << "try_file_eval not auth for " << *lock->get_parent() << endl;
+ dout(7) << "try_file_eval not auth for " << *lock->get_parent() << dendl;
return;
}
if (!lock->get_parent()->can_auth_pin()) {
- dout(7) << "try_file_eval can't auth_pin, waiting on " << *in << endl;
+ dout(7) << "try_file_eval can't auth_pin, waiting on " << *in << dendl;
//if (!lock->get_parent()->is_waiter(MDSCacheObject::WAIT_SINGLEAUTH))
in->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_Locker_FileEval(this, lock));
return;
dout(7) << "file_eval_gather issued " << cap_string(issued)
<< " vs " << cap_string(lock->caps_allowed())
<< " on " << *lock << " on " << *lock->get_parent()
- << endl;
+ << dendl;
if (lock->is_stable())
return; // nothing for us to do here!
if (in->is_auth() &&
!lock->is_gathering() &&
((issued & ~lock->caps_allowed()) == 0)) {
- dout(7) << "file_eval_gather finished gather" << endl;
+ dout(7) << "file_eval_gather finished gather" << dendl;
switch (lock->get_state()) {
// to lock
dout(7) << "file_eval wanted=" << cap_string(wanted)
<< " filelock=" << *lock << " on " << *lock->get_parent()
<< " loner=" << loner
- << endl;
+ << dendl;
assert(lock->get_parent()->is_auth());
assert(lock->is_stable());
(wanted & CAP_FILE_WR) &&
loner &&
lock->get_state() != LOCK_LONER) {
- dout(7) << "file_eval stable, bump to loner " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_eval stable, bump to loner " << *lock << " on " << *lock->get_parent() << dendl;
file_loner(lock);
}
(wanted & CAP_FILE_WR) &&
!(loner && lock->get_state() == LOCK_LONER) &&
lock->get_state() != LOCK_MIXED) {
- dout(7) << "file_eval stable, bump to mixed " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_eval stable, bump to mixed " << *lock << " on " << *lock->get_parent() << dendl;
file_mixed(lock);
}
in->is_replicated() ||
(!loner && lock->get_state() == LOCK_LONER)) &&
lock->get_state() != LOCK_SYNC) {
- dout(7) << "file_eval stable, bump to sync " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_eval stable, bump to sync " << *lock << " on " << *lock->get_parent() << dendl;
file_sync(lock);
}
bool Locker::file_sync(FileLock *lock)
{
CInode *in = (CInode*)lock->get_parent();
- dout(7) << "file_sync " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_sync " << *lock << " on " << *lock->get_parent() << dendl;
assert(in->is_auth());
assert(lock->is_stable());
void Locker::file_lock(FileLock *lock)
{
CInode *in = (CInode*)lock->get_parent();
- dout(7) << "inode_file_lock " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "inode_file_lock " << *lock << " on " << *lock->get_parent() << dendl;
assert(in->is_auth());
assert(lock->is_stable());
void Locker::file_mixed(FileLock *lock)
{
- dout(7) << "file_mixed " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "file_mixed " << *lock << " on " << *lock->get_parent() << dendl;
CInode *in = (CInode*)lock->get_parent();
assert(in->is_auth());
void Locker::file_loner(FileLock *lock)
{
CInode *in = (CInode*)lock->get_parent();
- dout(7) << "inode_file_loner " << *lock << " on " << *lock->get_parent() << endl;
+ dout(7) << "inode_file_loner " << *lock << " on " << *lock->get_parent() << dendl;
assert(in->is_auth());
assert(lock->is_stable());
if (mds->is_rejoin()) {
if (in->is_rejoining()) {
dout(7) << "handle_file_lock still rejoining " << *in
- << ", dropping " << *m << endl;
+ << ", dropping " << *m << dendl;
delete m;
return;
}
dout(7) << "handle_file_lock a=" << m->get_action() << " from " << from << " "
- << *in << " filelock=" << *lock << endl;
+ << *in << " filelock=" << *lock << dendl;
int issued = in->get_caps_issued();
// call back caps?
if (issued & CAP_FILE_RD) {
- dout(7) << "handle_file_lock client readers, gathering caps on " << *in << endl;
+ dout(7) << "handle_file_lock client readers, gathering caps on " << *in << dendl;
issue_caps(in);
break;
}
else if (lock->is_rdlocked()) {
- dout(7) << "handle_file_lock rdlocked, waiting before ack on " << *in << endl;
+ dout(7) << "handle_file_lock rdlocked, waiting before ack on " << *in << dendl;
break;
}
if (lock->is_gathering()) {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", still gathering " << lock->get_gather_set() << endl;
+ << ", still gathering " << lock->get_gather_set() << dendl;
} else {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", last one" << endl;
+ << ", last one" << dendl;
file_eval_gather(lock);
}
break;
if (lock->is_gathering()) {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", still gathering " << lock->get_gather_set() << endl;
+ << ", still gathering " << lock->get_gather_set() << dendl;
} else {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", last one" << endl;
+ << ", last one" << dendl;
file_eval_gather(lock);
}
break;
if (lock->is_gathering()) {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", still gathering " << lock->get_gather_set() << endl;
+ << ", still gathering " << lock->get_gather_set() << dendl;
} else {
dout(7) << "handle_lock_inode_file " << *in << " from " << from
- << ", last one" << endl;
+ << ", last one" << dendl;
file_eval_gather(lock);
}
break;
#include "events/EAnchorClient.h"
+
LogEvent *LogEvent::decode(bufferlist& bl)
{
// parse type, length
off += sizeof(type);
int length = bl.length() - off;
- dout(15) << "decode_log_event type " << type << ", size " << length << endl;
+ generic_dout(15) << "decode_log_event type " << type << ", size " << length << dendl;
assert(type > 0);
case EVENT_ANCHOR: le = new EAnchor; break;
case EVENT_ANCHORCLIENT: le = new EAnchorClient; break;
default:
- dout(1) << "uh oh, unknown log event type " << type << endl;
+ generic_dout(1) << "uh oh, unknown log event type " << type << dendl;
assert(0);
}
using namespace std;
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug_mds || l<=g_conf.debug_mds_balancer) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".bal "
+
+#define dout(l) if (l<=g_conf.debug_mds || l<=g_conf.debug_mds_balancer) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".bal "
#define MIN_LOAD 50 // ??
#define MIN_REEXPORT 5 // will automatically reexport
break;
default:
- dout(1) << " balancer unknown message " << m->get_type() << endl;
+ dout(1) << " balancer unknown message " << m->get_type() << dendl;
assert(0);
break;
}
// sample?
if ((double)now - (double)last_sample > g_conf.mds_bal_sample_interval) {
- dout(15) << "tick last_sample now " << now << endl;
+ dout(15) << "tick last_sample now " << now << dendl;
last_sample = now;
}
{
utime_t now = g_clock.now();
if (!mds->mdcache->get_root()) {
- dout(5) << "no root on send_heartbeat" << endl;
+ dout(5) << "no root on send_heartbeat" << dendl;
mds->mdcache->open_root(new C_Bal_SendHeartbeat(mds));
return;
}
mds_import_map[ mds->get_nodeid() ] = import_map;
- dout(5) << "mds" << mds->get_nodeid() << " sending heartbeat " << beat_epoch << " " << load << endl;
+ dout(5) << "mds" << mds->get_nodeid() << " sending heartbeat " << beat_epoch << " " << load << dendl;
for (map<int, float>::iterator it = import_map.begin();
it != import_map.end();
it++) {
- dout(5) << " import_map from " << it->first << " -> " << it->second << endl;
+ dout(5) << " import_map from " << it->first << " -> " << it->second << dendl;
}
void MDBalancer::handle_heartbeat(MHeartbeat *m)
{
- dout(25) << "=== got heartbeat " << m->get_beat() << " from " << m->get_source().num() << " " << m->get_load() << endl;
+ dout(25) << "=== got heartbeat " << m->get_beat() << " from " << m->get_source().num() << " " << m->get_load() << dendl;
if (!mds->mdcache->get_root()) {
- dout(10) << "opening root on handle_heartbeat" << endl;
+ dout(10) << "opening root on handle_heartbeat" << dendl;
mds->mdcache->open_root(new C_MDS_RetryMessage(mds, m));
return;
}
int who = m->get_source().num();
if (who == 0) {
- dout(20) << " from mds0, new epoch" << endl;
+ dout(20) << " from mds0, new epoch" << dendl;
beat_epoch = m->get_beat();
send_heartbeat();
mds_load[ who ] = m->get_load();
mds_import_map[ who ] = m->get_import_map();
- //cout << " load is " << load << " have " << mds_load.size() << endl;
+ //dout(0) << " load is " << load << " have " << mds_load.size() << dendl;
unsigned cluster_size = mds->get_mds_map()->get_num_mds();
if (mds_load.size() == cluster_size) {
void MDBalancer::export_empties()
{
- dout(5) << "export_empties checking for empty imports" << endl;
+ dout(5) << "export_empties checking for empty imports" << dendl;
for (map<CDir*,set<CDir*> >::iterator it = mds->mdcache->subtrees.begin();
it != mds->mdcache->subtrees.end();
double howmuch = MIN(maxex, maxim);
if (howmuch <= 0) return 0.0;
- dout(5) << " - mds" << ex << " exports " << howmuch << " to mds" << im << endl;
+ dout(5) << " - mds" << ex << " exports " << howmuch << " to mds" << im << dendl;
if (ex == mds->get_nodeid())
my_targets[im] += howmuch;
void MDBalancer::do_fragmenting()
{
if (split_queue.empty()) {
- dout(20) << "do_fragmenting has nothing to do" << endl;
+ dout(20) << "do_fragmenting has nothing to do" << dendl;
return;
}
- dout(0) << "do_fragmenting " << split_queue.size() << " dirs marked for possible splitting" << endl;
+ dout(0) << "do_fragmenting " << split_queue.size() << " dirs marked for possible splitting" << dendl;
for (set<dirfrag_t>::iterator i = split_queue.begin();
i != split_queue.end();
if (!dir) continue;
if (!dir->is_auth()) continue;
- dout(0) << "do_fragmenting splitting " << *dir << endl;
+ dout(0) << "do_fragmenting splitting " << *dir << dendl;
mds->mdcache->split_dir(dir, 3);
}
split_queue.clear();
imported.clear();
exported.clear();
- dout(5) << " do_rebalance: cluster loads are" << endl;
+ dout(5) << " do_rebalance: cluster loads are" << dendl;
// rescale! turn my mds_load back into meta_load units
double load_fac = 1.0;
dout(7) << " load_fac is " << load_fac
<< " <- " << mds_load[whoami].auth.meta_load(now)
<< " / " << mds_load[whoami].mds_load(now)
- << endl;
+ << dendl;
}
double total_load = 0;
dout(-5) << " mds" << i
<< " " << mds_load[i]
<< " = " << mds_load[i].mds_load(now)
- << " ~ " << l << endl;
+ << " ~ " << l << dendl;
if (whoami == i) my_load = l;
total_load += l;
dout(5) << "do_rebalance: my load " << my_load
<< " target " << target_load
<< " total " << total_load
- << endl;
+ << dendl;
// under or over?
if (my_load < target_load * (1.0 + g_conf.mds_bal_min_rebalance)) {
- dout(5) << " i am underloaded or barely overloaded, doing nothing." << endl;
+ dout(5) << " i am underloaded or barely overloaded, doing nothing." << dendl;
show_imports();
return;
}
- dout(5) << " i am sufficiently overloaded" << endl;
+ dout(5) << " i am sufficiently overloaded" << dendl;
// first separate exporters and importers
it != load_map.end();
it++) {
if (it->first < target_load) {
- dout(15) << " mds" << it->second << " is importer" << endl;
+ dout(15) << " mds" << it->second << " is importer" << dendl;
importers.insert(pair<double,int>(it->first,it->second));
importer_set.insert(it->second);
} else {
- dout(15) << " mds" << it->second << " is exporter" << endl;
+ dout(15) << " mds" << it->second << " is exporter" << dendl;
exporters.insert(pair<double,int>(it->first,it->second));
exporter_set.insert(it->second);
}
if (true) {
// analyze import_map; do any matches i can
- dout(15) << " matching exporters to import sources" << endl;
+ dout(15) << " matching exporters to import sources" << dendl;
// big -> small exporters
for (multimap<double,int>::reverse_iterator ex = exporters.rbegin();
if (1) {
if (beat % 2 == 1) {
// old way
- dout(15) << " matching big exporters to big importers" << endl;
+ dout(15) << " matching big exporters to big importers" << dendl;
// big exporters to big importers
multimap<double,int>::reverse_iterator ex = exporters.rbegin();
multimap<double,int>::iterator im = importers.begin();
}
} else {
// new way
- dout(15) << " matching small exporters to big importers" << endl;
+ dout(15) << " matching small exporters to big importers" << dendl;
// small exporters to big importers
multimap<double,int>::iterator ex = exporters.begin();
multimap<double,int>::iterator im = importers.begin();
im->inode->authority().first != mds->get_nodeid()) {
dout(-5) << " exporting idle import " << *im
<< " back to mds" << im->inode->authority().first
- << endl;
+ << dendl;
mds->mdcache->migrator->export_dir(im, im->inode->authority().first);
continue;
}
import_pop_map[ pop ] = im;
int from = im->inode->authority().first;
- dout(15) << " map: i imported " << *im << " from " << from << endl;
+ dout(15) << " map: i imported " << *im << " from " << from << dendl;
import_from_map.insert(pair<int,CDir*>(from, im));
}
double fac = 1.0;
if (false && total_goal > 0 && total_sent > 0) {
fac = total_goal / total_sent;
- dout(-5) << " total sent is " << total_sent << " / " << total_goal << " -> fac 1/ " << fac << endl;
+ dout(-5) << " total sent is " << total_sent << " / " << total_goal << " -> fac 1/ " << fac << dendl;
if (fac > 1.0) fac = 1.0;
}
fac = .9 - .4 * ((float)g_conf.num_mds / 128.0); // hack magic fixme
dout(5) << "want to send " << amount << " to mds" << target
//<< " .. " << (*it).second << " * " << load_fac
<< " -> " << amount
- << endl;//" .. fudge is " << fudge << endl;
+ << dendl;//" .. fudge is " << fudge << dendl;
double have = 0;
show_imports();
// search imports from target
if (import_from_map.count(target)) {
- dout(5) << " aha, looking through imports from target mds" << target << endl;
+ dout(5) << " aha, looking through imports from target mds" << target << dendl;
pair<multimap<int,CDir*>::iterator, multimap<int,CDir*>::iterator> p =
import_from_map.equal_range(target);
while (p.first != p.second) {
CDir *dir = (*p.first).second;
- dout(5) << "considering " << *dir << " from " << (*p.first).first << endl;
+ dout(5) << "considering " << *dir << " from " << (*p.first).first << dendl;
multimap<int,CDir*>::iterator plast = p.first++;
if (dir->inode->is_root()) continue;
if (pop <= amount-have) {
dout(-5) << "reexporting " << *dir
<< " pop " << pop
- << " back to mds" << target << endl;
+ << " back to mds" << target << dendl;
mds->mdcache->migrator->export_dir(dir, target);
have += pop;
import_from_map.erase(plast);
import_pop_map.erase(pop);
} else {
- dout(5) << "can't reexport " << *dir << ", too big " << pop << endl;
+ dout(5) << "can't reexport " << *dir << ", too big " << pop << dendl;
}
if (amount-have < MIN_OFFLOAD) break;
}
dout(-5) << "reexporting " << *imp
<< " pop " << pop
<< " back to mds" << imp->inode->authority()
- << endl;
+ << dendl;
have += pop;
mds->mdcache->migrator->export_dir(imp, imp->inode->authority().first);
}
<< (*it)->pop_auth_subtree.meta_load(now)
<< " to mds" << target
<< " " << **it
- << endl;
+ << dendl;
mds->mdcache->migrator->export_dir(*it, target);
}
}
- dout(5) << "rebalance done" << endl;
+ dout(5) << "rebalance done" << dendl;
show_imports();
}
multimap<double, CDir*> smaller;
double dir_pop = dir->pop_auth_subtree.meta_load(now);
- dout(7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << endl;
+ dout(7) << " find_exports in " << dir_pop << " " << *dir << " need " << need << " (" << needmin << " - " << needmax << ")" << dendl;
double subdir_sum = 0;
for (CDir_map_t::iterator it = dir->begin();
// how popular?
double pop = subdir->pop_auth_subtree.meta_load(now);
subdir_sum += pop;
- dout(15) << " subdir pop " << pop << " " << *subdir << endl;
+ dout(15) << " subdir pop " << pop << " " << *subdir << dendl;
if (pop < minchunk) continue;
smaller.insert(pair<double,CDir*>(pop, subdir));
}
}
- dout(15) << " sum " << subdir_sum << " / " << dir_pop << endl;
+ dout(15) << " sum " << subdir_sum << " / " << dir_pop << dendl;
// grab some sufficiently big small items
multimap<double,CDir*>::reverse_iterator it;
if ((*it).first < midchunk)
break; // try later
- dout(7) << " taking smaller " << *(*it).second << endl;
+ dout(7) << " taking smaller " << *(*it).second << dendl;
exports.push_back((*it).second);
already_exporting.insert((*it).second);
for (list<CDir*>::iterator it = bigger_unrep.begin();
it != bigger_unrep.end();
it++) {
- dout(15) << " descending into " << **it << endl;
+ dout(15) << " descending into " << **it << dendl;
find_exports(*it, amount, exports, have, already_exporting, now);
if (have > needmin)
return;
for (;
it != smaller.rend();
it++) {
- dout(7) << " taking (much) smaller " << it->first << " " << *(*it).second << endl;
+ dout(7) << " taking (much) smaller " << it->first << " " << *(*it).second << dendl;
exports.push_back((*it).second);
already_exporting.insert((*it).second);
for (list<CDir*>::iterator it = bigger_rep.begin();
it != bigger_rep.end();
it++) {
- dout(7) << " descending into replicated " << **it << endl;
+ dout(7) << " descending into replicated " << **it << dendl;
find_exports(*it, amount, exports, have, already_exporting, now);
if (have > needmin)
return;
<< in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " curdom, "
<< in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " anydom"
<< " on " << *in
- << endl;
+ << dendl;
} else {
dout(20) << "hit_inode " << type << " pop "
<< in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
<< in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
<< " on " << *in
- << endl;
+ << dendl;
}
// hit auth up to import
float v = dir->popularity[MDS_POP_JUSTME].pop[type].get();
dout(20) << "hit_dir " << type << " pop " << v << " me "
- << *dir << endl;
+ << *dir << dendl;
// fragment this dir? (later?)
if (((g_conf.mds_bal_split_size > 0 &&
//(v > g_conf.mds_bal_split_wr && type == META_POP_IWR) ||
(v > g_conf.mds_bal_split_wr && type == META_POP_DWR)) &&
split_queue.count(dir->dirfrag()) == 0) {
- dout(0) << "hit_dir " << type << " pop is " << v << ", putting in split_queue: " << *dir << endl;
+ dout(0) << "hit_dir " << type << " pop is " << v << ", putting in split_queue: " << *dir << dendl;
split_queue.insert(dir->dirfrag());
}
float dir_pop = dir->pop_auth_subtree.get(type).get(now); // hmm??
dir->last_popularity_sample = last_sample;
- dout(20) << "hit_dir " << type << " pop " << dir_pop << " in " << *dir << endl;
+ dout(20) << "hit_dir " << type << " pop " << dir_pop << " in " << *dir << dendl;
if (dir->is_auth()) {
if (!dir->is_rep() &&
rd_adj = rdp / mds->get_mds_map()->get_num_mds() - rdp;
rd_adj /= 2.0; // temper somewhat
- dout(2) << "replicating dir " << *dir << " pop " << dir_pop << " .. rdp " << rdp << " adj " << rd_adj << endl;
+ dout(2) << "replicating dir " << *dir << " pop " << dir_pop << " .. rdp " << rdp << " adj " << rd_adj << dendl;
dir->dir_rep = CDir::REP_ALL;
mds->mdcache->send_dir_updates(dir, true);
dir->is_rep() &&
dir_pop < g_conf.mds_bal_unreplicate_threshold) {
// unreplicate
- dout(2) << "unreplicating dir " << *dir << " pop " << dir_pop << endl;
+ dout(2) << "unreplicating dir " << *dir << " pop " << dir_pop << dendl;
dir->dir_rep = CDir::REP_NONE;
mds->mdcache->send_dir_updates(dir);
char fn[20];
sprintf(fn, "popdump.%d.mds%d", beat_epoch, mds->get_nodeid());
- dout(1) << "dump_pop_map to " << fn << endl;
+ dout(1) << "dump_pop_map to " << fn << dendl;
ofstream myfile;
myfile.open(fn);
myfile << "." << p;
if (dir->get_frag() != frag_t())
myfile << "___" << (unsigned)dir->get_frag();
- myfile << endl; //"/" << dir->get_frag() << endl;
+ myfile << dendl; //"/" << dir->get_frag() << dendl;
// add contents
for (map<string,CDentry*>::iterator q = dir->items.begin();
if (!dir->is_rep() &&
dir_pop >= g_conf.mds_bal_replicate_threshold) {
// replicate
- dout(5) << "replicating dir " << *in << " pop " << dir_pop << endl;
+ dout(5) << "replicating dir " << *in << " pop " << dir_pop << dendl;
dir->dir_rep = CDIR_REP_ALL;
mds->mdcache->send_dir_updates(dir);
if (dir->is_rep() &&
dir_pop < g_conf.mds_bal_unreplicate_threshold) {
// unreplicate
- dout(5) << "unreplicating dir " << *in << " pop " << dir_pop << endl;
+ dout(5) << "unreplicating dir " << *in << " pop " << dir_pop << dendl;
dir->dir_rep = CDIR_REP_NONE;
mds->mdcache->send_dir_updates(dir);
using namespace std;
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".cache "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".cache "
bool MDCache::shutdown()
{
if (lru.lru_get_size() > 0) {
- dout(7) << "WARNING: mdcache shutodwn with non-empty cache" << endl;
+ dout(7) << "WARNING: mdcache shutodwn with non-empty cache" << dendl;
//show_cache();
show_subtrees();
//dump();
void MDCache::remove_inode(CInode *o)
{
- dout(14) << "remove_inode " << *o << endl;
+ dout(14) << "remove_inode " << *o << dendl;
if (o->get_parent_dn()) {
// FIXME: multiple parents?
} else {
// request inode from root mds
if (waiting_for_root.empty()) {
- dout(7) << "discovering root" << endl;
+ dout(7) << "discovering root" << dendl;
filepath want;
MDiscover *req = new MDiscover(whoami,
false); // there _is_ no base dir for the root inode
mds->send_message_mds(req, 0, MDS_PORT_CACHE);
} else {
- dout(7) << "waiting for root" << endl;
+ dout(7) << "waiting for root" << dendl;
}
// wait
void MDCache::open_foreign_stray(int who, Context *c)
{
inodeno_t ino = MDS_INO_STRAY(who);
- dout(10) << "open_foreign_stray mds" << who << " " << ino << endl;
+ dout(10) << "open_foreign_stray mds" << who << " " << ino << dendl;
assert(!have_inode(ino));
// discover
void MDCache::adjust_subtree_auth(CDir *dir, pair<int,int> auth)
{
dout(7) << "adjust_subtree_auth " << dir->get_dir_auth() << " -> " << auth
- << " on " << *dir << endl;
+ << " on " << *dir << dendl;
show_subtrees();
}
assert(root);
assert(subtrees.count(root));
- dout(7) << " current root is " << *root << endl;
+ dout(7) << " current root is " << *root << dendl;
if (root == dir) {
// i am already a subtree.
dir->set_dir_auth(auth);
} else {
// i am a new subtree.
- dout(10) << " new subtree at " << *dir << endl;
+ dout(10) << " new subtree at " << *dir << dendl;
assert(subtrees.count(dir) == 0);
subtrees[dir].clear(); // create empty subtree bounds list for me.
next++;
if (get_subtree_root((*p)->get_parent_dir()) == dir) {
// move under me
- dout(10) << " claiming child bound " << **p << endl;
+ dout(10) << " claiming child bound " << **p << dendl;
subtrees[dir].insert(*p);
subtrees[root].erase(p);
}
dir->inode->authority().first == mds->get_nodeid()) {
// export.
if (!dir->state_test(CDir::STATE_EXPORT)) {
- dout(10) << "adjust_export_state pinning new export " << *dir << endl;
+ dout(10) << "adjust_export_state pinning new export " << *dir << dendl;
dir->state_set(CDir::STATE_EXPORT);
dir->get(CDir::PIN_EXPORT);
}
else {
// not export.
if (dir->state_test(CDir::STATE_EXPORT)) {
- dout(10) << "adjust_export_state unpinning old export " << *dir << endl;
+ dout(10) << "adjust_export_state unpinning old export " << *dir << dendl;
dir->state_clear(CDir::STATE_EXPORT);
dir->put(CDir::PIN_EXPORT);
}
void MDCache::try_subtree_merge(CDir *dir)
{
- dout(7) << "try_subtree_merge " << *dir << endl;
+ dout(7) << "try_subtree_merge " << *dir << dendl;
assert(subtrees.count(dir));
set<CDir*> oldbounds = subtrees[dir];
void MDCache::try_subtree_merge_at(CDir *dir)
{
- dout(10) << "try_subtree_merge_at " << *dir << endl;
+ dout(10) << "try_subtree_merge_at " << *dir << dendl;
assert(subtrees.count(dir));
// merge with parent?
dir->dir_auth.second == CDIR_AUTH_UNKNOWN && // auth is unambiguous,
!dir->state_test(CDir::STATE_EXPORTBOUND)) { // not an exportbound,
// merge with parent.
- dout(10) << " subtree merge at " << *dir << endl;
+ dout(10) << " subtree merge at " << *dir << dendl;
dir->set_dir_auth(CDIR_AUTH_DEFAULT);
// move our bounds under the parent
dir->inode->can_auth_pin() &&
(mds->is_active() || mds->is_stopping())) {
CInode *in = dir->inode;
- dout(10) << "try_subtree_merge_at journaling merged bound " << *in << endl;
+ dout(10) << "try_subtree_merge_at journaling merged bound " << *in << dendl;
in->auth_pin();
void MDCache::subtree_merge_writebehind_finish(CInode *in)
{
- dout(10) << "subtree_merge_writebehind_finish on " << in << endl;
+ dout(10) << "subtree_merge_writebehind_finish on " << in << dendl;
in->pop_and_dirty_projected_inode();
in->auth_unpin();
}
dout(7) << "adjust_bounded_subtree_auth " << dir->get_dir_auth() << " -> " << auth
<< " on " << *dir
<< " bounds " << bounds
- << endl;
+ << dendl;
show_subtrees();
}
assert(root);
assert(subtrees.count(root));
- dout(7) << " current root is " << *root << endl;
+ dout(7) << " current root is " << *root << dendl;
pair<int,int> oldauth = dir->authority();
dir->set_dir_auth(auth);
} else {
// i am a new subtree.
- dout(10) << " new subtree at " << *dir << endl;
+ dout(10) << " new subtree at " << *dir << dendl;
assert(subtrees.count(dir) == 0);
subtrees[dir].clear(); // create empty subtree bounds list for me.
next++;
if (get_subtree_root((*p)->get_parent_dir()) == dir) {
// move under me
- dout(10) << " claiming child bound " << **p << endl;
+ dout(10) << " claiming child bound " << **p << dendl;
subtrees[dir].insert(*p);
subtrees[root].erase(p);
}
// new bound?
if (subtrees[dir].count(bound) == 0) {
if (get_subtree_root(bound) == dir) {
- dout(10) << " new bound " << *bound << ", adjusting auth back to old " << oldauth << endl;
+ dout(10) << " new bound " << *bound << ", adjusting auth back to old " << oldauth << dendl;
adjust_subtree_auth(bound, oldauth); // otherwise, adjust at bound.
}
else {
- dout(10) << " want bound " << *bound << endl;
+ dout(10) << " want bound " << *bound << dendl;
// make sure it's nested beneath ambiguous subtree(s)
while (1) {
CDir *t = get_subtree_root(bound->get_parent_dir());
if (t == dir) break;
while (subtrees[dir].count(t) == 0)
t = get_subtree_root(t->get_parent_dir());
- dout(10) << " swallowing intervening subtree at " << *t << endl;
+ dout(10) << " swallowing intervening subtree at " << *t << dendl;
adjust_subtree_auth(t, auth);
try_subtree_merge_at(t);
}
}
}
else {
- dout(10) << " already have bound " << *bound << endl;
+ dout(10) << " already have bound " << *bound << dendl;
}
}
// merge stray bounds?
n++;
if (bounds.count(*p) == 0) {
CDir *stray = *p;
- dout(10) << " swallowing extra subtree at " << *stray << endl;
+ dout(10) << " swallowing extra subtree at " << *stray << dendl;
adjust_subtree_auth(stray, auth);
try_subtree_merge_at(stray);
}
dout(7) << "adjust_bounded_subtree_auth " << dir->get_dir_auth() << " -> " << auth
<< " on " << *dir
<< " bound_dfs " << bound_dfs
- << endl;
+ << dendl;
// make bounds list
set<CDir*> bounds;
in->dirfragtree.get_leaves_under(*q, fglist);
dout(15) << "map_dirfrag_set " << p->second << " -> " << fglist
- << " on " << *in << endl;
+ << " on " << *in << dendl;
for (list<frag_t>::iterator q = fglist.begin(); q != fglist.end(); ++q) {
CDir *dir = in->get_dirfrag(*q);
void MDCache::remove_subtree(CDir *dir)
{
- dout(10) << "remove_subtree " << *dir << endl;
+ dout(10) << "remove_subtree " << *dir << dendl;
assert(subtrees.count(dir));
assert(subtrees[dir].empty());
subtrees.erase(dir);
// for debugging only.
assert(subtrees.count(dir));
if (bounds != subtrees[dir]) {
- dout(0) << "verify_subtree_bounds failed" << endl;
+ dout(0) << "verify_subtree_bounds failed" << dendl;
set<CDir*> b = bounds;
for (set<CDir*>::iterator p = subtrees[dir].begin();
p != subtrees[dir].end();
b.erase(*p);
continue;
}
- dout(0) << " missing bound " << **p << endl;
+ dout(0) << " missing bound " << **p << dendl;
}
for (set<CDir*>::iterator p = b.begin();
p != b.end();
++p)
- dout(0) << " extra bound " << **p << endl;
+ dout(0) << " extra bound " << **p << dendl;
}
assert(bounds == subtrees[dir]);
}
CDir *bd = get_dirfrag(*p);
if (!bd) continue;
if (subtrees[dir].count(bd) == 0) {
- dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << endl;
+ dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << dendl;
failed++;
}
}
void MDCache::adjust_subtree_after_rename(CInode *diri, CDir *olddir)
{
- dout(10) << "adjust_subtree_after_rename " << *diri << " from " << *olddir << endl;
+ dout(10) << "adjust_subtree_after_rename " << *diri << " from " << *olddir << dendl;
//show_subtrees();
for (list<CDir*>::iterator p = dfls.begin(); p != dfls.end(); ++p) {
CDir *dir = *p;
- dout(10) << "dirfrag " << *dir << endl;
+ dout(10) << "dirfrag " << *dir << dendl;
CDir *oldparent = get_subtree_root(olddir);
- dout(10) << " old parent " << *oldparent << endl;
+ dout(10) << " old parent " << *oldparent << dendl;
CDir *newparent = get_subtree_root(diri->get_parent_dir());
- dout(10) << " new parent " << *newparent << endl;
+ dout(10) << " new parent " << *newparent << dendl;
if (oldparent == newparent) {
- dout(10) << "parent unchanged for " << *dir << " at " << *oldparent << endl;
+ dout(10) << "parent unchanged for " << *dir << " at " << *oldparent << dendl;
continue;
}
if (dir->is_subtree_root()) {
// children are fine. change parent.
- dout(10) << "moving " << *dir << " from " << *oldparent << " to " << *newparent << endl;
+ dout(10) << "moving " << *dir << " from " << *oldparent << " to " << *newparent << dendl;
assert(subtrees[oldparent].count(dir));
subtrees[oldparent].erase(dir);
assert(subtrees.count(newparent));
}
for (list<CDir*>::iterator p = tomove.begin(); p != tomove.end(); ++p) {
CDir *bound = *p;
- dout(10) << "moving bound " << *bound << " from " << *oldparent << " to " << *newparent << endl;
+ dout(10) << "moving bound " << *bound << " from " << *oldparent << " to " << *newparent << dendl;
subtrees[oldparent].erase(bound);
subtrees[newparent].insert(bound);
}
{
dout(10) << "log_subtree_map " << num_subtrees() << " subtrees, "
<< num_subtrees_fullauth() << " fullauth"
- << endl;
+ << dendl;
ESubtreeMap *le = new ESubtreeMap();
CDir *dir = p->first;
if (!dir->is_auth()) continue;
- dout(15) << " subtree " << *dir << endl;
+ dout(15) << " subtree " << *dir << dendl;
le->subtrees[dir->dirfrag()].clear();
le->metablob.add_dir_context(dir, EMetaBlob::TO_ROOT);
le->metablob.add_dir(dir, false);
q != p->second.end();
++q) {
CDir *bound = *q;
- dout(15) << " subtree bound " << *bound << endl;
+ dout(15) << " subtree bound " << *bound << dendl;
le->subtrees[dir->dirfrag()].push_back(bound->dirfrag());
le->metablob.add_dir_context(bound, EMetaBlob::TO_ROOT);
le->metablob.add_dir(bound, false);
void MDCache::_logged_subtree_map(off_t off)
{
- dout(10) << "_logged_subtree_map at " << off << endl;
+ dout(10) << "_logged_subtree_map at " << off << dendl;
mds->mdlog->last_subtree_map = off;
mds->mdlog->writing_subtree_map = false;
void MDCache::send_resolve_later(int who)
{
- dout(10) << "send_resolve_later to mds" << who << endl;
+ dout(10) << "send_resolve_later to mds" << who << dendl;
wants_resolve.insert(who);
}
// only if it's appropriate!
if (migrator->is_exporting() ||
migrator->is_importing()) {
- dout(7) << "maybe_send_pending_resolves waiting, imports/exports still in progress" << endl;
+ dout(7) << "maybe_send_pending_resolves waiting, imports/exports still in progress" << dendl;
migrator->show_importing();
migrator->show_exporting();
return; // not now
void MDCache::send_resolve_now(int who)
{
- dout(10) << "send_resolve_now to mds" << who << endl;
+ dout(10) << "send_resolve_now to mds" << who << dendl;
MMDSResolve *m = new MMDSResolve;
show_subtrees();
p != active_requests.end();
++p) {
if (p->second->is_slave() && p->second->slave_to_mds == who) {
- dout(10) << " including uncommitted " << *p->second << endl;
+ dout(10) << " including uncommitted " << *p->second << dendl;
m->add_slave_request(p->first);
}
}
for (map<metareqid_t, EMetaBlob>::iterator p = uncommitted_slave_updates[who].begin();
p != uncommitted_slave_updates[who].end();
++p) {
- dout(10) << " including uncommitted " << p->first << endl;
+ dout(10) << " including uncommitted " << p->first << dendl;
m->add_slave_request(p->first);
}
need_resolve_ack.insert(who);
void MDCache::handle_mds_failure(int who)
{
- dout(7) << "handle_mds_failure mds" << who << endl;
+ dout(7) << "handle_mds_failure mds" << who << dendl;
// make note of recovery set
mds->mdsmap->get_recovery_mds_set(recovery_set);
recovery_set.erase(mds->get_nodeid());
- dout(1) << "my recovery peers will be " << recovery_set << endl;
+ dout(1) << "my recovery peers will be " << recovery_set << dendl;
// adjust my recovery lists
wants_resolve.erase(who); // MDS will ask again
list<Context*> waiters;
in->take_waiting(CInode::WAIT_DIR, waiters);
mds->queue_waiters(waiters);
- dout(10) << "kicking WAIT_DIR on " << *in << endl;
+ dout(10) << "kicking WAIT_DIR on " << *in << dendl;
// remove from mds list
p->second.erase(who);
// slave to the failed node?
if (p->second->slave_to_mds == who) {
if (p->second->slave_did_prepare()) {
- dout(10) << " slave request " << *p->second << " uncommitted, will resolve shortly" << endl;
+ dout(10) << " slave request " << *p->second << " uncommitted, will resolve shortly" << dendl;
} else {
- dout(10) << " slave request " << *p->second << " has no prepare, finishing up" << endl;
+ dout(10) << " slave request " << *p->second << " has no prepare, finishing up" << dendl;
if (p->second->slave_request)
p->second->aborted = true;
else
if (!p->second->committing) {
if (p->second->witnessed.count(who)) {
dout(10) << " master request " << *p->second << " no longer witnessed by slave mds" << who
- << endl;
+ << dendl;
// discard this peer's prepare (if any)
p->second->witnessed.erase(who);
}
if (p->second->waiting_on_slave.count(who)) {
dout(10) << " master request " << *p->second << " waiting for slave mds" << who
- << " to recover" << endl;
+ << " to recover" << dendl;
// retry request when peer recovers
p->second->waiting_on_slave.erase(who);
mds->wait_for_active_peer(who, new C_MDS_RetryRequest(this, p->second));
}
while (!finish.empty()) {
- dout(10) << "cleaning up slave request " << *finish.front() << endl;
+ dout(10) << "cleaning up slave request " << *finish.front() << dendl;
request_finish(finish.front());
finish.pop_front();
}
*/
void MDCache::handle_mds_recovery(int who)
{
- dout(7) << "handle_mds_recovery mds" << who << endl;
+ dout(7) << "handle_mds_recovery mds" << who << dendl;
list<Context*> waiters;
void MDCache::set_recovery_set(set<int>& s)
{
- dout(7) << "set_recovery_set " << s << endl;
+ dout(7) << "set_recovery_set " << s << dendl;
recovery_set = s;
}
*/
void MDCache::handle_resolve(MMDSResolve *m)
{
- dout(7) << "handle_resolve from " << m->get_source() << endl;
+ dout(7) << "handle_resolve from " << m->get_source() << dendl;
int from = m->get_source().num();
// ambiguous slave requests?
++p) {
if (mds->clientmap.have_completed_request(*p)) {
// COMMIT
- dout(10) << " ambiguous slave request " << *p << " will COMMIT" << endl;
+ dout(10) << " ambiguous slave request " << *p << " will COMMIT" << dendl;
ack->add_commit(*p);
} else {
// ABORT
- dout(10) << " ambiguous slave request " << *p << " will ABORT" << endl;
+ dout(10) << " ambiguous slave request " << *p << " will ABORT" << dendl;
ack->add_abort(*p);
}
}
next++;
CDir *dir = get_dirfrag(p->first);
assert(dir);
- dout(10) << "checking ambiguous import " << *dir << endl;
+ dout(10) << "checking ambiguous import " << *dir << dendl;
if (migrator->is_importing(dir->dirfrag()) &&
migrator->get_import_peer(dir->dirfrag()) == from) {
assert(migrator->get_import_state(dir->dirfrag()) == Migrator::IMPORT_ACKING);
}
if (claimed_by_sender) {
- dout(7) << "ambiguous import failed on " << *dir << endl;
+ dout(7) << "ambiguous import failed on " << *dir << dendl;
migrator->import_reverse(dir);
} else {
- dout(7) << "ambiguous import succeeded on " << *dir << endl;
+ dout(7) << "ambiguous import succeeded on " << *dir << dendl;
migrator->import_finish(dir);
}
}
if (forced) {
dout(10) << " forced frag " << pi->first.frag << " to leaf in "
<< diri->dirfragtree
- << " on " << pi->first << endl;
+ << " on " << pi->first << dendl;
}
CDir *dir = diri->get_dirfrag(pi->first.frag);
for (map<dirfrag_t, list<dirfrag_t> >::iterator pi = m->ambiguous_imports.begin();
pi != m->ambiguous_imports.end();
++pi) {
- dout(10) << "noting ambiguous import on " << pi->first << " bounds " << pi->second << endl;
+ dout(10) << "noting ambiguous import on " << pi->first << " bounds " << pi->second << dendl;
other_ambiguous_imports[from][pi->first].swap( pi->second );
}
{
if (got_resolve != recovery_set) {
dout(10) << "maybe_resolve_finish still waiting for more resolves, got (" << got_resolve
- << "), need (" << recovery_set << ")" << endl;
+ << "), need (" << recovery_set << ")" << dendl;
}
else if (!need_resolve_ack.empty()) {
- dout(10) << "maybe_resolve_finish still waiting for resolve_ack from (" << need_resolve_ack << ")" << endl;
+ dout(10) << "maybe_resolve_finish still waiting for resolve_ack from (" << need_resolve_ack << ")" << dendl;
}
else {
- dout(10) << "maybe_resolve_finish got all resolves+resolve_acks, done." << endl;
+ dout(10) << "maybe_resolve_finish got all resolves+resolve_acks, done." << dendl;
disambiguate_imports();
if (mds->is_resolve()) {
void MDCache::handle_resolve_ack(MMDSResolveAck *ack)
{
- dout(10) << "handle_resolve_ack " << *ack << " from " << ack->get_source() << endl;
+ dout(10) << "handle_resolve_ack " << *ack << " from " << ack->get_source() << dendl;
int from = ack->get_source().num();
for (list<metareqid_t>::iterator p = ack->commit.begin();
p != ack->commit.end();
++p) {
- dout(10) << " commit on slave " << *p << endl;
+ dout(10) << " commit on slave " << *p << dendl;
if (mds->is_resolve()) {
// replay
for (list<metareqid_t>::iterator p = ack->abort.begin();
p != ack->abort.end();
++p) {
- dout(10) << " abort on slave " << *p << endl;
+ dout(10) << " abort on slave " << *p << dendl;
if (mds->is_resolve()) {
assert(uncommitted_slave_updates[from].count(*p));
void MDCache::disambiguate_imports()
{
- dout(10) << "disambiguate_imports" << endl;
+ dout(10) << "disambiguate_imports" << dendl;
// other nodes' ambiguous imports
for (map<int, map<dirfrag_t, list<dirfrag_t> > >::iterator p = other_ambiguous_imports.begin();
p != other_ambiguous_imports.end();
++p) {
int who = p->first;
- dout(10) << "ambiguous imports for mds" << who << endl;
+ dout(10) << "ambiguous imports for mds" << who << dendl;
for (map<dirfrag_t, list<dirfrag_t> >::iterator q = p->second.begin();
q != p->second.end();
++q) {
- dout(10) << " ambiguous import " << q->first << " bounds " << q->second << endl;
+ dout(10) << " ambiguous import " << q->first << " bounds " << q->second << dendl;
CDir *dir = get_dirfrag(q->first);
if (!dir) continue;
if (dir->authority().first == CDIR_AUTH_UNKNOWN || // if i am resolving
dir->is_ambiguous_auth()) { // if i am a surviving bystander
- dout(10) << " mds" << who << " did import " << *dir << endl;
+ dout(10) << " mds" << who << " did import " << *dir << dendl;
adjust_bounded_subtree_auth(dir, q->second, who);
try_subtree_merge(dir);
} else {
- dout(10) << " mds" << who << " did not import " << *dir << endl;
+ dout(10) << " mds" << who << " did not import " << *dir << dendl;
}
}
}
if (!dir) continue;
if (dir->authority().first != CDIR_AUTH_UNKNOWN) {
- dout(10) << "ambiguous import auth known, must not be me " << *dir << endl;
+ dout(10) << "ambiguous import auth known, must not be me " << *dir << dendl;
cancel_ambiguous_import(q->first);
mds->mdlog->submit_entry(new EImportFinish(dir, false));
} else {
- dout(10) << "ambiguous import auth unknown, must be me " << *dir << endl;
+ dout(10) << "ambiguous import auth unknown, must be me " << *dir << dendl;
finish_ambiguous_import(q->first);
mds->mdlog->submit_entry(new EImportFinish(dir, true));
}
assert(my_ambiguous_imports.count(df));
dout(10) << "cancel_ambiguous_import " << df
<< " bounds " << my_ambiguous_imports[df]
- << endl;
+ << dendl;
my_ambiguous_imports.erase(df);
}
dout(10) << "finish_ambiguous_import " << df
<< " bounds " << bounds
- << endl;
+ << dendl;
CDir *dir = get_dirfrag(df);
assert(dir);
*/
void MDCache::recalc_auth_bits()
{
- dout(7) << "recalc_auth_bits" << endl;
+ dout(7) << "recalc_auth_bits" << dendl;
for (map<CDir*,set<CDir*> >::iterator p = subtrees.begin();
p != subtrees.end();
dfq.push_back(p->first);
bool auth = p->first->authority().first == mds->get_nodeid();
- dout(10) << " subtree auth=" << auth << " for " << *p->first << endl;
+ dout(10) << " subtree auth=" << auth << " for " << *p->first << dendl;
while (!dfq.empty()) {
CDir *dir = dfq.front();
*/
void MDCache::rejoin_send_rejoins()
{
- dout(10) << "rejoin_send_rejoins with recovery_set " << recovery_set << endl;
+ dout(10) << "rejoin_send_rejoins with recovery_set " << recovery_set << dendl;
map<int, MMDSCacheRejoin*> rejoins;
if (rejoins.count(who) == 0) continue;
MMDSCacheRejoin *rejoin = rejoins[who];
- dout(15) << " " << *p->second << " authpin on " << **q << endl;
+ dout(15) << " " << *p->second << " authpin on " << **q << dendl;
MDSCacheObjectInfo i;
(*q)->set_object_info(i);
if (i.ino)
if (rejoins.count(who) == 0) continue;
MMDSCacheRejoin *rejoin = rejoins[who];
- dout(15) << " " << *p->second << " xlock on " << **q << " " << *(*q)->get_parent() << endl;
+ dout(15) << " " << *p->second << " xlock on " << **q << " " << *(*q)->get_parent() << dendl;
MDSCacheObjectInfo i;
(*q)->get_parent()->set_object_info(i);
if (i.ino)
// nothing?
if (mds->is_rejoin() && rejoins.empty()) {
- dout(10) << "nothing left to rejoin" << endl;
+ dout(10) << "nothing left to rejoin" << dendl;
mds->rejoin_done();
}
}
*/
void MDCache::rejoin_walk(CDir *dir, MMDSCacheRejoin *rejoin)
{
- dout(10) << "rejoin_walk " << *dir << endl;
+ dout(10) << "rejoin_walk " << *dir << dendl;
list<CDir*> nested; // finish this dir, then do nested items
if (mds->is_rejoin()) {
// WEAK
- dout(15) << " add_weak_dirfrag " << *dir << endl;
+ dout(15) << " add_weak_dirfrag " << *dir << dendl;
rejoin->add_weak_dirfrag(dir->dirfrag());
for (map<string,CDentry*>::iterator p = dir->items.begin();
++p) {
CDentry *dn = p->second;
assert(dn->is_primary());
- dout(15) << " add_weak_primary_dentry " << *dn << endl;
+ dout(15) << " add_weak_primary_dentry " << *dn << dendl;
rejoin->add_weak_primary_dentry(dir->dirfrag(), p->first, dn->get_inode()->ino());
dn->get_inode()->get_nested_dirfrags(nested);
}
} else {
// STRONG
- dout(15) << " add_strong_dirfrag " << *dir << endl;
+ dout(15) << " add_strong_dirfrag " << *dir << dendl;
rejoin->add_strong_dirfrag(dir->dirfrag(), dir->get_replica_nonce());
for (map<string,CDentry*>::iterator p = dir->items.begin();
p != dir->items.end();
++p) {
CDentry *dn = p->second;
- dout(15) << " add_strong_dentry " << *dn << endl;
+ dout(15) << " add_strong_dentry " << *dn << dendl;
rejoin->add_strong_dentry(dir->dirfrag(), p->first,
dn->is_primary() ? dn->get_inode()->ino():inodeno_t(0),
dn->is_remote() ? dn->get_remote_ino():inodeno_t(0),
dn->lock.get_state());
if (dn->is_primary()) {
CInode *in = dn->get_inode();
- dout(15) << " add_strong_inode " << *in << endl;
+ dout(15) << " add_strong_inode " << *in << dendl;
rejoin->add_strong_inode(in->ino(), in->get_replica_nonce(),
in->get_caps_wanted(),
in->authlock.get_state(),
*/
void MDCache::handle_cache_rejoin(MMDSCacheRejoin *m)
{
- dout(7) << "handle_cache_rejoin " << *m << " from " << m->get_source() << endl;
+ dout(7) << "handle_cache_rejoin " << *m << " from " << m->get_source() << dendl;
switch (m->op) {
case MMDSCacheRejoin::OP_WEAK:
if (mds->is_active() || mds->is_stopping()) {
survivor = true;
- dout(10) << "i am a surivivor, and will ack immediately" << endl;
+ dout(10) << "i am a surivivor, and will ack immediately" << dendl;
ack = new MMDSCacheRejoin(MMDSCacheRejoin::OP_ACK);
// check cap exports
for (map<int,inode_caps_reconnect_t>::iterator q = p->second.begin();
q != p->second.end();
++q) {
- dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << endl;
+ dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << dendl;
rejoin_import_cap(in, q->first, q->second, from);
}
}
if (!path_is_mine(weak->cap_export_paths[p->first]))
continue;
cap_import_paths[p->first] = weak->cap_export_paths[p->first];
- dout(10) << " noting cap import " << p->first << " path " << weak->cap_export_paths[p->first] << endl;
+ dout(10) << " noting cap import " << p->first << " path " << weak->cap_export_paths[p->first] << dendl;
}
// note
for (map<int,inode_caps_reconnect_t>::iterator q = p->second.begin();
q != p->second.end();
++q) {
- dout(10) << " claiming cap import " << p->first << " client" << q->first << endl;
+ dout(10) << " claiming cap import " << p->first << " client" << q->first << dendl;
cap_imports[p->first][q->first][from] = q->second;
}
}
assert(dir);
int nonce = dir->add_replica(from);
- dout(10) << " have " << *dir << endl;
+ dout(10) << " have " << *dir << dendl;
if (ack)
ack->add_strong_dirfrag(p->first, nonce);
if (survivor) dentry_remove_replica(dn, from);
int dnonce = dn->add_replica(from);
- dout(10) << " have " << *dn << endl;
+ dout(10) << " have " << *dn << dendl;
if (ack)
ack->add_strong_dentry(p->first, q->first,
dn->get_inode()->ino(), inodeno_t(0), 0,
if (survivor) inode_remove_replica(in, from);
int inonce = in->add_replica(from);
- dout(10) << " have " << *in << endl;
+ dout(10) << " have " << *in << dendl;
// scatter the dirlock, just in case?
if (!survivor && in->is_dir())
if (rejoin_gather.empty()) {
rejoin_gather_finish();
} else {
- dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+ dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
}
}
}
bool MDCache::parallel_fetch(map<inodeno_t,string>& pathmap,
Context *retry)
{
- dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << endl;
+ dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << dendl;
// scan list
set<CDir*> fetch_queue;
while (p != pathmap.end()) {
CInode *in = get_inode(p->first);
if (in) {
- dout(15) << " have " << *in << endl;
+ dout(15) << " have " << *in << dendl;
pathmap.erase(p++);
continue;
}
// traverse
- dout(17) << " missing " << p->first << " at " << p->second << endl;
+ dout(17) << " missing " << p->first << " at " << p->second << dendl;
filepath path(p->second);
CDir *dir = path_traverse_to_dir(path);
assert(dir);
}
if (pathmap.empty()) {
- dout(10) << "parallel_fetch done" << endl;
+ dout(10) << "parallel_fetch done" << dendl;
assert(fetch_queue.empty());
delete retry;
return true;
for (set<CDir*>::iterator p = fetch_queue.begin();
p != fetch_queue.end();
++p) {
- dout(10) << "parallel_fetch fetching " << **p << endl;
+ dout(10) << "parallel_fetch fetching " << **p << dendl;
(*p)->fetch(gather->new_sub());
}
*/
void MDCache::rejoin_scour_survivor_replicas(int from, MMDSCacheRejoin *ack)
{
- dout(10) << "rejoin_scour_survivor_replicas from mds" << from << endl;
+ dout(10) << "rejoin_scour_survivor_replicas from mds" << from << dendl;
// FIXME: what about root and stray inodes.
in->is_replica(from) &&
ack->strong_inodes.count(p->second->ino()) == 0) {
inode_remove_replica(in, from);
- dout(10) << " rem " << *in << endl;
+ dout(10) << " rem " << *in << dendl;
}
if (!in->is_dir()) continue;
dir->is_replica(from) &&
ack->strong_dirfrags.count(dir->dirfrag()) == 0) {
dir->remove_replica(from);
- dout(10) << " rem " << *dir << endl;
+ dout(10) << " rem " << *dir << dendl;
}
// dentries
(ack->strong_dentries.count(dir->dirfrag()) == 0 ||
ack->strong_dentries[dir->dirfrag()].count(dn->get_name()) == 0)) {
dentry_remove_replica(dn, from);
- dout(10) << " rem " << *dn << endl;
+ dout(10) << " rem " << *dn << dendl;
}
}
}
in->state_set(CInode::STATE_REJOINUNDEF);
add_inode(in);
rejoin_undef_inodes.insert(in);
- dout(10) << " invented " << *in << endl;
+ dout(10) << " invented " << *in << dendl;
return in;
}
dir = in->get_or_open_dirfrag(this, p->first.frag);
} else {
dir->add_replica(from);
- dout(10) << " have " << *dir << endl;
+ dout(10) << " have " << *dir << dendl;
}
for (map<string,MMDSCacheRejoin::dn_strong>::iterator q = strong->strong_dentries[p->first].begin();
if (!in) in = rejoin_invent_inode(q->second.ino);
dn = dir->add_primary_dentry(q->first, in);
- dout(10) << " missing " << q->second.ino << endl;
+ dout(10) << " missing " << q->second.ino << dendl;
if (!missing) missing = new MMDSCacheRejoin(MMDSCacheRejoin::OP_MISSING);
missing->add_weak_inode(q->second.ino); // we want it back!
}
- dout(10) << " invented " << *dn << endl;
+ dout(10) << " invented " << *dn << dendl;
}
// dn auth_pin?
if (strong->authpinned_dentries.count(p->first) &&
strong->authpinned_dentries[p->first].count(q->first)) {
metareqid_t ri = strong->authpinned_dentries[p->first][q->first];
- dout(10) << " dn authpin by " << ri << " on " << *dn << endl;
+ dout(10) << " dn authpin by " << ri << " on " << *dn << dendl;
// get/create slave mdrequest
MDRequest *mdr;
if (strong->xlocked_dentries.count(p->first) &&
strong->xlocked_dentries[p->first].count(q->first)) {
metareqid_t ri = strong->xlocked_dentries[p->first][q->first];
- dout(10) << " dn xlock by " << ri << " on " << *dn << endl;
+ dout(10) << " dn xlock by " << ri << " on " << *dn << dendl;
MDRequest *mdr = request_get(ri); // should have this from auth_pin above.
assert(mdr->is_auth_pinned(dn));
dn->lock.set_state(LOCK_LOCK);
}
dn->add_replica(from);
- dout(10) << " have " << *dn << endl;
+ dout(10) << " have " << *dn << dendl;
// inode?
if (dn->is_primary()) {
if (is.caps_wanted) {
in->mds_caps_wanted[from] = is.caps_wanted;
dout(15) << " inode caps_wanted " << cap_string(is.caps_wanted)
- << " on " << *in << endl;
+ << " on " << *in << dendl;
}
// scatterlock?
// auth pin?
if (strong->authpinned_inodes.count(in->ino())) {
metareqid_t ri = strong->authpinned_inodes[in->ino()];
- dout(10) << " inode authpin by " << ri << " on " << *in << endl;
+ dout(10) << " inode authpin by " << ri << " on " << *in << dendl;
// get/create slave mdrequest
MDRequest *mdr;
r != strong->xlocked_inodes[in->ino()].end();
++r) {
SimpleLock *lock = in->get_lock(r->first);
- dout(10) << " inode xlock by " << r->second << " on " << *lock << " on " << *in << endl;
+ dout(10) << " inode xlock by " << r->second << " on " << *lock << " on " << *in << dendl;
MDRequest *mdr = request_get(r->second); // should have this from auth_pin above.
assert(mdr->is_auth_pinned(in));
lock->set_state(LOCK_LOCK);
}
}
} else {
- dout(10) << " sender has dentry but not inode, adding them as a replica" << endl;
+ dout(10) << " sender has dentry but not inode, adding them as a replica" << dendl;
}
in->add_replica(from);
- dout(10) << " have " << *in << endl;
+ dout(10) << " have " << *in << dendl;
}
}
}
if (rejoin_gather.empty()) {
rejoin_gather_finish();
} else {
- dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+ dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
}
}
}
void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack)
{
- dout(7) << "handle_cache_rejoin_ack from " << ack->get_source() << endl;
+ dout(7) << "handle_cache_rejoin_ack from " << ack->get_source() << dendl;
int from = ack->get_source().num();
list<Context*> waiters;
dir->set_replica_nonce(p->second.nonce);
dir->state_clear(CDir::STATE_REJOINING);
- dout(10) << " got " << *dir << endl;
+ dout(10) << " got " << *dir << dendl;
// dentries
for (map<string,MMDSCacheRejoin::dn_strong>::iterator q = ack->strong_dentries[p->first].begin();
// hmm, did we have the proper linkage here?
if (dn->is_null() &&
!q->second.is_null()) {
- dout(10) << " had bad (missing) linkage for " << *dn << endl;
+ dout(10) << " had bad (missing) linkage for " << *dn << dendl;
if (q->second.is_remote()) {
dn->dir->link_remote_inode(dn, q->second.remote_ino, q->second.remote_d_type);
} else {
}
else if (!dn->is_null() &&
q->second.is_null()) {
- dout(10) << " had bad linkage for " << *dn << endl;
+ dout(10) << " had bad linkage for " << *dn << dendl;
assert(0); // hrmpf. unlink should use slave requests to clean this up during resolve.
}
dn->set_replica_nonce(q->second.nonce);
mds->locker->rejoin_set_state(&dn->lock, q->second.lock, waiters);
dn->state_clear(CDentry::STATE_REJOINING);
- dout(10) << " got " << *dn << endl;
+ dout(10) << " got " << *dn << dendl;
}
}
in->inode = p->inode;
in->symlink = p->symlink;
in->dirfragtree = p->dirfragtree;
- dout(10) << " got inode content " << *in << endl;
+ dout(10) << " got inode content " << *in << dendl;
}
// inodes
mds->locker->rejoin_set_state(&in->filelock, p->second.filelock, waiters);
mds->locker->rejoin_set_state(&in->dirlock, p->second.dirlock, waiters);
in->state_clear(CInode::STATE_REJOINING);
- dout(10) << " got " << *in << endl;
+ dout(10) << " got " << *in << dendl;
}
// done?
mds->rejoin_done();
} else {
dout(7) << "still need rejoin from (" << rejoin_gather << ")"
- << ", rejoin_ack from (" << rejoin_ack_gather << ")" << endl;
+ << ", rejoin_ack from (" << rejoin_ack_gather << ")" << dendl;
}
}
void MDCache::handle_cache_rejoin_missing(MMDSCacheRejoin *missing)
{
- dout(7) << "handle_cache_rejoin_missing from " << missing->get_source() << endl;
+ dout(7) << "handle_cache_rejoin_missing from " << missing->get_source() << dendl;
MMDSCacheRejoin *full = new MMDSCacheRejoin(MMDSCacheRejoin::OP_FULL);
++p) {
CInode *in = get_inode(*p);
if (!in) {
- dout(10) << " don't have inode " << *p << endl;
+ dout(10) << " don't have inode " << *p << dendl;
continue; // we must have trimmed it after the originalo rejoin
}
- dout(10) << " sending " << *in << endl;
+ dout(10) << " sending " << *in << dendl;
full->add_full_inode(in->inode, in->symlink, in->dirfragtree);
}
void MDCache::handle_cache_rejoin_full(MMDSCacheRejoin *full)
{
- dout(7) << "handle_cache_rejoin_full from " << full->get_source() << endl;
+ dout(7) << "handle_cache_rejoin_full from " << full->get_source() << dendl;
int from = full->get_source().num();
// integrate full inodes
in->symlink = p->symlink;
in->dirfragtree = p->dirfragtree;
in->state_clear(CInode::STATE_REJOINUNDEF);
- dout(10) << " got full " << *in << endl;
+ dout(10) << " got full " << *in << dendl;
rejoin_undef_inodes.erase(q);
} else {
- dout(10) << " had full " << *in << endl;
+ dout(10) << " had full " << *in << dendl;
}
}
if (rejoin_gather.empty()) {
rejoin_gather_finish();
} else {
- dout(7) << "still need rejoin from (" << rejoin_gather << ")" << endl;
+ dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
}
}
*/
void MDCache::rejoin_trim_undef_inodes()
{
- dout(10) << "rejoin_trim_undef_inodes" << endl;
+ dout(10) << "rejoin_trim_undef_inodes" << dendl;
while (!rejoin_undef_inodes.empty()) {
set<CInode*>::iterator p = rejoin_undef_inodes.begin();
CDentry *dn = p->second;
dn->clear_replica_map();
- dout(10) << " trimming " << *dn << endl;
+ dout(10) << " trimming " << *dn << dendl;
dir->remove_dentry(dn);
}
- dout(10) << " trimming " << *dir << endl;
+ dout(10) << " trimming " << *dir << dendl;
in->close_dirfrag(dir->dirfrag().frag);
}
}
CDentry *dn = in->get_parent_dn();
if (dn) {
dn->clear_replica_map();
- dout(10) << " trimming " << *dn << endl;
+ dout(10) << " trimming " << *dn << dendl;
dn->dir->remove_dentry(dn);
} else {
- dout(10) << " trimming " << *in << endl;
+ dout(10) << " trimming " << *in << dendl;
remove_inode(in);
}
}
void MDCache::rejoin_gather_finish()
{
- dout(10) << "rejoin_gather_finish" << endl;
+ dout(10) << "rejoin_gather_finish" << dendl;
assert(mds->is_rejoin());
rejoin_trim_undef_inodes();
void MDCache::rejoin_import_cap(CInode *in, int client, inode_caps_reconnect_t& icr, int frommds)
{
dout(10) << "rejoin_import_cap for client" << client << " from mds" << frommds
- << " on " << *in << endl;
+ << " on " << *in << dendl;
// add cap
in->reconnect_cap(client, icr);
void MDCache::rejoin_send_acks()
{
- dout(7) << "rejoin_send_acks" << endl;
+ dout(7) << "rejoin_send_acks" << dendl;
// send acks to everyone in the recovery set
map<int,MMDSCacheRejoin*> ack;
p++) {
CDir *dir = p->first;
if (!dir->is_auth()) continue;
- dout(10) << "subtree " << *dir << endl;
+ dout(10) << "subtree " << *dir << dendl;
// auth items in this subtree
list<CDir*> dq;
{
dout(10) << "purge_inode " << inode->ino << " size " << inode->size
<< " -> " << newsize
- << endl;
+ << dendl;
// take note
assert(purging[inode->ino].count(newsize) == 0);
void MDCache::purge_inode_finish(inodeno_t ino, off_t newsize)
{
dout(10) << "purge_inode_finish " << ino << " to " << newsize
- << " - logging our completion" << endl;
+ << " - logging our completion" << dendl;
// log completion
mds->mdlog->submit_entry(new EPurgeFinish(ino, newsize),
void MDCache::purge_inode_finish_2(inodeno_t ino, off_t newsize)
{
- dout(10) << "purge_inode_finish_2 " << ino << " to " << newsize << endl;
+ dout(10) << "purge_inode_finish_2 " << ino << " to " << newsize << dendl;
// remove from purging list
purging[ino].erase(newsize);
void MDCache::start_recovered_purges()
{
- dout(10) << "start_recovered_purges (" << purging.size() << " purges)" << endl;
+ dout(10) << "start_recovered_purges (" << purging.size() << " purges)" << dendl;
for (map<inodeno_t, map<off_t,inode_t> >::iterator p = purging.begin();
p != purging.end();
++q) {
dout(10) << "start_recovered_purges " << p->first
<< " size " << q->second.size
- << " to " << q->first << endl;
+ << " to " << q->first << dendl;
_do_purge_inode(&q->second, q->first);
}
}
max = lru.lru_get_max();
if (!max) return false;
}
- dout(7) << "trim max=" << max << " cur=" << lru.lru_get_size() << endl;
+ dout(7) << "trim max=" << max << " cur=" << lru.lru_get_size() << dendl;
map<int, MCacheExpire*> expiremap;
for (map<int, MCacheExpire*>::iterator it = expiremap.begin();
it != expiremap.end();
it++) {
- dout(7) << "sending cache_expire to " << it->first << endl;
+ dout(7) << "sending cache_expire to " << it->first << dendl;
mds->send_message_mds(it->second, it->first, MDS_PORT_CACHE);
}
}
void MDCache::trim_dentry(CDentry *dn, map<int, MCacheExpire*>& expiremap)
{
- dout(12) << "trim_dentry " << *dn << endl;
+ dout(12) << "trim_dentry " << *dn << dendl;
CDir *dir = dn->get_dir();
assert(dir);
CDir *con = get_subtree_root(dir);
assert(con);
- dout(12) << " in container " << *con << endl;
+ dout(12) << " in container " << *con << dendl;
// notify dentry authority?
if (!dn->is_auth()) {
con->is_importing()) break; // don't send any expire while importing.
if (a == mds->get_nodeid()) continue; // on export, ignore myself.
- dout(12) << " sending expire to mds" << a << " on " << *dn << endl;
+ dout(12) << " sending expire to mds" << a << " on " << *dn << dendl;
assert(a != mds->get_nodeid());
if (expiremap.count(a) == 0)
expiremap[a] = new MCacheExpire(mds->get_nodeid());
{
assert(dir->get_num_ref() == 0);
- dout(15) << "trim_dirfrag " << *dir << endl;
+ dout(15) << "trim_dirfrag " << *dir << dendl;
CInode *in = dir->get_inode();
// was this an auth delegation? (if so, slightly modified container)
dirfrag_t condf;
if (dir->is_subtree_root()) {
- dout(12) << " subtree root, container is " << *dir << endl;
+ dout(12) << " subtree root, container is " << *dir << dendl;
con = dir;
condf = dir->dirfrag();
} else {
con->is_importing()) break; // don't send any expire while importing.
if (a == mds->get_nodeid()) continue; // on export, ignore myself.
- dout(12) << " sending expire to mds" << a << " on " << *dir << endl;
+ dout(12) << " sending expire to mds" << a << " on " << *dir << dendl;
assert(a != mds->get_nodeid());
if (expiremap.count(a) == 0)
expiremap[a] = new MCacheExpire(mds->get_nodeid());
void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<int, MCacheExpire*>& expiremap)
{
- dout(15) << "trim_inode " << *in << endl;
+ dout(15) << "trim_inode " << *in << dendl;
assert(in->get_num_ref() == 0);
// DIR
con->is_importing()) break; // don't send any expire while importing.
if (a == mds->get_nodeid()) continue; // on export, ignore myself.
- dout(12) << " sending expire to mds" << a << " on " << *in << endl;
+ dout(12) << " sending expire to mds" << a << " on " << *in << dendl;
assert(a != mds->get_nodeid());
if (expiremap.count(a) == 0)
expiremap[a] = new MCacheExpire(mds->get_nodeid());
*/
void MDCache::trim_non_auth()
{
- dout(7) << "trim_non_auth" << endl;
+ dout(7) << "trim_non_auth" << dendl;
// note first auth item we see.
// when we see it the second time, stop.
assert(dir);
// unlink the dentry
- dout(15) << "trim_non_auth removing " << *dn << endl;
+ dout(15) << "trim_non_auth removing " << *dn << dendl;
if (dn->is_remote()) {
dir->unlink_inode(dn);
}
{
int from = m->get_from();
- dout(7) << "cache_expire from mds" << from << endl;
+ dout(7) << "cache_expire from mds" << from << dendl;
// loop over realms
for (map<dirfrag_t,MCacheExpire::realm>::iterator p = m->realms.begin();
migrator->get_export_state(con) == Migrator::EXPORT_WARNING &&
migrator->export_has_warned(con,from))) {
// not auth.
- dout(7) << "delaying nonauth|warned expires for " << *con << endl;
+ dout(7) << "delaying nonauth|warned expires for " << *con << dendl;
assert(con->is_frozen_tree_root());
// make a message container
delayed_expire[con][from]->add_realm(p->first, p->second);
continue;
}
- dout(7) << "expires for " << *con << endl;
+ dout(7) << "expires for " << *con << dendl;
} else {
- dout(7) << "containerless expires (root, stray inodes)" << endl;
+ dout(7) << "containerless expires (root, stray inodes)" << dendl;
}
// INODES
int nonce = it->second;
if (!in) {
- dout(0) << " inode expire on " << it->first << " from " << from << ", don't have it" << endl;
+ dout(0) << " inode expire on " << it->first << " from " << from << ", don't have it" << dendl;
assert(in);
}
assert(in->is_auth());
// check nonce
if (nonce == in->get_replica_nonce(from)) {
// remove from our cached_by
- dout(7) << " inode expire on " << *in << " from mds" << from << " cached_by was " << in->get_replicas() << endl;
+ dout(7) << " inode expire on " << *in << " from mds" << from << " cached_by was " << in->get_replicas() << dendl;
inode_remove_replica(in, from);
}
else {
// this is an old nonce, ignore expire.
dout(7) << " inode expire on " << *in << " from mds" << from
<< " with old nonce " << nonce << " (current " << in->get_replica_nonce(from) << "), dropping"
- << endl;
+ << dendl;
assert(in->get_replica_nonce(from) > nonce);
}
}
int nonce = it->second;
if (!dir) {
- dout(0) << " dir expire on " << it->first << " from " << from << ", don't have it" << endl;
+ dout(0) << " dir expire on " << it->first << " from " << from << ", don't have it" << dendl;
assert(dir);
}
assert(dir->is_auth());
if (nonce == dir->get_replica_nonce(from)) {
// remove from our cached_by
dout(7) << " dir expire on " << *dir << " from mds" << from
- << " replicas was " << dir->replica_map << endl;
+ << " replicas was " << dir->replica_map << dendl;
dir->remove_replica(from);
}
else {
// this is an old nonce, ignore expire.
dout(7) << " dir expire on " << *dir << " from mds" << from
<< " with old nonce " << nonce << " (current " << dir->get_replica_nonce(from)
- << "), dropping" << endl;
+ << "), dropping" << dendl;
assert(dir->get_replica_nonce(from) > nonce);
}
}
for (map<dirfrag_t, map<string,int> >::iterator pd = p->second.dentries.begin();
pd != p->second.dentries.end();
++pd) {
- dout(10) << " dn expires in dir " << pd->first << endl;
+ dout(10) << " dn expires in dir " << pd->first << dendl;
CInode *diri = get_inode(pd->first.ino);
assert(diri);
CDir *dir = diri->get_dirfrag(pd->first.frag);
if (!dir) {
- dout(0) << " dn expires on " << pd->first << " from " << from << ", must have refragmented" << endl;
+ dout(0) << " dn expires on " << pd->first << " from " << from << ", must have refragmented" << dendl;
} else {
assert(dir->is_auth());
}
}
if (!dn)
- dout(0) << " missing dentry for " << p->first << " in " << *dir << endl;
+ dout(0) << " missing dentry for " << p->first << " in " << *dir << dendl;
assert(dn);
if (nonce == dn->get_replica_nonce(from)) {
- dout(7) << " dentry_expire on " << *dn << " from mds" << from << endl;
+ dout(7) << " dentry_expire on " << *dn << " from mds" << from << dendl;
dentry_remove_replica(dn, from);
}
else {
dout(7) << " dentry_expire on " << *dn << " from mds" << from
<< " with old nonce " << nonce << " (current " << dn->get_replica_nonce(from)
- << "), dropping" << endl;
+ << "), dropping" << dendl;
assert(dn->get_replica_nonce(from) > nonce);
}
}
void MDCache::process_delayed_expire(CDir *dir)
{
- dout(7) << "process_delayed_expire on " << *dir << endl;
+ dout(7) << "process_delayed_expire on " << *dir << dendl;
for (map<int,MCacheExpire*>::iterator p = delayed_expire[dir].begin();
p != delayed_expire[dir].end();
++p)
void MDCache::discard_delayed_expire(CDir *dir)
{
- dout(7) << "discard_delayed_expire on " << *dir << endl;
+ dout(7) << "discard_delayed_expire on " << *dir << dendl;
for (map<int,MCacheExpire*>::iterator p = delayed_expire[dir].begin();
p != delayed_expire[dir].end();
++p)
void MDCache::shutdown_check()
{
- dout(0) << "shutdown_check at " << g_clock.now() << endl;
+ dout(0) << "shutdown_check at " << g_clock.now() << dendl;
// cache
int o = g_conf.debug_mds;
mds->timer.add_event_after(g_conf.mds_shutdown_check, new C_MDC_ShutdownCheck(this));
// this
- dout(0) << "lru size now " << lru.lru_get_size() << endl;
- dout(0) << "log len " << mds->mdlog->get_num_events() << endl;
+ dout(0) << "lru size now " << lru.lru_get_size() << dendl;
+ dout(0) << "log len " << mds->mdlog->get_num_events() << dendl;
if (mds->filer->is_active())
- dout(0) << "filer still active" << endl;
+ dout(0) << "filer still active" << dendl;
}
void MDCache::shutdown_start()
{
- dout(1) << "shutdown_start" << endl;
+ dout(1) << "shutdown_start" << dendl;
if (g_conf.mds_shutdown_check)
mds->timer.add_event_after(g_conf.mds_shutdown_check, new C_MDC_ShutdownCheck(this));
bool MDCache::shutdown_pass()
{
- dout(7) << "shutdown_pass" << endl;
+ dout(7) << "shutdown_pass" << dendl;
if (mds->is_stopped()) {
- dout(7) << " already shut down" << endl;
+ dout(7) << " already shut down" << dendl;
show_cache();
show_subtrees();
return true;
if (g_conf.mds_commit_on_shutdown) {
if (shutdown_commits < 0) {
- dout(1) << "shutdown_pass committing all dirty dirs" << endl;
+ dout(1) << "shutdown_pass committing all dirty dirs" << dendl;
shutdown_commits = 0;
for (hash_map<inodeno_t, CInode*>::iterator it = inode_map.begin();
// commits?
if (shutdown_commits > 0) {
- dout(7) << "shutdown_commits still waiting for " << shutdown_commits << endl;
+ dout(7) << "shutdown_commits still waiting for " << shutdown_commits << dendl;
return false;
}
}
// flush anything we can from the cache
trim(0);
- dout(5) << "lru size now " << lru.lru_get_size() << endl;
+ dout(5) << "lru size now " << lru.lru_get_size() << dendl;
// flush batching eopens, so that we can properly expire them.
mds->server->journal_opens(); // hrm, this is sort of a hack.
//!migrator->is_importing()
) {
// export to root
- dout(7) << "looking for subtrees to export to mds0" << endl;
+ dout(7) << "looking for subtrees to export to mds0" << dendl;
list<CDir*> ls;
for (map<CDir*, set<CDir*> >::iterator it = subtrees.begin();
it != subtrees.end();
}
for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
CDir *dir = *p;
- dout(7) << "sending " << *dir << " back to mds0" << endl;
+ dout(7) << "sending " << *dir << " back to mds0" << dendl;
migrator->export_dir(dir, 0);
}
}
// subtrees map not empty yet?
if (!subtrees.empty()) {
- dout(7) << "still have " << num_subtrees() << " subtrees" << endl;
+ dout(7) << "still have " << num_subtrees() << " subtrees" << dendl;
show_subtrees();
migrator->show_importing();
migrator->show_exporting();
// empty out stray contents
// FIXME
- dout(7) << "FIXME: i need to empty out stray dir contents..." << endl;
+ dout(7) << "FIXME: i need to empty out stray dir contents..." << dendl;
// (wait for) flush log?
if (g_conf.mds_log_flush_on_shutdown) {
if (mds->mdlog->get_non_subtreemap_events()) {
dout(7) << "waiting for log to flush .. " << mds->mdlog->get_num_events()
- << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << endl;
+ << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << dendl;
return false;
}
}
// (only do this once!)
if (!mds->mdlog->is_capped()) {
- dout(7) << "capping the log" << endl;
+ dout(7) << "capping the log" << dendl;
mds->mdlog->cap();
// note that this won't flush right away, so we'll make at least one more pass
}
if (mds->mdlog->get_num_events()) {
dout(7) << "waiting for log to flush (including subtree_map, now) .. " << mds->mdlog->get_num_events()
- << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << endl;
+ << " (" << mds->mdlog->get_non_subtreemap_events() << ")" << dendl;
return false;
}
if (!did_shutdown_log_cap) {
// flush journal header
- dout(7) << "writing header for (now-empty) journal" << endl;
+ dout(7) << "writing header for (now-empty) journal" << dendl;
assert(mds->mdlog->empty());
mds->mdlog->write_head(0);
// NOTE: filer active checker below will block us until this completes.
// filer active?
if (mds->filer->is_active()) {
- dout(7) << "filer still active" << endl;
+ dout(7) << "filer still active" << dendl;
return false;
}
// done?
if (lru.lru_get_size() > 0) {
- dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << endl;
+ dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << dendl;
show_cache();
//dump();
return false;
}
// done!
- dout(2) << "shutdown done." << endl;
+ dout(2) << "shutdown done." << dendl;
return true;
}
default:
- dout(7) << "cache unknown message " << m->get_type() << endl;
+ dout(7) << "cache unknown message " << m->get_type() << dendl;
assert(0);
break;
}
CInode *cur = base;
if (!cur) cur = get_root();
if (cur == NULL) {
- dout(7) << "traverse: i don't have root" << endl;
+ dout(7) << "traverse: i don't have root" << dendl;
open_root(_get_waiter(mdr, req));
return 1;
}
unsigned depth = 0;
while (depth < path.depth()) {
- dout(12) << "traverse: path seg depth " << depth << " = " << path[depth] << endl;
+ dout(12) << "traverse: path seg depth " << depth << " = " << path[depth] << dendl;
// ENOTDIR?
if (!cur->is_dir()) {
- dout(7) << "traverse: " << *cur << " not a dir " << endl;
+ dout(7) << "traverse: " << *cur << " not a dir " << dendl;
return -ENOTDIR;
}
if (cur->is_auth()) {
// parent dir frozen_dir?
if (cur->is_frozen_dir()) {
- dout(7) << "traverse: " << *cur->get_parent_dir() << " is frozen_dir, waiting" << endl;
+ dout(7) << "traverse: " << *cur->get_parent_dir() << " is frozen_dir, waiting" << dendl;
cur->get_parent_dir()->add_waiter(CDir::WAIT_UNFREEZE, _get_waiter(mdr, req));
return 1;
}
// discover?
assert(!cur->is_auth());
if (cur->is_ambiguous_auth()) {
- dout(10) << "traverse: need dirfrag " << fg << ", waiting for single auth on " << *cur << endl;
+ dout(10) << "traverse: need dirfrag " << fg << ", waiting for single auth on " << *cur << dendl;
cur->add_waiter(CInode::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
return 1;
} else if (dir_discovers.count(cur->ino())) {
- dout(10) << "traverse: need dirfrag " << fg << ", already doing discover for " << *cur << endl;
+ dout(10) << "traverse: need dirfrag " << fg << ", already doing discover for " << *cur << dendl;
assert(cur->is_waiter_for(CInode::WAIT_DIR));
} else {
filepath want = path.postfixpath(depth);
dout(10) << "traverse: need dirfrag " << fg << ", doing discover, want " << want.get_path()
- << " from " << *cur << endl;
+ << " from " << *cur << dendl;
mds->send_message_mds(new MDiscover(mds->get_nodeid(),
cur->ino(),
want,
if (curdir->is_frozen()) {
// doh!
// FIXME: traverse is allowed?
- dout(7) << "traverse: " << *curdir << " is frozen, waiting" << endl;
+ dout(7) << "traverse: " << *curdir << " is frozen, waiting" << dendl;
curdir->add_waiter(CDir::WAIT_UNFREEZE, _get_waiter(mdr, req));
if (onfinish) delete onfinish;
return 1;
trace.pop_back();
depth++;
cur = cur->get_parent_inode();
- dout(10) << "traverse: following .. back to " << *cur << endl;
+ dout(10) << "traverse: following .. back to " << *cur << dendl;
continue;
}
// null and last_bit and xlocked by me?
if (dn && dn->is_null() && null_okay) {
- dout(10) << "traverse: hit null dentry at tail of traverse, succeeding" << endl;
+ dout(10) << "traverse: hit null dentry at tail of traverse, succeeding" << dendl;
trace.push_back(dn);
break; // done!
}
if (dn && !dn->is_null()) {
// dentry exists. xlocked?
if (!noperm && dn->lock.is_xlocked() && dn->lock.get_xlocked_by() != mdr) {
- dout(10) << "traverse: xlocked dentry at " << *dn << endl;
+ dout(10) << "traverse: xlocked dentry at " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req));
return 1;
}
// do i have it?
CInode *in = get_inode(dn->get_remote_ino());
if (in) {
- dout(7) << "linking in remote in " << *in << endl;
+ dout(7) << "linking in remote in " << *in << dendl;
dn->link_remote(in);
} else {
- dout(7) << "remote link to " << dn->get_remote_ino() << ", which i don't have" << endl;
+ dout(7) << "remote link to " << dn->get_remote_ino() << ", which i don't have" << dendl;
assert(mdr); // we shouldn't hit non-primary dentries doing a non-mdr traversal!
open_remote_ino(dn->get_remote_ino(), mdr, _get_waiter(mdr, req));
return 1;
(follow_trailing_symlink || depth < path.depth()-1)) {
// symlink, resolve!
filepath sym = dn->inode->symlink;
- dout(10) << "traverse: hit symlink " << *dn->inode << " to " << sym << endl;
+ dout(10) << "traverse: hit symlink " << *dn->inode << " to " << sym << dendl;
// break up path components
// /head/symlink/tail
filepath head = path.prefixpath(depth);
filepath tail = path.postfixpath(depth+1);
- dout(10) << "traverse: path head = " << head << endl;
- dout(10) << "traverse: path tail = " << tail << endl;
+ dout(10) << "traverse: path head = " << head << dendl;
+ dout(10) << "traverse: path tail = " << tail << dendl;
if (symlinks_resolved.count(pair<CInode*,string>(dn->inode, tail.get_path()))) {
- dout(10) << "already hit this symlink, bailing to avoid the loop" << endl;
+ dout(10) << "already hit this symlink, bailing to avoid the loop" << dendl;
return -ELOOP;
}
symlinks_resolved.insert(pair<CInode*,string>(dn->inode, tail.get_path()));
trace.clear();
depth = 0;
path = tail;
- dout(10) << "traverse: absolute symlink, path now " << path << " depth " << depth << endl;
+ dout(10) << "traverse: absolute symlink, path now " << path << " depth " << depth << dendl;
} else {
// relative
path = head;
path.append(sym);
path.append(tail);
- dout(10) << "traverse: relative symlink, path now " << path << " depth " << depth << endl;
+ dout(10) << "traverse: relative symlink, path now " << path << " depth " << depth << dendl;
}
continue;
}
mdr->client_request->get_mds_wants_replica_in_dirino()) {
dout(30) << "traverse: REP is here, "
<< mdr->client_request->get_mds_wants_replica_in_dirino()
- << " vs " << curdir->dirfrag() << endl;
+ << " vs " << curdir->dirfrag() << dendl;
if (mdr->client_request->get_mds_wants_replica_in_dirino() == curdir->ino() &&
curdir->is_auth() &&
if (dn->is_replica(from)) {
dout(15) << "traverse: REP would replicate to mds" << from << ", but already cached_by "
- << req->get_source() << " dn " << *dn << endl;
+ << req->get_source() << " dn " << *dn << dendl;
} else {
- dout(10) << "traverse: REP replicating to " << req->get_source() << " dn " << *dn << endl;
+ dout(10) << "traverse: REP replicating to " << req->get_source() << " dn " << *dn << dendl;
MDiscoverReply *reply = new MDiscoverReply(curdir->ino());
reply->add_dentry( dn->replicate_to( from ) );
if (dn->is_primary())
}
// MISS. dentry doesn't exist.
- dout(12) << "traverse: miss on dentry " << path[depth] << " in " << *curdir << endl;
+ dout(12) << "traverse: miss on dentry " << path[depth] << " in " << *curdir << dendl;
if (curdir->is_auth()) {
// dentry is mine.
return -ENOENT;
} else {
// directory isn't complete; reload
- dout(7) << "traverse: incomplete dir contents for " << *cur << ", fetching" << endl;
+ dout(7) << "traverse: incomplete dir contents for " << *cur << ", fetching" << dendl;
touch_inode(cur);
curdir->fetch(_get_waiter(mdr, req));
if (mds->logger) mds->logger->inc("cmiss");
if (curdir->is_waiting_for_dentry(path[depth])) {
dout(7) << "traverse: already waiting for discover " << want.get_path()
- << " from " << *curdir << endl;
+ << " from " << *curdir << dendl;
}
else if (curdir->is_ambiguous_auth()) {
- dout(7) << "traverse: waiting for single auth on " << *curdir << endl;
+ dout(7) << "traverse: waiting for single auth on " << *curdir << dendl;
curdir->add_waiter(CDir::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
return 1;
}
else {
- dout(7) << "traverse: discover " << want << " from " << *curdir << endl;
+ dout(7) << "traverse: discover " << want << " from " << *curdir << dendl;
touch_inode(cur);
mds->send_message_mds(new MDiscover(mds->get_nodeid(),
}
if (onfail == MDS_TRAVERSE_FORWARD) {
// forward
- dout(7) << "traverse: not auth for " << path << " in " << *curdir << endl;
+ dout(7) << "traverse: not auth for " << path << " in " << *curdir << dendl;
if (curdir->is_ambiguous_auth()) {
// wait
- dout(7) << "traverse: waiting for single auth in " << *curdir << endl;
+ dout(7) << "traverse: waiting for single auth in " << *curdir << dendl;
curdir->add_waiter(CDir::WAIT_SINGLEAUTH, _get_waiter(mdr, req));
return 1;
} else {
- dout(7) << "traverse: forwarding, not auth for " << *curdir << endl;
+ dout(7) << "traverse: forwarding, not auth for " << *curdir << dendl;
// request replication?
if (mdr && mdr->client_request && curdir->is_rep()) {
dout(15) << "traverse: REP fw to mds" << dauth << ", requesting rep under "
- << *curdir << " req " << *(MClientRequest*)req << endl;
+ << *curdir << " req " << *(MClientRequest*)req << dendl;
mdr->client_request->set_mds_wants_replica_in_dirino(curdir->ino());
req->clear_payload(); // reencode!
}
bool MDCache::path_is_mine(filepath& path)
{
- dout(15) << "path_is_mine " << path << endl;
+ dout(15) << "path_is_mine " << path << dendl;
// start at root. FIXME.
CInode *cur = root;
assert(cur);
for (unsigned i=0; i<path.depth(); i++) {
- dout(15) << "path_is_mine seg " << i << ": " << path[i] << " under " << *cur << endl;
+ dout(15) << "path_is_mine seg " << i << ": " << path[i] << " under " << *cur << dendl;
frag_t fg = cur->pick_dirfrag(path[i]);
CDir *dir = cur->get_dirfrag(fg);
if (!dir) return cur->is_auth();
CInode *cur = root;
assert(cur);
for (unsigned i=0; i<path.depth(); i++) {
- dout(20) << "path_traverse_to_dir seg " << i << ": " << path[i] << " under " << *cur << endl;
+ dout(20) << "path_traverse_to_dir seg " << i << ": " << path[i] << " under " << *cur << dendl;
frag_t fg = cur->pick_dirfrag(path[i]);
CDir *dir = cur->get_or_open_dirfrag(this, fg);
CDentry *dn = dir->lookup(path[i]);
*/
void MDCache::open_remote_dirfrag(CInode *diri, frag_t approxfg, Context *fin)
{
- dout(10) << "open_remote_dir on " << *diri << endl;
+ dout(10) << "open_remote_dir on " << *diri << dendl;
assert(diri->is_dir());
assert(!diri->is_auth());
assert(dn->is_remote());
CInode *in = get_inode(dn->get_remote_ino());
if (in) {
- dout(7) << "get_dentry_inode linking in remote in " << *in << endl;
+ dout(7) << "get_dentry_inode linking in remote in " << *in << dendl;
dn->link_remote(in);
return in;
} else {
- dout(10) << "get_dentry_inode on remote dn, opening inode for " << *dn << endl;
+ dout(10) << "get_dentry_inode on remote dn, opening inode for " << *dn << dendl;
open_remote_ino(dn->get_remote_ino(), mdr, new C_MDS_RetryRequest(this, mdr));
return 0;
}
MDRequest *mdr,
Context *onfinish)
{
- dout(7) << "open_remote_ino on " << ino << endl;
+ dout(7) << "open_remote_ino on " << ino << dendl;
C_MDC_OpenRemoteIno *c = new C_MDC_OpenRemoteIno(this, ino, mdr, onfinish);
mds->anchorclient->lookup(ino, c->anchortrace, c);
Context *onfinish)
{
dout(7) << "open_remote_ino_2 on " << ino
- << ", trace depth is " << anchortrace.size() << endl;
+ << ", trace depth is " << anchortrace.size() << dendl;
// find deepest cached inode in prefix
unsigned i = anchortrace.size(); // i := array index + 1
CInode *in = 0;
while (1) {
// inode?
- dout(10) << " " << i << ": " << anchortrace[i-1] << endl;
+ dout(10) << " " << i << ": " << anchortrace[i-1] << dendl;
in = get_inode(anchortrace[i-1].ino);
if (in) break;
i--;
break;
}
}
- dout(10) << "deepest cached inode at " << i << " is " << *in << endl;
+ dout(10) << "deepest cached inode at " << i << " is " << *in << dendl;
if (in->ino() == ino) {
// success
- dout(10) << "open_remote_ino_2 have " << *in << endl;
+ dout(10) << "open_remote_ino_2 have " << *in << dendl;
onfinish->finish(0);
delete onfinish;
return;
frag_t frag = anchortrace[i].dirfrag.frag;
if (!in->dirfragtree.contains(frag)) {
- dout(10) << "frag " << frag << " not valid, requerying anchortable" << endl;
+ dout(10) << "frag " << frag << " not valid, requerying anchortable" << dendl;
open_remote_ino(ino, mdr, onfinish);
return;
}
if (!in->is_auth()) {
- dout(10) << "opening remote dirfrag " << frag << " under " << *in << endl;
+ dout(10) << "opening remote dirfrag " << frag << " under " << *in << dendl;
/* FIXME: we re-query the anchortable just to avoid a fragtree update race */
open_remote_dirfrag(in, frag,
new C_MDC_RetryOpenRemoteIno(this, ino, mdr, onfinish));
dout(10) << "expected ino " << anchortrace[i].ino
<< " in complete dir " << *dir
<< ", requerying anchortable"
- << endl;
+ << dendl;
open_remote_ino(ino, mdr, onfinish);
} else {
dout(10) << "need ino " << anchortrace[i].ino
<< ", fetching incomplete dir " << *dir
- << endl;
+ << dendl;
dir->fetch(new C_MDC_OpenRemoteIno(this, ino, anchortrace, mdr, onfinish));
}
} else {
// hmm, discover.
dout(10) << "have remote dirfrag " << *dir << ", discovering "
- << anchortrace[i].ino << endl;
+ << anchortrace[i].ino << dendl;
MDiscover *dis = new MDiscover(mds->get_nodeid(),
dir->dirfrag(),
make_trace(trace, parent);
CDentry *dn = in->get_parent_dn();
- dout(15) << "make_trace adding " << *dn << endl;
+ dout(15) << "make_trace adding " << *dn << dendl;
trace.push_back(dn);
}
}
// did we win a forward race against a slave?
if (active_requests.count(req->get_reqid())) {
MDRequest *mdr = active_requests[req->get_reqid()];
- dout(10) << "request_start already had " << *mdr << ", cleaning up" << endl;
+ dout(10) << "request_start already had " << *mdr << ", cleaning up" << dendl;
assert(mdr->is_slave());
request_cleanup(mdr);
delete mdr;
// register new client request
MDRequest *mdr = new MDRequest(req->get_reqid(), req);
active_requests[req->get_reqid()] = mdr;
- dout(7) << "request_start " << *mdr << endl;
+ dout(7) << "request_start " << *mdr << dendl;
return mdr;
}
MDRequest *mdr = new MDRequest(ri, by);
assert(active_requests.count(mdr->reqid) == 0);
active_requests[mdr->reqid] = mdr;
- dout(7) << "request_start_slave " << *mdr << " by mds" << by << endl;
+ dout(7) << "request_start_slave " << *mdr << " by mds" << by << dendl;
return mdr;
}
MDRequest *MDCache::request_get(metareqid_t rid)
{
assert(active_requests.count(rid));
- dout(7) << "request_get " << rid << " " << *active_requests[rid] << endl;
+ dout(7) << "request_get " << rid << " " << *active_requests[rid] << dendl;
return active_requests[rid];
}
void MDCache::request_finish(MDRequest *mdr)
{
- dout(7) << "request_finish " << *mdr << endl;
+ dout(7) << "request_finish " << *mdr << dendl;
// slave finisher?
if (mdr->slave_commit) {
void MDCache::request_forward(MDRequest *mdr, int who, int port)
{
if (!port) port = MDS_PORT_SERVER;
- dout(7) << "request_forward " << *mdr << " to mds" << who << " req " << *mdr << endl;
+ dout(7) << "request_forward " << *mdr << " to mds" << who << " req " << *mdr << dendl;
mds->forward_message_mds(mdr->client_request, who, port);
request_cleanup(mdr);
p++;
else {
dout(10) << "request_forget_foreign_locks " << **p
- << " on " << *(*p)->get_parent() << endl;
+ << " on " << *(*p)->get_parent() << dendl;
(*p)->put_xlock();
mdr->locks.erase(*p);
mdr->xlocks.erase(p++);
void MDCache::request_cleanup(MDRequest *mdr)
{
- dout(15) << "request_cleanup " << *mdr << endl;
+ dout(15) << "request_cleanup " << *mdr << dendl;
metareqid_t ri = mdr->reqid;
// clear ref, trace
// auth pin
if (!in->can_auth_pin() &&
!mdr->is_auth_pinned(in)) {
- dout(7) << "anchor_create not authpinnable, waiting on " << *in << endl;
+ dout(7) << "anchor_create not authpinnable, waiting on " << *in << dendl;
in->add_waiter(CInode::WAIT_AUTHPINNABLE, onfinish);
return;
}
// already anchoring?
if (in->state_test(CInode::STATE_ANCHORING)) {
- dout(7) << "anchor_create already anchoring " << *in << endl;
+ dout(7) << "anchor_create already anchoring " << *in << dendl;
return;
}
- dout(7) << "anchor_create " << *in << endl;
+ dout(7) << "anchor_create " << *in << dendl;
// auth: do it
in->state_set(CInode::STATE_ANCHORING);
void MDCache::_anchor_create_prepared(CInode *in, version_t atid)
{
- dout(10) << "_anchor_create_prepared " << *in << " atid " << atid << endl;
+ dout(10) << "_anchor_create_prepared " << *in << " atid " << atid << dendl;
assert(in->inode.anchored == false);
// predirty, prepare log entry
void MDCache::_anchor_create_logged(CInode *in, version_t atid, version_t pdv)
{
- dout(10) << "_anchor_create_logged pdv " << pdv << " on " << *in << endl;
+ dout(10) << "_anchor_create_logged pdv " << pdv << " on " << *in << dendl;
// unpin
assert(in->state_test(CInode::STATE_ANCHORING));
// auth pin
if (!in->can_auth_pin()/* &&
!mdr->is_auth_pinned(in)*/) {
- dout(7) << "anchor_destroy not authpinnable, waiting on " << *in << endl;
+ dout(7) << "anchor_destroy not authpinnable, waiting on " << *in << dendl;
in->add_waiter(CInode::WAIT_AUTHPINNABLE, onfinish);
return;
}
// already anchoring?
if (in->state_test(CInode::STATE_UNANCHORING)) {
- dout(7) << "anchor_destroy already unanchoring " << *in << endl;
+ dout(7) << "anchor_destroy already unanchoring " << *in << dendl;
return;
}
- dout(7) << "anchor_destroy " << *in << endl;
+ dout(7) << "anchor_destroy " << *in << dendl;
// auth: do it
in->state_set(CInode::STATE_UNANCHORING);
void MDCache::_anchor_destroy_prepared(CInode *in, version_t atid)
{
- dout(10) << "_anchor_destroy_prepared " << *in << " atid " << atid << endl;
+ dout(10) << "_anchor_destroy_prepared " << *in << " atid " << atid << dendl;
assert(in->inode.anchored == true);
void MDCache::_anchor_destroy_logged(CInode *in, version_t atid, version_t pdv)
{
- dout(10) << "_anchor_destroy_logged pdv " << pdv << " on " << *in << endl;
+ dout(10) << "_anchor_destroy_logged pdv " << pdv << " on " << *in << dendl;
// unpin
assert(in->state_test(CInode::STATE_UNANCHORING));
void MDCache::eval_stray(CDentry *dn)
{
- dout(10) << "eval_stray " << *dn << endl;
+ dout(10) << "eval_stray " << *dn << dendl;
assert(dn->is_primary());
CInode *in = dn->inode;
assert(in);
void MDCache::_purge_stray(CDentry *dn)
{
- dout(10) << "_purge_stray " << *dn << " " << *dn->inode << endl;
+ dout(10) << "_purge_stray " << *dn << " " << *dn->inode << dendl;
assert(!dn->is_replicated());
// log removal
void MDCache::_purge_stray_logged(CDentry *dn, version_t pdv)
{
- dout(10) << "_purge_stray_logged " << *dn << " " << *dn->inode << endl;
+ dout(10) << "_purge_stray_logged " << *dn << " " << *dn->inode << dendl;
CInode *in = dn->inode;
// dirty+unlink dentry
void MDCache::reintegrate_stray(CDentry *dn, CDentry *rlink)
{
- dout(10) << "reintegrate_stray " << *dn << " into " << *rlink << endl;
+ dout(10) << "reintegrate_stray " << *dn << " into " << *rlink << dendl;
}
void MDCache::migrate_stray(CDentry *dn, int dest)
{
- dout(10) << "migrate_stray to mds" << dest << " " << *dn << endl;
+ dout(10) << "migrate_stray to mds" << dest << " " << *dn << dendl;
}
if (dis->get_base_ino() == MDS_INO_ROOT) {
// wants root
dout(7) << "handle_discover from mds" << dis->get_asker()
- << " wants root + " << dis->get_want().get_path() << endl;
+ << " wants root + " << dis->get_want().get_path() << dendl;
assert(mds->get_nodeid() == 0);
assert(root->is_auth());
// add root
reply->add_inode( root->replicate_to( dis->get_asker() ) );
- dout(10) << "added root " << *root << endl;
+ dout(10) << "added root " << *root << dendl;
cur = root;
}
else if (dis->get_base_ino() == MDS_INO_STRAY(whoami)) {
// wants root
dout(7) << "handle_discover from mds" << dis->get_asker()
- << " wants stray + " << dis->get_want().get_path() << endl;
+ << " wants stray + " << dis->get_want().get_path() << dendl;
reply->add_inode( stray->replicate_to( dis->get_asker() ) );
- dout(10) << "added stray " << *stray << endl;
+ dout(10) << "added stray " << *stray << dendl;
cur = stray;
}
if (!cur) {
dout(7) << "handle_discover mds" << dis->get_asker()
<< " don't have base ino " << dis->get_base_ino()
- << ", dropping" << endl;
+ << ", dropping" << dendl;
delete reply;
return;
}
dout(7) << "handle_discover mds" << dis->get_asker()
<< " has " << *cur
<< " wants basedir+" << dis->get_want().get_path()
- << endl;
+ << dendl;
} else {
dout(7) << "handle_discover mds" << dis->get_asker()
<< " has " << *cur
<< " wants " << dis->get_want().get_path()
- << endl;
+ << dendl;
}
}
// is *cur even a dir at all?
if (!cur->is_dir()) {
- dout(7) << *cur << " not a dir" << endl;
+ dout(7) << *cur << " not a dir" << dendl;
reply->set_flag_error_dir();
break;
}
if ((!curdir && !cur->is_auth()) ||
(curdir && !curdir->is_auth())) {
if (curdir) {
- dout(7) << " not dirfrag auth, setting dir_auth_hint for " << *curdir << endl;
+ dout(7) << " not dirfrag auth, setting dir_auth_hint for " << *curdir << dendl;
reply->set_dir_auth_hint(curdir->authority().first);
} else {
- dout(7) << " dirfrag not open, not inode auth, setting dir_auth_hint for " << *cur << endl;
+ dout(7) << " dirfrag not open, not inode auth, setting dir_auth_hint for " << *cur << dendl;
reply->set_dir_auth_hint(cur->authority().first);
}
reply->set_wanted_xlocks_hint(dis->wants_xlocked());
// is dir frozen?
if (curdir->is_frozen()) {
if (reply->is_empty()) {
- dout(7) << *curdir << " is frozen, empty reply, waiting" << endl;
+ dout(7) << *curdir << " is frozen, empty reply, waiting" << dendl;
curdir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryMessage(mds, dis));
delete reply;
return;
} else {
- dout(7) << *curdir << " is frozen, non-empty reply, stopping" << endl;
+ dout(7) << *curdir << " is frozen, non-empty reply, stopping" << dendl;
break;
}
}
// add dir
if (reply->is_empty() && !dis->wants_base_dir()) {
- dout(7) << "handle_discover not adding unwanted base dir " << *curdir << endl;
+ dout(7) << "handle_discover not adding unwanted base dir " << *curdir << dendl;
} else {
assert(!curdir->is_ambiguous_auth()); // would be frozen.
reply->add_dir( curdir->replicate_to(dis->get_asker()) );
- dout(7) << "handle_discover added dir " << *curdir << endl;
+ dout(7) << "handle_discover added dir " << *curdir << dendl;
}
if (dis->get_want().depth() == 0) break;
if (!dn) {
if (!curdir->is_complete()) {
// readdir
- dout(7) << "incomplete dir contents for " << *curdir << ", fetching" << endl;
+ dout(7) << "incomplete dir contents for " << *curdir << ", fetching" << dendl;
if (reply->is_empty()) {
// fetch and wait
curdir->fetch(new C_MDS_RetryMessage(mds, dis));
if (dis->get_want_ino()) {
// set error flag in reply
dout(7) << "ino " << dis->get_want_ino() << " in this dir, flagging error in "
- << *curdir << endl;
+ << *curdir << dendl;
reply->set_flag_error_ino();
break;
}
// send null dentry
dout(7) << "dentry " << dis->get_dentry(i) << " dne, returning null in "
- << *curdir << endl;
+ << *curdir << dendl;
dn = curdir->add_null_dentry(dis->get_dentry(i));
}
assert(dn);
// is this the last (tail) item in the discover traversal?
bool tailitem = (dis->get_want().depth() == 0) || (i == dis->get_want().depth() - 1);
if (tailitem && dis->wants_xlocked()) {
- dout(7) << "handle_discover allowing discovery of xlocked tail " << *dn << endl;
+ dout(7) << "handle_discover allowing discovery of xlocked tail " << *dn << dendl;
} else {
- dout(7) << "handle_discover blocking on xlocked " << *dn << endl;
+ dout(7) << "handle_discover blocking on xlocked " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryMessage(mds, dis));
delete reply;
return;
// add dentry
reply->add_dentry( dn->replicate_to( dis->get_asker() ) );
- dout(7) << "handle_discover added dentry " << *dn << endl;
+ dout(7) << "handle_discover added dentry " << *dn << dendl;
if (!dn->is_primary()) break; // stop on null or remote link.
assert(next->is_auth());
reply->add_inode( next->replicate_to( dis->get_asker() ) );
- dout(7) << "handle_discover added inode " << *next << endl;
+ dout(7) << "handle_discover added inode " << *next << dendl;
// descend, keep going.
cur = next;
// how did we do?
if (reply->is_empty()) {
- dout(7) << "handle_discover dropping this empty reply)." << endl;
+ dout(7) << "handle_discover dropping this empty reply)." << dendl;
delete reply;
} else {
- dout(7) << "handle_discover sending result back to asker mds" << dis->get_asker() << endl;
+ dout(7) << "handle_discover sending result back to asker mds" << dis->get_asker() << dendl;
mds->send_message_mds(reply, dis->get_asker(), MDS_PORT_CACHE);
}
CInode *cur = get_inode(m->get_base_ino());
if (cur) {
- dout(7) << "discover_reply " << *cur << " + " << m->get_path() << ", have " << m->get_num_inodes() << " inodes" << endl;
+ dout(7) << "discover_reply " << *cur << " + " << m->get_path() << ", have " << m->get_num_inodes() << " inodes" << dendl;
}
else if (m->get_base_ino() == MDS_INO_ROOT) {
// it's the root inode.
assert(!m->has_base_dentry());
assert(!m->has_base_dir());
- dout(7) << "discover_reply root + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << endl;
+ dout(7) << "discover_reply root + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << dendl;
// add in root
cur = add_replica_inode(m->get_inode(0), NULL);
cur->force_auth = pair<int,int>(m->get_source().num(), CDIR_AUTH_UNKNOWN);
set_root(cur);
- dout(7) << "discover_reply got root " << *cur << endl;
+ dout(7) << "discover_reply got root " << *cur << dendl;
// take root waiters
finished.swap(waiting_for_root);
}
else if (MDS_INO_IS_STRAY(m->get_base_ino())) {
- dout(7) << "discover_reply stray + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << endl;
+ dout(7) << "discover_reply stray + " << m->get_path() << " " << m->get_num_inodes() << " inodes" << dendl;
// add
cur = add_replica_inode(m->get_inode(0), NULL);
cur->force_auth = pair<int,int>(m->get_source().num(), CDIR_AUTH_UNKNOWN);
- dout(7) << "discover_reply got stray " << *cur << endl;
+ dout(7) << "discover_reply got stray " << *cur << dendl;
// take waiters
finished.swap(waiting_for_stray[cur->ino()]);
}
// fyi
- if (m->is_flag_error_dir()) dout(7) << " flag error, dir" << endl;
- if (m->is_flag_error_dn()) dout(7) << " flag error, dentry = " << m->get_error_dentry() << endl;
+ if (m->is_flag_error_dir()) dout(7) << " flag error, dir" << dendl;
+ if (m->is_flag_error_dn()) dout(7) << " flag error, dentry = " << m->get_error_dentry() << dendl;
dout(10) << "depth = " << m->get_depth()
<< ", has base_dir/base_dn/root = "
<< m->has_base_dir() << " / " << m->has_base_dentry() << " / " << m->has_base_inode()
<< ", num dirs/dentries/inodes = "
<< m->get_num_dirs() << " / " << m->get_num_dentries() << " / " << m->get_num_inodes()
- << endl;
+ << dendl;
// loop over discover results.
// indexese follow each ([[dir] dentry] inode)
// can start, end with any type.
for (int i=m->has_base_inode(); i<m->get_depth(); i++) {
- dout(10) << "discover_reply i=" << i << " cur " << *cur << endl;
+ dout(10) << "discover_reply i=" << i << " cur " << *cur << dendl;
// dir
frag_t fg;
// error!
assert(cur->is_dir());
if (curdir) {
- dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dentry?" << endl;
+ dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dentry?" << dendl;
curdir->take_dentry_waiting(m->get_error_dentry(),
error);
} else {
- dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dir?" << endl;
+ dout(7) << " flag_error on dentry " << m->get_error_dentry() << ", triggering dir?" << dendl;
cur->take_waiting(CInode::WAIT_DIR, error);
dir_discovers.erase(cur->ino());
}
// dir_auth hint?
if (m->get_dir_auth_hint() != CDIR_AUTH_UNKNOWN &&
m->get_dir_auth_hint() != mds->get_nodeid()) {
- dout(7) << " dir_auth_hint is " << m->get_dir_auth_hint() << endl;
+ dout(7) << " dir_auth_hint is " << m->get_dir_auth_hint() << dendl;
// try again. include dentry _and_ dirfrag, just in case.
int hint = m->get_dir_auth_hint();
}
else if (m->is_flag_error_dir()) {
// dir error at the end there?
- dout(7) << " flag_error on dir " << *cur << endl;
+ dout(7) << " flag_error on dir " << *cur << dendl;
assert(!cur->is_dir());
cur->take_waiting(CInode::WAIT_DIR, error);
dir_discovers.erase(cur->ino());
if (dir) {
// had replica. update w/ new nonce.
dis.update_dir(dir);
- dout(7) << "add_replica_dir had " << *dir << " nonce " << dir->replica_nonce << endl;
+ dout(7) << "add_replica_dir had " << *dir << " nonce " << dir->replica_nonce << dendl;
} else {
// force frag to leaf in the diri tree
if (!diri->dirfragtree.is_leaf(fg)) {
dout(7) << "add_replica_dir forcing frag " << fg << " to leaf in the fragtree "
- << diri->dirfragtree << endl;
+ << diri->dirfragtree << dendl;
diri->dirfragtree.force_to_leaf(fg);
}
diri->ino() < MDS_INO_BASE)
adjust_subtree_auth(dir, from);
- dout(7) << "add_replica_dir added " << *dir << " nonce " << dir->replica_nonce << endl;
+ dout(7) << "add_replica_dir added " << *dir << " nonce " << dir->replica_nonce << dendl;
// get waiters
diri->take_waiting(CInode::WAIT_DIR, finished);
// i'm assuming this is a subtree root.
adjust_subtree_auth(dir, from);
- dout(7) << "forge_replica_dir added " << *dir << " while mds" << from << " is down" << endl;
+ dout(7) << "forge_replica_dir added " << *dir << " while mds" << from << " is down" << dendl;
return dir;
}
// have it?
if (dn) {
dis.update_dentry(dn);
- dout(7) << "add_replica_dentry had " << *dn << endl;
+ dout(7) << "add_replica_dentry had " << *dn << dendl;
} else {
dn = dir->add_null_dentry(dis.get_dname());
dis.update_dentry(dn);
dis.init_dentry_lock(dn);
- dout(7) << "add_replica_dentry added " << *dn << endl;
+ dout(7) << "add_replica_dentry added " << *dn << dendl;
}
// remote_ino linkage?
dis.update_inode(in);
dis.init_inode_locks(in);
add_inode(in);
- dout(10) << "add_replica_inode had " << *in << endl;
+ dout(10) << "add_replica_inode had " << *in << dendl;
if (dn && dn->is_null())
dn->dir->link_primary_inode(dn, in);
} else {
dis.update_inode(in);
- dout(10) << "add_replica_inode added " << *in << endl;
+ dout(10) << "add_replica_inode added " << *in << dendl;
}
if (dn) {
indis._decode(bl, off);
CInode *strayin = add_replica_inode(indis, NULL);
strayin->force_auth = pair<int,int>(from, CDIR_AUTH_UNKNOWN);
- dout(15) << "strayin " << *strayin << endl;
+ dout(15) << "strayin " << *strayin << dendl;
// dir
CDirDiscover dirdis;
dirdis._decode(bl, off);
CDir *straydir = add_replica_dir(strayin, dirdis.get_dirfrag().frag, dirdis,
from, finished);
- dout(15) << "straydir " << *straydir << endl;
+ dout(15) << "straydir " << *straydir << dendl;
// dentry
CDentryDiscover dndis;
for (set<int>::iterator it = in->cached_by_begin();
it != in->cached_by_end();
it++) {
- dout(7) << "sending inode_update on " << *in << " to " << *it << endl;
+ dout(7) << "sending inode_update on " << *in << " to " << *it << dendl;
assert(*it != mds->get_nodeid());
mds->send_message_mds(new MInodeUpdate(in, in->get_cached_by_nonce(*it)), *it, MDS_PORT_CACHE);
}
inodeno_t ino = m->get_ino();
CInode *in = get_inode(m->get_ino());
if (!in) {
- //dout(7) << "inode_update on " << m->get_ino() << ", don't have it, ignoring" << endl;
- dout(7) << "inode_update on " << m->get_ino() << ", don't have it, sending expire" << endl;
+ //dout(7) << "inode_update on " << m->get_ino() << ", don't have it, ignoring" << dendl;
+ dout(7) << "inode_update on " << m->get_ino() << ", don't have it, sending expire" << dendl;
MCacheExpire *expire = new MCacheExpire(mds->get_nodeid());
expire->add_inode(m->get_ino(), m->get_nonce());
mds->send_message_mds(expire, m->get_source().num(), MDS_PORT_CACHE);
}
if (in->is_auth()) {
- dout(7) << "inode_update on " << *in << ", but i'm the authority!" << endl;
+ dout(7) << "inode_update on " << *in << ", but i'm the authority!" << dendl;
assert(0); // this should never happen
}
- dout(7) << "inode_update on " << *in << endl;
+ dout(7) << "inode_update on " << *in << dendl;
// update! NOTE dir_auth is unaffected by this.
in->decode_basic_state(m->get_payload());
who.insert(p->first);
}
- dout(7) << "sending dir_update on " << *dir << " bcast " << bcast << " to " << who << endl;
+ dout(7) << "sending dir_update on " << *dir << " bcast " << bcast << " to " << who << dendl;
string path;
dir->inode->make_path(path);
it++) {
if (*it == whoami) continue;
//if (*it == except) continue;
- dout(7) << "sending dir_update on " << *dir << " to " << *it << endl;
+ dout(7) << "sending dir_update on " << *dir << " to " << *it << dendl;
mds->send_message_mds(new MDirUpdate(dir->dirfrag(),
dir->dir_rep,
{
CDir *dir = get_dirfrag(m->get_dirfrag());
if (!dir) {
- dout(5) << "dir_update on " << m->get_dirfrag() << ", don't have it" << endl;
+ dout(5) << "dir_update on " << m->get_dirfrag() << ", don't have it" << dendl;
// discover it?
if (m->should_discover()) {
vector<CDentry*> trace;
filepath path = m->get_path();
- dout(5) << "trying discover on dir_update for " << path << endl;
+ dout(5) << "trying discover on dir_update for " << path << dendl;
int r = path_traverse(0, m,
0, path, trace, true,
}
// update
- dout(5) << "dir_update on " << *dir << endl;
+ dout(5) << "dir_update on " << *dir << dendl;
dir->dir_rep = m->get_dir_rep();
dir->dir_rep_by = m->get_dir_rep_by();
CDir *dir = get_dirfrag(m->get_dirfrag());
if (!dir) {
- dout(7) << "handle_dentry_unlink don't have dirfrag " << m->get_dirfrag() << endl;
+ dout(7) << "handle_dentry_unlink don't have dirfrag " << m->get_dirfrag() << dendl;
}
else {
CDentry *dn = dir->lookup(m->get_dn());
if (!dn) {
- dout(7) << "handle_dentry_unlink don't have dentry " << *dir << " dn " << m->get_dn() << endl;
+ dout(7) << "handle_dentry_unlink don't have dentry " << *dir << " dn " << m->get_dn() << dendl;
} else {
- dout(7) << "handle_dentry_unlink on " << *dn << endl;
+ dout(7) << "handle_dentry_unlink on " << *dn << dendl;
// move to stray?
CDentry *straydn = 0;
list<Context*>& waiters)
{
dout(10) << "adjust_dir_fragments " << basefrag << " " << bits
- << " on " << *diri << endl;
+ << " on " << *diri << dendl;
// yuck. we may have discovered the inode while it was being fragmented.
if (!diri->dirfragtree.is_leaf(basefrag))
// adjust fragtree
diri->dirfragtree.split(basefrag, bits);
- dout(10) << " new fragtree is " << diri->dirfragtree << endl;
+ dout(10) << " new fragtree is " << diri->dirfragtree << dendl;
if (bits > 0) {
if (base) {
void MDCache::split_dir(CDir *dir, int bits)
{
- dout(7) << "split_dir " << *dir << " bits " << bits << endl;
+ dout(7) << "split_dir " << *dir << " bits " << bits << dendl;
assert(dir->is_auth());
if (mds->mdsmap->is_degraded()) {
- dout(7) << "cluster degraded, no fragmenting for now" << endl;
+ dout(7) << "cluster degraded, no fragmenting for now" << dendl;
return;
}
if (dir->inode->is_root()) {
- dout(7) << "i won't fragment root" << endl;
+ dout(7) << "i won't fragment root" << dendl;
//assert(0);
return;
}
if (dir->state_test(CDir::STATE_FRAGMENTING)) {
- dout(7) << "already fragmenting" << endl;
+ dout(7) << "already fragmenting" << dendl;
return;
}
if (!dir->can_auth_pin()) {
- dout(7) << "not authpinnable on " << *dir << endl;
+ dout(7) << "not authpinnable on " << *dir << dendl;
return;
}
frag_t basefrag, int bits)
{
dout(10) << "fragment_mark_and_complete " << basefrag << " by " << bits
- << " on " << *diri << endl;
+ << " on " << *diri << dendl;
C_Gather *gather = 0;
CDir *dir = *p;
if (!dir->is_complete()) {
- dout(15) << " fetching incomplete " << *dir << endl;
+ dout(15) << " fetching incomplete " << *dir << dendl;
if (!gather) gather = new C_Gather(new C_MDC_FragmentMarking(this, diri, startfrags, basefrag, bits));
dir->fetch(gather->new_sub(),
true); // ignore authpinnability
}
else if (!dir->state_test(CDir::STATE_DNPINNEDFRAG)) {
- dout(15) << " marking " << *dir << endl;
+ dout(15) << " marking " << *dir << dendl;
for (map<string,CDentry*>::iterator p = dir->items.begin();
p != dir->items.end();
++p) {
dir->auth_unpin(); // allow our freeze to complete
}
else {
- dout(15) << " marked " << *dir << endl;
+ dout(15) << " marked " << *dir << dendl;
}
}
}
void MDCache::fragment_go(CInode *diri, list<CDir*>& startfrags, frag_t basefrag, int bits)
{
dout(10) << "fragment_go " << basefrag << " by " << bits
- << " on " << *diri << endl;
+ << " on " << *diri << dendl;
// refragment
list<CDir*> resultfrags;
p != resultfrags.end();
p++) {
CDir *dir = *p;
- dout(10) << " result frag " << *dir << endl;
+ dout(10) << " result frag " << *dir << dendl;
dir->state_set(CDir::STATE_FRAGMENTING);
dir->commit(0, gather->new_sub());
dir->_freeze_dir();
list<CDir*>& resultfrags)
{
dout(10) << "fragment_stored " << basefrag << " by " << bits
- << " on " << *diri << endl;
+ << " on " << *diri << dendl;
EFragment *le = new EFragment(mds->mdlog, diri->ino(), basefrag, bits);
p != resultfrags.end();
p++) {
CDir *dir = *p;
- dout(10) << " result frag " << *dir << endl;
+ dout(10) << " result frag " << *dir << dendl;
if (p == resultfrags.begin()) {
le->metablob.add_dir_context(dir);
vector<version_t>& pvs)
{
dout(10) << "fragment_logged " << basefrag << " bits " << bits
- << " on " << *diri << endl;
+ << " on " << *diri << dendl;
// dirty resulting frags
p != resultfrags.end();
p++) {
CDir *dir = *p;
- dout(10) << " result frag " << *dir << endl;
+ dout(10) << " result frag " << *dir << dendl;
// dirty, unpin, unfreeze
dir->state_clear(CDir::STATE_FRAGMENTING);
void MDCache::handle_fragment_notify(MMDSFragmentNotify *notify)
{
- dout(10) << "handle_fragment_notify " << *notify << " from " << notify->get_source() << endl;
+ dout(10) << "handle_fragment_notify " << *notify << " from " << notify->get_source() << dendl;
CInode *diri = get_inode(notify->get_ino());
if (diri) {
void MDCache::show_subtrees(int dbl)
{
- //dout(10) << "show_subtrees" << endl;
+ //dout(10) << "show_subtrees" << dendl;
if (dbl > g_conf.debug && dbl > g_conf.debug_mds)
return; // i won't print anything.
if (subtrees.empty()) {
- dout(dbl) << "no subtrees" << endl;
+ dout(dbl) << "no subtrees" << dendl;
return;
}
list<CDir*> rootfrags;
if (root) root->get_dirfrags(rootfrags);
if (stray) stray->get_dirfrags(rootfrags);
- dout(15) << "rootfrags " << rootfrags << endl;
+ dout(15) << "rootfrags " << rootfrags << dendl;
// queue stuff
list<pair<CDir*,int> > q;
if (d > depth) depth = d;
// sanity check
- //dout(25) << "saw depth " << d << " " << *dir << endl;
- if (seen.count(dir)) dout(0) << "aah, already seen " << *dir << endl;
+ //dout(25) << "saw depth " << d << " " << *dir << dendl;
+ if (seen.count(dir)) dout(0) << "aah, already seen " << *dir << dendl;
assert(seen.count(dir) == 0);
seen.insert(dir);
for (set<CDir*>::iterator p = subtrees[dir].begin();
p != subtrees[dir].end();
++p) {
- //dout(25) << " saw sub " << **p << endl;
+ //dout(25) << " saw sub " << **p << dendl;
q.push_front(pair<CDir*,int>(*p, d+1));
}
}
sprintf(s, "%2d,%2d", dir->get_dir_auth().first, dir->get_dir_auth().second);
// print
- dout(dbl) << indent << "|_" << pad << s << " " << auth << *dir << endl;
+ dout(dbl) << indent << "|_" << pad << s << " " << auth << *dir << dendl;
if (dir->ino() == MDS_INO_ROOT)
assert(dir->inode == root);
void MDCache::show_cache()
{
- dout(7) << "show_cache" << endl;
+ dout(7) << "show_cache" << dendl;
for (hash_map<inodeno_t,CInode*>::iterator it = inode_map.begin();
it != inode_map.end();
it++) {
// unlinked?
if (!it->second->parent)
- dout(7) << " unlinked " << *it->second << endl;
+ dout(7) << " unlinked " << *it->second << dendl;
// dirfrags?
list<CDir*> dfs;
it->second->get_dirfrags(dfs);
for (list<CDir*>::iterator p = dfs.begin(); p != dfs.end(); ++p) {
CDir *dir = *p;
- dout(7) << " dirfrag " << *dir << endl;
+ dout(7) << " dirfrag " << *dir << dendl;
for (CDir_map_t::iterator p = dir->items.begin();
p != dir->items.end();
++p) {
CDentry *dn = p->second;
- dout(7) << " dentry " << *dn << endl;
+ dout(7) << " dentry " << *dn << dendl;
if (dn->is_primary() && dn->inode)
- dout(7) << " inode " << *dn->inode << endl;
+ dout(7) << " inode " << *dn->inode << dendl;
}
}
}
char fn[20];
sprintf(fn, "cachedump.%d.mds%d", mds->mdsmap->get_epoch(), mds->get_nodeid());
- dout(1) << "dump_cache to " << fn << endl;
+ dout(1) << "dump_cache to " << fn << dendl;
ofstream myfile;
myfile.open(fn);
it->second->get_dirfrags(dfs);
for (list<CDir*>::iterator p = dfs.begin(); p != dfs.end(); ++p) {
CDir *dir = *p;
- myfile << *dir->inode << endl;
- myfile << *dir << endl;
+ myfile << *dir->inode << dendl;
+ myfile << *dir << dendl;
for (CDir_map_t::iterator p = dir->items.begin();
p != dir->items.end();
++p) {
CDentry *dn = p->second;
- myfile << *dn << endl;
+ myfile << *dn << dendl;
}
}
}
#include "common/Logger.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
-#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
+
+#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
+#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".log "
// cons/des
void MDLog::reset()
{
- dout(5) << "reset to empty log" << endl;
+ dout(5) << "reset to empty log" << dendl;
init_journaler();
journaler->reset();
}
void MDLog::open(Context *c)
{
- dout(5) << "open discovering log bounds" << endl;
+ dout(5) << "open discovering log bounds" << dendl;
init_journaler();
journaler->recover(c);
}
void MDLog::submit_entry( LogEvent *le, Context *c )
{
if (g_conf.mds_log) {
- dout(5) << "submit_entry " << journaler->get_write_pos() << " : " << *le << endl;
+ dout(5) << "submit_entry " << journaler->get_write_pos() << " : " << *le << dendl;
// encode it, with event type
{
(journaler->get_write_pos() - last_subtree_map > log_inode.layout.period()/2)) {
// log import map
dout(10) << "submit_entry also logging subtree map: last = " << last_subtree_map
- << ", cur pos = " << journaler->get_write_pos() << endl;
+ << ", cur pos = " << journaler->get_write_pos() << dendl;
mds->mdcache->log_subtree_map();
}
void MDLog::_did_read()
{
- dout(5) << "_did_read()" << endl;
+ dout(5) << "_did_read()" << dendl;
waiting_for_read = false;
trim(0);
}
{
// successful trim?
if (!le->has_expired(mds)) {
- dout(7) << "retrimming : " << le->get_start_off() << " : " << *le << endl;
+ dout(7) << "retrimming : " << le->get_start_off() << " : " << *le << dendl;
le->expire(mds, new C_MDL_Trimmed(this, le));
return;
}
- dout(7) << "trimmed : " << le->get_start_off() << " : " << *le << endl;
+ dout(7) << "trimmed : " << le->get_start_off() << " : " << *le << dendl;
if (trimming.begin()->first == le->_end_off) {
// we trimmed off the front!
trim_waiters.push_back(c);
// trim!
- dout(10) << "trim " << num_events << " events / " << max_events << " max" << endl;
+ dout(10) << "trim " << num_events << " events / " << max_events << " max" << dendl;
// hack: only trim for a few seconds at a time
utime_t stop = g_clock.now();
dout(5) << "trim num_events " << num_events << " > max " << max_events
<< ", trimming " << trimming.size()
<< ", byte gap " << gap
- << endl;
+ << dendl;
if ((int)trimming.size() >= g_conf.mds_log_max_trimming) {
- dout(7) << "trim already trimming max, waiting" << endl;
+ dout(7) << "trim already trimming max, waiting" << dendl;
return;
}
// we just read an event.
if (le->has_expired(mds)) {
// obsolete
- dout(7) << "trim obsolete : " << le->get_start_off() << " : " << *le << endl;
+ dout(7) << "trim obsolete : " << le->get_start_off() << " : " << *le << dendl;
delete le;
logger->inc("obs");
} else {
assert ((int)trimming.size() < g_conf.mds_log_max_trimming);
// trim!
- dout(7) << "trim expiring : " << le->get_start_off() << " : " << *le << endl;
+ dout(7) << "trim expiring : " << le->get_start_off() << " : " << *le << dendl;
trimming[le->_end_off] = le;
le->expire(mds, new C_MDL_Trimmed(this, le));
logger->inc("trims");
// need to read!
if (!waiting_for_read) {
waiting_for_read = true;
- dout(7) << "trim waiting for read" << endl;
+ dout(7) << "trim waiting for read" << dendl;
journaler->wait_for_readable(new C_MDL_Reading(this));
} else {
- dout(7) << "trim already waiting for read" << endl;
+ dout(7) << "trim already waiting for read" << dendl;
}
return;
}
dout(10) << "trim num_events " << num_events << " <= max " << max_events
<< ", trimming " << trimming.size()
<< ", done for now."
- << endl;
+ << dendl;
// trimmed!
std::list<Context*> finished;
// empty?
if (journaler->get_read_pos() == journaler->get_write_pos()) {
- dout(10) << "replay - journal empty, done." << endl;
+ dout(10) << "replay - journal empty, done." << dendl;
if (c) {
c->finish(0);
delete c;
// go!
dout(10) << "replay start, from " << journaler->get_read_pos()
- << " to " << journaler->get_write_pos() << endl;
+ << " to " << journaler->get_write_pos() << dendl;
assert(num_events == 0);
void MDLog::_replay_thread()
{
mds->mds_lock.Lock();
- dout(10) << "_replay_thread start" << endl;
+ dout(10) << "_replay_thread start" << dendl;
// loop
while (1) {
if (!seen_subtree_map &&
le->get_type() != EVENT_SUBTREEMAP) {
dout(10) << "_replay " << pos << " / " << journaler->get_write_pos()
- << " -- waiting for subtree_map. (skipping " << *le << ")" << endl;
+ << " -- waiting for subtree_map. (skipping " << *le << ")" << dendl;
} else {
dout(10) << "_replay " << pos << " / " << journaler->get_write_pos()
- << " : " << *le << endl;
+ << " : " << *le << dendl;
le->replay(mds);
if (le->get_type() == EVENT_SUBTREEMAP)
// done!
assert(journaler->get_read_pos() == journaler->get_write_pos());
- dout(10) << "_replay - complete" << endl;
+ dout(10) << "_replay - complete" << dendl;
// move read pointer _back_ to expire pos, for eventual trimming
journaler->set_read_pos(journaler->get_expire_pos());
ls.swap(waitfor_replay);
finish_contexts(ls,0);
- dout(10) << "_replay_thread finish" << endl;
+ dout(10) << "_replay_thread finish" << dendl;
mds->mds_lock.Unlock();
}
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << whoami << " "
-#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << whoami << " "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << whoami << " "
+#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << whoami << " "
void MDS::send_message_client(Message *m, int client)
{
version_t seq = clientmap.inc_push_seq(client);
- dout(10) << "send_message_client client" << client << " seq " << seq << " " << *m << endl;
+ dout(10) << "send_message_client client" << client << " seq " << seq << " " << *m << dendl;
messenger->send_message(m, clientmap.get_inst(client));
}
void MDS::send_message_client(Message *m, entity_inst_t clientinst)
{
version_t seq = clientmap.inc_push_seq(clientinst.name.num());
- dout(10) << "send_message_client client" << clientinst.name.num() << " seq " << seq << " " << *m << endl;
+ dout(10) << "send_message_client client" << clientinst.name.num() << " seq " << seq << " " << *m << dendl;
messenger->send_message(m, clientinst);
}
int client = clientinst.name.num();
if (!clientmap.have_session(client)) {
// no session!
- dout(10) << "send_message_client opening session with " << clientinst << endl;
+ dout(10) << "send_message_client opening session with " << clientinst << dendl;
clientmap.add_opening(client);
mdlog->submit_entry(new ESession(clientinst, true, clientmap.inc_projected()),
new C_MDS_SendMessageClientSession(this, m, clientinst));
dout(10) << "beacon_send " << MDSMap::get_state_name(want_state)
<< " seq " << beacon_last_seq
<< " (currently " << MDSMap::get_state_name(state) << ")"
- << endl;
+ << dendl;
beacon_seq_stamp[beacon_last_seq] = g_clock.now();
void MDS::handle_mds_beacon(MMDSBeacon *m)
{
dout(10) << "handle_mds_beacon " << MDSMap::get_state_name(m->get_state())
- << " seq " << m->get_seq() << endl;
+ << " seq " << m->get_seq() << dendl;
version_t seq = m->get_seq();
// update lab
when += g_conf.mds_beacon_grace;
dout(15) << "reset_beacon_killer last_acked_stamp at " << beacon_last_acked_stamp
- << ", will die at " << when << endl;
+ << ", will die at " << when << dendl;
if (beacon_killer) timer.cancel_event(beacon_killer);
if (lab == beacon_last_acked_stamp) {
dout(0) << "beacon_kill last_acked_stamp " << lab
<< ", killing myself."
- << endl;
+ << dendl;
suicide();
} else {
dout(20) << "beacon_kill last_acked_stamp " << beacon_last_acked_stamp
<< " != my " << lab
<< ", doing nothing."
- << endl;
+ << dendl;
}
}
{
version_t hadepoch = mdsmap->get_epoch();
version_t epoch = m->get_epoch();
- dout(5) << "handle_mds_map epoch " << epoch << " from " << m->get_source() << endl;
+ dout(5) << "handle_mds_map epoch " << epoch << " from " << m->get_source() << dendl;
// note source's map version
if (m->get_source().is_mds() &&
peer_mdsmap_epoch[m->get_source().num()] < epoch) {
dout(15) << " peer " << m->get_source()
<< " has mdsmap epoch >= " << epoch
- << endl;
+ << dendl;
peer_mdsmap_epoch[m->get_source().num()] = epoch;
}
// is it new?
if (epoch <= mdsmap->get_epoch()) {
dout(5) << " old map epoch " << epoch << " <= " << mdsmap->get_epoch()
- << ", discarding" << endl;
+ << ", discarding" << dendl;
delete m;
return;
}
// see who i am
whoami = mdsmap->get_addr_rank(messenger->get_myaddr());
if (whoami < 0) {
- dout(1) << "handle_mds_map i'm not in the mdsmap, killing myself" << endl;
+ dout(1) << "handle_mds_map i'm not in the mdsmap, killing myself" << dendl;
suicide();
return;
}
reopen_logger();
dout(1) << "handle_mds_map i am now mds" << whoami
<< " incarnation " << mdsmap->get_inc(whoami)
- << endl;
+ << dendl;
// do i need an osdmap?
if (oldwhoami < 0) {
// did it change?
if (oldstate != state) {
if (state == want_state) {
- dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state) << endl;
+ dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state) << dendl;
} else {
dout(1) << "handle_mds_map new state " << mdsmap->get_state_name(state)
<< ", although i wanted " << mdsmap->get_state_name(want_state)
- << endl;
+ << dendl;
want_state = state;
}
// contemplate suicide
if (mdsmap->get_inst(whoami) != messenger->get_myinst()) {
- dout(1) << "apparently i've been replaced by " << mdsmap->get_inst(whoami) << ", committing suicide." << endl;
+ dout(1) << "apparently i've been replaced by " << mdsmap->get_inst(whoami) << ", committing suicide." << dendl;
suicide();
return;
}
stopping_start();
} else if (is_stopped()) {
assert(oldstate == MDSMap::STATE_STOPPING);
- dout(1) << "now stopped, sending down:out and exiting" << endl;
+ dout(1) << "now stopped, sending down:out and exiting" << dendl;
suicide();
return;
}
set<int> resolve;
mdsmap->get_mds_set(resolve, MDSMap::STATE_RESOLVE);
if (oldresolve != resolve) {
- dout(10) << "resolve set is " << resolve << ", was " << oldresolve << endl;
+ dout(10) << "resolve set is " << resolve << ", was " << oldresolve << dendl;
for (set<int>::iterator p = resolve.begin(); p != resolve.end(); ++p) {
if (*p == whoami) continue;
if (oldresolve.count(*p)) continue;
void MDS::bcast_mds_map()
{
- dout(7) << "bcast_mds_map " << mdsmap->get_epoch() << endl;
+ dout(7) << "bcast_mds_map " << mdsmap->get_epoch() << dendl;
// share the map with mounted clients
for (set<int>::const_iterator p = clientmap.get_session_set().begin();
void MDS::handle_osd_map(MOSDMap *m)
{
version_t hadepoch = osdmap->get_epoch();
- dout(10) << "handle_osd_map had " << hadepoch << endl;
+ dout(10) << "handle_osd_map had " << hadepoch << dendl;
// process
objecter->handle_osd_map(m);
void MDS::set_want_state(int s)
{
- dout(3) << "set_want_state " << MDSMap::get_state_name(s) << endl;
+ dout(3) << "set_want_state " << MDSMap::get_state_name(s) << dendl;
want_state = s;
beacon_send();
}
void MDS::boot_create()
{
- dout(3) << "boot_create" << endl;
+ dout(3) << "boot_create" << dendl;
C_Gather *fin = new C_Gather(new C_MDS_BootFinish(this));
if (whoami == 0) {
- dout(3) << "boot_create since i am also mds0, creating root inode and dir" << endl;
+ dout(3) << "boot_create since i am also mds0, creating root inode and dir" << dendl;
// create root inode.
mdcache->open_root(0);
// create my stray dir
{
- dout(10) << "boot_create creating local stray dir" << endl;
+ dout(10) << "boot_create creating local stray dir" << dendl;
mdcache->open_local_stray();
CInode *stray = mdcache->get_stray();
CDir *dir = stray->get_dirfrag(frag_t());
}
// start with a fresh journal
- dout(10) << "boot_create creating fresh journal" << endl;
+ dout(10) << "boot_create creating fresh journal" << dendl;
mdlog->reset();
mdlog->write_head(fin->new_sub());
mdcache->log_subtree_map(fin->new_sub());
// fixme: fake out idalloc (reset, pretend loaded)
- dout(10) << "boot_create creating fresh idalloc table" << endl;
+ dout(10) << "boot_create creating fresh idalloc table" << dendl;
idalloc->reset();
idalloc->save(fin->new_sub());
// fixme: fake out anchortable
if (mdsmap->get_anchortable() == whoami) {
- dout(10) << "boot_create creating fresh anchortable" << endl;
+ dout(10) << "boot_create creating fresh anchortable" << dendl;
anchortable->create_fresh();
anchortable->save(fin->new_sub());
}
void MDS::boot_start()
{
- dout(2) << "boot_start" << endl;
+ dout(2) << "boot_start" << dendl;
C_Gather *fin = new C_Gather(new C_MDS_BootFinish(this));
- dout(2) << "boot_start opening idalloc" << endl;
+ dout(2) << "boot_start opening idalloc" << dendl;
idalloc->load(fin->new_sub());
- dout(2) << "boot_start opening clientmap" << endl;
+ dout(2) << "boot_start opening clientmap" << dendl;
clientmap.load(fin->new_sub());
if (mdsmap->get_anchortable() == whoami) {
- dout(2) << "boot_start opening anchor table" << endl;
+ dout(2) << "boot_start opening anchor table" << dendl;
anchortable->load(fin->new_sub());
} else {
- dout(2) << "boot_start i have no anchor table" << endl;
+ dout(2) << "boot_start i have no anchor table" << dendl;
}
- dout(2) << "boot_start opening mds log" << endl;
+ dout(2) << "boot_start opening mds log" << dendl;
mdlog->open(fin->new_sub());
if (mdsmap->get_root() == whoami) {
- dout(2) << "boot_start opening root directory" << endl;
+ dout(2) << "boot_start opening root directory" << dendl;
mdcache->open_root(fin->new_sub());
}
- dout(2) << "boot_start opening local stray directory" << endl;
+ dout(2) << "boot_start opening local stray directory" << dendl;
mdcache->open_local_stray();
}
void MDS::boot_finish()
{
- dout(3) << "boot_finish" << endl;
+ dout(3) << "boot_finish" << dendl;
if (is_starting()) {
// make sure mdslog is empty
case 1:
{
C_Gather *gather = new C_Gather(new C_MDS_BootRecover(this, 2));
- dout(2) << "boot_replay " << step << ": opening idalloc" << endl;
+ dout(2) << "boot_replay " << step << ": opening idalloc" << dendl;
idalloc->load(gather->new_sub());
- dout(2) << "boot_replay " << step << ": opening clientmap" << endl;
+ dout(2) << "boot_replay " << step << ": opening clientmap" << dendl;
clientmap.load(gather->new_sub());
if (mdsmap->get_anchortable() == whoami) {
- dout(2) << "boot_replay " << step << ": opening anchor table" << endl;
+ dout(2) << "boot_replay " << step << ": opening anchor table" << dendl;
anchortable->load(gather->new_sub());
}
}
break;
case 2:
- dout(2) << "boot_replay " << step << ": opening mds log" << endl;
+ dout(2) << "boot_replay " << step << ": opening mds log" << dendl;
mdlog->open(new C_MDS_BootRecover(this, 3));
break;
case 3:
- dout(2) << "boot_replay " << step << ": replaying mds log" << endl;
+ dout(2) << "boot_replay " << step << ": replaying mds log" << dendl;
mdlog->replay(new C_MDS_BootRecover(this, 4));
break;
void MDS::replay_start()
{
- dout(1) << "replay_start" << endl;
+ dout(1) << "replay_start" << dendl;
// initialize gather sets
set<int> rs;
mdsmap->get_recovery_mds_set(rs);
rs.erase(whoami);
- dout(1) << "now replay. my recovery peers are " << rs << endl;
+ dout(1) << "now replay. my recovery peers are " << rs << dendl;
mdcache->set_recovery_set(rs);
// note: don't actually start yet. boot() will get called once we have
void MDS::replay_done()
{
- dout(1) << "replay_done" << endl;
+ dout(1) << "replay_done" << dendl;
if (mdsmap->get_num_in_mds() == 1 &&
mdsmap->get_num_mds(MDSMap::STATE_FAILED) == 0) { // just me!
- dout(2) << "i am alone, moving to state reconnect" << endl;
+ dout(2) << "i am alone, moving to state reconnect" << dendl;
set_want_state(MDSMap::STATE_RECONNECT);
} else {
- dout(2) << "i am not alone, moving to state resolve" << endl;
+ dout(2) << "i am not alone, moving to state resolve" << dendl;
set_want_state(MDSMap::STATE_RESOLVE);
}
}
void MDS::resolve_start()
{
- dout(1) << "resolve_start" << endl;
+ dout(1) << "resolve_start" << dendl;
set<int> who;
mdsmap->get_mds_set(who, MDSMap::STATE_RESOLVE);
}
void MDS::resolve_done()
{
- dout(1) << "resolve_done" << endl;
+ dout(1) << "resolve_done" << dendl;
set_want_state(MDSMap::STATE_RECONNECT);
}
void MDS::reconnect_start()
{
- dout(1) << "reconnect_start" << endl;
+ dout(1) << "reconnect_start" << dendl;
server->reconnect_clients();
}
void MDS::reconnect_done()
{
- dout(1) << "reconnect_done" << endl;
+ dout(1) << "reconnect_done" << dendl;
set_want_state(MDSMap::STATE_REJOIN); // move to rejoin state
/*
void MDS::rejoin_joint_start()
{
- dout(1) << "rejoin_joint_start" << endl;
+ dout(1) << "rejoin_joint_start" << dendl;
mdcache->rejoin_send_rejoins();
}
void MDS::rejoin_done()
{
- dout(1) << "rejoin_done" << endl;
+ dout(1) << "rejoin_done" << dendl;
mdcache->show_subtrees();
mdcache->show_cache();
set_want_state(MDSMap::STATE_ACTIVE);
void MDS::recovery_done()
{
- dout(1) << "recovery_done -- successful recovery!" << endl;
+ dout(1) << "recovery_done -- successful recovery!" << dendl;
assert(is_active());
// kick anchortable (resent AGREEs)
void MDS::handle_mds_recovery(int who)
{
- dout(5) << "handle_mds_recovery mds" << who << endl;
+ dout(5) << "handle_mds_recovery mds" << who << dendl;
mdcache->handle_mds_recovery(who);
void MDS::shutdown_start()
{
- dout(1) << "shutdown_start" << endl;
- derr(0) << "mds shutdown start" << endl;
+ dout(1) << "shutdown_start" << dendl;
+ derr(0) << "mds shutdown start" << dendl;
// tell everyone to stop.
set<int> active;
p != active.end();
p++) {
if (mdsmap->is_up(*p)) {
- dout(1) << "sending MShutdownStart to mds" << *p << endl;
+ dout(1) << "sending MShutdownStart to mds" << *p << dendl;
send_message_mds(new MGenericMessage(MSG_MDS_SHUTDOWNSTART),
*p, MDS_PORT_MAIN);
}
void MDS::handle_shutdown_start(Message *m)
{
- dout(1) << " handle_shutdown_start" << endl;
+ dout(1) << " handle_shutdown_start" << dendl;
set_want_state(MDSMap::STATE_STOPPING);
delete m;
void MDS::stopping_start()
{
- dout(1) << "stopping_start" << endl;
+ dout(1) << "stopping_start" << dendl;
// start cache shutdown
mdcache->shutdown_start();
}
void MDS::stopping_done()
{
- dout(1) << "stopping_done" << endl;
+ dout(1) << "stopping_done" << dendl;
// tell monitor we shut down cleanly.
set_want_state(MDSMap::STATE_STOPPED);
void MDS::suicide()
{
- dout(1) << "suicide" << endl;
+ dout(1) << "suicide" << dendl;
// flush loggers
if (logger) logger->flush(true);
// bogus mds?
if (m->get_type() != MSG_MDS_MAP) {
dout(5) << "got " << *m << " from down/old/bad/imposter mds " << m->get_source()
- << ", dropping" << endl;
+ << ", dropping" << dendl;
delete m;
return;
} else {
dout(5) << "got " << *m << " from old/bad/imposter mds " << m->get_source()
- << ", but it's an mdsmap, looking at it" << endl;
+ << ", but it's an mdsmap, looking at it" << dendl;
}
}
}
break;
default:
- dout(1) << "MDS dispatch unknown message port" << m->get_dest_port() << endl;
+ dout(1) << "MDS dispatch unknown message port" << m->get_dest_port() << dendl;
assert(0);
}
// finish any triggered contexts
if (finished_queue.size()) {
- dout(7) << "mds has " << finished_queue.size() << " queued contexts" << endl;
- dout(10) << finished_queue << endl;
+ dout(7) << "mds has " << finished_queue.size() << " queued contexts" << dendl;
+ dout(10) << finished_queue << dendl;
list<Context*> ls;
ls.splice(ls.begin(), finished_queue);
assert(finished_queue.empty());
if (s.size() < 2 || mdcache->get_num_inodes() < 10)
break; // need peers for this to work.
- dout(7) << "mds thrashing exports pass " << (i+1) << "/" << g_conf.mds_thrash_exports << endl;
+ dout(7) << "mds thrashing exports pass " << (i+1) << "/" << g_conf.mds_thrash_exports << dendl;
// pick a random dir inode
CInode *in = mdcache->hack_pick_random_inode();
// hack: thrash exports
for (int i=0; i<g_conf.mds_thrash_fragments; i++) {
if (!is_active()) break;
- dout(7) << "mds thrashing fragments pass " << (i+1) << "/" << g_conf.mds_thrash_fragments << endl;
+ dout(7) << "mds thrashing fragments pass " << (i+1) << "/" << g_conf.mds_thrash_fragments << dendl;
// pick a random dir inode
CInode *in = mdcache->hack_pick_random_inode();
mdcache->get_root()->dir &&
!(mdcache->get_root()->dir->is_hashed() ||
mdcache->get_root()->dir->is_hashing())) {
- dout(0) << "hashing root" << endl;
+ dout(0) << "hashing root" << dendl;
mdcache->migrator->hash_dir(mdcache->get_root()->dir);
}
*/
// shut down?
if (is_stopping()) {
if (mdcache->shutdown_pass()) {
- dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to down:stopped" << endl;
+ dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to down:stopped" << dendl;
stopping_done();
}
}
void MDS::ms_handle_failure(Message *m, const entity_inst_t& inst)
{
mds_lock.Lock();
- dout(10) << "handle_ms_failure to " << inst << " on " << *m << endl;
+ dout(10) << "handle_ms_failure to " << inst << " on " << *m << dendl;
if (m->get_type() == MSG_MDS_MAP && m->get_dest().is_client())
server->client_reconnect_failure(m->get_dest().num());
void MDS::handle_ping(MPing *m)
{
- dout(10) << " received ping from " << m->get_source() << " with seq " << m->seq << endl;
+ dout(10) << " received ping from " << m->get_source() << " with seq " << m->seq << dendl;
messenger->send_message(new MPingAck(m),
m->get_source_inst());
#include "messages/MExportDirFinish.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".migrator "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds || l <= g_conf.debug_mds_migrator) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".migrator "
void Migrator::export_empty_import(CDir *dir)
{
- dout(7) << "export_empty_import " << *dir << endl;
+ dout(7) << "export_empty_import " << *dir << dendl;
if (dir->inode->is_auth()) return;
if (!dir->is_auth()) return;
if (dir->is_freezing() || dir->is_frozen()) return;
if (dir->get_size() > 0) {
- dout(7) << "not actually empty" << endl;
+ dout(7) << "not actually empty" << dendl;
return;
}
if (dir->inode->is_root()) {
- dout(7) << "root" << endl;
+ dout(7) << "root" << dendl;
return;
}
// is it really empty?
if (!dir->is_complete()) {
- dout(7) << "not complete, fetching." << endl;
+ dout(7) << "not complete, fetching." << dendl;
dir->fetch(new C_MDC_EmptyImport(this,dir));
return;
}
// comment this out ot wreak havoc?
//if (mds->is_shutting_down()) dest = 0; // this is more efficient.
- dout(7) << "really empty, exporting to " << dest << endl;
+ dout(7) << "really empty, exporting to " << dest << dendl;
assert (dest != mds->get_nodeid());
dout(-7) << "exporting to mds" << dest
- << " empty import " << *dir << endl;
+ << " empty import " << *dir << dendl;
export_dir( dir, dest );
}
void Migrator::handle_mds_failure_or_stop(int who)
{
- dout(5) << "handle_mds_failure_or_stop mds" << who << endl;
+ dout(5) << "handle_mds_failure_or_stop mds" << who << dendl;
// check my exports
map<CDir*,int>::iterator p = export_state.begin();
if (export_peer[dir] == who ||
p->second == EXPORT_DISCOVERING || p->second == EXPORT_FREEZING) {
// the guy i'm exporting to failed, or we're just freezing.
- dout(10) << "cleaning up export state " << p->second << " of " << *dir << endl;
+ dout(10) << "cleaning up export state " << p->second << " of " << *dir << dendl;
switch (p->second) {
case EXPORT_DISCOVERING:
- dout(10) << "export state=discovering : canceling freeze and removing auth_pin" << endl;
+ dout(10) << "export state=discovering : canceling freeze and removing auth_pin" << dendl;
dir->unfreeze_tree(); // cancel the freeze
dir->auth_unpin();
export_state.erase(dir); // clean up
break;
case EXPORT_FREEZING:
- dout(10) << "export state=freezing : canceling freeze" << endl;
+ dout(10) << "export state=freezing : canceling freeze" << dendl;
dir->unfreeze_tree(); // cancel the freeze
export_state.erase(dir); // clean up
dir->state_clear(CDir::STATE_EXPORTING);
// NOTE: state order reversal, warning comes after loggingstart+prepping
case EXPORT_WARNING:
- dout(10) << "export state=warning : unpinning bounds, unfreezing, notifying" << endl;
+ dout(10) << "export state=warning : unpinning bounds, unfreezing, notifying" << dendl;
// fall-thru
//case EXPORT_LOGGINGSTART:
case EXPORT_PREPPING:
if (p->second != EXPORT_WARNING)
- dout(10) << "export state=loggingstart|prepping : unpinning bounds, unfreezing" << endl;
+ dout(10) << "export state=loggingstart|prepping : unpinning bounds, unfreezing" << dendl;
{
// unpin bounds
set<CDir*> bounds;
break;
case EXPORT_EXPORTING:
- dout(10) << "export state=exporting : reversing, and unfreezing" << endl;
+ dout(10) << "export state=exporting : reversing, and unfreezing" << dendl;
export_reverse(dir);
export_state.erase(dir); // clean up
dir->state_clear(CDir::STATE_EXPORTING);
case EXPORT_LOGGINGFINISH:
case EXPORT_NOTIFYING:
- dout(10) << "export state=loggingfinish|notifying : ignoring dest failure, we were successful." << endl;
+ dout(10) << "export state=loggingfinish|notifying : ignoring dest failure, we were successful." << dendl;
// leave export_state, don't clean up now.
break;
// exporter waiting for warning acks, let's fake theirs.
dout(10) << "faking export_warning_ack from mds" << who
<< " on " << *dir << " to mds" << export_peer[dir]
- << endl;
+ << dendl;
if (export_warning_ack_waiting[dir].empty())
export_go(dir);
}
// exporter is waiting for notify acks, fake it
dout(10) << "faking export_notify_ack from mds" << who
<< " on " << *dir << " to mds" << export_peer[dir]
- << endl;
+ << dendl;
if (export_notify_ack_waiting[dir].empty())
export_finish(dir);
}
if (import_peer[df] == who) {
switch (q->second) {
case IMPORT_DISCOVERING:
- dout(10) << "import state=discovering : clearing state" << endl;
+ dout(10) << "import state=discovering : clearing state" << dendl;
import_state.erase(df);
import_peer.erase(df);
break;
case IMPORT_DISCOVERED:
- dout(10) << "import state=discovered : unpinning inode " << *diri << endl;
+ dout(10) << "import state=discovered : unpinning inode " << *diri << dendl;
assert(diri);
// unpin base
diri->put(CInode::PIN_IMPORTING);
case IMPORT_PREPPING:
if (q->second == IMPORT_PREPPING) {
- dout(10) << "import state=prepping : unpinning base+bounds " << *dir << endl;
+ dout(10) << "import state=prepping : unpinning base+bounds " << *dir << dendl;
}
assert(dir);
{
break;
case IMPORT_PREPPED:
- dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << endl;
+ dout(10) << "import state=prepped : unpinning base+bounds, unfreezing " << *dir << dendl;
assert(dir);
{
set<CDir*> bounds;
break;
case IMPORT_LOGGINGSTART:
- dout(10) << "import state=loggingstart : reversing import on " << *dir << endl;
+ dout(10) << "import state=loggingstart : reversing import on " << *dir << dendl;
import_reverse(dir);
break;
case IMPORT_ACKING:
// hrm. make this an ambiguous import, and wait for exporter recovery to disambiguate
- dout(10) << "import state=acking : noting ambiguous import " << *dir << endl;
+ dout(10) << "import state=acking : noting ambiguous import " << *dir << dendl;
{
set<CDir*> bounds;
cache->get_subtree_bounds(dir, bounds);
break;
case IMPORT_ABORTING:
- dout(10) << "import state=aborting : ignoring repeat failure " << *dir << endl;
+ dout(10) << "import state=aborting : ignoring repeat failure " << *dir << dendl;
break;
}
} else {
import_bystanders[dir].count(who)) {
dout(10) << "faking export_notify_ack from mds" << who
<< " on aborting import " << *dir << " from mds" << import_peer[df]
- << endl;
+ << dendl;
import_bystanders[dir].erase(who);
if (import_bystanders[dir].empty()) {
import_bystanders.erase(dir);
void Migrator::show_importing()
{
- dout(10) << "show_importing" << endl;
+ dout(10) << "show_importing" << dendl;
for (map<dirfrag_t,int>::iterator p = import_state.begin();
p != import_state.end();
p++) {
<< ": (" << p->second << ") " << get_import_statename(p->second)
<< " " << p->first
<< " " << *dir
- << endl;
+ << dendl;
} else {
dout(10) << " importing from " << import_peer[p->first]
<< ": (" << p->second << ") " << get_import_statename(p->second)
<< " " << p->first
- << endl;
+ << dendl;
}
}
}
void Migrator::show_exporting()
{
- dout(10) << "show_exporting" << endl;
+ dout(10) << "show_exporting" << dendl;
for (map<CDir*,int>::iterator p = export_state.begin();
p != export_state.end();
p++)
<< ": (" << p->second << ") " << get_export_statename(p->second)
<< " " << p->first->dirfrag()
<< " " << *p->first
- << endl;
+ << dendl;
}
*/
void Migrator::export_dir(CDir *dir, int dest)
{
- dout(7) << "export_dir " << *dir << " to " << dest << endl;
+ dout(7) << "export_dir " << *dir << " to " << dest << dendl;
assert(dir->is_auth());
assert(dest != mds->get_nodeid());
if (mds->mdsmap->is_degraded()) {
- dout(7) << "cluster degraded, no exports for now" << endl;
+ dout(7) << "cluster degraded, no exports for now" << dendl;
return;
}
if (dir->inode->is_root()) {
- dout(7) << "i won't export root" << endl;
+ dout(7) << "i won't export root" << dendl;
//assert(0);
return;
}
if (dir->is_frozen() ||
dir->is_freezing()) {
- dout(7) << " can't export, freezing|frozen. wait for other exports to finish first." << endl;
+ dout(7) << " can't export, freezing|frozen. wait for other exports to finish first." << dendl;
return;
}
if (dir->state_test(CDir::STATE_EXPORTING)) {
- dout(7) << "already exporting" << endl;
+ dout(7) << "already exporting" << dendl;
return;
}
vector<CDentry*> trace;
cache->make_trace(trace, dir->inode);
if (!mds->locker->dentry_can_rdlock_trace(trace)) {
- dout(7) << "export_dir couldn't pin path, failing." << endl;
+ dout(7) << "export_dir couldn't pin path, failing." << dendl;
return;
}
assert(dir);
dout(7) << "export_discover_ack from " << m->get_source()
- << " on " << *dir << endl;
+ << " on " << *dir << dendl;
if (export_state.count(dir) == 0 ||
export_state[dir] != EXPORT_DISCOVERING ||
export_peer[dir] != m->get_source().num()) {
- dout(7) << "must have aborted" << endl;
+ dout(7) << "must have aborted" << dendl;
} else {
// freeze the subtree
export_state[dir] = EXPORT_FREEZING;
void Migrator::export_frozen(CDir *dir)
{
- dout(7) << "export_frozen on " << *dir << endl;
+ dout(7) << "export_frozen on " << *dir << dendl;
assert(dir->is_frozen());
int dest = export_peer[dir];
p != dir->replicas_end();
p++) {
if (p->first != dest) {
- dout(10) << "bystander mds" << p->first << endl;
+ dout(10) << "bystander mds" << p->first << dendl;
prep->add_bystander(p->first);
}
}
bound->get(CDir::PIN_EXPORTBOUND);
bound->state_set(CDir::STATE_EXPORTBOUND);
- dout(7) << " export bound " << *bound << endl;
+ dout(7) << " export bound " << *bound << dendl;
prep->add_export( bound->dirfrag() );
// inode
assert(cur->inode->is_auth());
inode_trace.push_front(cur->inode);
- dout(7) << " will add " << *cur->inode << endl;
+ dout(7) << " will add " << *cur->inode << dendl;
// include the dirfrag? only if it's not the bounding subtree root.
if (cur != bound) {
assert(cur->is_auth());
prep->add_dirfrag( cur->replicate_to(dest) ); // yay!
- dout(7) << " added " << *cur << endl;
+ dout(7) << " added " << *cur << dendl;
}
cur = cur->get_parent_dir();
it != inode_trace.end();
it++) {
CInode *in = *it;
- dout(7) << " added " << *in->parent << endl;
- dout(7) << " added " << *in << endl;
+ dout(7) << " added " << *in->parent << dendl;
+ dout(7) << " added " << *in << dendl;
prep->add_inode( in->parent->get_dir()->dirfrag(),
in->parent->get_name(),
in->parent->replicate_to(dest),
CDir *dir = cache->get_dirfrag(m->get_dirfrag());
assert(dir);
- dout(7) << "export_prep_ack " << *dir << endl;
+ dout(7) << "export_prep_ack " << *dir << dendl;
if (export_state.count(dir) == 0 ||
export_state[dir] != EXPORT_PREPPING) {
// export must have aborted.
- dout(7) << "export must have aborted" << endl;
+ dout(7) << "export must have aborted" << dendl;
delete m;
return;
}
{
assert(export_peer.count(dir));
int dest = export_peer[dir];
- dout(7) << "export_go " << *dir << " to " << dest << endl;
+ dout(7) << "export_go " << *dir << " to " << dest << dendl;
cache->show_subtrees();
for (map<int, Capability>::iterator it = in->client_caps.begin();
it != in->client_caps.end();
it++) {
- dout(7) << "encode_export_inode " << *in << " telling client" << it->first << " stale caps" << endl;
+ dout(7) << "encode_export_inode " << *in << " telling client" << it->first << " stale caps" << dendl;
MClientFileCaps *m = new MClientFileCaps(MClientFileCaps::OP_STALE,
in->inode,
it->second.get_last_seq(),
istate._encode( enc_state );
// we're export this inode; fix inode state
- dout(7) << "encode_export_inode " << *in << endl;
+ dout(7) << "encode_export_inode " << *in << dendl;
if (in->is_dirty()) in->mark_clean();
{
int num_exported = 0;
- dout(7) << "encode_export_dir " << *dir << " " << dir->nitems << " items" << endl;
+ dout(7) << "encode_export_dir " << *dir << " " << dir->nitems << " items" << dendl;
assert(dir->get_projected_version() == dir->get_version());
num_exported++;
// -- dentry
- dout(7) << "encode_export_dir exporting " << *dn << endl;
+ dout(7) << "encode_export_dir exporting " << *dn << dendl;
// name
::_encode(it->first, enc_dir);
assert(dir->is_frozen_tree_root()); // i'm exporting!
// yay!
- dout(7) << "handle_export_ack " << *dir << endl;
+ dout(7) << "handle_export_ack " << *dir << dendl;
export_warning_ack_waiting.erase(dir);
*/
void Migrator::export_reverse(CDir *dir)
{
- dout(7) << "export_reverse " << *dir << endl;
+ dout(7) << "export_reverse " << *dir << dendl;
assert(export_state[dir] == EXPORT_EXPORTING);
assert(export_data.count(dir));
*/
void Migrator::export_logged_finish(CDir *dir)
{
- dout(7) << "export_logged_finish " << *dir << endl;
+ dout(7) << "export_logged_finish " << *dir << dendl;
// send notifies
int dest = export_peer[dir];
// exporting. process warning.
dout(7) << "handle_export_notify_ack from " << m->get_source()
<< ": exporting, processing warning on "
- << *dir << endl;
+ << *dir << dendl;
assert(export_warning_ack_waiting.count(dir));
export_warning_ack_waiting[dir].erase(from);
// exporting. process notify.
dout(7) << "handle_export_notify_ack from " << m->get_source()
<< ": exporting, processing notify on "
- << *dir << endl;
+ << *dir << dendl;
assert(export_notify_ack_waiting.count(dir));
export_notify_ack_waiting[dir].erase(from);
// reversing import
dout(7) << "handle_export_notify_ack from " << m->get_source()
<< ": aborting import on "
- << *dir << endl;
+ << *dir << dendl;
assert(import_bystanders[dir].count(from));
import_bystanders[dir].erase(from);
if (import_bystanders[dir].empty()) {
void Migrator::export_finish(CDir *dir)
{
- dout(5) << "export_finish " << *dir << endl;
+ dout(5) << "export_finish " << *dir << dendl;
if (export_state.count(dir) == 0) {
- dout(7) << "target must have failed, not sending final commit message. export succeeded anyway." << endl;
+ dout(7) << "target must have failed, not sending final commit message. export succeeded anyway." << dendl;
return;
}
mds->send_message_mds(new MExportDirFinish(dir->dirfrag()),
export_peer[dir], MDS_PORT_MIGRATOR);
} else {
- dout(7) << "not sending MExportDirFinish, dest has failed" << endl;
+ dout(7) << "not sending MExportDirFinish, dest has failed" << dendl;
}
// unfreeze
- dout(7) << "export_finish unfreezing" << endl;
+ dout(7) << "export_finish unfreezing" << dendl;
dir->unfreeze_tree();
// unpin bounds
cache->try_subtree_merge(dir);
// unpin path
- dout(7) << "export_finish unpinning path" << endl;
+ dout(7) << "export_finish unpinning path" << dendl;
vector<CDentry*> trace;
cache->make_trace(trace, dir->inode);
mds->locker->dentry_anon_rdlock_trace_finish(trace);
{
assert(m->get_source().num() != mds->get_nodeid());
- dout(7) << "handle_export_discover on " << m->get_path() << endl;
+ dout(7) << "handle_export_discover on " << m->get_path() << dendl;
// note import state
dirfrag_t df = m->get_dirfrag();
// am i retrying after ancient path_traverse results?
if (import_state.count(df) == 0 &&
import_state[df] != IMPORT_DISCOVERING) {
- dout(7) << "hmm import_state is off, i must be obsolete lookup" << endl;
+ dout(7) << "hmm import_state is off, i must be obsolete lookup" << dendl;
delete m;
return;
}
MDS_TRAVERSE_DISCOVER);
if (r > 0) return; // wait
if (r < 0) {
- dout(7) << "handle_export_discover_2 failed to discover or not dir " << m->get_path() << ", NAK" << endl;
+ dout(7) << "handle_export_discover_2 failed to discover or not dir " << m->get_path() << ", NAK" << dendl;
assert(0); // this shouldn't happen if the auth pins his path properly!!!!
}
}
// yay
- dout(7) << "handle_export_discover have " << df << " inode " << *in << endl;
+ dout(7) << "handle_export_discover have " << df << " inode " << *in << dendl;
import_state[m->get_dirfrag()] = IMPORT_DISCOVERED;
in->get(CInode::PIN_IMPORTING);
// reply
- dout(7) << " sending export_discover_ack on " << *in << endl;
+ dout(7) << " sending export_discover_ack on " << *in << dendl;
mds->send_message_mds(new MExportDirDiscoverAck(df),
import_peer[df], MDS_PORT_MIGRATOR);
}
void Migrator::handle_export_cancel(MExportDirCancel *m)
{
- dout(7) << "handle_export_cancel on " << m->get_dirfrag() << endl;
+ dout(7) << "handle_export_cancel on " << m->get_dirfrag() << dendl;
if (import_state[m->get_dirfrag()] == IMPORT_DISCOVERED) {
CInode *in = cache->get_inode(m->get_dirfrag().ino);
(import_state[m->get_dirfrag()] != IMPORT_DISCOVERED &&
import_state[m->get_dirfrag()] != IMPORT_PREPPING) ||
import_peer[m->get_dirfrag()] != oldauth) {
- dout(10) << "handle_export_prep import has aborted, dropping" << endl;
+ dout(10) << "handle_export_prep import has aborted, dropping" << dendl;
delete m;
return;
}
dir = cache->add_replica_dir(diri,
m->get_dirfrag().frag, *m->get_dirfrag_discover(m->get_dirfrag()),
oldauth, finished);
- dout(7) << "handle_export_prep on " << *dir << " (first pass)" << endl;
+ dout(7) << "handle_export_prep on " << *dir << " (first pass)" << dendl;
} else {
dir = cache->get_dirfrag(m->get_dirfrag());
assert(dir);
- dout(7) << "handle_export_prep on " << *dir << " (subsequent pass)" << endl;
+ dout(7) << "handle_export_prep on " << *dir << " (subsequent pass)" << dendl;
}
assert(dir->is_auth() == false);
for (list<dirfrag_t>::iterator p = m->get_bounds().begin();
p != m->get_bounds().end();
++p) {
- dout(10) << " bound " << *p << endl;
+ dout(10) << " bound " << *p << dendl;
import_bound_fragset[p->ino].insert(p->frag);
}
// assimilate contents?
if (!m->did_assim()) {
- dout(7) << "doing assim on " << *dir << endl;
+ dout(7) << "doing assim on " << *dir << dendl;
m->mark_assim(); // only do this the first time!
// move pin to dir
// bystander list
import_bystanders[dir] = m->get_bystanders();
- dout(7) << "bystanders are " << import_bystanders[dir] << endl;
+ dout(7) << "bystanders are " << import_bystanders[dir] << dendl;
// assimilate traces to exports
for (list<CInodeDiscover*>::iterator it = m->get_inodes().begin();
CInode *in = cache->get_inode( (*it)->get_ino() );
if (in) {
(*it)->update_inode(in);
- dout(7) << " updated " << *in << endl;
+ dout(7) << " updated " << *in << dendl;
} else {
in = new CInode(mds->mdcache, false);
(*it)->update_inode(in);
cache->add_inode( in );
condir->add_primary_dentry( m->get_dentry(in->ino()), in );
- dout(7) << " added " << *in << endl;
+ dout(7) << " added " << *in << dendl;
}
assert( in->get_parent_dir()->dirfrag() == m->get_containing_dirfrag(in->ino()) );
CInode *in = cache->get_inode(p->first);
assert(in);
in->get_stickydirs();
- dout(7) << " set stickydirs on bound inode " << *in << endl;
+ dout(7) << " set stickydirs on bound inode " << *in << dendl;
}
} else {
- dout(7) << " not doing assim on " << *dir << endl;
+ dout(7) << " not doing assim on " << *dir << dendl;
}
if (!finished.empty())
list<frag_t> fglist;
for (set<frag_t>::iterator q = p->second.begin(); q != p->second.end(); ++q)
in->dirfragtree.get_leaves_under(*q, fglist);
- dout(10) << " bound inode " << p->first << " fragset " << p->second << " maps to " << fglist << endl;
+ dout(10) << " bound inode " << p->first << " fragset " << p->second << " maps to " << fglist << dendl;
for (list<frag_t>::iterator q = fglist.begin();
q != fglist.end();
++q) {
CDir *bound = cache->get_dirfrag(dirfrag_t(p->first, *q));
if (!bound) {
- dout(7) << " opening bounding dirfrag " << *q << " on " << *in << endl;
+ dout(7) << " opening bounding dirfrag " << *q << " on " << *in << dendl;
cache->open_remote_dirfrag(in, *q,
new C_MDS_RetryMessage(mds, m));
return;
}
if (!bound->state_test(CDir::STATE_IMPORTBOUND)) {
- dout(7) << " pinning import bound " << *bound << endl;
+ dout(7) << " pinning import bound " << *bound << dendl;
bound->get(CDir::PIN_IMPORTBOUND);
bound->state_set(CDir::STATE_IMPORTBOUND);
} else {
- dout(7) << " already pinned import bound " << *bound << endl;
+ dout(7) << " already pinned import bound " << *bound << dendl;
}
import_bounds.insert(bound);
}
}
- dout(7) << " all ready, noting auth and freezing import region" << endl;
+ dout(7) << " all ready, noting auth and freezing import region" << dendl;
// note that i am an ambiguous auth for this subtree.
// specify bounds, since the exporter explicitly defines the region.
dir->_freeze_tree();
// ok!
- dout(7) << " sending export_prep_ack on " << *dir << endl;
+ dout(7) << " sending export_prep_ack on " << *dir << dendl;
mds->send_message_mds(new MExportDirPrepAck(dir->dirfrag()),
m->get_source().num(), MDS_PORT_MIGRATOR);
assert(dir);
int oldauth = m->get_source().num();
- dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << endl;
+ dout(7) << "handle_export_dir importing " << *dir << " from " << oldauth << dendl;
assert(dir->is_auth() == false);
cache->show_subtrees();
imported_client_map);
m->get_dirstate().pop_front();
}
- dout(10) << " " << m->get_bounds().size() << " imported bounds" << endl;
+ dout(10) << " " << m->get_bounds().size() << " imported bounds" << dendl;
// include bounds in EImportStart
set<CDir*> import_bounds;
// adjust popularity
mds->balancer->add_import(dir);
- dout(7) << "handle_export_dir did " << *dir << endl;
+ dout(7) << "handle_export_dir did " << *dir << dendl;
// log it
mds->mdlog->submit_entry(le,
*/
void Migrator::import_reverse(CDir *dir)
{
- dout(7) << "import_reverse " << *dir << endl;
+ dout(7) << "import_reverse " << *dir << dendl;
set<CDir*> bounds;
cache->get_subtree_bounds(dir, bounds);
// bystanders?
if (import_bystanders[dir].empty()) {
- dout(7) << "no bystanders, finishing reverse now" << endl;
+ dout(7) << "no bystanders, finishing reverse now" << dendl;
import_reverse_unfreeze(dir);
} else {
// notify them; wait in aborting state
- dout(7) << "notifying bystanders of abort" << endl;
+ dout(7) << "notifying bystanders of abort" << dendl;
import_notify_abort(dir, bounds);
import_state[dir->dirfrag()] = IMPORT_ABORTING;
}
void Migrator::import_notify_abort(CDir *dir, set<CDir*>& bounds)
{
- dout(7) << "import_notify_abort " << *dir << endl;
+ dout(7) << "import_notify_abort " << *dir << dendl;
for (set<int>::iterator p = import_bystanders[dir].begin();
p != import_bystanders[dir].end();
void Migrator::import_reverse_unfreeze(CDir *dir)
{
- dout(7) << "import_reverse_unfreeze " << *dir << endl;
+ dout(7) << "import_reverse_unfreeze " << *dir << dendl;
dir->unfreeze_tree();
cache->discard_delayed_expire(dir);
import_reverse_final(dir);
void Migrator::import_reverse_final(CDir *dir)
{
- dout(7) << "import_reverse_final " << *dir << endl;
+ dout(7) << "import_reverse_final " << *dir << dendl;
// clean up
import_state.erase(dir->dirfrag());
void Migrator::import_logged_start(CDir *dir, int from)
{
- dout(7) << "import_logged " << *dir << endl;
+ dout(7) << "import_logged " << *dir << dendl;
// note state
import_state[dir->dirfrag()] = IMPORT_ACKING;
// send notify's etc.
- dout(7) << "sending ack for " << *dir << " to old auth mds" << from << endl;
+ dout(7) << "sending ack for " << *dir << " to old auth mds" << from << dendl;
mds->send_message_mds(new MExportDirAck(dir->dirfrag()),
from, MDS_PORT_MIGRATOR);
{
CDir *dir = cache->get_dirfrag(m->get_dirfrag());
assert(dir);
- dout(7) << "handle_export_finish on " << *dir << endl;
+ dout(7) << "handle_export_finish on " << *dir << dendl;
import_finish(dir);
delete m;
}
void Migrator::import_finish(CDir *dir)
{
- dout(7) << "import_finish on " << *dir << endl;
+ dout(7) << "import_finish on " << *dir << dendl;
// log finish
mds->mdlog->submit_entry(new EImportFinish(dir, true));
void Migrator::decode_import_inode(CDentry *dn, bufferlist& bl, int& off, int oldauth,
map<int,entity_inst_t>& imported_client_map)
{
- dout(15) << "decode_import_inode on " << *dn << endl;
+ dout(15) << "decode_import_inode on " << *dn << dendl;
CInodeExport istate;
off = istate._decode(bl, off);
// add inode?
if (added) {
cache->add_inode(in);
- dout(10) << "added " << *in << endl;
+ dout(10) << "added " << *in << dendl;
} else {
- dout(10) << " had " << *in << endl;
+ dout(10) << " had " << *in << dendl;
}
CDir *dir = diri->get_or_open_dirfrag(mds->mdcache, dstate.get_dirfrag().frag);
assert(dir);
- dout(7) << "decode_import_dir " << *dir << endl;
+ dout(7) << "decode_import_dir " << *dir << dendl;
// assimilate state
dstate.update_dir( dir );
it++)
import_root->add_waiter(CDir::WAIT_UNFREEZE, *it); // UNFREEZE will get kicked both on success or failure
- dout(15) << "doing contents" << endl;
+ dout(15) << "doing contents" << dendl;
// contents
long nden = dstate.get_nden();
// decode state
dn->decode_import_state(bl, off, oldauth, mds->get_nodeid());
- dout(15) << "decode_import_dir got " << *dn << endl;
+ dout(15) << "decode_import_dir got " << *dn << dendl;
// points to...
char icode;
le->metablob.add_dentry(dn, dn->is_dirty());
}
- dout(7) << "decode_import_dir done " << *dir << endl;
+ dout(7) << "decode_import_dir done " << *dir << dendl;
return num_imported;
}
if (!dir) {
dout(7) << "handle_export_notify " << old_auth << " -> " << new_auth
- << " on missing dir " << m->get_dirfrag() << endl;
+ << " on missing dir " << m->get_dirfrag() << dendl;
} else if (dir->authority() != old_auth) {
dout(7) << "handle_export_notify old_auth was " << dir->authority()
<< " != " << old_auth << " -> " << new_auth
- << " on " << *dir << endl;
+ << " on " << *dir << dendl;
} else {
dout(7) << "handle_export_notify " << old_auth << " -> " << new_auth
- << " on " << *dir << endl;
+ << " on " << *dir << dendl;
// adjust auth
set<CDir*> have;
cache->map_dirfrag_set(m->get_bounds(), have);
from, MDS_PORT_MIGRATOR);
} else {
// aborted. no ack.
- dout(7) << "handle_export_notify no ack requested" << endl;
+ dout(7) << "handle_export_notify no ack requested" << dendl;
}
delete m;
using namespace std;
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
-#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
+
+#define dout(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
+#define derr(l) if (l<=g_conf.debug || l <= g_conf.debug_mds) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".server "
void Server::reopen_logger()
// active?
if (!mds->is_active()) {
- dout(3) << "not active yet, waiting" << endl;
+ dout(3) << "not active yet, waiting" << dendl;
mds->wait_for_active(new C_MDS_RetryMessage(mds, m));
return;
}
return;
}
- dout(1) << "server unknown message " << m->get_type() << endl;
+ dout(1) << "server unknown message " << m->get_type() << dendl;
assert(0);
}
void Server::handle_client_session(MClientSession *m)
{
- dout(3) << "handle_client_session " << *m << " from " << m->get_source() << endl;
+ dout(3) << "handle_client_session " << *m << " from " << m->get_source() << dendl;
int from = m->get_source().num();
bool open = m->op == MClientSession::OP_REQUEST_OPEN;
if (open) {
if (mds->clientmap.have_session(from)) {
- dout(10) << "already open, dropping this req" << endl;
+ dout(10) << "already open, dropping this req" << dendl;
delete m;
return;
}
if (mds->clientmap.is_opening(from)) {
- dout(10) << "already opening, dropping this req" << endl;
+ dout(10) << "already opening, dropping this req" << dendl;
delete m;
return;
}
mds->clientmap.add_opening(from);
} else {
if (mds->clientmap.is_closing(from)) {
- dout(10) << "already closing, dropping this req" << endl;
+ dout(10) << "already closing, dropping this req" << dendl;
delete m;
return;
}
if (m->seq < mds->clientmap.get_push_seq(from)) {
dout(10) << "old push seq " << m->seq << " < " << mds->clientmap.get_push_seq(from)
- << ", dropping" << endl;
+ << ", dropping" << dendl;
delete m;
return;
}
{
dout(10) << "_session_logged " << client_inst << " " << (open ? "open":"close")
<< " " << cmapv
- << endl;
+ << dendl;
// apply
int from = client_inst.name.num();
void Server::terminate_sessions()
{
- dout(2) << "terminate_sessions" << endl;
+ dout(2) << "terminate_sessions" << dendl;
// kill them off. clients will retry etc.
for (set<int>::const_iterator p = mds->clientmap.get_session_set().begin();
{
// reconnect with clients
if (mds->clientmap.get_session_set().empty()) {
- dout(7) << "reconnect_clients -- no sessions, doing nothing." << endl;
+ dout(7) << "reconnect_clients -- no sessions, doing nothing." << dendl;
reconnect_gather_finish();
return;
}
- dout(7) << "reconnect_clients -- sending mdsmap to clients with sessions" << endl;
+ dout(7) << "reconnect_clients -- sending mdsmap to clients with sessions" << dendl;
mds->bcast_mds_map(); // send mdsmap to all client sessions
void Server::handle_client_reconnect(MClientReconnect *m)
{
- dout(7) << "handle_client_reconnect " << m->get_source() << endl;
+ dout(7) << "handle_client_reconnect " << m->get_source() << dendl;
int from = m->get_source().num();
if (m->closed) {
- dout(7) << " client had no session, removing from clientmap" << endl;
+ dout(7) << " client had no session, removing from clientmap" << dendl;
mds->clientmap.add_closing(from);
version_t cmapv = mds->clientmap.inc_projected();
CInode *in = mdcache->get_inode(p->first);
if (in && in->is_auth()) {
// we recovered it, and it's ours. take note.
- dout(15) << "open caps on " << *in << endl;
+ dout(15) << "open caps on " << *in << dendl;
in->reconnect_cap(from, p->second);
reconnected_caps.insert(in);
continue;
!mds->mdcache->path_is_mine(path)) {
// not mine.
dout(0) << "non-auth " << p->first << " " << m->inode_path[p->first]
- << ", will pass off to authority" << endl;
+ << ", will pass off to authority" << dendl;
// mark client caps stale.
inode_t fake_inode;
} else {
// mine. fetch later.
dout(0) << "missing " << p->first << " " << m->inode_path[p->first]
- << " (mine), will load later" << endl;
+ << " (mine), will load later" << dendl;
mdcache->rejoin_recovered_caps(p->first, m->inode_path[p->first], from, p->second,
-1); // "from" me.
}
*/
void Server::process_reconnected_caps()
{
- dout(10) << "process_reconnected_caps" << endl;
+ dout(10) << "process_reconnected_caps" << dendl;
// adjust filelock state appropriately
for (set<CInode*>::iterator p = reconnected_caps.begin();
}
dout(15) << " issued " << cap_string(issued)
<< " chose " << in->filelock
- << " on " << *in << endl;
+ << " on " << *in << dendl;
}
reconnected_caps.clear(); // clean up
}
void Server::client_reconnect_failure(int from)
{
- dout(5) << "client_reconnect_failure on client" << from << endl;
+ dout(5) << "client_reconnect_failure on client" << from << dendl;
client_reconnect_gather.erase(from);
if (client_reconnect_gather.empty())
reconnect_gather_finish();
void Server::reconnect_gather_finish()
{
- dout(7) << "reconnect_gather_finish" << endl;
+ dout(7) << "reconnect_gather_finish" << dendl;
mds->reconnect_done();
}
dout(10) << "reply_request " << reply->get_result()
<< " (" << strerror(-reply->get_result())
- << ") " << *req << endl;
+ << ") " << *req << dendl;
// note result code in clientmap?
if (!req->is_idempotent())
*/
void Server::handle_client_request(MClientRequest *req)
{
- dout(4) << "handle_client_request " << *req << endl;
+ dout(4) << "handle_client_request " << *req << dendl;
int client = req->get_client();
if (logger) logger->inc("hcreq");
if (!mds->is_active()) {
- dout(5) << " not active, discarding client request." << endl;
+ dout(5) << " not active, discarding client request." << dendl;
delete req;
return;
}
if (!mdcache->get_root()) {
- dout(5) << "need to open root" << endl;
+ dout(5) << "need to open root" << dendl;
mdcache->open_root(new C_MDS_RetryMessage(mds, req));
return;
}
// active session?
if (!mds->clientmap.have_session(client)) {
- dout(1) << "no session for client" << client << ", dropping" << endl;
+ dout(1) << "no session for client" << client << ", dropping" << dendl;
delete req;
return;
}
// retry?
if (req->get_retry_attempt()) {
if (mds->clientmap.have_completed_request(req->get_reqid())) {
- dout(5) << "already completed " << req->get_reqid() << endl;
+ dout(5) << "already completed " << req->get_reqid() << dendl;
mds->messenger->send_message(new MClientReply(req, 0),
req->get_client_inst());
delete req;
}
// trim completed_request list
if (req->get_oldest_client_tid() > 0) {
- dout(15) << " oldest_client_tid=" << req->get_oldest_client_tid() << endl;
+ dout(15) << " oldest_client_tid=" << req->get_oldest_client_tid() << dendl;
mds->clientmap.trim_completed_requests(client,
req->get_oldest_client_tid());
}
MDRequest *mdr = mdcache->request_start(req);
if (ref) {
- dout(10) << "inode op on ref " << *ref << endl;
+ dout(10) << "inode op on ref " << *ref << dendl;
mdr->ref = ref;
mdr->pin(ref);
}
if (logger) logger->inc("dcreq");
if (mdr->ref) {
- dout(7) << "dispatch_client_request " << *req << " ref " << *mdr->ref << endl;
+ dout(7) << "dispatch_client_request " << *req << " ref " << *mdr->ref << dendl;
} else {
- dout(7) << "dispatch_client_request " << *req << endl;
+ dout(7) << "dispatch_client_request " << *req << dendl;
}
// we shouldn't be waiting on anyone.
default:
- dout(1) << " unknown client op " << req->get_op() << endl;
+ dout(1) << " unknown client op " << req->get_op() << dendl;
assert(0);
}
}
void Server::handle_slave_request(MMDSSlaveRequest *m)
{
- dout(4) << "handle_slave_request " << m->get_reqid() << " from " << m->get_source() << endl;
+ dout(4) << "handle_slave_request " << m->get_reqid() << " from " << m->get_source() << dendl;
int from = m->get_source().num();
if (logger) logger->inc("hsreq");
m->get_object_info());
MDRequest *mdr = mdcache->request_get(m->get_reqid());
mdr->slaves.insert(from);
- dout(10) << "got remote xlock on " << *lock << " on " << *lock->get_parent() << endl;
+ dout(10) << "got remote xlock on " << *lock << " on " << *lock->get_parent() << dendl;
mdr->xlocks.insert(lock);
mdr->locks.insert(lock);
lock->get_xlock(mdr);
mdr = mdcache->request_get(m->get_reqid());
if (mdr->slave_to_mds != from) { // may not even be a slave! (e.g. forward race)
dout(10) << "local request " << *mdr << " not slave to mds" << from
- << ", ignoring " << *m << endl;
+ << ", ignoring " << *m << dendl;
delete m;
return;
}
// new?
if (m->get_op() == MMDSSlaveRequest::OP_FINISH) {
dout(10) << "missing slave request for " << m->get_reqid()
- << " OP_FINISH, must have lost race with a forward" << endl;
+ << " OP_FINISH, must have lost race with a forward" << dendl;
delete m;
return;
}
void Server::dispatch_slave_request(MDRequest *mdr)
{
- dout(7) << "dispatch_slave_request " << *mdr << " " << *mdr->slave_request << endl;
+ dout(7) << "dispatch_slave_request " << *mdr << " " << *mdr->slave_request << dendl;
if (mdr->aborted) {
- dout(7) << " abort flag set, finishing" << endl;
+ dout(7) << " abort flag set, finishing" << dendl;
mdcache->request_finish(mdr);
return;
}
} else {
if (lock) {
dout(10) << "not auth for remote xlock attempt, dropping on "
- << *lock << " on " << *lock->get_parent() << endl;
+ << *lock << " on " << *lock->get_parent() << dendl;
} else {
- dout(10) << "don't have object, dropping" << endl;
+ dout(10) << "don't have object, dropping" << dendl;
assert(0); // can this happen, if we auth pinned properly.
}
}
void Server::handle_slave_auth_pin(MDRequest *mdr)
{
- dout(10) << "handle_slave_auth_pin " << *mdr << endl;
+ dout(10) << "handle_slave_auth_pin " << *mdr << dendl;
// build list of objects
list<MDSCacheObject*> objects;
++p) {
MDSCacheObject *object = mdcache->get_object(*p);
if (!object) {
- dout(10) << " don't have " << *p << endl;
+ dout(10) << " don't have " << *p << dendl;
fail = true;
break;
}
p != objects.end();
++p) {
if (!(*p)->is_auth()) {
- dout(10) << " not auth for " << **p << endl;
+ dout(10) << " not auth for " << **p << dendl;
fail = true;
break;
}
if (!mdr->is_auth_pinned(*p) &&
!(*p)->can_auth_pin()) {
// wait
- dout(10) << " waiting for authpinnable on " << **p << endl;
+ dout(10) << " waiting for authpinnable on " << **p << dendl;
(*p)->add_waiter(CDir::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
mdr->drop_local_auth_pins();
return;
for (list<MDSCacheObject*>::iterator p = objects.begin();
p != objects.end();
++p) {
- dout(10) << "auth_pinning " << **p << endl;
+ dout(10) << "auth_pinning " << **p << dendl;
mdr->auth_pin(*p);
}
}
void Server::handle_slave_auth_pin_ack(MDRequest *mdr, MMDSSlaveRequest *ack)
{
- dout(10) << "handle_slave_auth_pin_ack on " << *mdr << " " << *ack << endl;
+ dout(10) << "handle_slave_auth_pin_ack on " << *mdr << " " << *ack << dendl;
int from = ack->get_source().num();
// added auth pins?
++p) {
MDSCacheObject *object = mdcache->get_object(*p);
assert(object); // we pinned it
- dout(10) << " remote has pinned " << *object << endl;
+ dout(10) << " remote has pinned " << *object << dendl;
if (!mdr->is_auth_pinned(object))
mdr->auth_pins.insert(object);
pinned.insert(object);
while (p != mdr->auth_pins.end()) {
if ((*p)->authority().first == from &&
pinned.count(*p) == 0) {
- dout(10) << " remote has unpinned " << **p << endl;
+ dout(10) << " remote has unpinned " << **p << dendl;
set<MDSCacheObject*>::iterator o = p;
++p;
mdr->auth_pins.erase(o);
if (mdr->waiting_on_slave.empty())
dispatch_client_request(mdr);
else
- dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+ dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
}
{
// make sure parent is a dir?
if (!diri->is_dir()) {
- dout(7) << "validate_dentry_dir: not a dir" << endl;
+ dout(7) << "validate_dentry_dir: not a dir" << dendl;
reply_request(mdr, -ENOTDIR);
return false;
}
// frozen?
if (dir->is_frozen()) {
- dout(7) << "dir is frozen " << *dir << endl;
+ dout(7) << "dir is frozen " << *dir << dendl;
dir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
*/
CDentry* Server::prepare_null_dentry(MDRequest *mdr, CDir *dir, const string& dname, bool okexist)
{
- dout(10) << "prepare_null_dentry " << dname << " in " << *dir << endl;
+ dout(10) << "prepare_null_dentry " << dname << " in " << *dir << dendl;
assert(dir->is_auth());
// does it already exist?
CDentry *dn = dir->lookup(dname);
if (dn) {
if (dn->lock.is_xlocked_by_other(mdr)) {
- dout(10) << "waiting on xlocked dentry " << *dn << endl;
+ dout(10) << "waiting on xlocked dentry " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
if (!dn->is_null()) {
// name already exists
- dout(10) << "dentry " << dname << " exists in " << *dir << endl;
+ dout(10) << "dentry " << dname << " exists in " << *dir << dendl;
if (!okexist) {
reply_request(mdr, -EEXIST);
return 0;
// make sure dir is complete
if (!dir->is_complete()) {
- dout(7) << " incomplete dir contents for " << *dir << ", fetching" << endl;
+ dout(7) << " incomplete dir contents for " << *dir << ", fetching" << dendl;
dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
// create
dn = dir->add_null_dentry(dname);
dn->mark_new();
- dout(10) << "prepare_null_dentry added " << *dn << endl;
+ dout(10) << "prepare_null_dentry added " << *dn << dendl;
return dn;
}
in->inode.uid = mdr->client_request->get_caller_uid();
in->inode.gid = mdr->client_request->get_caller_gid();
in->inode.ctime = in->inode.mtime = in->inode.atime = mdr->now; // now
- dout(10) << "prepare_new_inode " << *in << endl;
+ dout(10) << "prepare_new_inode " << *in << dendl;
return in;
}
{
// figure parent dir vs dname
if (refpath.depth() == 0) {
- dout(7) << "can't do that to root" << endl;
+ dout(7) << "can't do that to root" << dendl;
reply_request(mdr, -EINVAL);
return 0;
}
string dname = refpath.last_dentry();
refpath.pop_dentry();
- dout(10) << "traverse_to_auth_dir dirpath " << refpath << " dname " << dname << endl;
+ dout(10) << "traverse_to_auth_dir dirpath " << refpath << " dname " << dname << dendl;
// traverse to parent dir
int r = mdcache->path_traverse(mdr, mdr->client_request,
if (!dir)
return 0; // forwarded or waiting for freeze
- dout(10) << "traverse_to_auth_dir " << *dir << endl;
+ dout(10) << "traverse_to_auth_dir " << *dir << dendl;
return dir;
}
(dn->is_null() ||
(dn->is_remote() && dn->inode))) {
if (dn->is_ambiguous_auth()) {
- dout(10) << "waiting for single auth on " << *dn << endl;
+ dout(10) << "waiting for single auth on " << *dn << dendl;
dn->dir->add_waiter(CInode::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
} else {
- dout(10) << "fw to auth for " << *dn << endl;
+ dout(10) << "fw to auth for " << *dn << dendl;
mdcache->request_forward(mdr, dn->authority().first);
return 0;
}
ref = mdcache->get_dentry_inode(dn, mdr);
if (!ref) return 0;
}
- dout(10) << "ref is " << *ref << endl;
+ dout(10) << "ref is " << *ref << dendl;
// fw to inode auth?
if (want_auth && !ref->is_auth()) {
if (ref->is_ambiguous_auth()) {
- dout(10) << "waiting for single auth on " << *ref << endl;
+ dout(10) << "waiting for single auth on " << *ref << dendl;
ref->add_waiter(CInode::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
} else {
- dout(10) << "fw to auth for " << *ref << endl;
+ dout(10) << "fw to auth for " << *ref << dendl;
mdcache->request_forward(mdr, ref->authority().first);
}
return 0;
// auth_pin?
if (want_auth) {
if (ref->is_frozen()) {
- dout(7) << "waiting for !frozen/authpinnable on " << *ref << endl;
+ dout(7) << "waiting for !frozen/authpinnable on " << *ref << dendl;
ref->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
vector<CDentry*> trace;
CDir *dir = traverse_to_auth_dir(mdr, trace, req->get_filepath());
if (!dir) return 0;
- dout(10) << "rdlock_path_xlock_dentry dir " << *dir << endl;
+ dout(10) << "rdlock_path_xlock_dentry dir " << *dir << dendl;
// make sure we can auth_pin (or have already authpinned) dir
if (dir->is_frozen()) {
- dout(7) << "waiting for !frozen/authpinnable on " << *dir << endl;
+ dout(7) << "waiting for !frozen/authpinnable on " << *dir << dendl;
dir->add_waiter(CInode::WAIT_AUTHPINNABLE, new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
// make sure dir is complete
if (!dn && !dir->is_complete()) {
- dout(7) << " incomplete dir contents for " << *dir << ", fetching" << endl;
+ dout(7) << " incomplete dir contents for " << *dir << ", fetching" << dendl;
dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
// readable?
if (dn && dn->lock.is_xlocked_by_other(mdr)) {
- dout(10) << "waiting on xlocked dentry " << *dn << endl;
+ dout(10) << "waiting on xlocked dentry " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
return 0;
}
// exists?
if (!dn || dn->is_null()) {
- dout(7) << "dentry " << dname << " dne in " << *dir << endl;
+ dout(7) << "dentry " << dname << " dne in " << *dir << dendl;
reply_request(mdr, -ENOENT);
return 0;
}
// not open and inode not mine?
if (!dir && !diri->is_auth()) {
int inauth = diri->authority().first;
- dout(7) << "try_open_auth_dirfrag: not open, not inode auth, fw to mds" << inauth << endl;
+ dout(7) << "try_open_auth_dirfrag: not open, not inode auth, fw to mds" << inauth << dendl;
mdcache->request_forward(mdr, inauth);
return 0;
}
// not open and inode frozen?
if (!dir && diri->is_frozen_dir()) {
- dout(10) << "try_open_auth_dirfrag: dir inode is frozen, waiting " << *diri << endl;
+ dout(10) << "try_open_auth_dirfrag: dir inode is frozen, waiting " << *diri << dendl;
assert(diri->get_parent_dir());
diri->get_parent_dir()->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mdcache, mdr));
return 0;
if (!dir->is_auth()) {
int auth = dir->authority().first;
dout(7) << "try_open_auth_dirfrag: not auth for " << *dir
- << ", fw to mds" << auth << endl;
+ << ", fw to mds" << auth << dendl;
mdcache->request_forward(mdr, auth);
return 0;
}
assert(mdr->wrlocks.count(&diri->dirlock));
dirpv = diri->pre_dirty();
- dout(10) << "predirty_dn_diri ctime/mtime " << mdr->now << " pv " << dirpv << " on " << *diri << endl;
+ dout(10) << "predirty_dn_diri ctime/mtime " << mdr->now << " pv " << dirpv << " on " << *diri << dendl;
// predirty+journal
inode_t *pi = diri->project_inode();
inode_t *ji = blob->add_primary_dentry(diri->get_parent_dn(), true);
ji->ctime = ji->mtime = mdr->now;
- dout(10) << "predirty_dn_diri (non-auth) ctime/mtime " << mdr->now << " on " << *diri << endl;
+ dout(10) << "predirty_dn_diri (non-auth) ctime/mtime " << mdr->now << " on " << *diri << dendl;
blob->add_dirtied_inode_mtime(diri->ino(), mdr->now);
}
// we journaled and predirtied.
assert(diri->is_auth() && !diri->is_root());
diri->pop_and_dirty_projected_inode();
- dout(10) << "dirty_dn_diri ctime/mtime " << mtime << " v " << diri->inode.version << " on " << *diri << endl;
+ dout(10) << "dirty_dn_diri ctime/mtime " << mtime << " v " << diri->inode.version << " on " << *diri << dendl;
} else {
// dirlock scatterlock will propagate the update.
diri->inode.ctime = diri->inode.mtime = mtime;
diri->dirlock.set_updated();
- dout(10) << "dirty_dn_diri (non-dirty) ctime/mtime " << mtime << " on " << *diri << endl;
+ dout(10) << "dirty_dn_diri (non-dirty) ctime/mtime " << mtime << " on " << *diri << dendl;
}
}
return;
// reply
- dout(10) << "reply to stat on " << *req << endl;
+ dout(10) << "reply to stat on " << *req << dendl;
MClientReply *reply = new MClientReply(req);
reply_request(mdr, reply, ref);
}
CInode *in = dn->inode;
InodeStat *st;
if (in) {
- dout(12) << "including inode " << *in << endl;
+ dout(12) << "including inode " << *in << dendl;
// add this item
// note: InodeStat makes note of whether inode data is readable.
st = new InodeStat(in, mds->get_nodeid());
} else {
assert(dn->is_remote());
- dout(12) << "including inode-less (remote) dentry " << *dn << endl;
+ dout(12) << "including inode-less (remote) dentry " << *dn << dendl;
st = new InodeStat;
st->mask = STAT_MASK_INO | STAT_MASK_TYPE;
memset(&st->inode, 0, sizeof(st->inode));
// it's a directory, right?
if (!diri->is_dir()) {
// not a dir
- dout(10) << "reply to " << *req << " readdir -ENOTDIR" << endl;
+ dout(10) << "reply to " << *req << " readdir -ENOTDIR" << dendl;
reply_request(mdr, -ENOTDIR, diri);
return;
}
// does the frag exist?
if (diri->dirfragtree[fg] != fg) {
- dout(10) << "frag " << fg << " doesn't appear in fragtree " << diri->dirfragtree << endl;
+ dout(10) << "frag " << fg << " doesn't appear in fragtree " << diri->dirfragtree << dendl;
reply_request(mdr, -EAGAIN, diri);
return;
}
if (!dir->is_complete()) {
// fetch
- dout(10) << " incomplete dir contents for readdir on " << *dir << ", fetching" << endl;
+ dout(10) << " incomplete dir contents for readdir on " << *dir << ", fetching" << dendl;
dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
return;
}
MClientReply *reply = new MClientReply(req);
reply->take_dir_items(dnls, inls, numfiles);
- dout(10) << "reply to " << *req << " readdir " << numfiles << " files" << endl;
+ dout(10) << "reply to " << *req << " readdir " << numfiles << " files" << dendl;
reply->set_result(0);
// bump popularity. NOTE: this doesn't quite capture it.
!newdir->is_hashing()) {
int dest = rand() % mds->mdsmap->get_num_mds();
if (dest != whoami) {
- dout(10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << endl;
+ dout(10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << dendl;
mdcache->migrator->export_dir(newdir, dest);
}
}
dout(7) << "handle_client_link " << req->get_filepath()
<< " to " << req->get_sarg()
- << endl;
+ << dendl;
// traverse to dest dir, make sure it's ours.
const filepath &linkpath = req->get_filepath();
vector<CDentry*> linktrace;
CDir *dir = traverse_to_auth_dir(mdr, linktrace, linkpath);
if (!dir) return;
- dout(7) << "handle_client_link link " << dname << " in " << *dir << endl;
+ dout(7) << "handle_client_link link " << dname << " in " << *dir << dendl;
// traverse to link target
filepath targetpath = req->get_sarg();
- dout(7) << "handle_client_link discovering target " << targetpath << endl;
+ dout(7) << "handle_client_link discovering target " << targetpath << dendl;
vector<CDentry*> targettrace;
int r = mdcache->path_traverse(mdr, req,
0, targetpath, targettrace, false,
assert(targeti);
// dir?
- dout(7) << "target is " << *targeti << endl;
+ dout(7) << "target is " << *targeti << dendl;
if (targeti->is_dir()) {
- dout(7) << "target is a dir, failing..." << endl;
+ dout(7) << "target is a dir, failing..." << dendl;
reply_request(mdr, -EINVAL);
return;
}
// does the target need an anchor?
if (targeti->is_auth()) {
/*if (targeti->get_parent_dir() == dn->dir) {
- dout(7) << "target is in the same dirfrag, sweet" << endl;
+ dout(7) << "target is in the same dirfrag, sweet" << dendl;
}
else
*/
if (targeti->is_anchored() && !targeti->is_unanchoring()) {
- dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << endl;
+ dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << dendl;
}
else {
- dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << endl;
+ dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << dendl;
mdcache->anchor_create(mdr, targeti,
new C_MDS_RetryRequest(mdcache, mdr));
void Server::_link_local(MDRequest *mdr, CDentry *dn, CInode *targeti)
{
- dout(10) << "_link_local " << *dn << " to " << *targeti << endl;
+ dout(10) << "_link_local " << *dn << " to " << *targeti << dendl;
// predirty NEW dentry
version_t dnpv = dn->pre_dirty();
void Server::_link_local_finish(MDRequest *mdr, CDentry *dn, CInode *targeti,
version_t dnpv, version_t tipv, version_t dirpv)
{
- dout(10) << "_link_local_finish " << *dn << " to " << *targeti << endl;
+ dout(10) << "_link_local_finish " << *dn << " to " << *targeti << dendl;
// link and unlock the NEW dentry
dn->dir->link_remote_inode(dn, targeti->ino(), MODE_TO_DT(targeti->inode.mode));
void Server::_link_remote(MDRequest *mdr, CDentry *dn, CInode *targeti)
{
- dout(10) << "_link_remote " << *dn << " to " << *targeti << endl;
+ dout(10) << "_link_remote " << *dn << " to " << *targeti << dendl;
// 1. send LinkPrepare to dest (journal nlink++ prepare)
int linkauth = targeti->authority().first;
if (mdr->witnessed.count(linkauth) == 0) {
- dout(10) << " targeti auth must prepare nlink++" << endl;
+ dout(10) << " targeti auth must prepare nlink++" << dendl;
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_LINKPREP);
targeti->set_object_info(req->get_object_info());
mdr->waiting_on_slave.insert(linkauth);
return;
}
- dout(10) << " targeti auth has prepared nlink++" << endl;
+ dout(10) << " targeti auth has prepared nlink++" << dendl;
// go.
// predirty dentry
void Server::_link_remote_finish(MDRequest *mdr, CDentry *dn, CInode *targeti,
version_t dpv, version_t dirpv)
{
- dout(10) << "_link_remote_finish " << *dn << " to " << *targeti << endl;
+ dout(10) << "_link_remote_finish " << *dn << " to " << *targeti << dendl;
// link the new dentry
dn->dir->link_remote_inode(dn, targeti->ino(), MODE_TO_DT(targeti->inode.mode));
{
dout(10) << "handle_slave_link_prep " << *mdr
<< " on " << mdr->slave_request->get_object_info()
- << endl;
+ << dendl;
CInode *targeti = mdcache->get_inode(mdr->slave_request->get_object_info().ino);
assert(targeti);
- dout(10) << "targeti " << *targeti << endl;
+ dout(10) << "targeti " << *targeti << dendl;
CDentry *dn = targeti->get_parent_dn();
assert(dn->is_primary());
// anchor?
if (mdr->slave_request->get_op() == MMDSSlaveRequest::OP_LINKPREP) {
if (targeti->is_anchored() && !targeti->is_unanchoring()) {
- dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << endl;
+ dout(7) << "target anchored already (nlink=" << targeti->inode.nlink << "), sweet" << dendl;
}
else {
- dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << endl;
+ dout(7) << "target needs anchor, nlink=" << targeti->inode.nlink << ", creating anchor" << dendl;
mdcache->anchor_create(mdr, targeti,
new C_MDS_RetryRequest(mdcache, mdr));
return;
pi->ctime = mdr->now;
pi->version = targeti->pre_dirty();
- dout(10) << " projected inode " << pi << " v " << pi->version << endl;
+ dout(10) << " projected inode " << pi << " v " << pi->version << dendl;
// journal it
ESlaveUpdate *le = new ESlaveUpdate(mdlog, "slave_link_prep", mdr->reqid, mdr->slave_to_mds, ESlaveUpdate::OP_PREPARE);
{
dout(10) << "_logged_slave_link " << *mdr
<< " inc=" << inc
- << " " << *targeti << endl;
+ << " " << *targeti << dendl;
version_t old_version = targeti->inode.version;
dout(10) << "_commit_slave_link " << *mdr
<< " r=" << r
<< " inc=" << inc
- << " " << *targeti << endl;
+ << " " << *targeti << dendl;
ESlaveUpdate *le;
if (r == 0) {
void Server::handle_slave_link_prep_ack(MDRequest *mdr, MMDSSlaveRequest *m)
{
dout(10) << "handle_slave_link_prep_ack " << *mdr
- << " " << *m << endl;
+ << " " << *m << dendl;
int from = m->get_source().num();
// note slave
if (req->get_op() == MDS_OP_RMDIR) rmdir = true;
if (rmdir) {
- dout(7) << "handle_client_rmdir on " << *dn << endl;
+ dout(7) << "handle_client_rmdir on " << *dn << dendl;
} else {
- dout(7) << "handle_client_unlink on " << *dn << endl;
+ dout(7) << "handle_client_unlink on " << *dn << dendl;
}
// readable?
if (dn->lock.is_xlocked_by_other(mdr)) {
- dout(10) << "waiting on xlocked dentry " << *dn << endl;
+ dout(10) << "waiting on xlocked dentry " << *dn << dendl;
dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryRequest(mdcache, mdr));
return;
}
mdr->trace.swap(trace);
CInode *in = mdcache->get_dentry_inode(dn, mdr);
if (!in) return;
- dout(7) << "dn links to " << *in << endl;
+ dout(7) << "dn links to " << *in << dendl;
// rmdir vs is_dir
if (in->is_dir()) {
if (!_verify_rmdir(mdr, in))
return;
} else {
- dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << endl;
+ dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << dendl;
reply_request(mdr, -EISDIR);
return;
}
} else {
if (rmdir) {
// unlink
- dout(7) << "handle_client_rmdir on non-dir " << *in << ", returning error" << endl;
+ dout(7) << "handle_client_rmdir on non-dir " << *in << ", returning error" << dendl;
reply_request(mdr, -ENOTDIR);
return;
}
CDentry *straydn = 0;
if (dn->is_primary()) {
straydn = mdcache->get_or_create_stray_dentry(dn->inode);
- dout(10) << " straydn is " << *straydn << endl;
+ dout(10) << " straydn is " << *straydn << dendl;
if (!mdr->dst_reanchor_atid &&
dn->inode->is_anchored()) {
- dout(10) << "reanchoring to stray " << *dn->inode << endl;
+ dout(10) << "reanchoring to stray " << *dn->inode << dendl;
vector<Anchor> trace;
straydn->make_anchor_trace(trace, dn->inode);
mds->anchorclient->prepare_update(dn->inode->ino(), trace, &mdr->dst_reanchor_atid,
void Server::_unlink_local(MDRequest *mdr, CDentry *dn, CDentry *straydn)
{
- dout(10) << "_unlink_local " << *dn << endl;
+ dout(10) << "_unlink_local " << *dn << dendl;
// ok, let's do it.
// prepare log entry
CDentry *dn, CDentry *straydn,
version_t dnpv, version_t dirpv)
{
- dout(10) << "_unlink_local_finish " << *dn << endl;
+ dout(10) << "_unlink_local_finish " << *dn << dendl;
// unlink main dentry
CInode *in = dn->inode;
for (map<int,int>::iterator it = dn->replicas_begin();
it != dn->replicas_end();
it++) {
- dout(7) << "_unlink_local_finish sending MDentryUnlink to mds" << it->first << endl;
+ dout(7) << "_unlink_local_finish sending MDentryUnlink to mds" << it->first << dendl;
MDentryUnlink *unlink = new MDentryUnlink(dn->dir->dirfrag(), dn->name);
if (straydn) {
unlink->strayin = straydn->dir->inode->replicate_to(it->first);
void Server::_unlink_remote(MDRequest *mdr, CDentry *dn)
{
- dout(10) << "_unlink_remote " << *dn << " " << *dn->inode << endl;
+ dout(10) << "_unlink_remote " << *dn << " " << *dn->inode << dendl;
// 1. send LinkPrepare to dest (journal nlink-- prepare)
int inauth = dn->inode->authority().first;
if (mdr->witnessed.count(inauth) == 0) {
- dout(10) << " inode auth must prepare nlink--" << endl;
+ dout(10) << " inode auth must prepare nlink--" << dendl;
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_UNLINKPREP);
dn->inode->set_object_info(req->get_object_info());
mdr->waiting_on_slave.insert(inauth);
return;
}
- dout(10) << " inode auth has prepared nlink--" << endl;
+ dout(10) << " inode auth has prepared nlink--" << dendl;
// ok, let's do it.
// prepare log entry
CDentry *dn,
version_t dnpv, version_t dirpv)
{
- dout(10) << "_unlink_remote_finish " << *dn << endl;
+ dout(10) << "_unlink_remote_finish " << *dn << dendl;
// unlink main dentry
dn->dir->unlink_inode(dn);
for (map<int,int>::iterator it = dn->replicas_begin();
it != dn->replicas_end();
it++) {
- dout(7) << "_unlink_remote_finish sending MDentryUnlink to mds" << it->first << endl;
+ dout(7) << "_unlink_remote_finish sending MDentryUnlink to mds" << it->first << dendl;
MDentryUnlink *unlink = new MDentryUnlink(dn->dir->dirfrag(), dn->name);
mds->send_message_mds(unlink, it->first, MDS_PORT_CACHE);
}
*/
bool Server::_verify_rmdir(MDRequest *mdr, CInode *in)
{
- dout(10) << "_verify_rmdir " << *in << endl;
+ dout(10) << "_verify_rmdir " << *in << dendl;
assert(in->is_auth());
list<frag_t> frags;
if (dir->is_auth() &&
dir->get_size() == 0 &&
!dir->is_complete()) {
- dout(7) << "_verify_rmdir fetching incomplete dir " << *dir << endl;
+ dout(7) << "_verify_rmdir fetching incomplete dir " << *dir << dendl;
dir->fetch(new C_MDS_RetryRequest(mdcache, mdr));
return false;
}
// does the frag _look_ empty?
if (dir->get_size()) {
- dout(10) << "_verify_rmdir still " << dir->get_size() << " items in frag " << *dir << endl;
+ dout(10) << "_verify_rmdir still " << dir->get_size() << " items in frag " << *dir << dendl;
reply_request(mdr, -ENOTEMPTY);
return false;
}
// not dir auth?
if (!dir->is_auth()) {
- dout(10) << "_verify_rmdir not auth for " << *dir << ", FIXME BUG" << endl;
+ dout(10) << "_verify_rmdir not auth for " << *dir << ", FIXME BUG" << dendl;
reply_request(mdr, -ENOTEMPTY);
return false;
}
// export sanity check
if (!in->is_auth()) {
// i should be exporting this now/soon, since the dir is empty.
- dout(7) << "handle_client_rmdir dir is auth, but not inode." << endl;
+ dout(7) << "handle_client_rmdir dir is auth, but not inode." << dendl;
mdcache->migrator->export_empty_import(in->dir);
in->dir->add_waiter(CDir::WAIT_UNFREEZE, new C_MDS_RetryRequest(mds, req, diri));
return;
void Server::handle_client_rename(MDRequest *mdr)
{
MClientRequest *req = mdr->client_request;
- dout(7) << "handle_client_rename " << *req << endl;
+ dout(7) << "handle_client_rename " << *req << dendl;
// traverse to dest dir (not dest)
// we do this FIRST, because the rename should occur on the
vector<CDentry*> desttrace;
CDir *destdir = traverse_to_auth_dir(mdr, desttrace, destpath);
if (!destdir) return; // fw or error out
- dout(10) << "dest will be " << destname << " in " << *destdir << endl;
+ dout(10) << "dest will be " << destname << " in " << *destdir << dendl;
assert(destdir->is_auth());
// traverse to src
return;
}
CDentry *srcdn = srctrace[srctrace.size()-1];
- dout(10) << " srcdn " << *srcdn << endl;
+ dout(10) << " srcdn " << *srcdn << dendl;
CInode *srci = mdcache->get_dentry_inode(srcdn, mdr);
- dout(10) << " srci " << *srci << endl;
+ dout(10) << " srci " << *srci << dendl;
// -- some sanity checks --
// src == dest?
if (srcdn->get_dir() == destdir && srcdn->name == destname) {
- dout(7) << "rename src=dest, noop" << endl;
+ dout(7) << "rename src=dest, noop" << dendl;
reply_request(mdr, 0);
return;
}
CDentry *pdn = destdir->inode->parent;
while (pdn) {
if (pdn == srcdn) {
- dout(7) << "cannot rename item to be a child of itself" << endl;
+ dout(7) << "cannot rename item to be a child of itself" << dendl;
reply_request(mdr, -EINVAL);
return;
}
CInode *oldin = 0;
if (destdn && !destdn->is_null()) {
- //dout(10) << "dest dn exists " << *destdn << endl;
+ //dout(10) << "dest dn exists " << *destdn << dendl;
oldin = mdcache->get_dentry_inode(destdn, mdr);
if (!oldin) return;
- dout(10) << " oldin " << *oldin << endl;
+ dout(10) << " oldin " << *oldin << dendl;
// mv /some/thing /to/some/existing_other_thing
if (oldin->is_dir() && !srci->is_dir()) {
if (!destdn) return;
}
- dout(10) << " destdn " << *destdn << endl;
+ dout(10) << " destdn " << *destdn << dendl;
// -- locks --
if (srcdn->is_primary() &&
!srcdn->is_auth() &&
srci->is_dir()) {
- dout(10) << "srci is remote dir, setting stickydirs and opening all frags" << endl;
+ dout(10) << "srci is remote dir, setting stickydirs and opening all frags" << dendl;
mdr->set_stickydirs(srci);
list<frag_t> frags;
++p) {
CDir *dir = srci->get_dirfrag(*p);
if (!dir) {
- dout(10) << " opening " << *dir << endl;
+ dout(10) << " opening " << *dir << dendl;
mdcache->open_remote_dirfrag(srci, *p, new C_MDS_RetryRequest(mdcache, mdr));
return;
}
CDentry *straydn = 0;
if (destdn->is_primary()) {
straydn = mdcache->get_or_create_stray_dentry(destdn->inode);
- dout(10) << "straydn is " << *straydn << endl;
+ dout(10) << "straydn is " << *straydn << dendl;
}
// -- prepare witnesses --
p != witnesses.end();
++p) {
if (mdr->witnessed.count(*p)) {
- dout(10) << " already witnessed by mds" << *p << endl;
+ dout(10) << " already witnessed by mds" << *p << dendl;
} else {
- dout(10) << " not yet witnessed by mds" << *p << ", sending prepare" << endl;
+ dout(10) << " not yet witnessed by mds" << *p << ", sending prepare" << dendl;
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEPREP);
srcdn->make_path(req->srcdnpath);
destdn->make_path(req->destdnpath);
if (mdr->inode_import.length() == 0) {
// get inode
int auth = srcdn->authority().first;
- dout(10) << " requesting inode export from srcdn auth mds" << auth << endl;
+ dout(10) << " requesting inode export from srcdn auth mds" << auth << dendl;
MMDSSlaveRequest *req = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEGETINODE);
srcdn->make_path(req->srcdnpath);
mds->send_message_mds(req, auth, MDS_PORT_SERVER);
mdr->waiting_on_slave.insert(auth);
return;
} else {
- dout(10) << " already (just!) got inode export from srcdn auth" << endl;
+ dout(10) << " already (just!) got inode export from srcdn auth" << dendl;
/*int off = 0;
mdcache->migrator->decode_import_inode(destdn, mdr->inode_import, off,
srcdn->authority().first);
if (srcdn->is_primary() && srcdn->inode->is_anchored() &&
srcdn->dir != destdn->dir &&
!mdr->src_reanchor_atid) {
- dout(10) << "reanchoring src->dst " << *srcdn->inode << endl;
+ dout(10) << "reanchoring src->dst " << *srcdn->inode << dendl;
vector<Anchor> trace;
destdn->make_anchor_trace(trace, srcdn->inode);
if (destdn->is_primary() &&
destdn->inode->is_anchored() &&
!mdr->dst_reanchor_atid) {
- dout(10) << "reanchoring dst->stray " << *destdn->inode << endl;
+ dout(10) << "reanchoring dst->stray " << *destdn->inode << dendl;
assert(straydn);
vector<Anchor> trace;
void Server::_rename_finish(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_rename_finish " << *mdr << endl;
+ dout(10) << "_rename_finish " << *mdr << dendl;
// apply
_rename_apply(mdr, srcdn, destdn, straydn);
EMetaBlob *metablob,
CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_rename_prepare " << *mdr << " " << *srcdn << " " << *destdn << endl;
+ dout(10) << "_rename_prepare " << *mdr << " " << *srcdn << " " << *destdn << dendl;
// primary+remote link merge?
bool linkmerge = (srcdn->inode == destdn->inode &&
version_t ipv = 0; // it's version
if (linkmerge) {
- dout(10) << "will merge remote+primary links" << endl;
+ dout(10) << "will merge remote+primary links" << dendl;
// destdn -> primary
metablob->add_dir_context(destdn->dir);
if (destdn->inode->is_auth())
ipv = mdr->pvmap[destdn->inode] = destdn->inode->pre_dirty();
ji = metablob->add_primary_dentry(destdn->inode->parent, true, destdn->inode); // update primary
- dout(10) << "remote targeti (nlink--) is " << *destdn->inode << endl;
+ dout(10) << "remote targeti (nlink--) is " << *destdn->inode << dendl;
}
else {
assert(destdn->is_null());
// add dest dentry
metablob->add_dir_context(destdn->dir);
if (srcdn->is_primary()) {
- dout(10) << "src is a primary dentry" << endl;
+ dout(10) << "src is a primary dentry" << dendl;
if (destdn->is_auth()) {
version_t siv;
if (srcdn->is_auth())
} else {
assert(srcdn->is_remote());
- dout(10) << "src is a remote dentry" << endl;
+ dout(10) << "src is a remote dentry" << dendl;
if (destdn->is_auth())
mdr->pvmap[destdn] = destdn->pre_dirty();
metablob->add_remote_dentry(destdn, true, srcdn->get_remote_ino());
void Server::_rename_apply(MDRequest *mdr, CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_rename_apply " << *mdr << " " << *srcdn << " " << *destdn << endl;
- dout(10) << " pvs " << mdr->pvmap << endl;
+ dout(10) << "_rename_apply " << *mdr << " " << *srcdn << " " << *destdn << dendl;
+ dout(10) << " pvs " << mdr->pvmap << dendl;
CInode *oldin = destdn->inode;
if (linkmerge) {
if (destdn->is_primary()) {
- dout(10) << "merging remote onto primary link" << endl;
+ dout(10) << "merging remote onto primary link" << dendl;
// nlink-- in place
destdn->inode->inode.nlink--;
if (srcdn->is_auth())
srcdn->mark_dirty(mdr->pvmap[srcdn]);
} else {
- dout(10) << "merging primary onto remote link" << endl;
+ dout(10) << "merging primary onto remote link" << dendl;
assert(srcdn->is_primary());
// move inode to dest
destdn->dir->unlink_inode(destdn);
if (straydn) {
- dout(10) << "straydn is " << *straydn << endl;
+ dout(10) << "straydn is " << *straydn << dendl;
// relink oldin to stray dir. destdn was primary.
assert(oldin);
dout(10) << "handle_slave_rename_prep " << *mdr
<< " " << mdr->slave_request->srcdnpath
<< " to " << mdr->slave_request->destdnpath
- << endl;
+ << dendl;
// discover destdn
filepath destpath(mdr->slave_request->destdnpath);
- dout(10) << " dest " << destpath << endl;
+ dout(10) << " dest " << destpath << dendl;
vector<CDentry*> trace;
int r = mdcache->path_traverse(mdr, mdr->slave_request,
0, destpath, trace, false,
assert(r == 0); // we shouldn't get an error here!
CDentry *destdn = trace[trace.size()-1];
- dout(10) << " destdn " << *destdn << endl;
+ dout(10) << " destdn " << *destdn << dendl;
mdr->pin(destdn);
// discover srcdn
filepath srcpath(mdr->slave_request->srcdnpath);
- dout(10) << " src " << srcpath << endl;
+ dout(10) << " src " << srcpath << dendl;
r = mdcache->path_traverse(mdr, mdr->slave_request,
0, srcpath, trace, false,
MDS_TRAVERSE_DISCOVERXLOCK);
assert(r == 0); // we shouldn't get an error here!
CDentry *srcdn = trace[trace.size()-1];
- dout(10) << " srcdn " << *srcdn << endl;
+ dout(10) << " srcdn " << *srcdn << dendl;
mdr->pin(srcdn);
assert(srcdn->inode);
mdr->pin(srcdn->inode);
mds->mdlog->submit_entry(le, new C_MDS_SlaveRenamePrep(this, mdr, srcdn, destdn, straydn));
} else {
// don't journal.
- dout(10) << "not journaling, i'm not auth for anything, and srci isn't open" << endl;
+ dout(10) << "not journaling, i'm not auth for anything, and srci isn't open" << dendl;
_logged_slave_rename(mdr, srcdn, destdn, straydn);
}
}
void Server::_logged_slave_rename(MDRequest *mdr,
CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_logged_slave_rename " << *mdr << endl;
+ dout(10) << "_logged_slave_rename " << *mdr << dendl;
// ack
MMDSSlaveRequest *reply = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEPREPACK);
void Server::_commit_slave_rename(MDRequest *mdr, int r,
CDentry *srcdn, CDentry *destdn, CDentry *straydn)
{
- dout(10) << "_commit_slave_rename " << *mdr << " r=" << r << endl;
+ dout(10) << "_commit_slave_rename " << *mdr << " r=" << r << dendl;
ESlaveUpdate *le;
if (r == 0) {
{
dout(10) << "handle_slave_rename_prep_ack " << *mdr
<< " witnessed by " << m->get_source()
- << " " << *m << endl;
+ << " " << *m << dendl;
int from = m->get_source().num();
// note slave
// add extra witnesses?
if (!m->srcdn_replicas.empty()) {
- dout(10) << " extra witnesses (srcdn replicas) are " << m->srcdn_replicas << endl;
+ dout(10) << " extra witnesses (srcdn replicas) are " << m->srcdn_replicas << dendl;
mdr->extra_witnesses = m->srcdn_replicas;
mdr->extra_witnesses.erase(mds->get_nodeid()); // not me!
}
if (mdr->waiting_on_slave.empty())
dispatch_client_request(mdr); // go again!
else
- dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+ dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
}
void Server::handle_slave_rename_get_inode(MDRequest *mdr)
{
- dout(10) << "handle_slave_rename_get_inode " << *mdr << endl;
+ dout(10) << "handle_slave_rename_get_inode " << *mdr << dendl;
assert(mdr->srcdn);
assert(mdr->srcdn->is_auth());
// reply
MMDSSlaveRequest *reply = new MMDSSlaveRequest(mdr->reqid, MMDSSlaveRequest::OP_RENAMEGETINODEACK);
- dout(10) << " replying with inode export info " << *mdr->srcdn->inode << endl;
+ dout(10) << " replying with inode export info " << *mdr->srcdn->inode << dendl;
map<int,entity_inst_t> exported_client_map;
bufferlist inodebl;
void Server::handle_slave_rename_get_inode_ack(MDRequest *mdr, MMDSSlaveRequest *m)
{
dout(10) << "handle_slave_rename_get_inode_ack " << *mdr
- << " " << *m << endl;
+ << " " << *m << dendl;
int from = m->get_source().num();
assert(m->inode_export.length());
- dout(10) << " got inode export, saving in " << *mdr << endl;
+ dout(10) << " got inode export, saving in " << *mdr << dendl;
mdr->inode_import.claim(m->inode_export);
mdr->inode_import_v = m->inode_export_v;
if (mdr->waiting_on_slave.empty())
dispatch_client_request(mdr); // go again!
else
- dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << endl;
+ dout(10) << "still waiting on slaves " << mdr->waiting_on_slave << dendl;
}
dout(10) << "open flags = " << flags
<< ", filemode = " << cmode
<< ", need_auth = " << need_auth
- << endl;
+ << dendl;
CInode *cur = rdlock_path_pin_ref(mdr, need_auth);
if (!cur) return;
// regular file?
if ((cur->inode.mode & INODE_TYPE_MASK) != INODE_MODE_FILE) {
- dout(7) << "not a regular file " << *cur << endl;
+ dout(7) << "not a regular file " << *cur << dendl;
reply_request(mdr, -EINVAL); // FIXME what error do we want?
return;
}
dout(12) << "_do_open issuing caps " << cap_string(cap->pending())
<< " for " << req->get_source()
- << " on " << *cur << endl;
+ << " on " << *cur << dendl;
// hit pop
mdr->now = g_clock.now();
void Server::queue_journal_open(CInode *in)
{
- dout(10) << "queue_journal_open on " << *in << endl;
+ dout(10) << "queue_journal_open on " << *in << dendl;
if (journal_open_queue.count(in) == 0) {
// pin so our pointer stays valid
void Server::journal_opens()
{
- dout(10) << "journal_opens " << journal_open_queue.size() << " inodes" << endl;
+ dout(10) << "journal_opens " << journal_open_queue.size() << " inodes" << dendl;
if (journal_open_queue.empty()) return;
EOpen *le = 0;
{
MClientRequest *req = mdr->client_request;
- dout(7) << "open w/ O_CREAT on " << req->get_filepath() << endl;
+ dout(7) << "open w/ O_CREAT on " << req->get_filepath() << dendl;
bool excl = (req->args.open.flags & O_EXCL);
CDentry *dn = rdlock_path_xlock_dentry(mdr, !excl, false);
if (!dn->is_null()) {
// it existed.
if (req->args.open.flags & O_EXCL) {
- dout(10) << "O_EXCL, target exists, failing with -EEXIST" << endl;
+ dout(10) << "O_EXCL, target exists, failing with -EEXIST" << dendl;
reply_request(mdr, -EEXIST, dn->get_dir()->get_inode());
return;
}
#include "IdAllocator.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
-#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+
+#define dout(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
+#define derr(l) if (l<=g_conf.debug_mds || l <= g_conf.debug_mds_log) cout << dbeginl << g_clock.now() << " mds" << mds->get_nodeid() << ".journal "
// -----------------------
// EString
bool EString::has_expired(MDS *mds) {
- dout(10) << "EString.has_expired " << event << endl;
+ dout(10) << "EString.has_expired " << event << dendl;
return true;
}
void EString::expire(MDS *mds, Context *c)
{
- dout(10) << "EString.expire " << event << endl;
+ dout(10) << "EString.expire " << event << dendl;
}
void EString::replay(MDS *mds)
{
- dout(10) << "EString.replay " << event << endl;
+ dout(10) << "EString.replay " << event << dendl;
}
if (dir->authority().first != mds->get_nodeid()) {
dout(10) << "EMetaBlob.has_expired not auth, needed dirv " << lp->second.dirv
- << " for " << *dir << endl;
+ << " for " << *dir << dendl;
continue; // not our problem
}
// but is not perfectly safe. for benchmarking ONLY!
if (dir->get_committing_version() >= lp->second.dirv || // committING, not committED.
dir->get_committed_version_equivalent() >= lp->second.dirv) {
- dout(10) << "EMetaBlob.has_expired have dirv " << lp->second.dirv
- << " for " << *dir << endl;
+ dout(10) << "EMetaBlob.has_expired have|committING (unsafe hack!) dirv " << lp->second.dirv
+ << " for " << *dir << dendl;
continue; // yay
}
} else {
if (dir->get_committed_version() >= lp->second.dirv ||
dir->get_committed_version_equivalent() >= lp->second.dirv) {
dout(10) << "EMetaBlob.has_expired have dirv " << lp->second.dirv
- << " for " << *dir << endl;
+ << " for " << *dir << dendl;
continue; // yay
}
}
if (ex->is_exporting()) {
// wait until export is acked (logged on remote) and committed (logged locally)
dout(10) << "EMetaBlob.has_expired ambiguous auth for " << *dir
- << ", exporting on " << *ex << endl;
+ << ", exporting on " << *ex << dendl;
return false;
} else {
dout(10) << "EMetaBlob.has_expired ambiguous auth for " << *dir
- << ", importing on " << *ex << endl;
+ << ", importing on " << *ex << dendl;
return false;
}
}
if (dir->get_committed_version() < lp->second.dirv) {
dout(10) << "EMetaBlob.has_expired need dirv " << lp->second.dirv
- << " for " << *dir << endl;
+ << " for " << *dir << dendl;
return false; // not committed.
}
++p) {
if (!mds->anchorclient->has_committed(*p)) {
dout(10) << "EMetaBlob.has_expired anchor transaction " << *p
- << " not yet acked" << endl;
+ << " not yet acked" << dendl;
return false;
}
}
if (in) {
if (in->inode.ctime == p->second &&
in->dirlock.is_updated()) {
- dout(10) << "EMetaBlob.has_expired dirty mtime dirlock hasn't flushed on " << *in << endl;
+ dout(10) << "EMetaBlob.has_expired dirty mtime dirlock hasn't flushed on " << *in << dendl;
return false;
}
}
version_t cv = mds->idalloc->get_committed_version();
if (cv < alloc_tablev) {
dout(10) << "EMetaBlob.has_expired idalloc tablev " << alloc_tablev << " > " << cv
- << ", still dirty" << endl;
+ << ", still dirty" << dendl;
return false; // still dirty
} else {
dout(10) << "EMetaBlob.has_expired idalloc tablev " << alloc_tablev << " <= " << cv
- << ", already flushed" << endl;
+ << ", already flushed" << dendl;
}
}
++p) {
if (mds->mdcache->is_purging(p->first.ino, p->second)) {
dout(10) << "EMetaBlob.has_expired still purging inode " << p->first.ino
- << " to " << p->second << endl;
+ << " to " << p->second << dendl;
return false;
}
}
++p) {
if (mds->clientmap.have_completed_request(*p)) {
dout(10) << "EMetaBlob.has_expired still have completed request " << *p
- << endl;
+ << dendl;
return false;
}
}
if (dir->authority().first != mds->get_nodeid()) {
dout(10) << "EMetaBlob.expire not auth, needed dirv " << lp->second.dirv
- << " for " << *dir << endl;
+ << " for " << *dir << dendl;
continue; // not our problem
}
if (dir->get_committed_version() >= lp->second.dirv ||
dir->get_committed_version_equivalent() >= lp->second.dirv) {
dout(10) << "EMetaBlob.expire have dirv " << lp->second.dirv
- << " on " << *dir << endl;
+ << " on " << *dir << dendl;
continue; // yay
}
if (ex->is_exporting()) {
// wait until export is acked (logged on remote) and committed (logged locally)
dout(10) << "EMetaBlob.expire ambiguous auth for " << *dir
- << ", waiting for export finish on " << *ex << endl;
+ << ", waiting for export finish on " << *ex << dendl;
waitfor_export.push_back(ex);
continue;
} else {
dout(10) << "EMetaBlob.expire ambiguous auth for " << *dir
- << ", waiting for import finish on " << *ex << endl;
+ << ", waiting for import finish on " << *ex << dendl;
waitfor_import.push_back(ex);
continue;
}
assert(dir->get_committed_version() < lp->second.dirv);
dout(10) << "EMetaBlob.expire need dirv " << lp->second.dirv
- << ", committing " << *dir << endl;
+ << ", committing " << *dir << dendl;
commit[dir] = MAX(commit[dir], lp->second.dirv);
ncommit++;
}
++p) {
if (!mds->anchorclient->has_committed(*p)) {
dout(10) << "EMetaBlob.expire anchor transaction " << *p
- << " not yet acked, waiting" << endl;
+ << " not yet acked, waiting" << dendl;
mds->anchorclient->wait_for_ack(*p, gather->new_sub());
}
}
if (in->inode.ctime == p->second &&
in->dirlock.is_updated()) {
dout(10) << "EMetaBlob.expire dirty mtime dirlock hasn't flushed, waiting on "
- << *in << endl;
+ << *in << dendl;
in->dirlock.add_waiter(SimpleLock::WAIT_STABLE, gather->new_sub());
}
}
if (!allocated_inos.empty()) {
version_t cv = mds->idalloc->get_committed_version();
if (cv < alloc_tablev) {
- dout(10) << "EMetaBlob.expire saving idalloc table, need " << alloc_tablev << endl;
+ dout(10) << "EMetaBlob.expire saving idalloc table, need " << alloc_tablev << dendl;
mds->idalloc->save(gather->new_sub(), alloc_tablev);
}
}
++p) {
if (mds->mdcache->is_purging(p->first.ino, p->second)) {
dout(10) << "EMetaBlob.expire waiting for purge of inode " << p->first.ino
- << " to " << p->second << endl;
+ << " to " << p->second << dendl;
mds->mdcache->wait_for_purge(p->first.ino, p->second, gather->new_sub());
}
}
++p) {
if (mds->clientmap.have_completed_request(*p)) {
dout(10) << "EMetaBlob.expire waiting on completed request " << *p
- << endl;
+ << dendl;
mds->clientmap.add_trim_waiter(*p, gather->new_sub());
}
}
- dout(10) << "my gather finsher is " << gather << " with " << gather->get_num() << endl;
+ dout(10) << "my gather finsher is " << gather << " with " << gather->get_num() << dendl;
}
void EMetaBlob::replay(MDS *mds)
{
- dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps" << endl;
+ dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps" << dendl;
// walk through my dirs (in order!)
for (list<dirfrag_t>::iterator lp = lump_order.begin();
lp != lump_order.end();
++lp) {
- dout(10) << "EMetaBlob.replay dir " << *lp << endl;
+ dout(10) << "EMetaBlob.replay dir " << *lp << dendl;
dirlump &lump = lump_map[*lp];
// the dir
if (!diri) {
if ((*lp).ino == MDS_INO_ROOT) {
diri = mds->mdcache->create_root_inode();
- dout(10) << "EMetaBlob.replay created root " << *diri << endl;
+ dout(10) << "EMetaBlob.replay created root " << *diri << dendl;
} else if (MDS_INO_IS_STRAY((*lp).ino)) {
int whose = (*lp).ino - MDS_INO_STRAY_OFFSET;
diri = mds->mdcache->create_stray_inode(whose);
- dout(10) << "EMetaBlob.replay created stray " << *diri << endl;
+ dout(10) << "EMetaBlob.replay created stray " << *diri << dendl;
} else {
assert(0);
}
if ((*lp).ino < MDS_INO_BASE)
mds->mdcache->adjust_subtree_auth(dir, CDIR_AUTH_UNKNOWN);
- dout(10) << "EMetaBlob.replay added dir " << *dir << endl;
+ dout(10) << "EMetaBlob.replay added dir " << *dir << dendl;
}
dir->set_version( lump.dirv );
if (lump.is_dirty())
dn = dir->add_null_dentry(p->dn);
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay added " << *dn << endl;
+ dout(10) << "EMetaBlob.replay added " << *dn << dendl;
} else {
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay had " << *dn << endl;
+ dout(10) << "EMetaBlob.replay had " << *dn << dendl;
}
CInode *in = mds->mdcache->get_inode(p->inode.ino);
mds->mdcache->add_inode(in);
dir->link_primary_inode(dn, in);
if (p->dirty) in->_mark_dirty();
- dout(10) << "EMetaBlob.replay added " << *in << endl;
+ dout(10) << "EMetaBlob.replay added " << *in << dendl;
} else {
if (dn->get_inode() != in && in->get_parent_dn()) {
- dout(10) << "EMetaBlob.replay unlinking " << *in << endl;
+ dout(10) << "EMetaBlob.replay unlinking " << *in << dendl;
in->get_parent_dn()->get_dir()->unlink_inode(in->get_parent_dn());
}
in->inode = p->inode;
if (p->dirty) in->_mark_dirty();
if (dn->get_inode() != in) {
dir->link_primary_inode(dn, in);
- dout(10) << "EMetaBlob.replay linked " << *in << endl;
+ dout(10) << "EMetaBlob.replay linked " << *in << dendl;
} else {
- dout(10) << "EMetaBlob.replay had " << *in << endl;
+ dout(10) << "EMetaBlob.replay had " << *in << dendl;
}
}
}
dn = dir->add_remote_dentry(p->dn, p->ino, p->d_type);
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay added " << *dn << endl;
+ dout(10) << "EMetaBlob.replay added " << *dn << dendl;
} else {
if (!dn->is_null()) {
- dout(10) << "EMetaBlob.replay unlinking " << *dn << endl;
+ dout(10) << "EMetaBlob.replay unlinking " << *dn << dendl;
dir->unlink_inode(dn);
}
dn->set_remote(p->ino, p->d_type);
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay had " << *dn << endl;
+ dout(10) << "EMetaBlob.replay had " << *dn << dendl;
}
}
dn = dir->add_null_dentry(p->dn);
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay added " << *dn << endl;
+ dout(10) << "EMetaBlob.replay added " << *dn << dendl;
} else {
if (!dn->is_null()) {
- dout(10) << "EMetaBlob.replay unlinking " << *dn << endl;
+ dout(10) << "EMetaBlob.replay unlinking " << *dn << dendl;
dir->unlink_inode(dn);
}
dn->set_version(p->dnv);
if (p->dirty) dn->_mark_dirty();
- dout(10) << "EMetaBlob.replay had " << *dn << endl;
+ dout(10) << "EMetaBlob.replay had " << *dn << dendl;
}
}
}
for (list<version_t>::iterator p = atids.begin();
p != atids.end();
++p) {
- dout(10) << "EMetaBlob.replay noting anchor transaction " << *p << endl;
+ dout(10) << "EMetaBlob.replay noting anchor transaction " << *p << dendl;
mds->anchorclient->got_journaled_agree(*p);
}
p != dirty_inode_mtimes.end();
++p) {
CInode *in = mds->mdcache->get_inode(p->first);
- dout(10) << "EMetaBlob.replay setting dirlock updated flag on " << *in << endl;
+ dout(10) << "EMetaBlob.replay setting dirlock updated flag on " << *in << dendl;
in->dirlock.set_updated();
}
if (!allocated_inos.empty()) {
if (mds->idalloc->get_version() >= alloc_tablev) {
dout(10) << "EMetaBlob.replay idalloc tablev " << alloc_tablev
- << " <= table " << mds->idalloc->get_version() << endl;
+ << " <= table " << mds->idalloc->get_version() << dendl;
} else {
for (list<inodeno_t>::iterator p = allocated_inos.begin();
p != allocated_inos.end();
++p) {
dout(10) << " EMetaBlob.replay idalloc " << *p << " tablev " << alloc_tablev
- << " - 1 == table " << mds->idalloc->get_version() << endl;
+ << " - 1 == table " << mds->idalloc->get_version() << dendl;
assert(alloc_tablev-1 == mds->idalloc->get_version());
inodeno_t ino = mds->idalloc->alloc_id();
p != truncated_inodes.end();
++p) {
dout(10) << "EMetaBlob.replay will purge truncated inode " << p->first.ino
- << " to " << p->second << endl;
+ << " to " << p->second << dendl;
mds->mdcache->add_recovered_purge(p->first, p->second);
}
{
if (mds->clientmap.get_committed() >= cmapv) {
dout(10) << "ESession.has_expired newer clientmap " << mds->clientmap.get_committed()
- << " >= " << cmapv << " has committed" << endl;
+ << " >= " << cmapv << " has committed" << dendl;
return true;
} else if (mds->clientmap.get_committing() >= cmapv) {
dout(10) << "ESession.has_expired newer clientmap " << mds->clientmap.get_committing()
- << " >= " << cmapv << " is still committing" << endl;
+ << " >= " << cmapv << " is still committing" << dendl;
return false;
} else {
dout(10) << "ESession.has_expired clientmap " << mds->clientmap.get_version()
- << " > " << cmapv << ", need to save" << endl;
+ << " > " << cmapv << ", need to save" << dendl;
return false;
}
}
void ESession::expire(MDS *mds, Context *c)
{
- dout(10) << "ESession.expire saving clientmap" << endl;
+ dout(10) << "ESession.expire saving clientmap" << dendl;
mds->clientmap.save(c, cmapv);
}
{
if (mds->clientmap.get_version() >= cmapv) {
dout(10) << "ESession.replay clientmap " << mds->clientmap.get_version()
- << " >= " << cmapv << ", noop" << endl;
+ << " >= " << cmapv << ", noop" << dendl;
// hrm, this isn't very pretty.
if (!open)
} else {
dout(10) << "ESession.replay clientmap " << mds->clientmap.get_version()
- << " < " << cmapv << endl;
+ << " < " << cmapv << dendl;
assert(mds->clientmap.get_version() + 1 == cmapv);
if (open) {
mds->clientmap.open_session(client_inst);
version_t cv = mds->anchortable->get_committed_version();
if (cv < version) {
dout(10) << "EAnchor.has_expired v " << version << " > " << cv
- << ", still dirty" << endl;
+ << ", still dirty" << dendl;
return false; // still dirty
} else {
dout(10) << "EAnchor.has_expired v " << version << " <= " << cv
- << ", already flushed" << endl;
+ << ", already flushed" << dendl;
return true; // already flushed
}
}
void EAnchor::expire(MDS *mds, Context *c)
{
- dout(10) << "EAnchor.expire saving anchor table" << endl;
+ dout(10) << "EAnchor.expire saving anchor table" << dendl;
mds->anchortable->save(c);
}
{
if (mds->anchortable->get_version() >= version) {
dout(10) << "EAnchor.replay event " << version
- << " <= table " << mds->anchortable->get_version() << endl;
+ << " <= table " << mds->anchortable->get_version() << dendl;
} else {
dout(10) << " EAnchor.replay event " << version
- << " - 1 == table " << mds->anchortable->get_version() << endl;
+ << " - 1 == table " << mds->anchortable->get_version() << dendl;
assert(version-1 == mds->anchortable->get_version());
switch (op) {
void EAnchorClient::replay(MDS *mds)
{
- dout(10) << " EAnchorClient.replay op " << op << " atid " << atid << endl;
+ dout(10) << " EAnchorClient.replay op " << op << " atid " << atid << dendl;
switch (op) {
// anchorclient
in->is_any_caps() &&
!(in->last_open_journaled > get_start_off() ||
in->last_open_journaled == 0)) {
- dout(10) << "EOpen.has_expired still refer to caps on " << *in << endl;
+ dout(10) << "EOpen.has_expired still refer to caps on " << *in << dendl;
return false;
}
}
void EOpen::expire(MDS *mds, Context *c)
{
- dout(10) << "EOpen.expire " << endl;
+ dout(10) << "EOpen.expire " << dendl;
if (mds->mdlog->is_capped()) {
- dout(0) << "uh oh, log is capped, but i have unexpired opens." << endl;
+ dout(0) << "uh oh, log is capped, but i have unexpired opens." << dendl;
assert(0);
}
if (!in->is_any_caps()) continue;
dout(10) << "EOpen.expire " << in->ino()
- << " last_open_journaled " << in->last_open_journaled << endl;
+ << " last_open_journaled " << in->last_open_journaled << dendl;
mds->server->queue_journal_open(in);
}
void EOpen::replay(MDS *mds)
{
- dout(10) << "EOpen.replay " << endl;
+ dout(10) << "EOpen.replay " << dendl;
metablob.replay(mds);
}
case ESlaveUpdate::OP_PREPARE:
if (mds->mdcache->ambiguous_slave_updates.count(reqid) == 0) {
dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master
- << ": haven't yet seen commit|rollback" << endl;
+ << ": haven't yet seen commit|rollback" << dendl;
return false;
}
else if (mds->mdcache->ambiguous_slave_updates[reqid]) {
dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master
- << ": committed, checking metablob" << endl;
+ << ": committed, checking metablob" << dendl;
bool exp = metablob.has_expired(mds);
if (exp)
mds->mdcache->ambiguous_slave_updates.erase(reqid);
}
else {
dout(10) << "ESlaveUpdate.has_expired prepare " << reqid << " for mds" << master
- << ": aborted" << endl;
+ << ": aborted" << dendl;
mds->mdcache->ambiguous_slave_updates.erase(reqid);
return true;
}
dout(10) << "ESlaveUpdate.has_expired "
<< ((op == ESlaveUpdate::OP_COMMIT) ? "commit ":"rollback ")
<< reqid << " for mds" << master
- << ": noting commit, kicking prepare waiter" << endl;
+ << ": noting commit, kicking prepare waiter" << dendl;
mds->mdcache->ambiguous_slave_updates[reqid] = (op == ESlaveUpdate::OP_COMMIT);
mds->mdcache->waiting_for_slave_update_commit[reqid]->finish(0);
delete mds->mdcache->waiting_for_slave_update_commit[reqid];
dout(10) << "ESlaveUpdate.has_expired "
<< ((op == ESlaveUpdate::OP_COMMIT) ? "commit ":"rollback ")
<< reqid << " for mds" << master
- << ": no prepare waiter, ignoring" << endl;
+ << ": no prepare waiter, ignoring" << dendl;
}
return true;
if (mds->mdcache->ambiguous_slave_updates.count(reqid) == 0) {
// wait
dout(10) << "ESlaveUpdate.expire prepare " << reqid << " for mds" << master
- << ": waiting for commit|rollback" << endl;
+ << ": waiting for commit|rollback" << dendl;
mds->mdcache->waiting_for_slave_update_commit[reqid] = c;
} else {
// we committed.. expire the metablob
assert(mds->mdcache->ambiguous_slave_updates[reqid] == true);
dout(10) << "ESlaveUpdate.expire prepare " << reqid << " for mds" << master
- << ": waiting for metablob to expire" << endl;
+ << ": waiting for metablob to expire" << dendl;
metablob.expire(mds, c);
}
}
case ESlaveUpdate::OP_PREPARE:
// FIXME: horribly inefficient copy; EMetaBlob needs a swap() or something
dout(10) << "ESlaveUpdate.replay prepare " << reqid << " for mds" << master
- << ": saving blob for later commit" << endl;
+ << ": saving blob for later commit" << dendl;
assert(mds->mdcache->uncommitted_slave_updates[master].count(reqid) == 0);
mds->mdcache->uncommitted_slave_updates[master][reqid] = metablob;
break;
case ESlaveUpdate::OP_COMMIT:
if (mds->mdcache->uncommitted_slave_updates[master].count(reqid)) {
dout(10) << "ESlaveUpdate.replay commit " << reqid << " for mds" << master
- << ": applying previously saved blob" << endl;
+ << ": applying previously saved blob" << dendl;
mds->mdcache->uncommitted_slave_updates[master][reqid].replay(mds);
mds->mdcache->uncommitted_slave_updates[master].erase(reqid);
} else {
dout(10) << "ESlaveUpdate.replay commit " << reqid << " for mds" << master
- << ": ignoring, no previously saved blob" << endl;
+ << ": ignoring, no previously saved blob" << dendl;
}
break;
case ESlaveUpdate::OP_ROLLBACK:
if (mds->mdcache->uncommitted_slave_updates[master].count(reqid)) {
dout(10) << "ESlaveUpdate.replay abort " << reqid << " for mds" << master
- << ": discarding previously saved blob" << endl;
+ << ": discarding previously saved blob" << dendl;
assert(mds->mdcache->uncommitted_slave_updates[master].count(reqid));
mds->mdcache->uncommitted_slave_updates[master].erase(reqid);
} else {
dout(10) << "ESlaveUpdate.replay abort " << reqid << " for mds" << master
- << ": ignoring, no previously saved blob" << endl;
+ << ": ignoring, no previously saved blob" << dendl;
}
break;
bool ESubtreeMap::has_expired(MDS *mds)
{
if (mds->mdlog->get_last_subtree_map_offset() > get_start_off()) {
- dout(10) << "ESubtreeMap.has_expired -- there's a newer map" << endl;
+ dout(10) << "ESubtreeMap.has_expired -- there's a newer map" << dendl;
return true;
} else if (mds->mdlog->is_capped()) {
- dout(10) << "ESubtreeMap.has_expired -- log is capped, allowing map to expire" << endl;
+ dout(10) << "ESubtreeMap.has_expired -- log is capped, allowing map to expire" << dendl;
return true;
} else {
dout(10) << "ESubtreeMap.has_expired -- not until there's a newer map written"
<< " (" << get_start_off() << " >= " << mds->mdlog->get_last_subtree_map_offset() << ")"
- << endl;
+ << dendl;
return false;
}
}
void ESubtreeMap::expire(MDS *mds, Context *c)
{
- dout(10) << "ESubtreeMap.has_expire -- waiting for a newer map to be written (or for shutdown)" << endl;
+ dout(10) << "ESubtreeMap.has_expire -- waiting for a newer map to be written (or for shutdown)" << dendl;
mds->mdlog->add_subtree_map_expire_waiter(c);
}
void ESubtreeMap::replay(MDS *mds)
{
if (mds->mdcache->is_subtrees()) {
- dout(10) << "ESubtreeMap.replay -- ignoring, already have import map" << endl;
+ dout(10) << "ESubtreeMap.replay -- ignoring, already have import map" << dendl;
} else {
- dout(10) << "ESubtreeMap.replay -- reconstructing (auth) subtree spanning tree" << endl;
+ dout(10) << "ESubtreeMap.replay -- reconstructing (auth) subtree spanning tree" << dendl;
// first, stick the spanning tree in my cache
//metablob.print(cout);
void EFragment::replay(MDS *mds)
{
- dout(10) << "EFragment.replay " << ino << " " << basefrag << " by " << bits << endl;
+ dout(10) << "EFragment.replay " << ino << " " << basefrag << " by " << bits << dendl;
CInode *in = mds->mdcache->get_inode(ino);
assert(in);
void EPurgeFinish::replay(MDS *mds)
{
- dout(10) << "EPurgeFinish.replay " << ino << " to " << newsize << endl;
+ dout(10) << "EPurgeFinish.replay " << ino << " to " << newsize << dendl;
mds->mdcache->remove_recovered_purge(ino, newsize);
}
{
CDir *dir = mds->mdcache->get_dirfrag(base);
if (dir && mds->mdcache->migrator->is_exporting(dir)) {
- dout(10) << "EExport.has_expired still exporting " << *dir << endl;
+ dout(10) << "EExport.has_expired still exporting " << *dir << dendl;
return false;
}
return true;
assert(dir);
assert(mds->mdcache->migrator->is_exporting(dir));
- dout(10) << "EExport.expire waiting for export of " << *dir << endl;
+ dout(10) << "EExport.expire waiting for export of " << *dir << dendl;
mds->mdcache->migrator->add_export_finish_waiter(dir, c);
}
void EExport::replay(MDS *mds)
{
- dout(10) << "EExport.replay " << base << endl;
+ dout(10) << "EExport.replay " << base << dendl;
metablob.replay(mds);
CDir *dir = mds->mdcache->get_dirfrag(base);
void EImportStart::expire(MDS *mds, Context *c)
{
- dout(10) << "EImportStart.expire " << base << endl;
+ dout(10) << "EImportStart.expire " << base << dendl;
metablob.expire(mds, c);
}
void EImportStart::replay(MDS *mds)
{
- dout(10) << "EImportStart.replay " << base << endl;
+ dout(10) << "EImportStart.replay " << base << dendl;
metablob.replay(mds);
// put in ambiguous import list
void EImportFinish::replay(MDS *mds)
{
if (mds->mdcache->have_ambiguous_import(base)) {
- dout(10) << "EImportFinish.replay " << base << " success=" << success << endl;
+ dout(10) << "EImportFinish.replay " << base << " success=" << success << dendl;
if (success)
mds->mdcache->finish_ambiguous_import(base);
else
} else {
dout(10) << "EImportFinish.replay " << base << " success=" << success
<< ", predates my subtree_map start point, ignoring"
- << endl;
+ << dendl;
// verify that?
}
}
pdout(10,g_conf.debug_mds) << (mdsco_db_line_prefix(this))
<< "add_waiter " << hex << mask << dec << " " << c
<< " on " << *this
- << endl;
+ << dendl;
}
virtual void take_waiting(int mask, list<Context*>& ls) {
<< "take_waiting mask " << hex << mask << dec << " took " << it->second
<< " tag " << it->first
<< " on " << *this
- << endl;
+ << dendl;
waiting.erase(it++);
} else {
pdout(10,g_conf.debug_mds) << "take_waiting mask " << hex << mask << dec << " SKIPPING " << it->second
<< " tag " << it->first
<< " on " << *this
- << endl;
+ << dendl;
it++;
}
}
dirs.push_back( new CDirDiscover() );
dirs[i]->_decode(payload, off);
}
- //dout(12) << n << " dirs out" << endl;
// inodes
payload.copy(off, sizeof(int), (char*)&n);
inodes.push_back( new CInodeDiscover() );
inodes[i]->_decode(payload, off);
}
- //dout(12) << n << " inodes out" << endl;
// dentries
payload.copy(off, sizeof(int), (char*)&n);
it != dirs.end();
it++)
(*it)->_encode( payload );
- //dout(12) << n << " dirs in" << endl;
// inodes
n = inodes.size();
it != inodes.end();
it++)
(*it)->_encode( payload );
- //dout(12) << n << " inodes in" << endl;
// dentries
n = dentries.size();
it != dentries.end();
it++)
(*it)->_encode( payload );
- //dout(12) << n << " dentries in" << endl;
}
};
char *get_type_name() { return "pg_stats"; }
void print(ostream& out) {
- out << "pg_stats" << endl;
+ out << "pg_stats";
}
void encode_payload() {
#include "common/Timer.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".client "
assert(paxosv >= client_map.version);
dout(10) << "update_from_paxos paxosv " << paxosv
- << ", my v " << client_map.version << endl;
+ << ", my v " << client_map.version << dendl;
if (client_map.version == 0 && paxosv > 1 &&
mon->store->exists_bl_ss("clientmap","latest")) {
// starting up: load latest
- dout(7) << "update_from_paxos startup: loading latest full clientmap" << endl;
+ dout(7) << "update_from_paxos startup: loading latest full clientmap" << dendl;
bufferlist bl;
mon->store->get_bl_ss(bl, "clientmap", "latest");
int off = 0;
bufferlist bl;
bool success = paxos->read(client_map.version+1, bl);
if (success) {
- dout(7) << "update_from_paxos applying incremental " << client_map.version+1 << endl;
+ dout(7) << "update_from_paxos applying incremental " << client_map.version+1 << dendl;
Incremental inc;
int off = 0;
inc._decode(bl, off);
client_map.apply_incremental(inc);
} else {
- dout(7) << "update_from_paxos couldn't read incremental " << client_map.version+1 << endl;
+ dout(7) << "update_from_paxos couldn't read incremental " << client_map.version+1 << dendl;
return false;
}
}
pending_inc.next_client = client_map.next_client;
dout(10) << "create_pending v " << pending_inc.version
<< ", next is " << pending_inc.next_client
- << endl;
+ << dendl;
}
void ClientMonitor::create_initial()
{
- dout(1) << "create_initial -- creating initial map" << endl;
+ dout(1) << "create_initial -- creating initial map" << dendl;
}
assert(mon->is_leader());
dout(10) << "encode_pending v " << pending_inc.version
<< ", next is " << pending_inc.next_client
- << endl;
+ << dendl;
assert(paxos->get_version() + 1 == pending_inc.version);
pending_inc._encode(bl);
}
bool ClientMonitor::preprocess_query(Message *m)
{
- dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
case MSG_CLIENT_MOUNT:
if (mount->instance == 0 && // only check for addr uniqueness if the client claims to be alone
client_map.addr_client.count(addr)) {
int client = client_map.addr_client[addr];
- dout(7) << " client" << client << " already mounted" << endl;
+ dout(7) << " client" << client << " already mounted" << dendl;
_mounted(client, (MClientMount*)m);
return true;
}
// already unmounted?
int client = m->get_source().num();
if (client_map.client_addr.count(client) == 0) {
- dout(7) << " client" << client << " not mounted" << endl;
+ dout(7) << " client" << client << " not mounted" << dendl;
_unmounted((MClientUnmount*)m);
return true;
}
bool ClientMonitor::prepare_update(Message *m)
{
- dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
case MSG_CLIENT_MOUNT:
// choose a client id
if (client < 0) {
client = pending_inc.next_client;
- dout(10) << "mount: assigned client" << client << " to " << addr << endl;
+ dout(10) << "mount: assigned client" << client << " to " << addr << dendl;
} else {
- dout(10) << "mount: client" << client << " requested by " << addr << endl;
+ dout(10) << "mount: client" << client << " requested by " << addr << dendl;
if (client_map.client_addr.count(client)) {
assert(client_map.client_addr[client] != addr);
dout(0) << "mount: WARNING: client" << client << " requested by " << addr
- << ", which used to be " << client_map.client_addr[client] << endl;
+ << ", which used to be " << client_map.client_addr[client] << dendl;
}
}
to.addr = m->addr;
to.name = MSG_ADDR_CLIENT(client);
- dout(10) << "_mounted client" << client << " at " << to << endl;
+ dout(10) << "_mounted client" << client << " at " << to << dendl;
// reply with latest mds, osd maps
mon->mdsmon->send_latest(to);
void ClientMonitor::_unmounted(MClientUnmount *m)
{
- dout(10) << "_unmounted " << m->inst << endl;
+ dout(10) << "_unmounted " << m->inst << dendl;
// reply with (same) unmount message
mon->messenger->send_message(m, m->inst);
client_map.version > 1 &&
client_map.client_addr.empty() &&
g_conf.mon_stop_on_last_unmount) {
- dout(1) << "last client unmounted" << endl;
+ dout(1) << "last client unmounted" << dendl;
mon->do_stop();
}
}
#include "messages/MMonElection.h"
#include "config.h"
-#undef dout
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
+
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".elector(" << epoch << ") "
void Elector::init()
epoch = mon->store->get_int("mon_epoch");
if (!epoch)
epoch = 1;
- dout(1) << "init, last seen epoch " << epoch << endl;
+ dout(1) << "init, last seen epoch " << epoch << dendl;
}
void Elector::shutdown()
void Elector::bump_epoch(epoch_t e)
{
- dout(10) << "bump_epoch " << epoch << " to " << e << endl;
+ dout(10) << "bump_epoch " << epoch << " to " << e << dendl;
assert(epoch < e);
epoch = e;
mon->store->put_int(epoch, "mon_epoch");
void Elector::start()
{
- dout(5) << "start -- can i be leader?" << endl;
+ dout(5) << "start -- can i be leader?" << dendl;
// start by trying to elect me
if (epoch % 2 == 0)
void Elector::defer(int who)
{
- dout(5) << "defer to " << who << endl;
+ dout(5) << "defer to " << who << dendl;
if (electing_me) {
// drop out
void Elector::expire()
{
- dout(5) << "election timer expired" << endl;
+ dout(5) << "election timer expired" << dendl;
// did i win?
if (electing_me &&
void Elector::handle_propose(MMonElection *m)
{
- dout(5) << "handle_propose from " << m->get_source() << endl;
+ dout(5) << "handle_propose from " << m->get_source() << dendl;
int from = m->get_source().num();
assert(m->epoch % 2 == 1); // election
epoch % 2 == 0 && // in a non-election cycle
mon->quorum.count(from) == 0) { // from someone outside the quorum
// a mon just started up, call a new election so they can rejoin!
- dout(5) << " got propose from old epoch, " << m->get_source() << " must have just started" << endl;
+ dout(5) << " got propose from old epoch, " << m->get_source() << " must have just started" << dendl;
start();
}
// i would win over them.
if (leader_acked >= 0) { // we already acked someone
assert(leader_acked < from); // and they still win, of course
- dout(5) << "no, we already acked " << leader_acked << endl;
+ dout(5) << "no, we already acked " << leader_acked << dendl;
} else {
// wait, i should win!
if (!electing_me)
defer(from);
} else {
// ignore them!
- dout(5) << "no, we already acked " << leader_acked << endl;
+ dout(5) << "no, we already acked " << leader_acked << dendl;
}
}
void Elector::handle_ack(MMonElection *m)
{
- dout(5) << "handle_ack from " << m->get_source() << endl;
+ dout(5) << "handle_ack from " << m->get_source() << dendl;
int from = m->get_source().num();
assert(m->epoch % 2 == 1); // election
if (m->epoch > epoch) {
- dout(5) << "woah, that's a newer epoch, i must have rebooted. bumping and re-starting!" << endl;
+ dout(5) << "woah, that's a newer epoch, i must have rebooted. bumping and re-starting!" << dendl;
bump_epoch(m->epoch);
start();
delete m;
if (electing_me) {
// thanks
acked_me.insert(from);
- dout(5) << " so far i have " << acked_me << endl;
+ dout(5) << " so far i have " << acked_me << dendl;
// is that _everyone_?
if (acked_me.size() == (unsigned)mon->monmap->num_mon) {
void Elector::handle_victory(MMonElection *m)
{
- dout(5) << "handle_victory from " << m->get_source() << endl;
+ dout(5) << "handle_victory from " << m->get_source() << dendl;
int from = m->get_source().num();
assert(from < whoami);
}
if (em->epoch < epoch) {
- dout(5) << "old epoch, dropping" << endl;
+ dout(5) << "old epoch, dropping" << dendl;
delete em;
break;
}
#include <sstream>
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".mds e" << mdsmap.get_epoch() << " "
void MDSMonitor::print_map(MDSMap &m)
{
- dout(7) << "print_map epoch " << m.get_epoch() << " target_num " << m.target_num << endl;
+ dout(7) << "print_map epoch " << m.get_epoch() << " target_num " << m.target_num << dendl;
entity_inst_t blank;
set<int> all;
m.get_mds_set(all);
dout(7) << " mds" << *p << "." << m.mds_inc[*p]
<< " : " << MDSMap::get_state_name(m.get_state(*p))
<< " : " << (m.have_inst(*p) ? m.get_inst(*p) : blank)
- << endl;
+ << dendl;
}
}
void MDSMonitor::create_initial()
{
- dout(10) << "create_initial" << endl;
+ dout(10) << "create_initial" << dendl;
pending_mdsmap.target_num = g_conf.num_mds;
pending_mdsmap.created = g_clock.now();
print_map(pending_mdsmap);
assert(paxosv >= mdsmap.epoch);
dout(10) << "update_from_paxos paxosv " << paxosv
- << ", my e " << mdsmap.epoch << endl;
+ << ", my e " << mdsmap.epoch << dendl;
// read and decode
mdsmap_bl.clear();
bool success = paxos->read(paxosv, mdsmap_bl);
assert(success);
- dout(10) << "update_from_paxos got " << paxosv << endl;
+ dout(10) << "update_from_paxos got " << paxosv << dendl;
mdsmap.decode(mdsmap_bl);
// new map
- dout(7) << "new map:" << endl;
+ dout(7) << "new map:" << dendl;
print_map(mdsmap);
// bcast map to mds, waiters
{
pending_mdsmap = mdsmap;
pending_mdsmap.epoch++;
- dout(10) << "create_pending e" << pending_mdsmap.epoch << endl;
+ dout(10) << "create_pending e" << pending_mdsmap.epoch << dendl;
}
void MDSMonitor::encode_pending(bufferlist &bl)
{
- dout(10) << "encode_pending e" << pending_mdsmap.epoch << endl;
+ dout(10) << "encode_pending e" << pending_mdsmap.epoch << dendl;
//print_map(pending_mdsmap);
bool MDSMonitor::preprocess_query(Message *m)
{
- dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
{
dout(12) << "preprocess_beacon " << *m
<< " from " << m->get_mds_inst()
- << endl;
+ << dendl;
// fw to leader?
if (!mon->is_leader()) {
- dout(10) << "fw to leader" << endl;
+ dout(10) << "fw to leader" << dendl;
mon->messenger->send_message(m, mon->monmap->get_inst(mon->get_leader()));
return true;
}
// reply to beacon
if (mdsmap.mds_state_seq[from] > seq) {
- dout(7) << "mds_beacon " << *m << " has old seq, ignoring" << endl;
+ dout(7) << "mds_beacon " << *m << " has old seq, ignoring" << dendl;
delete m;
return true;
}
if (mdsmap.mds_state.count(from) == 0) {
if (state == MDSMap::STATE_BOOT)
return false; // need to add to map
- dout(1) << "mds_beacon " << *m << " announcing non-boot state, ignoring" << endl;
+ dout(1) << "mds_beacon " << *m << " announcing non-boot state, ignoring" << dendl;
} else if (mdsmap.mds_state[from] != state) {
if (mdsmap.get_epoch() == m->get_last_epoch_seen())
return false; // need to update map
- dout(10) << "mds_beacon " << *m << " ignoring requested state, because mds hasn't seen latest map" << endl;
+ dout(10) << "mds_beacon " << *m << " ignoring requested state, because mds hasn't seen latest map" << dendl;
}
// we're done.
bool MDSMonitor::prepare_update(Message *m)
{
- dout(7) << "prepare_update " << *m << endl;
+ dout(7) << "prepare_update " << *m << dendl;
switch (m->get_type()) {
// -- this is an update --
dout(12) << "handle_beacon " << *m
<< " from " << m->get_mds_inst()
- << endl;
+ << dendl;
int from = m->get_mds_inst().name.num();
int state = m->get_state();
version_t seq = m->get_seq();
// wants to be (or already is) a specific MDS.
if (!g_conf.mon_allow_mds_bully &&
(!mdsmap.have_inst(from) || mdsmap.get_inst(from) != m->get_mds_inst())) {
- dout(10) << "mds_beacon boot: mds" << from << " is someone else" << endl;
+ dout(10) << "mds_beacon boot: mds" << from << " is someone else" << dendl;
from = -1;
} else {
switch (mdsmap.get_state(from)) {
dout(10) << "mds_beacon boot: mds" << from
<< " was " << MDSMap::get_state_name(mdsmap.get_state(from))
<< ", " << MDSMap::get_state_name(state)
- << endl;
+ << dendl;
}
}
if (from < 0) {
if (from >= 0) {
state = pending_mdsmap.mds_state[from];
dout(10) << "mds_beacon boot: already pending mds" << from
- << " " << MDSMap::get_state_name(state) << endl;
+ << " " << MDSMap::get_state_name(state) << dendl;
delete m;
return false;
}
pending_mdsmap.get_failed_mds_set(failed);
if (!failed.empty()) {
from = *failed.begin();
- dout(10) << "mds_beacon boot: assigned failed mds" << from << endl;
+ dout(10) << "mds_beacon boot: assigned failed mds" << from << dendl;
state = MDSMap::STATE_REPLAY;
}
}
// ok, just pick any unused mds id.
for (from=0; ; ++from) {
if (pending_mdsmap.is_dne(from)) {
- dout(10) << "mds_beacon boot: assigned new mds" << from << endl;
+ dout(10) << "mds_beacon boot: assigned new mds" << from << dendl;
state = MDSMap::STATE_CREATING;
break;
} else if (pending_mdsmap.is_stopped(from)) {
- dout(10) << "mds_beacon boot: assigned stopped mds" << from << endl;
+ dout(10) << "mds_beacon boot: assigned stopped mds" << from << dendl;
state = MDSMap::STATE_STARTING;
break;
}
if (state == MDSMap::STATE_ACTIVE &&
mdsmap.is_creating(from)) {
pending_mdsmap.mds_created.insert(from);
- dout(10) << "mds_beacon created mds" << from << endl;
+ dout(10) << "mds_beacon created mds" << from << dendl;
}
// if starting|creating and degraded|full, go to standby
mdsmap.is_creating(from)) &&
(pending_mdsmap.is_degraded() ||
pending_mdsmap.is_full())) {
- dout(10) << "mds_beacon cluster degraded|full, mds" << from << " will be standby" << endl;
+ dout(10) << "mds_beacon cluster degraded|full, mds" << from << " will be standby" << dendl;
state = MDSMap::STATE_STANDBY;
}
// update the map
dout(10) << "mds_beacon mds" << from << " " << MDSMap::get_state_name(mdsmap.mds_state[from])
<< " -> " << MDSMap::get_state_name(state)
- << endl;
+ << dendl;
// has someone join or leave the cluster?
if (state == MDSMap::STATE_REPLAY ||
else
pending_mdsmap.mds_state_seq.erase(from);
- dout(7) << "pending map now:" << endl;
+ dout(7) << "pending map now:" << dendl;
print_map(pending_mdsmap);
paxos->wait_for_commit(new C_Updated(this, from, m));
void MDSMonitor::_updated(int from, MMDSBeacon *m)
{
if (m->get_state() == MDSMap::STATE_BOOT) {
- dout(10) << "_updated (booted) mds" << from << " " << *m << endl;
+ dout(10) << "_updated (booted) mds" << from << " " << *m << dendl;
mon->osdmon->send_latest(mdsmap.get_inst(from));
} else {
- dout(10) << "_updated mds" << from << " " << *m << endl;
+ dout(10) << "_updated mds" << from << " " << *m << dendl;
}
if (m->get_state() == MDSMap::STATE_STOPPED) {
// send the map manually (they're out of the map, so they won't get it automatic)
else if (m->cmd[1] == "set_target_num" && m->cmd.size() > 2) {
pending_mdsmap.target_num = atoi(m->cmd[2].c_str());
r = 0;
- ss << "target_num = " << pending_mdsmap.target_num << endl;
+ ss << "target_num = " << pending_mdsmap.target_num << dendl;
}
}
if (r == -EINVAL) {
void MDSMonitor::bcast_latest_mds()
{
- dout(10) << "bcast_latest_mds " << mdsmap.get_epoch() << endl;
+ dout(10) << "bcast_latest_mds " << mdsmap.get_epoch() << dendl;
// tell mds
set<int> up;
void MDSMonitor::send_full(entity_inst_t dest)
{
- dout(11) << "send_full to " << dest << endl;
+ dout(11) << "send_full to " << dest << dendl;
mon->messenger->send_message(new MMDSMap(&mdsmap), dest);
}
void MDSMonitor::send_to_waiting()
{
- dout(10) << "send_to_waiting " << mdsmap.get_epoch() << endl;
+ dout(10) << "send_to_waiting " << mdsmap.get_epoch() << dendl;
for (list<entity_inst_t>::iterator i = waiting_for_map.begin();
i != waiting_for_map.end();
i++)
dout(10) << "no beacon from mds" << *p << " since " << last_beacon[*p]
<< ", marking " << mdsmap.get_state_name(newstate)
- << endl;
+ << dendl;
// update map
pending_mdsmap.mds_state[*p] = newstate;
changed = true;
}
} else {
- dout(10) << "no beacons from mds" << *p << ", assuming one " << now << endl;
+ dout(10) << "no beacons from mds" << *p << ", assuming one " << now << dendl;
last_beacon[*p] = now;
}
}
// hrm...
if (!mon->is_leader() ||
!paxos->is_active()) {
- dout(-10) << "do_stop can't stop right now, mdsmap not writeable" << endl;
+ dout(-10) << "do_stop can't stop right now, mdsmap not writeable" << dendl;
return;
}
- dout(7) << "do_stop stopping active mds nodes" << endl;
+ dout(7) << "do_stop stopping active mds nodes" << dendl;
print_map(mdsmap);
for (map<int,int>::iterator p = mdsmap.mds_state.begin();
#include "PGMonitor.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << whoami << (is_starting() ? (const char*)"(starting)":(is_leader() ? (const char*)"(leader)":(is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << " "
{
lock.Lock();
- dout(1) << "init" << endl;
+ dout(1) << "init" << dendl;
// store
char s[80];
void Monitor::shutdown()
{
- dout(1) << "shutdown" << endl;
+ dout(1) << "shutdown" << dendl;
elector.shutdown();
it != osdmon->osdmap.get_osds().end();
it++) {
if (osdmon->osdmap.is_down(*it)) continue;
- dout(10) << "sending shutdown to osd" << *it << endl;
+ dout(10) << "sending shutdown to osd" << *it << dendl;
messenger->send_message(new MGenericMessage(MSG_SHUTDOWN),
osdmon->osdmap.get_inst(*it));
}
{
if (monmap->num_mon == 1) return;
- dout(10) << "call_election" << endl;
+ dout(10) << "call_election" << dendl;
state = STATE_STARTING;
// tell paxos
leader = whoami;
mon_epoch = epoch;
quorum = active;
- dout(10) << "win_election, epoch " << mon_epoch << " quorum is " << quorum << endl;
+ dout(10) << "win_election, epoch " << mon_epoch << " quorum is " << quorum << dendl;
// init paxos
paxos_test.leader_init();
state = STATE_PEON;
mon_epoch = epoch;
leader = l;
- dout(10) << "lose_election, epoch " << mon_epoch << " leader is mon" << leader << endl;
+ dout(10) << "lose_election, epoch " << mon_epoch << " leader is mon" << leader << dendl;
// init paxos
paxos_test.peon_init();
void Monitor::handle_command(MMonCommand *m)
{
- dout(0) << "handle_command " << *m << endl;
+ dout(0) << "handle_command " << *m << dendl;
int r = -1;
string rs = "unrecognized command";
void Monitor::do_stop()
{
- dout(0) << "do_stop -- shutting down" << endl;
+ dout(0) << "do_stop -- shutting down" << dendl;
mdsmon->do_stop();
}
default:
- dout(0) << "unknown message " << *m << endl;
+ dout(0) << "unknown message " << *m << dendl;
assert(0);
}
}
{
assert(m->get_source().is_mon());
if (m->get_source().num() == get_leader()) {
- dout(1) << "shutdown from leader " << m->get_source() << endl;
+ dout(1) << "shutdown from leader " << m->get_source() << dendl;
shutdown();
} else {
- dout(1) << "ignoring shutdown from non-leader " << m->get_source() << endl;
+ dout(1) << "ignoring shutdown from non-leader " << m->get_source() << dendl;
}
delete m;
}
tick_timer = 0;
// ok go.
- dout(11) << "tick" << endl;
+ dout(11) << "tick" << dendl;
osdmon->tick();
mdsmon->tick();
#include "common/Clock.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " store(" << dir <<") "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " store(" << dir <<") "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " store(" << dir <<") "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " store(" << dir <<") "
#include <stdio.h>
#include <sys/types.h>
void MonitorStore::mount()
{
- dout(1) << "mount" << endl;
+ dout(1) << "mount" << dendl;
// verify dir exists
DIR *d = ::opendir(dir.c_str());
if (!d) {
- derr(1) << "basedir " << dir << " dne" << endl;
+ derr(1) << "basedir " << dir << " dne" << dendl;
assert(0);
}
::closedir(d);
void MonitorStore::mkfs()
{
- dout(1) << "mkfs" << endl;
+ dout(1) << "mkfs" << dendl;
char cmd[200];
sprintf(cmd, "test -d %s && /bin/rm -r %s ; mkdir -p %s", dir.c_str(), dir.c_str(), dir.c_str());
- dout(1) << cmd << endl;
+ dout(1) << cmd << dendl;
system(cmd);
}
version_t val = atoi(buf);
if (b) {
- dout(15) << "get_int " << a << "/" << b << " = " << val << endl;
+ dout(15) << "get_int " << a << "/" << b << " = " << val << dendl;
} else {
- dout(15) << "get_int " << a << " = " << val << endl;
+ dout(15) << "get_int " << a << " = " << val << dendl;
}
return val;
}
sprintf(fn, "%s/%s", dir.c_str(), a);
if (b) {
::mkdir(fn, 0755);
- dout(15) << "set_int " << a << "/" << b << " = " << val << endl;
+ dout(15) << "set_int " << a << "/" << b << " = " << val << dendl;
sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
} else {
- dout(15) << "set_int " << a << " = " << val << endl;
+ dout(15) << "set_int " << a << " = " << val << dendl;
}
char vs[30];
{
char fn[200];
if (b) {
- dout(15) << "exists_bl " << a << "/" << b << endl;
+ dout(15) << "exists_bl " << a << "/" << b << dendl;
sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
} else {
- dout(15) << "exists_bl " << a << endl;
+ dout(15) << "exists_bl " << a << dendl;
sprintf(fn, "%s/%s", dir.c_str(), a);
}
struct stat st;
int r = ::stat(fn, &st);
- //dout(15) << "exists_bl stat " << fn << " r=" << r << " errno " << errno << " " << strerror(errno) << endl;
+ //dout(15) << "exists_bl stat " << fn << " r=" << r << " errno " << errno << " " << strerror(errno) << dendl;
return r == 0;
}
int fd = ::open(fn, O_RDONLY);
if (!fd) {
if (b) {
- dout(15) << "get_bl " << a << "/" << b << " DNE" << endl;
+ dout(15) << "get_bl " << a << "/" << b << " DNE" << dendl;
} else {
- dout(15) << "get_bl " << a << " DNE" << endl;
+ dout(15) << "get_bl " << a << " DNE" << dendl;
}
return 0;
}
bufferptr bp(len);
int off = 0;
while (off < len) {
- dout(20) << "reading at off " << off << " of " << len << endl;
+ dout(20) << "reading at off " << off << " of " << len << dendl;
int r = ::read(fd, bp.c_str()+off, len-off);
- if (r < 0) derr(0) << "errno on read " << strerror(errno) << endl;
+ if (r < 0) derr(0) << "errno on read " << strerror(errno) << dendl;
assert(r>0);
off += r;
}
::close(fd);
if (b) {
- dout(15) << "get_bl " << a << "/" << b << " = " << bl.length() << " bytes" << endl;
+ dout(15) << "get_bl " << a << "/" << b << " = " << bl.length() << " bytes" << dendl;
} else {
- dout(15) << "get_bl " << a << " = " << bl.length() << " bytes" << endl;
+ dout(15) << "get_bl " << a << " = " << bl.length() << " bytes" << dendl;
}
return len;
sprintf(fn, "%s/%s", dir.c_str(), a);
if (b) {
::mkdir(fn, 0755);
- dout(15) << "put_bl " << a << "/" << b << " = " << bl.length() << " bytes" << endl;
+ dout(15) << "put_bl " << a << "/" << b << " = " << bl.length() << " bytes" << dendl;
sprintf(fn, "%s/%s/%s", dir.c_str(), a, b);
} else {
- dout(15) << "put_bl " << a << " = " << bl.length() << " bytes" << endl;
+ dout(15) << "put_bl " << a << " = " << bl.length() << " bytes" << dendl;
}
char tfn[200];
it++) {
int r = ::write(fd, it->c_str(), it->length());
if (r != (int)it->length())
- derr(0) << "put_bl_ss ::write() returned " << r << " not " << it->length() << endl;
+ derr(0) << "put_bl_ss ::write() returned " << r << " not " << it->length() << dendl;
if (r < 0)
- derr(0) << "put_bl_ss ::write() errored out, errno is " << strerror(errno) << endl;
+ derr(0) << "put_bl_ss ::write() errored out, errno is " << strerror(errno) << dendl;
}
::fsync(fd);
#include "common/Timer.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
+
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".osd(e" << osdmap.get_epoch() << ") "
// FAKING
void OSDMonitor::fake_osd_failure(int osd, bool down)
{
if (down) {
- dout(1) << "fake_osd_failure DOWN osd" << osd << endl;
+ dout(1) << "fake_osd_failure DOWN osd" << osd << dendl;
pending_inc.new_down[osd].first = osdmap.osd_inst[osd];
pending_inc.new_down[osd].second = false;
} else {
- dout(1) << "fake_osd_failure OUT osd" << osd << endl;
+ dout(1) << "fake_osd_failure OUT osd" << osd << dendl;
pending_inc.new_out.push_back(osd);
}
propose_pending();
void OSDMonitor::fake_osdmap_update()
{
- dout(1) << "fake_osdmap_update" << endl;
+ dout(1) << "fake_osdmap_update" << dendl;
propose_pending();
// tell a random osd
int r = rand() % g_conf.num_osd;
if (osdmap.is_out(r)) {
- dout(1) << "fake_reorg marking osd" << r << " in" << endl;
+ dout(1) << "fake_reorg marking osd" << r << " in" << dendl;
pending_inc.new_in.push_back(r);
} else {
- dout(1) << "fake_reorg marking osd" << r << " out" << endl;
+ dout(1) << "fake_reorg marking osd" << r << " out" << dendl;
pending_inc.new_out.push_back(r);
}
assert(mon->is_leader());
assert(paxos->get_version() == 0);
- dout(1) << "create_initial -- creating initial osdmap from g_conf" << endl;
+ dout(1) << "create_initial -- creating initial osdmap from g_conf" << dendl;
// <HACK set up OSDMap from g_conf>
OSDMap newmap;
// add osds
int nper = ((g_conf.num_osd - 1) / ndom) + 1;
- cerr << ndom << " failure domains, " << nper << " osds each" << endl;
+ cerr << ndom << " failure domains, " << nper << " osds each" << dendl;
int i = 0;
for (int dom=0; dom<ndom; dom++) {
for (int j=0; j<nper; j++) {
newmap.osds.insert(i);
newmap.down_osds[i] = true; // initially DOWN
domain[dom]->add_item(i, 1.0);
- //cerr << "osd" << i << " in domain " << dom << endl;
+ //cerr << "osd" << i << " in domain " << dom << dendl;
i++;
if (i == g_conf.num_osd) break;
}
// root
Bucket *root = new ListBucket(2);
for (int i=0; i<ndom; i++) {
- //cerr << "dom " << i << " w " << domain[i]->get_weight() << endl;
+ //cerr << "dom " << i << " w " << domain[i]->get_weight() << dendl;
root->add_item(domid[i], domain[i]->get_weight());
}
int nroot = newmap.crush.add_bucket(root);
for (map<int,float>::iterator i = g_fake_osd_down.begin();
i != g_fake_osd_down.end();
i++) {
- dout(0) << "will fake osd" << i->first << " DOWN after " << i->second << endl;
+ dout(0) << "will fake osd" << i->first << " DOWN after " << i->second << dendl;
mon->timer.add_event_after(i->second, new C_Mon_FakeOSDFailure(this, i->first, 1));
}
for (map<int,float>::iterator i = g_fake_osd_out.begin();
i != g_fake_osd_out.end();
i++) {
- dout(0) << "will fake osd" << i->first << " OUT after " << i->second << endl;
+ dout(0) << "will fake osd" << i->first << " OUT after " << i->second << dendl;
mon->timer.add_event_after(i->second, new C_Mon_FakeOSDFailure(this, i->first, 0));
}
assert(paxosv >= osdmap.epoch);
dout(15) << "update_from_paxos paxos e " << paxosv
- << ", my e " << osdmap.epoch << endl;
+ << ", my e " << osdmap.epoch << dendl;
if (osdmap.epoch == 0 && paxosv > 1) {
// startup: just load latest full map
epoch_t lastfull = mon->store->get_int("osdmap_full","last_epoch");
if (lastfull) {
- dout(7) << "update_from_paxos startup: loading latest full map e" << lastfull << endl;
+ dout(7) << "update_from_paxos startup: loading latest full map e" << lastfull << dendl;
bufferlist bl;
mon->store->get_bl_sn(bl, "osdmap_full", lastfull);
osdmap.decode(bl);
bool success = paxos->read(osdmap.epoch+1, bl);
assert(success);
- dout(7) << "update_from_paxos applying incremental " << osdmap.epoch+1 << endl;
+ dout(7) << "update_from_paxos applying incremental " << osdmap.epoch+1 << dendl;
OSDMap::Incremental inc;
int off = 0;
inc.decode(bl, off);
{
pending_inc = OSDMap::Incremental(osdmap.epoch+1);
dout(10) << "create_pending e " << pending_inc.epoch
- << endl;
+ << dendl;
}
void OSDMonitor::encode_pending(bufferlist &bl)
{
dout(10) << "encode_pending e " << pending_inc.epoch
- << endl;
+ << dendl;
// finish up pending_inc
pending_inc.ctime = g_clock.now();
for (map<int,pair<entity_inst_t,bool> >::iterator i = pending_inc.new_down.begin();
i != pending_inc.new_down.end();
i++) {
- dout(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << endl;
- derr(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << endl;
+ dout(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
+ derr(0) << " osd" << i->first << " DOWN " << i->second.first << " clean=" << i->second.second << dendl;
mon->messenger->mark_down(i->second.first.addr);
}
for (map<int,entity_inst_t>::iterator i = pending_inc.new_up.begin();
i != pending_inc.new_up.end();
i++) {
- dout(0) << " osd" << i->first << " UP " << i->second << endl;
- derr(0) << " osd" << i->first << " UP " << i->second << endl;
+ dout(0) << " osd" << i->first << " UP " << i->second << dendl;
+ derr(0) << " osd" << i->first << " UP " << i->second << dendl;
}
for (list<int>::iterator i = pending_inc.new_out.begin();
i != pending_inc.new_out.end();
i++) {
- dout(0) << " osd" << *i << " OUT" << endl;
- derr(0) << " osd" << *i << " OUT" << endl;
+ dout(0) << " osd" << *i << " OUT" << dendl;
+ derr(0) << " osd" << *i << " OUT" << dendl;
}
for (list<int>::iterator i = pending_inc.new_in.begin();
i != pending_inc.new_in.end();
i++) {
- dout(0) << " osd" << *i << " IN" << endl;
- derr(0) << " osd" << *i << " IN" << endl;
+ dout(0) << " osd" << *i << " IN" << dendl;
+ derr(0) << " osd" << *i << " IN" << dendl;
}
// encode
bool OSDMonitor::preprocess_query(Message *m)
{
- dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
// READs
bool OSDMonitor::prepare_update(Message *m)
{
- dout(7) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+ dout(7) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
// damp updates
bool OSDMonitor::should_propose_now()
{
// don't propose initial map until _all_ osds boot.
- //dout(10) << "should_propose_now " << pending_inc.new_up.size() << " vs " << osdmap.get_osds().size() << endl;
+ //dout(10) << "should_propose_now " << pending_inc.new_up.size() << " vs " << osdmap.get_osds().size() << dendl;
if (osdmap.epoch == 1 &&
pending_inc.new_up.size() < osdmap.get_osds().size())
return false; // not all up (yet)
void OSDMonitor::handle_osd_getmap(MOSDGetMap *m)
{
- dout(7) << "handle_osd_getmap from " << m->get_source() << " from " << m->get_start_epoch() << endl;
+ dout(7) << "handle_osd_getmap from " << m->get_source() << " from " << m->get_start_epoch() << dendl;
if (m->get_start_epoch())
send_incremental(m->get_source_inst(), m->get_start_epoch());
// weird?
if (!osdmap.have_inst(badboy)) {
- dout(5) << "preprocess_failure dne(/dup?): " << m->get_failed() << ", from " << m->get_from() << endl;
+ dout(5) << "preprocess_failure dne(/dup?): " << m->get_failed() << ", from " << m->get_from() << dendl;
send_incremental(m->get_from(), m->get_epoch()+1);
return true;
}
if (osdmap.get_inst(badboy) != m->get_failed()) {
dout(5) << "preprocess_failure wrong osd: report " << m->get_failed() << " != map's " << osdmap.get_inst(badboy)
- << ", from " << m->get_from() << endl;
+ << ", from " << m->get_from() << dendl;
send_incremental(m->get_from(), m->get_epoch()+1);
return true;
}
// already reported?
if (osdmap.is_down(badboy)) {
- dout(5) << "preprocess_failure dup: " << m->get_failed() << ", from " << m->get_from() << endl;
+ dout(5) << "preprocess_failure dup: " << m->get_failed() << ", from " << m->get_from() << dendl;
send_incremental(m->get_from(), m->get_epoch()+1);
return true;
}
- dout(10) << "preprocess_failure new: " << m->get_failed() << ", from " << m->get_from() << endl;
+ dout(10) << "preprocess_failure new: " << m->get_failed() << ", from " << m->get_from() << dendl;
return false;
}
bool OSDMonitor::prepare_failure(MOSDFailure *m)
{
- dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_from() << endl;
+ dout(1) << "prepare_failure " << m->get_failed() << " from " << m->get_from() << dendl;
// FIXME
// take their word for it
void OSDMonitor::_reported_failure(MOSDFailure *m)
{
- dout(7) << "_reported_failure on " << m->get_failed() << ", telling " << m->get_from() << endl;
+ dout(7) << "_reported_failure on " << m->get_failed() << ", telling " << m->get_from() << dendl;
send_latest(m->get_from(), m->get_epoch());
}
if (osdmap.is_up(from) &&
osdmap.get_inst(from) == m->inst) {
// yup.
- dout(7) << "preprocess_boot dup from " << m->inst << endl;
+ dout(7) << "preprocess_boot dup from " << m->inst << dendl;
_booted(m);
return true;
}
- dout(10) << "preprocess_boot from " << m->inst << endl;
+ dout(10) << "preprocess_boot from " << m->inst << dendl;
return false;
}
bool OSDMonitor::prepare_boot(MOSDBoot *m)
{
- dout(7) << "prepare_boot from " << m->inst << endl;
+ dout(7) << "prepare_boot from " << m->inst << dendl;
assert(m->inst.name.is_osd());
int from = m->inst.name.num();
// does this osd exist?
if (!osdmap.exists(from)) {
- dout(1) << "boot from non-existent osd" << from << endl;
+ dout(1) << "boot from non-existent osd" << from << dendl;
delete m;
return true;
}
// already up? mark down first?
if (osdmap.is_up(from)) {
- dout(7) << "prepare_boot was up, first marking down " << osdmap.get_inst(from) << endl;
+ dout(7) << "prepare_boot was up, first marking down " << osdmap.get_inst(from) << dendl;
assert(osdmap.get_inst(from) != m->inst); // preproces should have caught it
// mark previous guy down
void OSDMonitor::_booted(MOSDBoot *m)
{
- dout(7) << "_booted " << m->inst << endl;
+ dout(7) << "_booted " << m->inst << dendl;
send_latest(m->inst, m->sb.current_epoch);
delete m;
}
void OSDMonitor::send_to_waiting()
{
- dout(10) << "send_to_waiting " << osdmap.get_epoch() << endl;
+ dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl;
for (map<entity_name_t,pair<entity_inst_t,epoch_t> >::iterator i = awaiting_map.begin();
i != awaiting_map.end();
void OSDMonitor::send_latest(entity_inst_t who, epoch_t start)
{
if (paxos->is_readable()) {
- dout(5) << "send_latest to " << who << " now" << endl;
+ dout(5) << "send_latest to " << who << " now" << dendl;
if (start == 0)
send_full(who);
else
send_incremental(who, start);
} else {
- dout(5) << "send_latest to " << who << " later" << endl;
+ dout(5) << "send_latest to " << who << " later" << dendl;
awaiting_map[who.name].first = who;
awaiting_map[who.name].second = start;
}
void OSDMonitor::send_full(entity_inst_t who)
{
- dout(5) << "send_full to " << who << endl;
+ dout(5) << "send_full to " << who << dendl;
mon->messenger->send_message(new MOSDMap(&osdmap), who);
}
void OSDMonitor::send_incremental(entity_inst_t dest, epoch_t from)
{
dout(5) << "send_incremental from " << from << " -> " << osdmap.get_epoch()
- << " to " << dest << endl;
+ << " to " << dest << dendl;
MOSDMap *m = new MOSDMap;
e--) {
bufferlist bl;
if (mon->store->get_bl_sn(bl, "osdmap", e) > 0) {
- dout(20) << "send_incremental inc " << e << " " << bl.length() << " bytes" << endl;
+ dout(20) << "send_incremental inc " << e << " " << bl.length() << " bytes" << dendl;
m->incremental_maps[e] = bl;
}
else if (mon->store->get_bl_sn(bl, "osdmap_full", e) > 0) {
- dout(20) << "send_incremental full " << e << endl;
+ dout(20) << "send_incremental full " << e << dendl;
m->maps[e] = bl;
}
else {
void OSDMonitor::bcast_latest_mds()
{
epoch_t e = osdmap.get_epoch();
- dout(1) << "bcast_latest_mds epoch " << e << endl;
+ dout(1) << "bcast_latest_mds epoch " << e << dendl;
// tell mds
set<int> up;
void OSDMonitor::bcast_latest_osd()
{
epoch_t e = osdmap.get_epoch();
- dout(1) << "bcast_latest_osd epoch " << e << endl;
+ dout(1) << "bcast_latest_osd epoch " << e << dendl;
// tell osds
set<int> osds;
void OSDMonitor::bcast_full_osd()
{
epoch_t e = osdmap.get_epoch();
- dout(1) << "bcast_full_osd epoch " << e << endl;
+ dout(1) << "bcast_full_osd epoch " << e << dendl;
// tell osds
set<int> osds;
down -= i->second;
if (down.sec() >= g_conf.mon_osd_down_out_interval) {
- dout(10) << "tick marking osd" << i->first << " OUT after " << down << " sec" << endl;
+ dout(10) << "tick marking osd" << i->first << " OUT after " << down << " sec" << dendl;
mark_out.push_back(i->first);
}
}
if (get_map_bl(0, bl)) { // FIXME
// yay!
osdmap.decode(bl);
- dout(1) << "init got epoch " << osdmap.get_epoch() << " from store" << endl;
+ dout(1) << "init got epoch " << osdmap.get_epoch() << " from store" << dendl;
// set up pending_inc
pending_inc.epoch = osdmap.get_epoch()+1;
{
assert(mon->is_leader());
- dout(7) << "mark_all_down" << endl;
+ dout(7) << "mark_all_down" << dendl;
for (set<int>::iterator it = osdmap.get_osds().begin();
it != osdmap.get_osds().end();
void OSDMonitor::election_finished()
{
- dout(10) << "election_finished" << endl;
+ dout(10) << "election_finished" << dendl;
if (mon->is_leader()) {
if (g_conf.mkfs) {
} else {
//
epoch_t epoch = mon->store->get_int("osd_epoch");
- dout(10) << " last epoch was " << epoch << endl;
+ dout(10) << " last epoch was " << epoch << dendl;
bufferlist bl, blinc;
int r = mon->store->get_bl_sn(bl, "osdmap_full", epoch);
assert(r>0);
#include "common/Timer.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".pg "
void PGMonitor::create_initial()
{
- dout(1) << "create_initial -- creating initial map" << endl;
+ dout(1) << "create_initial -- creating initial map" << dendl;
}
bool PGMonitor::update_from_paxos()
if (pg_map.version == 0 && paxosv > 1 &&
mon->store->exists_bl_ss("pgmap","latest")) {
// starting up: load latest
- dout(7) << "update_from_paxos startup: loading latest full pgmap" << endl;
+ dout(7) << "update_from_paxos startup: loading latest full pgmap" << dendl;
bufferlist bl;
mon->store->get_bl_ss(bl, "pgmap", "latest");
int off = 0;
bufferlist bl;
bool success = paxos->read(pg_map.version+1, bl);
if (success) {
- dout(7) << "update_from_paxos applying incremental " << pg_map.version+1 << endl;
+ dout(7) << "update_from_paxos applying incremental " << pg_map.version+1 << dendl;
PGMap::Incremental inc;
int off = 0;
inc._decode(bl, off);
pg_map.apply_incremental(inc);
} else {
- dout(7) << "update_from_paxos couldn't read incremental " << pg_map.version+1 << endl;
+ dout(7) << "update_from_paxos couldn't read incremental " << pg_map.version+1 << dendl;
return false;
}
}
{
pending_inc = PGMap::Incremental();
pending_inc.version = pg_map.version + 1;
- dout(10) << "create_pending v " << pending_inc.version << endl;
+ dout(10) << "create_pending v " << pending_inc.version << dendl;
}
void PGMonitor::encode_pending(bufferlist &bl)
{
assert(mon->is_leader());
- dout(10) << "encode_pending v " << pending_inc.version << endl;
+ dout(10) << "encode_pending v " << pending_inc.version << dendl;
assert(paxos->get_version() + 1 == pending_inc.version);
pending_inc._encode(bl);
}
bool PGMonitor::preprocess_query(Message *m)
{
- dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "preprocess_query " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
case MSG_STATFS:
pg_map.pg_stat[p->first].reported < p->second.reported)
return false;
}
- dout(10) << " message contains no new pg stats" << endl;
+ dout(10) << " message contains no new pg stats" << dendl;
return true;
}
bool PGMonitor::prepare_update(Message *m)
{
- dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "prepare_update " << *m << " from " << m->get_source_inst() << dendl;
switch (m->get_type()) {
case MSG_PGSTATS:
return handle_pg_stats((MPGStats*)m);
void PGMonitor::handle_statfs(MStatfs *statfs)
{
- dout(10) << "handle_statfs " << *statfs << " from " << statfs->get_source() << endl;
+ dout(10) << "handle_statfs " << *statfs << " from " << statfs->get_source() << dendl;
// fill out stfs
MStatfsReply *reply = new MStatfsReply(statfs->tid);
bool PGMonitor::handle_pg_stats(MPGStats *stats)
{
- dout(10) << "handle_pg_stats " << *stats << " from " << stats->get_source() << endl;
+ dout(10) << "handle_pg_stats " << *stats << " from " << stats->get_source() << dendl;
for (map<pg_t,pg_stat_t>::iterator p = stats->pg_stat.begin();
p != stats->pg_stat.end();
pg_t pgid;
if ((pg_map.pg_stat.count(pgid) &&
pg_map.pg_stat[pgid].reported >= p->second.reported)) {
- dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported << endl;
+ dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported << dendl;
continue;
}
if (pending_inc.pg_stat_updates.count(pgid) &&
pending_inc.pg_stat_updates[pgid].reported >= p->second.reported) {
dout(15) << " had " << pgid << " from " << pending_inc.pg_stat_updates[pgid].reported
- << " (pending)" << endl;
+ << " (pending)" << dendl;
continue;
}
- dout(15) << " got " << pgid << " reported at " << p->second.reported << endl;
+ dout(15) << " got " << pgid << " reported at " << p->second.reported << dendl;
pending_inc.pg_stat_updates[pgid] = p->second;
// we don't care about consistency; apply to live map.
#include "messages/MMonPaxos.h"
#include "config.h"
-#undef dout
-#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cerr << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
+
+#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cerr << dbeginl << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << dbeginl << g_clock.now() << " mon" << whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxos(" << machine_name << " " << get_statename(state) << " lc " << last_committed << ") "
void Paxos::init()
accepted_pn = mon->store->get_int(machine_name, "accepted_pn");
last_committed = mon->store->get_int(machine_name, "last_committed");
- dout(10) << "init" << endl;
+ dout(10) << "init" << dendl;
}
// ---------------------------------
mon->store->get_bl_sn(uncommitted_value, machine_name, last_committed+1);
dout(10) << "learned uncommitted " << (last_committed+1)
<< " (" << uncommitted_value.length() << " bytes) from myself"
- << endl;
+ << dendl;
}
// pick new pn
accepted_pn = get_new_proposal_number(MAX(accepted_pn, oldpn));
accepted_pn_from = last_committed;
num_last = 1;
- dout(10) << "collect with pn " << accepted_pn << endl;
+ dout(10) << "collect with pn " << accepted_pn << dendl;
// send collect
for (set<int>::const_iterator p = mon->get_quorum().begin();
// peon
void Paxos::handle_collect(MMonPaxos *collect)
{
- dout(10) << "handle_collect " << *collect << endl;
+ dout(10) << "handle_collect " << *collect << dendl;
assert(mon->is_peon()); // mon epoch filter should catch strays
mon->store->get_bl_sn(bl, machine_name, last_committed+1);
assert(bl.length() > 0);
dout(10) << " sharing our accepted but uncommitted value for " << last_committed+1
- << " (" << bl.length() << " bytes)" << endl;
+ << " (" << bl.length() << " bytes)" << dendl;
last->values[last_committed+1] = bl;
last->uncommitted_pn = accepted_pn;
}
// ok, accept it
accepted_pn = collect->pn;
accepted_pn_from = collect->pn_from;
- dout(10) << "accepting pn " << accepted_pn << " from " << accepted_pn_from << endl;
+ dout(10) << "accepting pn " << accepted_pn << " from " << accepted_pn_from << dendl;
mon->store->put_int(accepted_pn, machine_name, "accepted_pn");
} else {
// don't accept!
dout(10) << "NOT accepting pn " << collect->pn << " from " << collect->pn_from
<< ", we already accepted " << accepted_pn << " from " << accepted_pn_from
- << endl;
+ << dendl;
}
last->pn = accepted_pn;
last->pn_from = accepted_pn_from;
if (mon->store->exists_bl_sn(machine_name, v)) {
mon->store->get_bl_sn(last->values[v], machine_name, v);
dout(10) << " sharing " << v << " ("
- << last->values[v].length() << " bytes)" << endl;
+ << last->values[v].length() << " bytes)" << dendl;
}
}
// leader
void Paxos::handle_last(MMonPaxos *last)
{
- dout(10) << "handle_last " << *last << endl;
+ dout(10) << "handle_last " << *last << dendl;
if (!mon->is_leader()) {
- dout(10) << "not leader, dropping" << endl;
+ dout(10) << "not leader, dropping" << dendl;
delete last;
return;
}
// share committed values?
if (last->last_committed < last_committed) {
// share committed values
- dout(10) << "sending commit to " << last->get_source() << endl;
+ dout(10) << "sending commit to " << last->get_source() << dendl;
MMonPaxos *commit = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_COMMIT, machine_id);
for (version_t v = last->last_committed+1;
v <= last_committed;
v++) {
mon->store->get_bl_sn(commit->values[v], machine_name, v);
dout(10) << " sharing " << v << " ("
- << commit->values[v].length() << " bytes)" << endl;
+ << commit->values[v].length() << " bytes)" << dendl;
}
commit->last_committed = last_committed;
mon->messenger->send_message(commit, last->get_source_inst());
v++) {
mon->store->put_bl_sn(last->values[v], machine_name, v);
dout(10) << "committing " << v << " "
- << last->values[v].length() << " bytes" << endl;
+ << last->values[v].length() << " bytes" << dendl;
}
last_committed = last->last_committed;
mon->store->put_int(last_committed, machine_name, "last_committed");
- dout(10) << "last_committed now " << last_committed << endl;
+ dout(10) << "last_committed now " << last_committed << dendl;
}
// do they accept your pn?
if (last->pn > accepted_pn) {
// no, try again.
- dout(10) << " they had a higher pn than us, picking a new one." << endl;
+ dout(10) << " they had a higher pn than us, picking a new one." << dendl;
collect(last->pn);
} else {
// yes, they accepted our pn. great.
num_last++;
dout(10) << " they accepted our pn, we now have "
- << num_last << " peons" << endl;
+ << num_last << " peons" << dendl;
// did this person send back an accepted but uncommitted value?
if (last->uncommitted_pn &&
dout(10) << "we learned an uncommitted value for " << uncommitted_v
<< " pn " << uncommitted_pn
<< " " << uncommitted_value.length() << " bytes"
- << endl;
+ << dendl;
}
// is that everyone?
// did we learn an old value?
if (uncommitted_v == last_committed+1 &&
uncommitted_value.length()) {
- dout(10) << "that's everyone. begin on old learned value" << endl;
+ dout(10) << "that's everyone. begin on old learned value" << dendl;
begin(uncommitted_value);
} else {
// active!
- dout(10) << "that's everyone. active!" << endl;
+ dout(10) << "that's everyone. active!" << dendl;
extend_lease();
// wake people up
{
dout(10) << "begin for " << last_committed+1 << " "
<< v.length() << " bytes"
- << endl;
+ << dendl;
assert(mon->is_leader());
assert(is_active());
++p) {
if (*p == whoami) continue;
- dout(10) << " sending begin to mon" << *p << endl;
+ dout(10) << " sending begin to mon" << *p << dendl;
MMonPaxos *begin = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_BEGIN, machine_id);
begin->values[last_committed+1] = new_value;
begin->last_committed = last_committed;
// peon
void Paxos::handle_begin(MMonPaxos *begin)
{
- dout(10) << "handle_begin " << *begin << endl;
+ dout(10) << "handle_begin " << *begin << dendl;
// can we accept this?
if (begin->pn < accepted_pn) {
- dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << endl;
+ dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << dendl;
delete begin;
return;
}
// yes.
version_t v = last_committed+1;
- dout(10) << "accepting value for " << v << " pn " << accepted_pn << endl;
+ dout(10) << "accepting value for " << v << " pn " << accepted_pn << dendl;
mon->store->put_bl_sn(begin->values[v], machine_name, v);
// reply
// leader
void Paxos::handle_accept(MMonPaxos *accept)
{
- dout(10) << "handle_accept " << *accept << endl;
+ dout(10) << "handle_accept " << *accept << dendl;
int from = accept->get_source().num();
if (accept->pn != accepted_pn) {
// we accepted a higher pn, from some other leader
- dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << endl;
+ dout(10) << " we accepted a higher pn " << accepted_pn << ", ignoring" << dendl;
delete accept;
return;
}
if (last_committed > 0 &&
accept->last_committed < last_committed-1) {
- dout(10) << " this is from an old round, ignoring" << endl;
+ dout(10) << " this is from an old round, ignoring" << dendl;
delete accept;
return;
}
assert(state == STATE_UPDATING);
assert(accepted.count(from) == 0);
accepted.insert(from);
- dout(10) << " now " << accepted << " have accepted" << endl;
+ dout(10) << " now " << accepted << " have accepted" << dendl;
// new majority?
if (accepted.size() == (unsigned)mon->monmap->num_mon/2+1) {
// yay, commit!
// note: this may happen before the lease is reextended (below)
- dout(10) << " got majority, committing" << endl;
+ dout(10) << " got majority, committing" << dendl;
commit();
}
// done?
if (accepted == mon->get_quorum()) {
- dout(10) << " got quorum, done with update" << endl;
+ dout(10) << " got quorum, done with update" << dendl;
// cancel timeout event
mon->timer.cancel_event(accept_timeout_event);
accept_timeout_event = 0;
void Paxos::accept_timeout()
{
- dout(5) << "accept timeout, calling fresh election" << endl;
+ dout(5) << "accept timeout, calling fresh election" << dendl;
accept_timeout_event = 0;
assert(mon->is_leader());
assert(is_updating());
void Paxos::commit()
{
- dout(10) << "commit " << last_committed+1 << endl;
+ dout(10) << "commit " << last_committed+1 << dendl;
// commit locally
last_committed++;
++p) {
if (*p == whoami) continue;
- dout(10) << " sending commit to mon" << *p << endl;
+ dout(10) << " sending commit to mon" << *p << dendl;
MMonPaxos *commit = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_COMMIT, machine_id);
commit->values[last_committed] = new_value;
commit->pn = accepted_pn;
void Paxos::handle_commit(MMonPaxos *commit)
{
- dout(10) << "handle_commit on " << commit->last_committed << endl;
+ dout(10) << "handle_commit on " << commit->last_committed << dendl;
if (!mon->is_peon()) {
- dout(10) << "not a peon, dropping" << endl;
+ dout(10) << "not a peon, dropping" << dendl;
assert(0);
delete commit;
return;
++p) {
assert(p->first == last_committed+1);
last_committed = p->first;
- dout(10) << " storing " << last_committed << " (" << p->second.length() << " bytes)" << endl;
+ dout(10) << " storing " << last_committed << " (" << p->second.length() << " bytes)" << dendl;
mon->store->put_bl_sn(p->second, machine_name, last_committed);
}
mon->store->put_int(last_committed, machine_name, "last_committed");
acked_lease.clear();
acked_lease.insert(whoami);
- dout(7) << "extend_lease now+" << g_conf.mon_lease << " (" << lease_expire << ")" << endl;
+ dout(7) << "extend_lease now+" << g_conf.mon_lease << " (" << lease_expire << ")" << dendl;
// bcast
for (set<int>::const_iterator p = mon->get_quorum().begin();
// sanity
if (!mon->is_peon() ||
last_committed != lease->last_committed) {
- dout(10) << "handle_lease i'm not a peon, or they're not the leader, or the last_committed doesn't match, dropping" << endl;
+ dout(10) << "handle_lease i'm not a peon, or they're not the leader, or the last_committed doesn't match, dropping" << dendl;
delete lease;
return;
}
state = STATE_ACTIVE;
dout(10) << "handle_lease on " << lease->last_committed
- << " now " << lease_expire << endl;
+ << " now " << lease_expire << dendl;
// ack
MMonPaxos *ack = new MMonPaxos(mon->get_epoch(), MMonPaxos::OP_LEASE_ACK, machine_id);
int from = ack->get_source().num();
if (!lease_ack_timeout_event) {
- dout(10) << "handle_lease_ack from " << ack->get_source() << " -- stray (probably since revoked)" << endl;
+ dout(10) << "handle_lease_ack from " << ack->get_source() << " -- stray (probably since revoked)" << dendl;
}
else if (acked_lease.count(from) == 0) {
acked_lease.insert(from);
if (acked_lease == mon->get_quorum()) {
// yay!
dout(10) << "handle_lease_ack from " << ack->get_source()
- << " -- got everyone" << endl;
+ << " -- got everyone" << dendl;
mon->timer.cancel_event(lease_ack_timeout_event);
lease_ack_timeout_event = 0;
} else {
dout(10) << "handle_lease_ack from " << ack->get_source()
<< " -- still need "
<< mon->get_quorum().size() - acked_lease.size()
- << " more" << endl;
+ << " more" << dendl;
}
} else {
dout(10) << "handle_lease_ack from " << ack->get_source()
- << " dup (lagging!), ignoring" << endl;
+ << " dup (lagging!), ignoring" << dendl;
}
delete ack;
void Paxos::lease_ack_timeout()
{
- dout(5) << "lease_ack_timeout -- calling new election" << endl;
+ dout(5) << "lease_ack_timeout -- calling new election" << dendl;
assert(mon->is_leader());
assert(is_active());
void Paxos::lease_timeout()
{
- dout(5) << "lease_timeout -- calling new election" << endl;
+ dout(5) << "lease_timeout -- calling new election" << dendl;
assert(mon->is_peon());
lease_timeout_event = 0;
// write
mon->store->put_int(last_pn, machine_name, "last_pn");
- dout(10) << "get_new_proposal_number = " << last_pn << endl;
+ dout(10) << "get_new_proposal_number = " << last_pn << dendl;
return last_pn;
}
cancel_events();
state = STATE_RECOVERING;
lease_expire = utime_t();
- dout(10) << "leader_init -- starting paxos recovery" << endl;
+ dout(10) << "leader_init -- starting paxos recovery" << dendl;
collect(0);
}
cancel_events();
state = STATE_RECOVERING;
lease_expire = utime_t();
- dout(10) << "peon_init -- i am a peon" << endl;
+ dout(10) << "peon_init -- i am a peon" << dendl;
// no chance to write now!
finish_contexts(waiting_for_writeable, -1);
void Paxos::election_starting()
{
- dout(10) << "election_starting -- canceling timeouts" << endl;
+ dout(10) << "election_starting -- canceling timeouts" << dendl;
cancel_events();
new_value.clear();
{
// election in progress?
if (mon->is_starting()) {
- dout(5) << "election in progress, dropping " << *m << endl;
+ dout(5) << "election in progress, dropping " << *m << dendl;
delete m;
return;
}
bool Paxos::is_readable()
{
- //dout(15) << "is_readable now=" << g_clock.now() << " lease_expire=" << lease_expire << endl;
+ //dout(15) << "is_readable now=" << g_clock.now() << " lease_expire=" << lease_expire << dendl;
return
(mon->is_peon() || mon->is_leader()) &&
is_active() &&
// writeable?
if (!is_writeable()) {
dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes"
- << " -- not writeable" << endl;
+ << " -- not writeable" << dendl;
if (oncommit) {
oncommit->finish(-1);
delete oncommit;
cancel_events();
// ok!
- dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes" << endl;
+ dout(5) << "propose_new_value " << last_committed+1 << " " << bl.length() << " bytes" << dendl;
if (oncommit)
waiting_for_commit.push_back(oncommit);
begin(bl);
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxosservice(" << get_paxos_name(paxos->machine_id) << ") "
-//#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << "." << get_paxos_name(paxos->machine_id) << " "
+
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_paxos) cout << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << ".paxosservice(" << get_paxos_name(paxos->machine_id) << ") "
+//#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_mon) cerr << dbeginl << g_clock.now() << " mon" << mon->whoami << (mon->is_starting() ? (const char*)"(starting)":(mon->is_leader() ? (const char*)"(leader)":(mon->is_peon() ? (const char*)"(peon)":(const char*)"(?\?)"))) << "." << get_paxos_name(paxos->machine_id) << " "
void PaxosService::dispatch(Message *m)
{
- dout(10) << "dispatch " << *m << " from " << m->get_source_inst() << endl;
+ dout(10) << "dispatch " << *m << " from " << m->get_source_inst() << dendl;
// make sure our map is readable and up to date
if (!paxos->is_readable()) {
- dout(10) << " waiting for paxos -> readable" << endl;
+ dout(10) << " waiting for paxos -> readable" << dendl;
paxos->wait_for_readable(new C_RetryMessage(this, m));
return;
}
// leader?
if (!mon->is_leader()) {
// fw to leader
- dout(10) << " fw to leader mon" << mon->get_leader() << endl;
+ dout(10) << " fw to leader mon" << mon->get_leader() << dendl;
mon->messenger->send_message(m, mon->monmap->get_inst(mon->get_leader()));
return;
}
// writeable?
if (!paxos->is_writeable()) {
- dout(10) << " waiting for paxos -> writeable" << endl;
+ dout(10) << " waiting for paxos -> writeable" << dendl;
paxos->wait_for_writeable(new C_RetryMessage(this, m));
return;
}
void PaxosService::_commit()
{
- dout(7) << "_commit" << endl;
+ dout(7) << "_commit" << dendl;
update_from_paxos(); // notify service of new paxos state
if (mon->is_leader()) {
- dout(7) << "_commit creating new pending" << endl;
+ dout(7) << "_commit creating new pending" << dendl;
assert(have_pending == false);
create_pending();
have_pending = true;
void PaxosService::propose_pending()
{
- dout(10) << "propose_pending" << endl;
+ dout(10) << "propose_pending" << dendl;
assert(have_pending);
// finish and encode
void PaxosService::election_finished()
{
- dout(10) << "election_finished" << endl;
+ dout(10) << "election_finished" << dendl;
if (have_pending &&
!mon->is_leader()) {
void PaxosService::_active()
{
- dout(10) << "_active" << endl;
+ dout(10) << "_active" << dendl;
assert(paxos->is_active());
// pull latest from paxos
#include "config.h"
-#include "debug.h"
-#undef dout
#define dout(x) if ((x) <= g_conf.debug_ms) cout << dbeginl << g_clock.now() << " "
#include "messages/MLock.h"
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug) cout << "messenger: "
+
+#define dout(l) if (l<=g_conf.debug) cout << dbeginl << g_clock.now() << " MESSENGER: "
#define DEBUGLVL 10 // debug level of output
break;
default:
- dout(1) << "can't decode unknown message type " << env.type << endl;
+ dout(1) << "can't decode unknown message type " << env.type << dendl;
assert(0);
}
#include <iostream>
#include <fstream>
+#include "debug.h"
#undef dout
-#define dout(l) if (l<=g_conf.debug_ms) cout << g_clock.now() << " -- " << rank.my_addr << " "
-#define derr(l) if (l<=g_conf.debug_ms) cerr << g_clock.now() << " -- " << rank.my_addr << " "
+#define dout(l) if (l<=g_conf.debug_ms) cout << dbeginl << g_clock.now() << " -- " << rank.my_addr << " "
+#define derr(l) if (l<=g_conf.debug_ms) cerr << dbeginl << g_clock.now() << " -- " << rank.my_addr << " "
void Rank::sigint()
{
lock.Lock();
- derr(0) << "got control-c, exiting" << endl;
+ derr(0) << "got control-c, exiting" << dendl;
// force close listener socket
::close(accepter.listen_sd);
void noop_signal_handler(int s)
{
- //cout << "blah_handler got " << s << endl;
+ //dout(0) << "blah_handler got " << s << dendl;
}
int Rank::Accepter::start()
{
// bind to a socket
- dout(10) << "accepter.start" << endl;
+ dout(10) << "accepter.start" << dendl;
char hostname[100];
gethostname(hostname, 100);
- dout(1) << "accepter.start my hostname is " << hostname << endl;
+ dout(1) << "accepter.start my hostname is " << hostname << dendl;
// is there a .ceph_hosts file?
{
if (!ospace) continue;
string host = line.substr(0, ospace);
string addr = line.substr(ospace+1);
- dout(15) << ".ceph_hosts: host '" << host << "' -> '" << addr << "'" << endl;
+ dout(15) << ".ceph_hosts: host '" << host << "' -> '" << addr << "'" << dendl;
if (host == hostname) {
parse_ip_port(addr.c_str(), g_my_addr);
g_my_addr.nonce = getpid(); // FIXME: pid might not be best choice here.
- dout(0) << ".ceph_hosts: my addr is " << g_my_addr << endl;
+ dout(0) << ".ceph_hosts: my addr is " << g_my_addr << dendl;
break;
}
}
/* bind to port */
int rc = bind(listen_sd, (struct sockaddr *) &rank.listen_addr, sizeof(rank.listen_addr));
if (rc < 0)
- derr(0) << "accepter.start unable to bind to " << rank.listen_addr << endl;
+ derr(0) << "accepter.start unable to bind to " << rank.listen_addr << dendl;
assert(rc >= 0);
// what port did we get?
socklen_t llen = sizeof(rank.listen_addr);
getsockname(listen_sd, (sockaddr*)&rank.listen_addr, &llen);
- dout(10) << "accepter.start bound to " << rank.listen_addr << endl;
+ dout(10) << "accepter.start bound to " << rank.listen_addr << dendl;
// listen!
rc = ::listen(listen_sd, 1000);
rank.my_addr.nonce = getpid(); // FIXME: pid might not be best choice here.
}
- dout(10) << "accepter.start my addr is " << rank.my_addr << endl;
+ dout(10) << "accepter.start my addr is " << rank.my_addr << dendl;
// set up signal handler
old_sigint_handler = signal(SIGINT, simplemessenger_sigint);
void *Rank::Accepter::entry()
{
- dout(10) << "accepter starting" << endl;
+ dout(10) << "accepter starting" << dendl;
fd_set fds;
while (!done) {
FD_ZERO(&fds);
FD_SET(listen_sd, &fds);
- dout(20) << "accepter calling select" << endl;
+ dout(20) << "accepter calling select" << dendl;
int r = ::select(listen_sd+1, &fds, 0, &fds, 0);
- dout(20) << "accepter select got " << r << endl;
+ dout(20) << "accepter select got " << r << dendl;
if (done) break;
socklen_t slen = sizeof(addr);
int sd = ::accept(listen_sd, (sockaddr*)&addr, &slen); // FIXME: make this non-blocking.
if (sd > 0) {
- dout(10) << "accepted incoming on sd " << sd << endl;
+ dout(10) << "accepted incoming on sd " << sd << dendl;
rank.lock.Lock();
if (!rank.local.empty()) {
}
rank.lock.Unlock();
} else {
- dout(10) << "no incoming connection?" << endl;
+ dout(10) << "no incoming connection?" << dendl;
}
}
// identify peer
rc = tcp_read(sd, (char*)&peer_addr, sizeof(peer_addr));
if (rc < 0) {
- dout(10) << "pipe(? " << this << ").accept couldn't read peer inst" << endl;
+ dout(10) << "pipe(? " << this << ").accept couldn't read peer inst" << dendl;
::close(sd);
done = true;
return -1;
{
if (rank.rank_pipe.count(peer_addr) == 0) {
// install a pipe!
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr << dendl;
rank.rank_pipe[peer_addr] = this;
} else {
// low ranks' Pipes "win"
if (peer_addr < rank.my_addr) {
dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr
- << ", already had pipe, but switching to this new one" << endl;
+ << ", already had pipe, but switching to this new one" << dendl;
// switch to this new Pipe
rank.rank_pipe[peer_addr]->close(); // close old one
rank.rank_pipe[peer_addr] = this;
} else {
dout(10) << "pipe(" << peer_addr << ' ' << this << ").accept peer is " << peer_addr
- << ", already had pipe, sticking with it" << endl;
+ << ", already had pipe, sticking with it" << dendl;
}
}
}
int Rank::Pipe::connect()
{
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect" << dendl;
// create socket?
sd = socket(AF_INET,SOCK_STREAM,0);
rc = ::connect(sd, (sockaddr*)&tcpaddr, sizeof(myAddr));
if (rc < 0) {
dout(10) << "connect error " << peer_addr
- << ", " << errno << ": " << strerror(errno) << endl;
+ << ", " << errno << ": " << strerror(errno) << dendl;
return rc;
}
entity_addr_t paddr;
rc = tcp_read(sd, (char*)&paddr, sizeof(paddr));
if (!rc) { // bool
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect couldn't read peer addr" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect couldn't read peer addr" << dendl;
return -1;
}
if (peer_addr != paddr) {
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect peer identifies itself as " << paddr << ", wrong guy!" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect peer identifies itself as " << paddr << ", wrong guy!" << dendl;
::close(sd);
sd = 0;
return -1;
rank.lock.Lock();
{
if (rank.rank_pipe.count(peer_addr) == 0) {
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect registering pipe" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect registering pipe" << dendl;
rank.rank_pipe[peer_addr] = this;
} else {
// this is normal.
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect pipe already registered." << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").connect pipe already registered." << dendl;
}
}
rank.lock.Unlock();
void Rank::Pipe::close()
{
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").close" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").close" << dendl;
// unreg ourselves
rank.lock.Lock();
if (rank.rank_pipe.count(peer_addr) &&
rank.rank_pipe[peer_addr] == this) {
dout(10) << "pipe(" << peer_addr << ' ' << this
- << ").close unregistering pipe" << endl;
+ << ").close unregistering pipe" << dendl;
rank.rank_pipe.erase(peer_addr);
}
}
// queue close message?
if (!need_to_send_close) {
dout(10) << "pipe(" << peer_addr << ' ' << this
- << ").close already closing/closed" << endl;
+ << ").close already closing/closed" << dendl;
return;
}
if (!writer_running) {
dout(10) << "pipe(" << peer_addr << ' ' << this
- << ").close not queueing MSG_CLOSE, no writer running" << endl;
+ << ").close not queueing MSG_CLOSE, no writer running" << dendl;
} else {
dout(10) << "pipe(" << peer_addr << ' ' << this
- << ").close queueing MSG_CLOSE" << endl;
+ << ").close queueing MSG_CLOSE" << dendl;
lock.Lock();
q.push_back(new MGenericMessage(MSG_CLOSE));
cond.Signal();
if (!m || m->get_type() == 0) {
if (m) {
delete m;
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader read MSG_CLOSE message" << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader read MSG_CLOSE message" << dendl;
need_to_send_close = false;
} else {
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").reader read null message" << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").reader read null message" << dendl;
}
close();
break;
}
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader got message for " << m->get_dest() << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").reader got message for " << m->get_dest() << dendl;
EntityMessenger *entity = 0;
if (rank.stopped.count(m->get_dest())) {
// ignore it
} else {
- derr(0) << "pipe(" << peer_addr << ' ' << this << ").reader got message " << *m << " for " << m->get_dest() << ", which isn't local" << endl;
+ derr(0) << "pipe(" << peer_addr << ' ' << this << ").reader got message " << *m << " for " << m->get_dest() << ", which isn't local" << dendl;
assert(0); // FIXME do this differently
}
}
lock.Unlock();
if (reap) {
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader queueing for reap" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader queueing for reap" << dendl;
::close(sd);
rank.lock.Lock();
{
if (rc < 0) {
derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error connecting, "
<< errno << ": " << strerror(errno)
- << endl;
+ << dendl;
done = true;
list<Message*> out;
fail(out);
while (!q.empty() || !done) {
if (!q.empty()) {
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer grabbing message(s)" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer grabbing message(s)" << dendl;
// grab outgoing list
list<Message*> out;
Message *m = out.front();
out.pop_front();
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sending " << *m << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sending " << *m << dendl;
// stamp.
m->set_source_addr(rank.my_addr);
// failed!
derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error sending " << *m << " to " << m->get_dest()
<< ", " << errno << ": " << strerror(errno)
- << endl;
+ << dendl;
out.push_front(m);
fail(out);
done = true;
}
// wait
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sleeping" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sleeping" << dendl;
cond.Wait(lock);
}
lock.Unlock();
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer finishing" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer finishing" << dendl;
// reap?
bool reap = false;
lock.Unlock();
if (reap) {
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer queueing for reap" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer queueing for reap" << dendl;
::close(sd);
rank.lock.Lock();
{
Message *Rank::Pipe::read_message()
{
// envelope
- //dout(10) << "receiver.read_message from sd " << sd << endl;
+ //dout(10) << "receiver.read_message from sd " << sd << dendl;
msg_envelope_t env;
if (!tcp_read( sd, (char*)&env, sizeof(env) )) {
dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got envelope type=" << env.type
<< " src " << env.src << " dst " << env.dst
<< " nchunks=" << env.nchunks
- << endl;
+ << dendl;
// payload
bufferlist blist;
blist.push_back(bp);
dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got frag " << i << " of " << env.nchunks
- << " len " << bp.length() << endl;
+ << " len " << bp.length() << dendl;
}
// unmarshall message
Message *m = decode_message(env, blist);
dout(20) << "pipe(" << peer_addr << ' ' << this << ").reader got " << s << " byte message from "
- << m->get_source() << endl;
+ << m->get_source() << dendl;
return m;
}
dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer sending " << m << " " << *m
<< " to " << m->get_dest()
- << endl;
+ << dendl;
// send envelope
int r = tcp_write( sd, (char*)env, sizeof(*env) );
if (r < 0) {
derr(1) << "pipe(" << peer_addr << ' ' << this << ").writer error sending envelope for " << *m
- << " to " << m->get_dest() << endl;
+ << " to " << m->get_dest() << dendl;
need_to_send_close = false;
return -1;
}
for (list<bufferptr>::const_iterator it = blist.buffers().begin();
it != blist.buffers().end();
it++) {
- dout(10) << "pipe(" << peer_addr << ' ' << this << ").writer tcp_sending frag " << i << " len " << (*it).length() << endl;
+ dout(10) << "pipe(" << peer_addr << ' ' << this << ").writer tcp_sending frag " << i << " len " << (*it).length() << dendl;
int32_t size = (*it).length();
r = tcp_write( sd, (char*)&size, sizeof(size) );
if (r < 0) {
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending chunk len for " << *m << " to " << m->get_dest() << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending chunk len for " << *m << " to " << m->get_dest() << dendl;
need_to_send_close = false;
return -1;
}
r = tcp_write( sd, (*it).c_str(), size );
if (r < 0) {
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data chunk for " << *m << " to " << m->get_dest() << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data chunk for " << *m << " to " << m->get_dest() << dendl;
need_to_send_close = false;
return -1;
}
int32_t size = blist.length();
r = tcp_write( sd, (char*)&size, sizeof(size) );
if (r < 0) {
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data len for " << *m << " to " << m->get_dest() << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data len for " << *m << " to " << m->get_dest() << dendl;
need_to_send_close = false;
return -1;
}
- dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer data len is " << size << " in " << blist.buffers().size() << " buffers" << endl;
+ dout(20) << "pipe(" << peer_addr << ' ' << this << ").writer data len is " << size << " in " << blist.buffers().size() << " buffers" << dendl;
for (list<bufferptr>::const_iterator it = blist.buffers().begin();
it != blist.buffers().end();
if ((*it).length() == 0) continue; // blank buffer.
r = tcp_write( sd, (char*)(*it).c_str(), (*it).length() );
if (r < 0) {
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data megachunk for " << *m << " to " << m->get_dest() << " : len " << (*it).length() << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").writer error sending data megachunk for " << *m << " to " << m->get_dest() << " : len " << (*it).length() << dendl;
need_to_send_close = false;
return -1;
}
void Rank::Pipe::fail(list<Message*>& out)
{
- derr(10) << "pipe(" << peer_addr << ' ' << this << ").fail" << endl;
+ derr(10) << "pipe(" << peer_addr << ' ' << this << ").fail" << dendl;
// FIXME: possible race before i reclaim lock here?
Dispatcher *dis = mgr->get_dispatcher();
if (mgr->is_stopped()) {
// ignore.
- dout(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << *q.front() << ", dispatcher stopping, ignoring." << endl;
+ dout(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << *q.front() << ", dispatcher stopping, ignoring." << dendl;
delete q.front();
} else {
by_dis[dis][q.front()->get_dest()].push_back(q.front());
for (list<Message*>::iterator k = j->second.begin();
k != j->second.end();
++k) {
- derr(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << **k << " to " << (*k)->get_dest_inst() << endl;
+ derr(1) << "pipe(" << peer_addr << ' ' << this << ").fail on " << **k << " to " << (*k)->get_dest_inst() << dendl;
if (i->first)
i->first->ms_handle_failure(*k, (*k)->get_dest_inst());
}
/*
void Rank::set_listen_addr(tcpaddr_t& a)
{
- dout(10) << "set_listen_addr " << a << endl;
+ dout(10) << "set_listen_addr " << a << dendl;
memcpy((char*)&listen_addr.sin_addr.s_addr, (char*)&a.sin_addr.s_addr, 4);
listen_addr.sin_port = a.sin_port;
}
<< " <-- " << m->get_source_inst()
<< " ---- " << *m
<< " -- " << m
- << endl;
+ << dendl;
assert(local.count(m->get_dest()));
local[m->get_dest()]->dispatch(m);
*/
void Rank::reaper()
{
- dout(10) << "reaper" << endl;
+ dout(10) << "reaper" << dendl;
assert(lock.is_locked());
while (!pipe_reap_queue.empty()) {
Pipe *p = pipe_reap_queue.front();
- dout(10) << "reaper reaping pipe " << p->get_peer_addr() << endl;
+ dout(10) << "reaper reaping pipe " << p->get_peer_addr() << dendl;
pipe_reap_queue.pop_front();
assert(pipes.count(p));
pipes.erase(p);
p->join();
- dout(10) << "reaper reaped pipe " << p->get_peer_addr() << endl;
+ dout(10) << "reaper reaped pipe " << p->get_peer_addr() << dendl;
delete p;
}
}
{
lock.Lock();
if (started) {
- dout(10) << "start_rank already started" << endl;
+ dout(10) << "start_rank already started" << dendl;
lock.Unlock();
return 0;
}
- dout(10) << "start_rank" << endl;
+ dout(10) << "start_rank" << dendl;
lock.Unlock();
// bind to a socket
lock.Lock();
- dout(1) << "start_rank at " << listen_addr << endl;
+ dout(1) << "start_rank at " << listen_addr << dendl;
started = true;
lock.Unlock();
return 0;
assert(rank.lock.is_locked());
assert(addr != rank.my_addr);
- dout(10) << "connect_rank to " << addr << endl;
+ dout(10) << "connect_rank to " << addr << dendl;
// create pipe
Pipe *pipe = new Pipe(addr);
*/
Rank::EntityMessenger *Rank::register_entity(entity_name_t name)
{
- dout(10) << "register_entity " << name << endl;
+ dout(10) << "register_entity " << name << dendl;
lock.Lock();
// create messenger
void Rank::unregister_entity(EntityMessenger *msgr)
{
lock.Lock();
- dout(10) << "unregister_entity " << msgr->get_myname() << endl;
+ dout(10) << "unregister_entity " << msgr->get_myname() << dendl;
// remove from local directory.
entity_name_t name = msgr->get_myname();
if (dest_addr == my_addr) {
if (local.count(dest)) {
// local
- dout(20) << "submit_message " << *m << " dest " << dest << " local" << endl;
+ dout(20) << "submit_message " << *m << " dest " << dest << " local" << dendl;
if (g_conf.ms_single_dispatch) {
_submit_single_dispatch(m);
} else {
entity = local[dest];
}
} else {
- derr(0) << "submit_message " << *m << " dest " << dest << " " << dest_addr << " local but not in local map?" << endl;
+ derr(0) << "submit_message " << *m << " dest " << dest << " " << dest_addr << " local but not in local map?" << dendl;
//assert(0); // hmpf, this is probably mds->mon beacon from newsyn.
}
}
else {
// remote.
if (rank_pipe.count( dest_addr )) {
- dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", already connected." << endl;
+ dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", already connected." << dendl;
// connected.
pipe = rank_pipe[ dest_addr ];
} else {
- dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", connecting." << endl;
+ dout(20) << "submit_message " << *m << " dest " << dest << " remote, " << dest_addr << ", connecting." << dendl;
// not connected.
pipe = connect_rank( dest_addr );
}
// do it
if (entity) {
// local!
- dout(20) << "submit_message " << *m << " dest " << dest << " local, queueing" << endl;
+ dout(20) << "submit_message " << *m << " dest " << dest << " local, queueing" << dendl;
entity->queue_message(m);
}
else if (pipe) {
// remote!
- dout(20) << "submit_message " << *m << " dest " << dest << " remote, sending" << endl;
+ dout(20) << "submit_message " << *m << " dest " << dest << " remote, sending" << dendl;
pipe->send(m);
}
}
reaper();
if (local.empty()) {
- dout(10) << "wait: everything stopped" << endl;
+ dout(10) << "wait: everything stopped" << dendl;
break; // everything stopped.
} else {
- dout(10) << "wait: local still has " << local.size() << " items, waiting" << endl;
+ dout(10) << "wait: local still has " << local.size() << " items, waiting" << dendl;
}
wait_cond.Wait(lock);
lock.Unlock();
// done! clean up.
- dout(-10) << "wait: stopping accepter thread" << endl;
+ dout(-10) << "wait: stopping accepter thread" << dendl;
accepter.stop();
- dout(-10) << "wait: stopped accepter thread" << endl;
+ dout(-10) << "wait: stopped accepter thread" << dendl;
// stop dispatch thread
if (g_conf.ms_single_dispatch) {
- dout(10) << "wait: stopping dispatch thread" << endl;
+ dout(10) << "wait: stopping dispatch thread" << dendl;
lock.Lock();
single_dispatch_stop = true;
single_dispatch_cond.Signal();
// reap pipes
lock.Lock();
{
- dout(10) << "wait: closing pipes" << endl;
+ dout(10) << "wait: closing pipes" << dendl;
list<Pipe*> toclose;
for (hash_map<entity_addr_t,Pipe*>::iterator i = rank_pipe.begin();
i != rank_pipe.end();
i++)
(*i)->close();
- dout(10) << "wait: waiting for pipes " << pipes << " to close" << endl;
+ dout(10) << "wait: waiting for pipes " << pipes << " to close" << dendl;
while (!pipes.empty()) {
wait_cond.Wait(lock);
reaper();
}
lock.Unlock();
- dout(10) << "wait: done." << endl;
- dout(1) << "shutdown complete." << endl;
+ dout(10) << "wait: done." << dendl;
+ dout(1) << "shutdown complete." << dendl;
}
while (!ls.empty()) {
if (stop) {
dout(1) << "dispatch: stop=true, discarding " << ls.size()
- << " messages in dispatch queue" << endl;
+ << " messages in dispatch queue" << dendl;
break;
}
Message *m = ls.front();
<< " <-- " << m->get_source_inst()
<< " ---- " << *m
<< " -- " << m
- << endl;
+ << dendl;
dispatch(m);
}
}
void Rank::EntityMessenger::ready()
{
- dout(10) << "ready " << get_myaddr() << endl;
+ dout(10) << "ready " << get_myaddr() << dendl;
if (g_conf.ms_single_dispatch) {
rank.lock.Lock();
int Rank::EntityMessenger::shutdown()
{
- dout(10) << "shutdown " << get_myaddr() << endl;
+ dout(10) << "shutdown " << get_myaddr() << dendl;
// stop my dispatch thread
if (dispatch_thread.am_self()) {
- dout(10) << "shutdown i am dispatch, setting stop flag" << endl;
+ dout(10) << "shutdown i am dispatch, setting stop flag" << dendl;
stop = true;
} else {
- dout(10) << "shutdown i am not dispatch, setting stop flag and joining thread." << endl;
+ dout(10) << "shutdown i am not dispatch, setting stop flag and joining thread." << dendl;
lock.Lock();
stop = true;
cond.Signal();
void Rank::EntityMessenger::suicide()
{
- dout(10) << "suicide " << get_myaddr() << endl;
+ dout(10) << "suicide " << get_myaddr() << dendl;
shutdown();
// hmm, or exit(0)?
}
<< " --> " << dest.name << " " << dest.addr
<< " -- " << *m
<< " -- " << m
- << endl;
+ << dendl;
rank.submit_message(m, dest.addr);
rank.lock.Lock();
{
entity_name_t oldname = get_myname();
- dout(10) << "reset_myname " << oldname << " to " << newname << endl;
+ dout(10) << "reset_myname " << oldname << " to " << newname << dendl;
rank.local.erase(oldname);
rank.local[newname] = this;
/*
if (entity_map.count(a) &&
entity_map[a] > inst) {
- dout(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << endl;
- derr(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << endl;
+ dout(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << dendl;
+ derr(10) << "mark_down " << a << " inst " << inst << " < " << entity_map[a] << dendl;
// do nothing!
} else {
if (entity_map.count(a) == 0) {
// don't know it
- dout(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << endl;
- derr(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << endl;
+ dout(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << dendl;
+ derr(10) << "mark_down " << a << " inst " << inst << " ... unknown by me" << dendl;
} else {
// know it
assert(entity_map[a] <= inst);
- dout(10) << "mark_down " << a << " inst " << inst << endl;
- derr(10) << "mark_down " << a << " inst " << inst << endl;
+ dout(10) << "mark_down " << a << " inst " << inst << dendl;
+ derr(10) << "mark_down " << a << " inst " << inst << dendl;
entity_map.erase(a);
while (len > 0) {
int got = ::recv( sd, buf, len, 0 );
if (got == 0) {
- dout(18) << "tcp_read socket " << sd << " closed" << endl;
+ generic_dout(18) << "tcp_read socket " << sd << " closed" << dendl;
return false;
}
if (got < 0) {
- dout(18) << "tcp_read bailing with " << got << endl;
+ generic_dout(18) << "tcp_read bailing with " << got << dendl;
return false;
}
assert(got >= 0);
len -= got;
buf += got;
- //dout(DBL) << "tcp_read got " << got << ", " << len << " left" << endl;
+ //generic_dout(DBL) << "tcp_read got " << got << ", " << len << " left" << dendl;
}
return true;
}
int tcp_write(int sd, char *buf, int len)
{
- //dout(DBL) << "tcp_write writing " << len << endl;
+ //generic_dout(DBL) << "tcp_write writing " << len << dendl;
assert(len > 0);
while (len > 0) {
int did = ::send( sd, buf, len, 0 );
if (did < 0) {
- dout(1) << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl;
- //cerr << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl;
+ generic_dout(1) << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << dendl;
+ //cerr << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << dendl;
}
//assert(did >= 0);
if (did < 0) return did;
len -= did;
buf += did;
- //dout(DBL) << "tcp_write did " << did << ", " << len << " left" << endl;
+ //generic_dout(DBL) << "tcp_write did " << did << ", " << len << " left" << dendl;
}
return 0;
}
while (len > 0) {
int got = ::recv( sd, buf, len, 0 );
if (got <= 0) {
- //dout(18) << "tcp_read socket " << sd << " closed" << endl;
+ //generic_dout(18) << "tcp_read socket " << sd << " closed" << dendl;
return false;
}
len -= got;
buf += got;
- //dout(DBL) << "tcp_read got " << got << ", " << len << " left" << endl;
+ //generic_dout(DBL) << "tcp_read got " << got << ", " << len << " left" << dendl;
}
return true;
}
inline int tcp_write(int sd, char *buf, int len) {
- //dout(DBL) << "tcp_write writing " << len << endl;
+ //generic_dout(DBL) << "tcp_write writing " << len << dendl;
assert(len > 0);
while (len > 0) {
int did = ::send( sd, buf, len, 0 );
if (did < 0) {
- //dout(1) << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl;
- //cerr << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl;
+ //generic_dout(1) << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << dendl;
+ //cerr << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << dendl;
return did;
}
len -= did;
buf += did;
- //dout(DBL) << "tcp_write did " << did << ", " << len << " left" << endl;
+ //generic_dout(DBL) << "tcp_write did " << did << ", " << len << " left" << dendl;
}
return 0;
}
public:
void finish(int) {
utime_t now = g_clock.now() - tick_start;
- dout(0) << "tick +" << g_conf.tick << " -> " << now << " (" << tick_count << ")" << endl;
+ cout << "tick +" << g_conf.tick << " -> " << now << " (" << tick_count << ")" << endl;
tick_count += g_conf.tick;
utime_t next = tick_start;
next.sec_ref() += tick_count;
void finish(int) {
int size = &g_conf.debug_after - &g_conf.debug;
memcpy((char*)&g_conf.debug, (char*)&g_debug_after_conf.debug, size);
- dout(0) << "debug_after flipping debug settings" << endl;
+ cout << "debug_after flipping debug settings" << endl;
}
};
nclients++;
}
- if (!clientlist.empty()) dout(2) << "i have " << clientlist << endl;
+ if (!clientlist.empty()) generic_dout(2) << "i have " << clientlist << dendl;
for (set<int>::iterator it = clientlist.begin();
it != clientlist.end();
if (myrank && !started) {
- //dout(1) << "IDLE" << endl;
+ //dout(1) << "IDLE" << dendl;
cerr << "idle at " << rank.my_addr << " " << hostname << "." << pid << endl;
//rank.stop_rank();
}
using namespace std;
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cout << "bdbstore(" << device << ")@" << __LINE__ << "."
-#undef derr
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cerr << "bdbstore(" << device << ")@" << __LINE__ << "."
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cout << dbeginl << "bdbstore(" << device << ")@" << __LINE__ << "."
+#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_bdbstore) cerr << dbeginl << "bdbstore(" << device << ")@" << __LINE__ << "."
#define CLEANUP(onsafe) do { \
- dout(6) << "DELETE " << hex << onsafe << dec << endl; \
+ dout(6) << "DELETE " << hex << onsafe << dec << dendl; \
delete onsafe; \
} while (0)
#define COMMIT(onsafe) do { \
- dout(6) << "COMMIT " << hex << onsafe << dec << endl; \
+ dout(6) << "COMMIT " << hex << onsafe << dec << dendl; \
sync(onsafe); \
} while (0)
| DB_PRIVATE);
if (envp->open (NULL, env_flags, 0) != 0)
{
- std::cerr << "failed to open environment " << std::endl;
+ std::cerr << "failed to open environment " << std::dendl;
assert(0);
}
return envp;
if ((ret = db->open (NULL, device.c_str(), NULL, type, flags, 0)) != 0)
{
derr(1) << "failed to open database: " << device << ": "
- << db_strerror(ret) << std::endl;
+ << db_strerror(ret) << std::dendl;
return -EINVAL;
}
opened = true;
int OSBDB::mount()
{
- dout(2) << "mount " << device << endl;
+ dout(2) << "mount " << device << dendl;
if (mounted)
{
- dout(4) << "..already mounted" << endl;
+ dout(4) << "..already mounted" << dendl;
return 0;
}
int ret;
if ((ret = opendb ()) != 0)
{
- dout(4) << "..returns " << ret << endl;
+ dout(4) << "..returns " << ret << dendl;
return ret;
}
}
if (db->get (NULL, &key, &value, 0) != 0)
{
- dout(4) << "..get superblock fails" << endl;
+ dout(4) << "..get superblock fails" << dendl;
return -EINVAL; // XXX how to say "badly formed fs?"
}
- dout(3) << ".mount " << super << endl;
+ dout(3) << ".mount " << super << dendl;
if (super.version != OSBDB_THIS_VERSION)
{
- dout(4) << "version mismatch (" << super.version << ")" << endl;
+ dout(4) << "version mismatch (" << super.version << ")" << dendl;
return -EINVAL;
}
db->get_flags (&flags);
dout(1) << "mounted version " << OSBDB_THIS_VERSION << "; Btree; "
<< "min keys per page: " << minkey << "; flags: "
- << hex << flags << dec << endl;
+ << hex << flags << dec << dendl;
cout << dec;
}
else
dout(1) << "mounted version " << OSBDB_THIS_VERSION << "; Hash; "
<< "fill factor: " << ffactor
<< " table size: " << nelem << "; flags: "
- << hex << flags << dec << endl;
+ << hex << flags << dec << dendl;
cout << dec;
}
mounted = true;
- dout(4) << "..mounted" << endl;
+ dout(4) << "..mounted" << dendl;
return 0;
}
if (!mounted)
return -EINVAL;
- dout(2) << "umount" << endl;
+ dout(2) << "umount" << dendl;
int ret;
if (opened)
env->log_flush (NULL);
if ((ret = env->lsn_reset (device.c_str(), 0)) != 0)
{
- derr(1) << "lsn_reset: " << db_strerror (ret) << endl;
+ derr(1) << "lsn_reset: " << db_strerror (ret) << dendl;
}
}
if ((ret = db->close (0)) != 0)
{
- derr(1) << "close: " << db_strerror(ret) << endl;
+ derr(1) << "close: " << db_strerror(ret) << dendl;
return -EINVAL;
}
delete db;
}
mounted = false;
opened = false;
- dout(4) << "..unmounted" << endl;
+ dout(4) << "..unmounted" << dendl;
return 0;
}
if (mounted)
return -EINVAL;
- dout(2) << "mkfs" << endl;
+ dout(2) << "mkfs" << dendl;
string d = env_dir;
d += device;
DB_CREATE, true)) != 0)
{
derr(1) << "failed to open database: " << device << ": "
- << db_strerror(ret) << std::endl;
+ << db_strerror(ret) << std::dendl;
return -EINVAL;
}
opened = true;
- dout(3) << "..opened " << device << endl;
+ dout(3) << "..opened " << device << dendl;
uint32_t c;
ret = db->truncate (NULL, &c, 0);
if (ret != 0)
{
- derr(1) << "db truncate failed: " << db_strerror (ret) << endl;
+ derr(1) << "db truncate failed: " << db_strerror (ret) << dendl;
return -EIO; // ???
}
sb.version = OSBDB_THIS_VERSION;
Dbt value (&sb, sizeof (sb));
- dout(3) << "..writing superblock" << endl;
+ dout(3) << "..writing superblock" << dendl;
if ((ret = db->put (NULL, &key, &value, 0)) != 0)
{
derr(1) << "failed to write superblock: " << db_strerror (ret)
- << endl;
+ << dendl;
return -EIO;
}
- dout(3) << "..wrote superblock" << endl;
- dout(4) << "..mkfs done" << endl;
+ dout(3) << "..wrote superblock" << dendl;
+ dout(4) << "..mkfs done" << dendl;
return 0;
}
int OSBDB::pick_object_revision_lt(object_t& oid)
{
// Not really needed.
- dout(0) << "pick_object_revision_lt " << oid << endl;
+ dout(0) << "pick_object_revision_lt " << oid << dendl;
return -ENOSYS;
}
bool OSBDB::exists(object_t oid)
{
- dout(2) << "exists " << oid << endl;
+ dout(2) << "exists " << oid << dendl;
struct stat st;
bool ret = (stat (oid, &st) == 0);
- dout(4) << "..returns " << ret << endl;
+ dout(4) << "..returns " << ret << dendl;
return ret;
}
if (::statfs (device.c_str(), st) != 0)
{
int ret = -errno;
- derr(1) << "statfs returns " << ret << endl;
+ derr(1) << "statfs returns " << ret << dendl;
return ret;
}
st->f_type = OSBDB_MAGIC;
- dout(4) << "..statfs OK" << endl;
+ dout(4) << "..statfs OK" << dendl;
return 0;
}
{
if (!mounted)
{
- dout(4) << "not mounted!" << endl;
+ dout(4) << "not mounted!" << dendl;
return -EINVAL;
}
- dout(2) << "stat " << oid << endl;
+ dout(2) << "stat " << oid << dendl;
object_inode_key ikey = new_object_inode_key(oid);
stored_object obj;
value.set_flags (DB_DBT_USERMEM);
value.set_ulen (sizeof (obj));
- dout(3) << " lookup " << ikey << endl;
+ dout(3) << " lookup " << ikey << dendl;
int ret;
if ((ret = db->get (NULL, &key, &value, 0)) != 0)
{
- derr(1) << " get returned " << ret << endl;
+ derr(1) << " get returned " << ret << dendl;
return -ENOENT;
}
st->st_size = obj.length;
- dout(3) << "stat length:" << obj.length << endl;
- dout(4) << "..stat OK" << endl;
+ dout(3) << "stat length:" << obj.length << dendl;
+ dout(4) << "..stat OK" << dendl;
return 0;
}
{
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
scoped_lock __lock(&lock);
- dout(2) << "remove " << oid << endl;
+ dout(2) << "remove " << oid << dendl;
DbTxn *txn = NULL;
if (transactional)
int ret;
if ((ret = db->del (txn, &key, 0)) != 0)
{
- derr(1) << ".del returned error: " << db_strerror (ret) << endl;
+ derr(1) << ".del returned error: " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
Dbt ikey (&_ikey, sizeof_object_inode_key());
if ((ret = db->del (txn, &ikey, 0)) != 0)
{
- derr(1) << ".del returned error: " << db_strerror (ret) << endl;
+ derr(1) << ".del returned error: " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
Dbt akey (&aid, sizeof (aid));
if ((ret = db->del (txn, &akey, 0)) != 0)
{
- derr(1) << ".del returns error: " << db_strerror (ret) << endl;
+ derr(1) << ".del returns error: " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
}
if ((ret = db->del (txn, &askey, 0)) != 0)
{
- derr(1) << ".del returns error: " << db_strerror (ret) << endl;
+ derr(1) << ".del returns error: " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
txn->commit (0);
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..remove OK" << endl;
+ dout(4) << "..remove OK" << dendl;
return 0;
}
int OSBDB::truncate(object_t oid, off_t size, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
scoped_lock __lock(&lock);
- dout(2) << "truncate " << size << endl;
+ dout(2) << "truncate " << size << dendl;
if (size > 0xFFFFFFFF)
{
- derr(1) << "object size too big!" << endl;
+ derr(1) << "object size too big!" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -ENOSPC;
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- dout(4) << "..returns -ENOENT" << endl;
+ dout(4) << "..returns -ENOENT" << dendl;
return -ENOENT;
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".updating object failed" << endl;
+ derr(1) << ".updating object failed" << dendl;
return -EIO;
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".updating object info failed" << endl;
+ derr(1) << ".updating object info failed" << dendl;
return -EIO;
}
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".updating object info failed" << endl;
+ derr(1) << ".updating object info failed" << dendl;
return -EIO;
}
if (size == 0)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".updating object failed" << endl;
+ derr(1) << ".updating object failed" << dendl;
return -EIO;
}
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".getting old object failed" << endl;
+ derr(1) << ".getting old object failed" << dendl;
return -EIO;
}
auto_ptr<char> ovalPtr ((char *) oval.get_data());
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".putting new object failed" << endl;
+ derr(1) << ".putting new object failed" << dendl;
return -EIO;
}
}
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..truncate OK" << endl;
+ dout(4) << "..truncate OK" << dendl;
return 0;
}
{
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
return -EINVAL;
}
dout(2) << "read " << oid << " " << offset << " "
- << len << endl;
+ << len << dendl;
if (bl.length() < len)
{
ival.set_flags (DB_DBT_USERMEM);
ival.set_ulen (sizeof(obj));
- dout(3) << "..get " << _ikey << endl;
+ dout(3) << "..get " << _ikey << dendl;
int ret;
if ((ret = db->get (txn, &ikey, &ival, 0)) != 0)
{
if (txn)
txn->abort();
- derr(1) << "get returned " << db_strerror (ret) << endl;
+ derr(1) << "get returned " << db_strerror (ret) << dendl;
return -ENOENT;
}
- dout(3) << "..object has size " << obj.length << endl;
+ dout(3) << "..object has size " << obj.length << dendl;
if (offset == 0 && len >= obj.length)
{
len = obj.length;
- dout(3) << "..doing full read of " << len << endl;
+ dout(3) << "..doing full read of " << len << dendl;
oid_t id;
mkoid (id, oid);
Dbt key (&id, sizeof (oid_t));
Dbt value (bl.c_str(), len);
value.set_ulen (len);
value.set_flags (DB_DBT_USERMEM);
- dout(3) << "..getting " << oid << endl;
+ dout(3) << "..getting " << oid << dendl;
if ((ret = db->get (txn, &key, &value, 0)) != 0)
{
- derr(1) << ".get returned " << db_strerror (ret) << endl;
+ derr(1) << ".get returned " << db_strerror (ret) << dendl;
if (txn)
txn->abort();
return -EIO;
{
if (offset > obj.length)
{
- dout(2) << "..offset out of range" << endl;
+ dout(2) << "..offset out of range" << dendl;
return 0;
}
if (offset + len > obj.length)
len = obj.length - (size_t) offset;
- dout(3) << "..doing partial read of " << len << endl;
+ dout(3) << "..doing partial read of " << len << dendl;
oid_t id;
mkoid (id, oid);
Dbt key (&id, sizeof (oid));
Dbt value;
char *data = bl.c_str();
- dout(3) << ".bufferlist c_str returned " << ((void*) data) << endl;
+ dout(3) << ".bufferlist c_str returned " << ((void*) data) << dendl;
value.set_data (data);
value.set_doff ((size_t) offset);
value.set_dlen (len);
value.set_ulen (len);
value.set_flags (DB_DBT_USERMEM | DB_DBT_PARTIAL);
- dout(3) << "..getting " << oid << endl;
+ dout(3) << "..getting " << oid << dendl;
if ((ret = db->get (txn, &key, &value, 0)) != 0)
{
- derr(1) << ".get returned " << db_strerror (ret) << endl;
+ derr(1) << ".get returned " << db_strerror (ret) << dendl;
if (txn)
txn->abort();
return -EIO;
if (txn)
txn->commit (0);
- dout(4) << "..read OK, returning " << len << endl;
+ dout(4) << "..read OK, returning " << len << dendl;
return len;
}
int OSBDB::write(object_t oid, off_t offset, size_t len,
bufferlist& bl, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
scoped_lock __lock(&lock);
dout(2) << "write " << oid << " " << offset << " "
- << len << endl;
+ << len << dendl;
if (offset > 0xFFFFFFFFL || offset + len > 0xFFFFFFFFL)
{
- derr(1) << "object too big" << endl;
+ derr(1) << "object too big" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -ENOSPC;
ival.set_flags (DB_DBT_USERMEM);
int ret;
- dout(3) << "..getting " << _ikey << endl;
+ dout(3) << "..getting " << _ikey << dendl;
if (db->get (txn, &ikey, &ival, 0) != 0)
{
- dout(3) << "..writing new object" << endl;
+ dout(3) << "..writing new object" << dendl;
// New object.
obj.length = (size_t) offset + len;
dout(3) << "..mapping " << _ikey << " => "
- << obj << endl;
+ << obj << dendl;
if ((ret = db->put (txn, &ikey, &ival, 0)) != 0)
{
- derr(1) << "..put returned " << db_strerror (ret) << endl;
+ derr(1) << "..put returned " << db_strerror (ret) << dendl;
if (txn)
txn->abort();
if (onsafe != NULL)
value.set_dlen (len);
}
dout(3) << "..mapping " << oid << " => ("
- << obj.length << " bytes)" << endl;
+ << obj.length << " bytes)" << dendl;
if ((ret = db->put (txn, &key, &value, 0)) != 0)
{
- derr(1) << "..put returned " << db_strerror (ret) << endl;
+ derr(1) << "..put returned " << db_strerror (ret) << dendl;
if (txn)
txn->abort();
if (onsafe != NULL)
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..write OK, returning " << len << endl;
+ dout(4) << "..write OK, returning " << len << dendl;
return len;
}
obj.length = len;
if ((ret = db->put (txn, &ikey, &ival, 0)) != 0)
{
- derr(1) << " put returned " << db_strerror (ret) << endl;
+ derr(1) << " put returned " << db_strerror (ret) << dendl;
if (txn)
txn->abort();
if (onsafe != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "..writing object failed!" << endl;
+ derr(1) << "..writing object failed!" << dendl;
return -EIO;
}
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "..writing object info failed!" << endl;
+ derr(1) << "..writing object info failed!" << dendl;
return -EIO;
}
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "..writing object failed!" << endl;
+ derr(1) << "..writing object failed!" << dendl;
return -EIO;
}
}
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..write OK, returning " << len << endl;
+ dout(4) << "..write OK, returning " << len << dendl;
return len;
}
{
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
return -EINVAL;
}
- dout(2) << "clone " << oid << ", " << noid << endl;
+ dout(2) << "clone " << oid << ", " << noid << dendl;
if (exists (noid))
{
- dout(4) << "..target exists; returning -EEXIST" << endl;
+ dout(4) << "..target exists; returning -EEXIST" << dendl;
return -EEXIST;
}
{
if (txn)
txn->abort();
- derr(1) << "..getting object info failed!" << endl;
+ derr(1) << "..getting object info failed!" << dendl;
return -ENOENT;
}
if (db->get (txn, &key, &value, 0) != 0)
{
if (txn)
txn->abort();
- derr(1) << "..getting original object failed" << endl;
+ derr(1) << "..getting original object failed" << dendl;
return -ENOENT;
}
auto_ptr<char> valueptr ((char *) value.get_data());
{
if (txn)
txn->abort();
- derr(1) << "..putting object info failed" << endl;
+ derr(1) << "..putting object info failed" << dendl;
return -EIO;
}
if (db->put (txn, &nkey, &value, 0) != 0)
{
if (txn)
txn->abort();
- derr(1) << "..putting new object failed" << endl;
+ derr(1) << "..putting new object failed" << dendl;
return -EIO;
}
if (txn)
txn->commit (0);
- dout(4) << "..clone OK" << endl;
+ dout(4) << "..clone OK" << dendl;
return 0;
}
{
if (!mounted)
{
- derr(1) << "not mounted!" << endl;
+ derr(1) << "not mounted!" << dendl;
return -EINVAL;
}
- dout(2) << "list_collections" << endl;
+ dout(2) << "list_collections" << dendl;
Dbt key (COLLECTIONS_KEY, 1);
Dbt value;
if (db->get (NULL, &key, &value, 0) != 0)
{
- dout(4) << "..no collections" << endl;
+ dout(4) << "..no collections" << dendl;
return 0; // no collections.
}
for (uint32_t i = 0; i < sc->count; i++)
ls.push_back (scp->colls[i]);
- dout(4) << "..list_collections returns " << scp->count << endl;
+ dout(4) << "..list_collections returns " << scp->count << dendl;
return scp->count;
}
int OSBDB::create_collection(coll_t c, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
scoped_lock __lock(&lock);
- dout(2) << "create_collection " << hex << c << dec << endl;
+ dout(2) << "create_collection " << hex << c << dec << dendl;
Dbt key (COLLECTIONS_KEY, 1);
Dbt value;
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".collection " << c << " already exists " << endl;
+ derr(1) << ".collection " << c << " already exists " << dendl;
return -EEXIST;
}
- dout(3) << "..insertion point: " << ins << endl;
+ dout(3) << "..insertion point: " << ins << dendl;
// Make room for a new collection ID.
if (!created)
{
sz += sizeof (coll_t);
- dout(3) << "..increase size to " << sz << endl;
+ dout(3) << "..increase size to " << sz << dendl;
stored_colls *scp2 = (stored_colls *) realloc (scp, sz);
sc.release ();
sc.reset (scp2);
int n = (scp->count - ins) * sizeof (coll_t);
if (n > 0)
{
- dout(3) << "..moving " << n << " bytes up" << endl;
+ dout(3) << "..moving " << n << " bytes up" << dendl;
memmove (&scp->colls[ins + 1], &scp->colls[ins], n);
}
scp->count++;
scp->colls[ins] = c;
- dout(3) << "..collections: " << scp << endl;
+ dout(3) << "..collections: " << scp << dendl;
// Put the modified collection list back.
{
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".writing new collections list failed" << endl;
+ derr(1) << ".writing new collections list failed" << dendl;
return -EIO;
}
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".writing new collection failed" << endl;
+ derr(1) << ".writing new collection failed" << dendl;
return -EIO;
}
}
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..create_collection OK" << endl;
+ dout(4) << "..create_collection OK" << dendl;
return 0;
}
int OSBDB::destroy_collection(coll_t c, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
scoped_lock __lock(&lock);
- dout(2) << "destroy_collection " << hex << c << dec << endl;
+ dout(2) << "destroy_collection " << hex << c << dec << dendl;
Dbt key (COLLECTIONS_KEY, 1);
Dbt value;
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".collection list doesn't exist" << endl;
+ derr(1) << ".collection list doesn't exist" << dendl;
return -ENOENT; // XXX
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".collection " << c << " not listed" << endl;
+ derr(1) << ".collection " << c << " not listed" << dendl;
return -ENOENT;
}
uint32_t ins = binary_search<coll_t> (scp->colls, scp->count, c);
- dout(4) << "..insertion point is " << ins << endl;
+ dout(4) << "..insertion point is " << ins << dendl;
if (ins >= scp->count || scp->colls[ins] != c)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".collection " << c << " not listed" << endl;
+ derr(1) << ".collection " << c << " not listed" << dendl;
return -ENOENT;
}
- dout(4) << "..collections list is " << scp << endl;
+ dout(4) << "..collections list is " << scp << dendl;
// Move the rest of the list down in memory, if needed.
if (ins < scp->count)
{
size_t n = scp->count - ins - 1;
- dout(4) << "..shift list down " << n << endl;
+ dout(4) << "..shift list down " << n << dendl;
memmove (&scp->colls[ins], &scp->colls[ins + 1], n);
}
- dout(4) << "..collections list is " << scp << endl;
+ dout(4) << "..collections list is " << scp << dendl;
// Modify the record size to be one less.
Dbt nvalue (scp, value.get_size() - sizeof (coll_t));
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".putting modified collection list failed" << endl;
+ derr(1) << ".putting modified collection list failed" << dendl;
return -EIO;
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".deleting collection failed" << endl;
+ derr(1) << ".deleting collection failed" << dendl;
return -EIO;
}
txn->commit (0);
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..destroy_collection OK" << endl;
+ dout(4) << "..destroy_collection OK" << dendl;
return 0;
}
{
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
return -EINVAL;
}
- dout(2) << "collection_exists " << hex << c << dec << endl;
+ dout(2) << "collection_exists " << hex << c << dec << dendl;
/*Dbt key (COLLECTIONS_KEY, 1);
Dbt value;
if (db->get (NULL, &key, &value, 0) != 0)
{
- dout(4) << "..no collection list; return false" << endl;
+ dout(4) << "..no collection list; return false" << dendl;
return false;
}
stored_colls *scp = (stored_colls *) value.get_data();
auto_ptr<stored_colls> sc (scp);
- dout(5) << "..collection list is " << scp << endl;
+ dout(5) << "..collection list is " << scp << dendl;
if (scp->count == 0)
{
- dout(4) << "..empty collection list; return false" << endl;
+ dout(4) << "..empty collection list; return false" << dendl;
return false;
}
uint32_t ins = binary_search<coll_t> (scp->colls, scp->count, c);
- dout(4) << "..insertion point is " << ins << endl;
+ dout(4) << "..insertion point is " << ins << dendl;
int ret = (scp->colls[ins] == c);
- dout(4) << "..returns " << ret << endl;
+ dout(4) << "..returns " << ret << dendl;
return ret;*/
Dbt key (&c, sizeof (coll_t));
value.set_flags (DB_DBT_MALLOC);
if (db->get (NULL, &key, &value, 0) != 0)
{
- dout(4) << "..no collection, return false" << endl;
+ dout(4) << "..no collection, return false" << dendl;
return false;
}
void *val = value.get_data();
free (val);
- dout(4) << "..collection exists; return true" << endl;
+ dout(4) << "..collection exists; return true" << dendl;
return true;
}
{
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
return -EINVAL;
}
- dout(2) << "collection_stat " << c << endl;
+ dout(2) << "collection_stat " << c << dendl;
// XXX is this needed?
return -ENOSYS;
}
int OSBDB::collection_add(coll_t c, object_t o, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- dout(2) << "not mounted" << endl;
+ dout(2) << "not mounted" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
scoped_lock __lock(&lock);
- dout(2) << "collection_add " << hex << c << dec << " " << o << endl;
+ dout(2) << "collection_add " << hex << c << dec << " " << o << dendl;
Dbt key (&c, sizeof (coll_t));
Dbt value;
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "failed to find collection" << endl;
+ derr(1) << "failed to find collection" << dendl;
return -ENOENT;
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "collection already has object" << endl;
+ derr(1) << "collection already has object" << dendl;
return -EEXIST;
}
}
scp = (stored_coll *) realloc (scp, sz);
sc.release();
sc.reset (scp);
- dout(3) << "..current collection: " << scp << endl;
+ dout(3) << "..current collection: " << scp << dendl;
if (ins < scp->count - 1)
{
size_t n = (scp->count - ins) * sizeof (object_t);
- dout(3) << "..move up " << n << " bytes" << endl;
+ dout(3) << "..move up " << n << " bytes" << dendl;
memmove (&scp->objects[ins + 1], &scp->objects[ins], n);
}
scp->count++;
scp->objects[ins] = o;
- dout(3) << "..collection: " << scp << endl;
+ dout(3) << "..collection: " << scp << dendl;
Dbt nvalue (scp, sz);
if (db->put (txn, &key, &nvalue, 0) != 0)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "..putting modified collection failed" << endl;
+ derr(1) << "..putting modified collection failed" << dendl;
return -EIO;
}
txn->commit (0);
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..collection add OK" << endl;
+ dout(4) << "..collection add OK" << dendl;
return 0;
}
int OSBDB::collection_remove(coll_t c, object_t o, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EINVAL;
}
scoped_lock __lock(&lock);
- dout(2) << "collection_remove " << hex << c << dec << " " << o << endl;
+ dout(2) << "collection_remove " << hex << c << dec << " " << o << dendl;
Dbt key (&c, sizeof (coll_t));
Dbt value;
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- dout(1) << "..collection doesn't exist" << endl;
+ dout(1) << "..collection doesn't exist" << dendl;
return -ENOENT;
}
stored_coll *scp = (stored_coll *) value.get_data();
auto_ptr<stored_coll> sc (scp);
- dout(5) << "..collection is " << scp << endl;
+ dout(5) << "..collection is " << scp << dendl;
if (scp->count == 0)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- dout(1) << "..collection is empty" << endl;
+ dout(1) << "..collection is empty" << dendl;
return -ENOENT;
}
uint32_t ins = binary_search<object_t> (scp->objects, scp->count, o);
- dout(4) << "..insertion point is " << ins << endl;
+ dout(4) << "..insertion point is " << ins << dendl;
if (ins >= scp->count || scp->objects[ins] != o)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- dout(1) << "..object not in collection" << endl;
+ dout(1) << "..object not in collection" << dendl;
return -ENOENT;
}
if (ins < scp->count - 1)
{
size_t n = (scp->count - ins - 1) * sizeof (object_t);
- dout(5) << "..moving " << n << " bytes down" << endl;
+ dout(5) << "..moving " << n << " bytes down" << dendl;
memmove (&scp->objects[ins], &scp->objects[ins + 1], n);
}
scp->count--;
- dout(3) << "..collection " << scp << endl;
+ dout(3) << "..collection " << scp << dendl;
Dbt nval (scp, value.get_size() - sizeof (object_t));
if (db->put (txn, &key, &nval, 0) != 0)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << "..putting modified collection failed" << endl;
+ derr(1) << "..putting modified collection failed" << dendl;
return -EIO;
}
txn->commit (0);
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..collection remove OK" << endl;
+ dout(4) << "..collection remove OK" << dendl;
return 0;
}
{
if (!mounted)
{
- derr(1) << "not mounted" << endl;
+ derr(1) << "not mounted" << dendl;
return -EINVAL;
}
const void *value, size_t size, Context *onsafe,
DbTxn *txn)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
if (strlen (name) >= OSBDB_MAX_ATTR_LEN)
{
- derr(1) << "name too long: " << name << endl;
+ derr(1) << "name too long: " << name << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -ENAMETOOLONG;
stored_attrs *sap = NULL;
size_t sz = 0;
- dout(3) << " getting " << aids << endl;
+ dout(3) << " getting " << aids << dendl;
if (db->get (txn, &attrs_key, &attrs_val, 0) != 0)
{
- dout(2) << " first attribute" << endl;
+ dout(2) << " first attribute" << dendl;
sz = sizeof (stored_attrs);
sap = (stored_attrs *) malloc(sz);
sap->count = 0;
{
sz = attrs_val.get_size();
sap = (stored_attrs *) attrs_val.get_data();
- dout(2) << "..add to list of " << sap->count << " attrs" << endl;
+ dout(2) << "..add to list of " << sap->count << " attrs" << dendl;
}
auto_ptr<stored_attrs> sa (sap);
int ins = 0;
if (sap->count > 0)
ins = binary_search<attr_name> (sap->names, sap->count, _name);
- dout(3) << "..insertion point is " << ins << endl;
+ dout(3) << "..insertion point is " << ins << dendl;
if (sap->count == 0 ||
(ins >= sap->count || strcmp (sap->names[ins].name, name) != 0))
{
sz += sizeof (attr_name);
dout(3) << "..realloc " << ((void *) sap) << " to "
- << dec << sz << endl;
+ << dec << sz << dendl;
sap = (stored_attrs *) realloc (sap, sz);
- dout(3) << "..returns " << ((void *) sap) << endl;
+ dout(3) << "..returns " << ((void *) sap) << dendl;
sa.release ();
sa.reset (sap);
int n = (sap->count - ins) * sizeof (attr_name);
{
dout(3) << "..move " << n << " bytes from 0x"
<< hex << (&sap->names[ins]) << " to 0x"
- << hex << (&sap->names[ins+1]) << dec << endl;
+ << hex << (&sap->names[ins+1]) << dec << dendl;
memmove (&sap->names[ins+1], &sap->names[ins], n);
}
memset (&sap->names[ins], 0, sizeof (attr_name));
Dbt newAttrs_val (sap, sz);
newAttrs_val.set_ulen (sz);
newAttrs_val.set_flags (DB_DBT_USERMEM);
- dout(3) << "..putting " << aids << endl;
+ dout(3) << "..putting " << aids << dendl;
if (db->put (txn, &attrs_key, &newAttrs_val, 0) != 0)
{
- derr(1) << ".writing attributes list failed" << endl;
+ derr(1) << ".writing attributes list failed" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EIO;
}
else
{
- dout(3) << "..attribute " << name << " already exists" << endl;
+ dout(3) << "..attribute " << name << " already exists" << dendl;
}
- dout(5) << "..attributes list: " << sap << endl;
+ dout(5) << "..attributes list: " << sap << dendl;
// Add the attribute.
attr_id aid = new_attr_id (oid, name);
Dbt attr_key (&aid, sizeof (aid));
Dbt attr_val ((void *) value, size);
- dout(3) << "..writing attribute key " << aid << endl;
+ dout(3) << "..writing attribute key " << aid << dendl;
if (db->put (txn, &attr_key, &attr_val, 0) != 0)
{
- derr(1) << ".writing attribute key failed" << endl;
+ derr(1) << ".writing attribute key failed" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -EIO;
}
- dout(4) << "..setattr OK" << endl;
+ dout(4) << "..setattr OK" << dendl;
if (onsafe != NULL)
COMMIT(onsafe);
return 0;
const void *value, size_t size,
Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
env->txn_begin (NULL, &txn, 0);
dout(2) << "setattr " << oid << ":" << name << " => ("
- << size << " bytes)" << endl;
+ << size << " bytes)" << dendl;
int ret = _setattr (oid, name, value, size, onsafe, txn);
if (ret == 0)
{
int OSBDB::setattrs(object_t oid, map<string,bufferptr>& aset,
Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
if (!mounted)
return -EINVAL;
- dout(2) << "_getattr " << oid << " " << name << " " << size << endl;
+ dout(2) << "_getattr " << oid << " " << name << " " << size << dendl;
attr_id aid = new_attr_id (oid, name);
Dbt key (&aid, sizeof (aid));
int ret;
if ((ret = db->get (NULL, &key, &val, 0)) != 0)
{
- derr(1) << ".getting value failed: " << db_strerror (ret) << endl;
+ derr(1) << ".getting value failed: " << db_strerror (ret) << dendl;
return -ENOENT;
}
- dout(4) << ".._getattr OK; returns " << val.get_size() << endl;
+ dout(4) << ".._getattr OK; returns " << val.get_size() << dendl;
return val.get_size();
}
int OSBDB::rmattr(object_t oid, const char *name, Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
}
scoped_lock __lock(&lock);
- dout(2) << "rmattr " << oid << " " << name << endl;
+ dout(2) << "rmattr " << oid << " " << name << dendl;
attrs_id aids = new_attrs_id (oid);
Dbt askey (&aids, sizeof_attrs_id());
stored_attrs *sap = (stored_attrs *) asvalue.get_data();
auto_ptr<stored_attrs> sa (sap);
- dout(5) << "..attributes list " << sap << endl;
+ dout(5) << "..attributes list " << sap << dendl;
if (sap->count == 0)
{
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".empty attribute list" << endl;
+ derr(1) << ".empty attribute list" << dendl;
return -ENOENT;
}
memset(&_name, 0, sizeof (_name));
strncpy (_name.name, name, OSBDB_MAX_ATTR_LEN);
int ins = binary_search<attr_name> (sap->names, sap->count, _name);
- dout(4) << "..insertion point is " << ins << endl;
+ dout(4) << "..insertion point is " << ins << dendl;
if (ins >= sap->count || strcmp (sap->names[ins].name, name) != 0)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".attribute not found in list" << endl;
+ derr(1) << ".attribute not found in list" << dendl;
return -ENOENT;
}
int n = (sap->count - ins) * sizeof (attr_name);
if (n > 0)
{
- dout(4) << "..shift down by " << n << endl;
+ dout(4) << "..shift down by " << n << dendl;
memmove (&(sap->names[ins]), &(sap->names[ins + 1]), n);
}
sap->count--;
- dout(5) << "..attributes list now " << sap << endl;
+ dout(5) << "..attributes list now " << sap << dendl;
asvalue.set_size(asvalue.get_size() - sizeof (attr_name));
int ret;
if ((ret = db->put (txn, &askey, &asvalue, 0)) != 0)
{
- derr(1) << "put stored_attrs " << db_strerror (ret) << endl;
+ derr(1) << "put stored_attrs " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
Dbt key (&aid, sizeof (aid));
if ((ret = db->del (txn, &key, 0)) != 0)
{
- derr(1) << "deleting " << aid << ": " << db_strerror(ret) << endl;
+ derr(1) << "deleting " << aid << ": " << db_strerror(ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
txn->commit (0);
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..rmattr OK" << endl;
+ dout(4) << "..rmattr OK" << dendl;
return 0;
}
if (!mounted)
return -EINVAL;
- dout(2) << "listattr " << oid << endl;
+ dout(2) << "listattr " << oid << dendl;
attrs_id aids = new_attrs_id (oid);
Dbt key (&aids, sizeof_attrs_id());
if ((ret = db->get (NULL, &key, &value, 0)) != 0)
{
derr(1) << "fetching " << aids << ": " << db_strerror (ret)
- << endl;
+ << dendl;
return -ENOENT;
}
p = p + n + 1;
}
- dout(4) << "listattr OK" << endl;
+ dout(4) << "listattr OK" << dendl;
return 0;
}
const void *value, size_t size,
Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
scoped_lock __lock(&lock);
dout(2) << "collection_setattr " << hex << cid << dec << " " << name
- << " (" << size << " bytes)" << endl;
+ << " (" << size << " bytes)" << dendl;
if (strlen (name) >= OSBDB_MAX_ATTR_LEN)
{
- derr(1) << "name too long" << endl;
+ derr(1) << "name too long" << dendl;
if (onsafe != NULL)
CLEANUP(onsafe);
return -ENAMETOOLONG;
if (transactional)
env->txn_begin (NULL, &txn, 0);
- dout(3) << " getting " << aids << endl;
+ dout(3) << " getting " << aids << dendl;
if (db->get (txn, &attrs_key, &attrs_val, 0) != 0)
{
- dout(2) << " first attribute" << endl;
+ dout(2) << " first attribute" << dendl;
sz = sizeof (stored_attrs);
sap = (stored_attrs *) malloc(sz);
sap->count = 0;
{
sz = attrs_val.get_size();
sap = (stored_attrs *) attrs_val.get_data();
- dout(2) << " add to list of " << sap->count << " attrs" << endl;
+ dout(2) << " add to list of " << sap->count << " attrs" << dendl;
}
auto_ptr<stored_attrs> sa (sap);
int ins = 0;
if (sap->count > 0)
ins = binary_search<attr_name> (sap->names, sap->count, _name);
- dout(3) << " insertion point is " << ins << endl;
+ dout(3) << " insertion point is " << ins << dendl;
if (ins >= sap->count || strcmp (sap->names[ins].name, name) != 0)
{
sz += sizeof (attr_name);
dout(3) << " realloc " << hex << ((void *) sap) << " to "
- << dec << sz << endl;
+ << dec << sz << dendl;
sap = (stored_attrs *) realloc (sap, sz);
- dout(3) << " returns " << hex << ((void *) sap) << dec << endl;
+ dout(3) << " returns " << hex << ((void *) sap) << dec << dendl;
sa.release ();
sa.reset (sap);
int n = (sap->count - ins) * sizeof (attr_name);
{
dout(3) << " move " << n << " bytes from 0x"
<< hex << (&sap->names[ins]) << " to 0x"
- << hex << (&sap->names[ins+1]) << dec << endl;
+ << hex << (&sap->names[ins+1]) << dec << dendl;
memmove (&sap->names[ins+1], &sap->names[ins], n);
}
memset (&sap->names[ins], 0, sizeof (attr_name));
Dbt newAttrs_val (sap, sz);
newAttrs_val.set_ulen (sz);
newAttrs_val.set_flags (DB_DBT_USERMEM);
- dout(3) << " putting " << aids << endl;
+ dout(3) << " putting " << aids << dendl;
if (db->put (txn, &attrs_key, &newAttrs_val, 0) != 0)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".putting new attributes failed" << endl;
+ derr(1) << ".putting new attributes failed" << dendl;
return -EIO;
}
}
else
{
- dout(3) << "..attribute " << name << " already exists" << endl;
+ dout(3) << "..attribute " << name << " already exists" << dendl;
}
- dout(3) << "..attributes list: " << sap << endl;
+ dout(3) << "..attributes list: " << sap << dendl;
// Add the attribute.
coll_attr_id aid = new_coll_attr_id (cid, name);
Dbt attr_key (&aid, sizeof (aid));
Dbt attr_val ((void *) value, size);
- dout(3) << " writing attribute key " << aid << endl;
+ dout(3) << " writing attribute key " << aid << dendl;
if (db->put (txn, &attr_key, &attr_val, 0) != 0)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".putting attribute failed" << endl;
+ derr(1) << ".putting attribute failed" << dendl;
return -EIO;
}
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..collection setattr OK" << endl;
+ dout(4) << "..collection setattr OK" << dendl;
return 0;
}
int OSBDB::collection_rmattr(coll_t cid, const char *name,
Context *onsafe)
{
- dout(6) << "Context " << hex << onsafe << dec << endl;
+ dout(6) << "Context " << hex << onsafe << dec << dendl;
if (!mounted)
{
if (onsafe != NULL)
scoped_lock __lock(&lock);
dout(2) << "collection_rmattr " << hex << cid << dec
- << " " << name << endl;
+ << " " << name << dendl;
coll_attrs_id aids = new_coll_attrs_id (cid);
Dbt askey (&aids, sizeof_coll_attrs_id());
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".no attributes list" << endl;
+ derr(1) << ".no attributes list" << dendl;
return -ENOENT;
}
stored_attrs *sap = (stored_attrs *) asvalue.get_data();
auto_ptr<stored_attrs> sa (sap);
- dout(5) << "..attributes list " << sap << endl;
+ dout(5) << "..attributes list " << sap << dendl;
if (sap->count == 0)
{
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".empty attributes list" << endl;
+ derr(1) << ".empty attributes list" << dendl;
return -ENOENT;
}
txn->abort();
if (onsafe != NULL)
CLEANUP(onsafe);
- derr(1) << ".attribute not listed" << endl;
+ derr(1) << ".attribute not listed" << dendl;
return -ENOENT;
}
int n = (sap->count - ins) * sizeof (attr_name);
if (n > 0)
{
- dout(4) << "..shift down by " << n << endl;
+ dout(4) << "..shift down by " << n << dendl;
memmove (&(sap->names[ins]), &(sap->names[ins + 1]), n);
}
sap->count--;
- dout(5) << "..attributes list now " << sap << endl;
+ dout(5) << "..attributes list now " << sap << dendl;
asvalue.set_size(asvalue.get_size() - sizeof (attr_name));
int ret;
if ((ret = db->put (txn, &askey, &asvalue, 0)) != 0)
{
- derr(1) << "put stored_attrs " << db_strerror (ret) << endl;
+ derr(1) << "put stored_attrs " << db_strerror (ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
Dbt key (&aid, sizeof (aid));
if ((ret = db->del (txn, &key, 0)) != 0)
{
- derr(1) << "deleting " << aid << ": " << db_strerror(ret) << endl;
+ derr(1) << "deleting " << aid << ": " << db_strerror(ret) << dendl;
if (txn != NULL)
txn->abort();
if (onsafe != NULL)
if (onsafe != NULL)
COMMIT(onsafe);
- dout(4) << "..collection rmattr OK" << endl;
+ dout(4) << "..collection rmattr OK" << dendl;
return 0;
}
return -EINVAL;
dout(2) << "collection_getattr " << hex << cid << dec
- << " " << name << endl;
+ << " " << name << dendl;
// XXX transactions/read isolation?
if (db->get (NULL, &key, &val, 0) != 0)
{
- derr(1) << ".no attribute entry" << endl;
+ derr(1) << ".no attribute entry" << dendl;
return -ENOENT;
}
- dout(4) << "..collection getattr OK; returns " << val.get_size() << endl;
+ dout(4) << "..collection getattr OK; returns " << val.get_size() << dendl;
return val.get_size();
}
if (!mounted)
return -EINVAL;
- dout(2) << "collection_listattr " << hex << cid << dec << endl;
+ dout(2) << "collection_listattr " << hex << cid << dec << dendl;
// XXX transactions/read isolation?
if ((ret = db->get (NULL, &key, &value, 0)) != 0)
{
derr(1) << "fetching " << caids << ": " << db_strerror (ret)
- << endl;
+ << dendl;
return -ENOENT;
}
float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks); // to write to
//float a = (float)(st.f_bfree) / (float)st.f_blocks;
- //dout(10) << "age_fill at " << a << " / " << pc << " .. " << st.f_blocks << " " << st.f_bavail << endl;
+ //dout(10) << "age_fill at " << a << " / " << pc << " .. " << st.f_blocks << " " << st.f_bavail << dendl;
if (free >= pc) {
- dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << endl;
+ generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << dendl;
break;
}
- dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
+ generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << oid << dec << " sz " << s << dendl;
if (false && !g_conf.ebofs_verify && start_debug && wrote > 1000000ULL) {
store->statfs(&st);
float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks); // to write to
- dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << endl;//" stopping" << endl;
+ generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << dendl;//" stopping" << dendl;
if (free <= pc) {
- dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << endl;
+ generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << dendl;
break;
}
int b = myrand() % 10;
n--;
if (n == 0 || age_objects[b].empty()) {
- dout(2) << "age_empty sync" << endl;
+ generic_dout(2) << "age_empty sync" << dendl;
//sync();
//sync();
n = nper;
object_t oid = age_objects[b].front();
age_objects[b].pop_front();
- dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << oid << dec << endl;
+ generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << oid << dec << dendl;
store->remove(oid);
age_free_oids.push_back(oid);
high_water = (float)high_water * f;
low_water = (float)low_water * f;
final_water = (float)final_water * f;
- dout(2) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << endl;
+ generic_dout(2) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << dendl;
}
// init size distn (once)
//if (c == 7) start_debug = true;
- dout(1) << "#age " << c << "/" << count << " filling to " << high_water << endl;
+ generic_dout(1) << "#age " << c << "/" << count << " filling to " << high_water << dendl;
uint64_t w = age_fill(high_water, until);
- //dout(1) << "age wrote " << w << endl;
+ //dout(1) << "age wrote " << w << dendl;
wrote += w;
//store->sync();
//store->_get_frag_stat(st);
if (c == count) {
- dout(1) << "#age final empty to " << final_water << endl;
+ generic_dout(1) << "#age final empty to " << final_water << dendl;
age_empty(final_water);
} else {
- dout(1) << "#age " << c << "/" << count << " emptying to " << low_water << endl;
+ generic_dout(1) << "#age " << c << "/" << count << " emptying to " << low_water << dendl;
age_empty(low_water);
}
//store->sync();
store->_fake_writes(false);
store->sync();
store->sync();
- dout(1) << "age finished" << endl;
+ generic_dout(1) << "age finished" << dendl;
}
void Ager::load_freelist()
{
- dout(1) << "load_freelist" << endl;
+ generic_dout(1) << "load_freelist" << dendl;
struct stat st;
void Ager::save_freelist(int el)
{
- dout(1) << "save_freelist " << el << endl;
+ generic_dout(1) << "save_freelist " << el << dendl;
char s[100];
sprintf(s, "ebofs.freelist.%d", el);
bufferlist bl;
#endif // DARWIN
#include "config.h"
-#undef dout
-#define dout(l) if (l<=g_conf.debug) cout << g_clock.now() << " osd" << whoami << ".fakestore "
-#define derr(l) if (l<=g_conf.debug) cerr << g_clock.now() << " osd" << whoami << ".fakestore "
+
+#define dout(l) if (l<=g_conf.debug) cout << dbeginl << g_clock.now() << " osd" << whoami << ".fakestore "
+#define derr(l) if (l<=g_conf.debug) cerr << dbeginl << g_clock.now() << " osd" << whoami << ".fakestore "
#include "include/buffer.h"
{
char cmd[200];
if (g_conf.fakestore_dev) {
- dout(0) << "mounting" << endl;
+ dout(0) << "mounting" << dendl;
sprintf(cmd,"mount %s", g_conf.fakestore_dev);
system(cmd);
}
- dout(1) << "mkfs in " << basedir << endl;
+ dout(1) << "mkfs in " << basedir << dendl;
// wipe
sprintf(cmd, "test -d %s && rm -r %s ; mkdir -p %s/collections && mkdir -p %s/objects",
basedir.c_str(), basedir.c_str(), basedir.c_str(), basedir.c_str());
- dout(5) << "wipe: " << cmd << endl;
+ dout(5) << "wipe: " << cmd << dendl;
system(cmd);
// hashed bits too
sprintf(s, "%02x", i);
string subdir = basedir + "/objects/" + s;
- dout(15) << " creating " << subdir << endl;
+ dout(15) << " creating " << subdir << dendl;
int r = ::mkdir(subdir.c_str(), 0755);
if (r != 0) {
- derr(0) << "couldnt create subdir, r = " << r << endl;
+ derr(0) << "couldnt create subdir, r = " << r << dendl;
return r;
}
}
if (g_conf.fakestore_dev) {
char cmd[100];
- dout(0) << "umounting" << endl;
+ dout(0) << "umounting" << dendl;
sprintf(cmd,"umount %s", g_conf.fakestore_dev);
//system(cmd);
}
- dout(1) << "mkfs done in " << basedir << endl;
+ dout(1) << "mkfs done in " << basedir << dendl;
return 0;
}
int FakeStore::mount()
{
if (g_conf.fakestore_dev) {
- dout(0) << "mounting" << endl;
+ dout(0) << "mounting" << dendl;
char cmd[100];
sprintf(cmd,"mount %s", g_conf.fakestore_dev);
//system(cmd);
}
- dout(5) << "basedir " << basedir << endl;
+ dout(5) << "basedir " << basedir << dendl;
// make sure global base dir exists
struct stat st;
int r = ::stat(basedir.c_str(), &st);
if (r != 0) {
- derr(0) << "unable to stat basedir " << basedir << ", r = " << r << endl;
+ derr(0) << "unable to stat basedir " << basedir << ", r = " << r << dendl;
return r;
}
if (g_conf.fakestore_fake_collections) {
- dout(0) << "faking collections (in memory)" << endl;
+ dout(0) << "faking collections (in memory)" << dendl;
fake_collections = true;
}
#ifndef __CYGWIN__
if (g_conf.fakestore_fake_attrs) {
#endif
- dout(0) << "faking attrs (in memory)" << endl;
+ dout(0) << "faking attrs (in memory)" << dendl;
fake_attrs = true;
#ifndef __CYGWIN__
} else {
char names[1000];
r = ::listxattr(basedir.c_str(), names, 1000);
if (r < 0) {
- derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --fakestore_fake_attrs to fake them (in memory)." << endl;
+ derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --fakestore_fake_attrs to fake them (in memory)." << dendl;
assert(0);
}
}
int FakeStore::umount()
{
- dout(5) << "umount " << basedir << endl;
+ dout(5) << "umount " << basedir << dendl;
sync();
if (g_conf.fakestore_dev) {
char cmd[100];
- dout(0) << "umounting" << endl;
+ dout(0) << "umounting" << dendl;
sprintf(cmd,"umount %s", g_conf.fakestore_dev);
//system(cmd);
}
int FakeStore::stat(object_t oid,
struct stat *st)
{
- dout(20) << "stat " << oid << endl;
+ dout(20) << "stat " << oid << dendl;
char fn[200];
get_oname(oid,fn);
int r = ::stat(fn, st);
int FakeStore::remove(object_t oid, Context *onsafe)
{
- dout(20) << "remove " << oid << endl;
+ dout(20) << "remove " << oid << dendl;
char fn[200];
get_oname(oid,fn);
int r = ::unlink(fn);
int FakeStore::truncate(object_t oid, off_t size, Context *onsafe)
{
- dout(20) << "truncate " << oid << " size " << size << endl;
+ dout(20) << "truncate " << oid << " size " << size << dendl;
char fn[200];
get_oname(oid,fn);
int FakeStore::read(object_t oid,
off_t offset, size_t len,
bufferlist& bl) {
- dout(20) << "read " << oid << " len " << len << " off " << offset << endl;
+ dout(20) << "read " << oid << " len " << len << " off " << offset << dendl;
char fn[200];
get_oname(oid,fn);
int fd = ::open(fn, O_RDONLY);
if (fd < 0) {
- dout(10) << "read couldn't open " << fn << " errno " << errno << " " << strerror(errno) << endl;
+ dout(10) << "read couldn't open " << fn << " errno " << errno << " " << strerror(errno) << dendl;
return fd;
}
::flock(fd, LOCK_EX); // lock for safety
char fn[200];
get_oname(oid,fn);
- dout(20) << "write " << fn << " len " << len << " off " << offset << endl;
+ dout(20) << "write " << fn << " len " << len << " off " << offset << dendl;
::mknod(fn, 0644, 0); // in case it doesn't exist yet.
int flags = O_WRONLY;//|O_CREAT;
int fd = ::open(fn, flags);
if (fd < 0) {
- derr(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror(errno) << endl;
+ derr(0) << "write couldn't open " << fn << " flags " << flags << " errno " << errno << " " << strerror(errno) << dendl;
return fd;
}
::fchmod(fd, 0664);
if (r > 0)
did += r;
else {
- derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << endl;
+ derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << dendl;
}
}
if (did < 0) {
- derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << endl;
+ derr(0) << "couldn't write to " << fn << " len " << len << " off " << offset << " errno " << errno << " " << strerror(errno) << dendl;
}
::flock(fd, LOCK_UN);
{
synclock.Lock();
while (unsync > 0) {
- dout(0) << "sync waiting for " << unsync << " items to (fake) sync" << endl;
+ dout(0) << "sync waiting for " << unsync << " items to (fake) sync" << dendl;
synccond.Wait(synclock);
}
synclock.Unlock();
char *name = names;
for (int i=0; i<num; i++) {
- dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "'" << endl;
+ dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "'" << dendl;
int l = ::getxattr(fn, name, val, 1000);
- dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "' = " << l << " bytes" << endl;
+ dout(0) << "getattrs " << oid << " getting " << (i+1) << "/" << num << " '" << names << "' = " << l << " bytes" << dendl;
aset[names].append(val, l);
name += strlen(name) + 1;
}
*(((uint64_t*)&o) + 0) = strtoll(de->d_name, 0, 16);
assert(de->d_name[16] == '.');
*(((uint64_t*)&o) + 1) = strtoll(de->d_name+17, 0, 16);
- dout(0) << " got " << o << " errno " << errno << " on " << de->d_name << endl;
+ dout(0) << " got " << o << " errno " << errno << " on " << de->d_name << dendl;
if (errno) continue;
ls.push_back(o);
}
#include "config.h"
-#include "debug.h"
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
#define derr(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) cerr << dbeginl << g_clock.now() << " osd" << whoami << " " << (osdmap ? osdmap->get_epoch():0) << " "
#include "config.h"
#include "common/Clock.h"
+#define dout(x) if (x < g_conf.debug) cout << dbeginl << g_clock.now() << " ager: "
object_t ObjectStore::age_get_oid() {
if (!age_free_oids.empty()) {
statfs(&st);
float a = (float)(st.f_blocks-st.f_bavail) / (float)st.f_blocks;
if (a >= pc) {
- dout(10) << "age_fill at " << a << " / " << pc << " stopping" << endl;
+ dout(10) << "age_fill at " << a << " / " << pc << " stopping" << dendl;
break;
}
ssize_t s = age_pick_size();
- dout(10) << "age_fill at " << a << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
+ dout(10) << "age_fill at " << a << " / " << pc << " creating " << hex << oid << dec << " sz " << s << dendl;
off_t off = 0;
while (s) {
statfs(&st);
float a = (float)(st.f_blocks-st.f_bavail) / (float)st.f_blocks;
if (a <= pc) {
- dout(10) << "age_empty at " << a << " / " << pc << " stopping" << endl;
+ dout(10) << "age_empty at " << a << " / " << pc << " stopping" << dendl;
break;
}
int b = rand() % 10;
n--;
if (n == 0 || age_objects[b].empty()) {
- dout(10) << "age_empty sync" << endl;
+ dout(10) << "age_empty sync" << dendl;
//sync();
sync();
n = nper;
object_t oid = age_objects[b].front();
age_objects[b].pop_front();
- dout(10) << "age_empty at " << a << " / " << pc << " removing " << hex << oid << dec << endl;
+ dout(10) << "age_empty at " << a << " / " << pc << " removing " << hex << oid << dec << dendl;
remove(oid);
age_free_oids.push_back(oid);
high_water = (float)high_water * f;
low_water = (float)low_water * f;
final_water = (float)final_water * f;
- dout(10) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << endl;
+ dout(10) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << dendl;
}
// init size distn (once)
for (int c=1; c<=count; c++) {
if (g_clock.now() > until) break;
- dout(1) << "age " << c << "/" << count << " filling to " << high_water << endl;
+ dout(1) << "age " << c << "/" << count << " filling to " << high_water << dendl;
age_fill(high_water, until);
if (c == count) {
- dout(1) << "age final empty to " << final_water << endl;
+ dout(1) << "age final empty to " << final_water << dendl;
age_empty(final_water);
} else {
- dout(1) << "age " << c << "/" << count << " emptying to " << low_water << endl;
+ dout(1) << "age " << c << "/" << count << " emptying to " << low_water << dendl;
age_empty(low_water);
}
}
- dout(1) << "age finished" << endl;
+ dout(1) << "age finished" << dendl;
}
#include "messages/MOSDPGRemove.h"
#include "messages/MOSDPGActivateSet.h"
-#include "debug.h"
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->whoami << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
dout(10) << "merge_log " << olog << " from osd" << fromosd
<< " into " << log << dendl;
- //cout << "log" << dendl;
+ //dout(0) << "log" << dendl;
//log.print(cout);
- //cout << "olog" << dendl;
+ //dout(0) << "olog" << dendl;
//olog.print(cout);
if (log.empty() ||
entity_name_t source;
int len = osd->store->getattr(oid, "wrlock", &source, sizeof(entity_name_t));
- //cout << "getattr returns " << len << " on " << oid << dendl;
+ //dout(0) << "getattr returns " << len << " on " << oid << dendl;
if (len == sizeof(source) &&
source != op->get_client()) {
#include "messages/MOSDPGRemove.h"
#include "config.h"
-#include "debug.h"
-#undef dout
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
#include <errno.h>
#include "config.h"
-#include "debug.h"
-
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_osd) cout << dbeginl << g_clock.now() << " osd" << osd->get_nodeid() << " " << (osd->osdmap ? osd->osdmap->get_epoch():0) << " " << *this << " "
#include <errno.h>
#include "include/Context.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
+
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
class Filer::C_Probe : public Context {
off_t *end,
Context *onfinish)
{
- dout(10) << "probe_fwd " << hex << inode.ino << dec << " starting from " << start_from << endl;
+ dout(10) << "probe_fwd " << hex << inode.ino << dec << " starting from " << start_from << dendl;
Probe *probe = new Probe(inode, start_from, end, onfinish);
void Filer::_probe(Probe *probe)
{
- dout(10) << "_probe " << hex << probe->inode.ino << dec << " " << probe->from << "~" << probe->probing_len << endl;
+ dout(10) << "_probe " << hex << probe->inode.ino << dec << " " << probe->from << "~" << probe->probing_len << dendl;
// map range onto objects
file_to_extents(probe->inode, probe->from, probe->probing_len, probe->probing);
for (list<ObjectExtent>::iterator p = probe->probing.begin();
p != probe->probing.end();
p++) {
- dout(10) << "_probe probing " << p->oid << endl;
+ dout(10) << "_probe probing " << p->oid << dendl;
C_Probe *c = new C_Probe(this, probe, p->oid);
probe->ops[p->oid] = objecter->stat(p->oid, &c->size, p->layout, c);
}
void Filer::_probed(Probe *probe, object_t oid, off_t size)
{
- dout(10) << "_probed " << probe->inode.ino << " object " << hex << oid << dec << " has size " << size << endl;
+ dout(10) << "_probed " << probe->inode.ino << " object " << hex << oid << dec << " has size " << size << dendl;
probe->known[oid] = size;
assert(probe->ops.count(oid));
dout(10) << "_probed " << probe->inode.ino << " object " << hex << p->oid << dec
<< " should be " << shouldbe
<< ", actual is " << probe->known[p->oid]
- << endl;
+ << dendl;
if (probe->known[p->oid] < 0) { end = -1; break; } // error!
end = probe->from + i->first + oleft;
dout(10) << "_probed end is in buffer_extent " << i->first << "~" << i->second << " off " << oleft
<< ", from was " << probe->from << ", end is " << end
- << endl;
+ << dendl;
break;
}
oleft -= i->second;
if (end == 0) {
// keep probing!
- dout(10) << "_probed didn't find end, probing further" << endl;
+ dout(10) << "_probed didn't find end, probing further" << dendl;
off_t period = probe->inode.layout.object_size * probe->inode.layout.stripe_count;
probe->from += probe->probing_len;
probe->probing_len = period;
}
if (end < 0) {
- dout(10) << "_probed encountered an error while probing" << endl;
+ dout(10) << "_probed encountered an error while probing" << dendl;
*probe->end = -1;
} else {
// hooray!
- dout(10) << "_probed found end at " << end << endl;
+ dout(10) << "_probed found end at " << end << dendl;
*probe->end = end;
}
{
dout(10) << "file_to_extents " << offset << "~" << len
<< " on " << hex << inode.ino << dec
- << endl;
+ << dendl;
/* we want only one extent per object!
* this means that each extent we read may map into different bits of the
assert(inode.layout.object_size >= inode.layout.stripe_unit);
off_t stripes_per_object = inode.layout.object_size / inode.layout.stripe_unit;
- dout(20) << " stripes_per_object " << stripes_per_object << endl;
+ dout(20) << " stripes_per_object " << stripes_per_object << dendl;
off_t cur = offset;
off_t left = len;
}
ex->buffer_extents[cur-offset] = x_len;
- dout(15) << "file_to_extents " << *ex << " in " << ex->layout << endl;
- //cout << "map: ino " << ino << " oid " << ex.oid << " osd " << ex.osd << " offset " << ex.offset << " len " << ex.len << " ... left " << left << endl;
+ dout(15) << "file_to_extents " << *ex << " in " << ex->layout << dendl;
+ //dout(0) << "map: ino " << ino << " oid " << ex.oid << " osd " << ex.osd << " offset " << ex.offset << " len " << ex.len << " ... left " << left << dendl;
left -= x_len;
cur += x_len;
#include "msg/Messenger.h"
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) cerr << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
+
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
+#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_journaler) cerr << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
void Journaler::reset()
{
- dout(1) << "reset to blank journal" << endl;
+ dout(1) << "reset to blank journal" << dendl;
state = STATE_ACTIVE;
write_pos = flush_pos = ack_pos =
read_pos = requested_pos = received_pos =
waitfor_recover.push_back(onread);
if (state != STATE_UNDEF) {
- dout(1) << "recover - already recoverying" << endl;
+ dout(1) << "recover - already recoverying" << dendl;
return;
}
- dout(1) << "read_head" << endl;
+ dout(1) << "read_head" << dendl;
state = STATE_READHEAD;
C_ReadHead *fin = new C_ReadHead(this);
filer.read(inode, 0, sizeof(Header), &fin->bl, fin);
assert(state == STATE_READHEAD);
if (bl.length() == 0) {
- dout(1) << "_finish_read_head r=" << r << " read 0 bytes, assuming empty log" << endl;
+ dout(1) << "_finish_read_head r=" << r << " read 0 bytes, assuming empty log" << dendl;
state = STATE_ACTIVE;
list<Context*> ls;
ls.swap(waitfor_recover);
expire_pos = h.expire_pos;
trimmed_pos = trimming_pos = h.trimmed_pos;
- dout(1) << "_finish_read_head " << h << ". probing for end of log (from " << write_pos << ")..." << endl;
+ dout(1) << "_finish_read_head " << h << ". probing for end of log (from " << write_pos << ")..." << dendl;
// probe the log
state = STATE_PROBING;
end = write_pos;
dout(1) << "_finish_probe_end write_pos = " << end
<< " (header had " << write_pos << "). log was empty. recovered."
- << endl;
+ << dendl;
assert(0); // hrm.
} else {
assert(end >= write_pos);
assert(r >= 0);
dout(1) << "_finish_probe_end write_pos = " << end
<< " (header had " << write_pos << "). recovered."
- << endl;
+ << dendl;
}
write_pos = flush_pos = ack_pos = end;
last_written.expire_pos = expire_pos;
last_written.read_pos = read_pos;
last_written.write_pos = ack_pos; //write_pos;
- dout(10) << "write_head " << last_written << endl;
+ dout(10) << "write_head " << last_written << dendl;
last_wrote_head = g_clock.now();
void Journaler::_finish_write_head(Header &wrote, Context *oncommit)
{
- dout(10) << "_finish_write_head " << wrote << endl;
+ dout(10) << "_finish_write_head " << wrote << dendl;
last_committed = wrote;
if (oncommit) {
oncommit->finish(0);
dout(10) << "_finish_flush from " << start
<< ", pending_flush now " << pending_flush
<< ", write positions now " << write_pos << "/" << flush_pos << "/" << ack_pos
- << endl;
+ << dendl;
// kick waiters <= ack_pos
while (!waitfor_flush.empty()) {
// now flush.
flush();
- dout(12) << "append_entry skipped " << (write_pos-owp) << " bytes to " << write_pos << " to avoid spanning stripe boundary" << endl;
+ dout(12) << "append_entry skipped " << (write_pos-owp) << " bytes to " << write_pos << " to avoid spanning stripe boundary" << dendl;
}
}
- dout(10) << "append_entry len " << bl.length() << " to " << write_pos << "~" << (bl.length() + sizeof(uint32_t)) << endl;
+ dout(10) << "append_entry len " << bl.length() << " to " << write_pos << "~" << (bl.length() + sizeof(uint32_t)) << dendl;
// cache?
// NOTE: this is a dumb thing to do; this is used for a benchmarking
// purposes only.
if (g_conf.journaler_cache &&
write_pos == read_pos + read_buf.length()) {
- dout(10) << "append_entry caching in read_buf too" << endl;
+ dout(10) << "append_entry caching in read_buf too" << dendl;
assert(requested_pos == received_pos);
assert(requested_pos == read_pos + read_buf.length());
read_buf.append((char*)&s, sizeof(s));
// all flushed and acked?
if (write_pos == ack_pos) {
assert(write_buf.length() == 0);
- dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+ dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
if (onsync) {
onsync->finish(0);
delete onsync;
if (write_pos == flush_pos) {
assert(write_buf.length() == 0);
- dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+ dout(10) << "flush nothing to flush, write pointers at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
} else {
// flush
unsigned len = write_pos - flush_pos;
assert(len == write_buf.length());
- dout(10) << "flush flushing " << flush_pos << "~" << len << endl;
+ dout(10) << "flush flushing " << flush_pos << "~" << len << dendl;
// submit write for anything pending
// flush _start_ pos to _finish_flush
flush_pos = write_pos;
write_buf.clear();
- dout(10) << "flush write pointers now at " << write_pos << "/" << flush_pos << "/" << ack_pos << endl;
+ dout(10) << "flush write pointers now at " << write_pos << "/" << flush_pos << "/" << ack_pos << dendl;
}
// queue waiter (at _new_ write_pos; will go when reached by ack_pos)
{
assert(r>=0);
- dout(10) << "_finish_read got " << received_pos << "~" << reading_buf.length() << endl;
+ dout(10) << "_finish_read got " << received_pos << "~" << reading_buf.length() << dendl;
received_pos += reading_buf.length();
read_buf.claim_append(reading_buf);
assert(received_pos <= requested_pos);
dout(10) << "_finish_read read_buf now " << read_pos << "~" << read_buf.length()
<< ", read pointers " << read_pos << "/" << received_pos << "/" << requested_pos
- << endl;
+ << dendl;
if (is_readable()) { // NOTE: this check may read more
// readable!
- dout(10) << "_finish_read now readable" << endl;
+ dout(10) << "_finish_read now readable" << dendl;
if (on_readable) {
Context *f = on_readable;
on_readable = 0;
{
if (_is_reading()) {
dout(10) << "_issue_read " << len << " waiting, already reading "
- << received_pos << "~" << (requested_pos-received_pos) << endl;
+ << received_pos << "~" << (requested_pos-received_pos) << dendl;
return;
}
assert(requested_pos == received_pos);
// stuck at ack_pos?
assert(requested_pos <= ack_pos);
if (requested_pos == ack_pos) {
- dout(10) << "_issue_read requested_pos = ack_pos = " << ack_pos << ", waiting" << endl;
+ dout(10) << "_issue_read requested_pos = ack_pos = " << ack_pos << ", waiting" << dendl;
assert(write_pos > requested_pos);
if (flush_pos == ack_pos)
flush();
// don't read too much
if (requested_pos + len > ack_pos) {
len = ack_pos - requested_pos;
- dout(10) << "_issue_read reading only up to ack_pos " << ack_pos << endl;
+ dout(10) << "_issue_read reading only up to ack_pos " << ack_pos << dendl;
}
// go.
dout(10) << "_issue_read reading " << requested_pos << "~" << len
<< ", read pointers " << read_pos << "/" << received_pos << "/" << (requested_pos+len)
- << endl;
+ << dendl;
filer.read(inode, requested_pos, len, &reading_buf,
new C_Read(this));
!_is_reading() && // and not reading anything right now
write_pos > requested_pos) { // there's something more to read...
dout(10) << "_prefetch only " << left << " < " << prefetch_from
- << ", prefetching " << endl;
+ << ", prefetching " << dendl;
_issue_read(fetch_len);
}
}
if (is_readable()) {
dout(10) << "read_entry at " << read_pos << ", read_buf is "
<< read_pos << "~" << read_buf.length()
- << ", readable now" << endl;
+ << ", readable now" << dendl;
// nice, just do it now.
bool r = try_read_entry(*bl);
} else {
dout(10) << "read_entry at " << read_pos << ", read_buf is "
<< read_pos << "~" << read_buf.length()
- << ", not readable now" << endl;
+ << ", not readable now" << dendl;
bl->clear();
// partial fragment at the end?
if (received_pos == write_pos) {
- dout(10) << "is_readable() detected partial entry at tail, adjusting write_pos to " << read_pos << endl;
+ dout(10) << "is_readable() detected partial entry at tail, adjusting write_pos to " << read_pos << dendl;
write_pos = flush_pos = ack_pos = read_pos;
assert(write_buf.length() == 0);
bool Journaler::try_read_entry(bufferlist& bl)
{
if (!is_readable()) { // this may start a read.
- dout(10) << "try_read_entry at " << read_pos << " not readable" << endl;
+ dout(10) << "try_read_entry at " << read_pos << " not readable" << dendl;
return false;
}
assert(read_buf.length() >= sizeof(s) + s);
dout(10) << "try_read_entry at " << read_pos << " reading "
- << read_pos << "~" << (sizeof(s)+s) << endl;
+ << read_pos << "~" << (sizeof(s)+s) << dendl;
// do it
assert(bl.length() == 0);
void Journaler::wait_for_readable(Context *onreadable)
{
- dout(10) << "wait_for_readable at " << read_pos << " onreadable " << onreadable << endl;
+ dout(10) << "wait_for_readable at " << read_pos << " onreadable " << onreadable << dendl;
assert(!is_readable());
assert(on_readable == 0);
on_readable = onreadable;
trim_to -= trim_to % inode.layout.period();
dout(10) << "trim last_commited head was " << last_committed
<< ", can trim to " << trim_to
- << endl;
+ << dendl;
if (trim_to == 0 || trim_to == trimming_pos) {
dout(10) << "trim already trimmed/trimming to "
- << trimmed_pos << "/" << trimming_pos << endl;
+ << trimmed_pos << "/" << trimming_pos << dendl;
return;
}
if (trimming_pos > trimmed_pos) {
dout(10) << "trim already trimming atm, try again later. trimmed/trimming is "
- << trimmed_pos << "/" << trimming_pos << endl;
+ << trimmed_pos << "/" << trimming_pos << dendl;
return;
}
dout(10) << "trim trimming to " << trim_to
<< ", trimmed/trimming/expire are "
<< trimmed_pos << "/" << trimming_pos << "/" << expire_pos
- << endl;
+ << dendl;
filer.remove(inode, trimming_pos, trim_to-trimming_pos,
0, new C_Trim(this, trim_to));
dout(10) << "_trim_finish trimmed_pos was " << trimmed_pos
<< ", trimmed/trimming/expire now "
<< to << "/" << trimming_pos << "/" << expire_pos
- << endl;
+ << dendl;
assert(r >= 0);
assert(to <= trimming_pos);
/*** ObjectCacher::Object ***/
-#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << dbeginl << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *left, off_t off)
{
- dout(20) << "split " << *left << " at " << off << endl;
+ dout(20) << "split " << *left << " at " << off << dendl;
// split off right
ObjectCacher::BufferHead *right = new BufferHead(this);
p--;
while (p != left->waitfor_read.begin()) {
if (p->first < right->start()) break;
- dout(0) << "split moving waiters at byte " << p->first << " to right bh" << endl;
+ dout(0) << "split moving waiters at byte " << p->first << " to right bh" << dendl;
right->waitfor_read[p->first].swap( p->second );
o = p;
p--;
}
}
- dout(20) << "split left is " << *left << endl;
- dout(20) << "split right is " << *right << endl;
+ dout(20) << "split left is " << *left << dendl;
+ dout(20) << "split right is " << *right << dendl;
return right;
}
assert(left->end() == right->start());
assert(left->get_state() == right->get_state());
- dout(10) << "merge_left " << *left << " + " << *right << endl;
+ dout(10) << "merge_left " << *left << " + " << *right << dendl;
oc->bh_remove(this, right);
oc->bh_stat_sub(left);
left->set_length( left->length() + right->length());
// hose right
delete right;
- dout(10) << "merge_left result " << *left << endl;
+ dout(10) << "merge_left result " << *left << dendl;
}
void ObjectCacher::Object::try_merge_bh(BufferHead *bh)
{
- dout(10) << "try_merge_bh " << *bh << endl;
+ dout(10) << "try_merge_bh " << *bh << dendl;
// to the left?
map<off_t,BufferHead*>::iterator p = data.find(bh->start());
if (ex_it->oid != oid) continue;
dout(10) << "map_read " << ex_it->oid
- << " " << ex_it->start << "~" << ex_it->length << endl;
+ << " " << ex_it->start << "~" << ex_it->length << dendl;
map<off_t, BufferHead*>::iterator p = data.lower_bound(ex_it->start);
// p->first >= start
n->set_length( left );
oc->bh_add(this, n);
missing[cur] = n;
- dout(20) << "map_read miss " << left << " left, " << *n << endl;
+ dout(20) << "map_read miss " << left << " left, " << *n << dendl;
cur += left;
left -= left;
assert(left == 0);
e->is_dirty() ||
e->is_tx()) {
hits[cur] = e; // readable!
- dout(20) << "map_read hit " << *e << endl;
+ dout(20) << "map_read hit " << *e << dendl;
}
else if (e->is_rx()) {
rx[cur] = e; // missing, not readable.
- dout(20) << "map_read rx " << *e << endl;
+ dout(20) << "map_read rx " << *e << dendl;
}
else assert(0);
missing[cur] = n;
cur += MIN(left, n->length());
left -= MIN(left, n->length());
- dout(20) << "map_read gap " << *n << endl;
+ dout(20) << "map_read gap " << *n << dendl;
continue; // more?
}
else
if (ex_it->oid != oid) continue;
dout(10) << "map_write oex " << ex_it->oid
- << " " << ex_it->start << "~" << ex_it->length << endl;
+ << " " << ex_it->start << "~" << ex_it->length << dendl;
map<off_t, BufferHead*>::iterator p = data.lower_bound(ex_it->start);
// p->first >= start
/*// dirty and butts up?
if (p->first + p->second->length() == cur &&
p->second->is_dirty()) {
- dout(10) << "map_write will append to tail of " << *p->second << endl;
+ dout(10) << "map_write will append to tail of " << *p->second << dendl;
final = p->second;
}
*/
final->set_start( cur );
final->set_length( max );
oc->bh_add(this, final);
- dout(10) << "map_write adding trailing bh " << *final << endl;
+ dout(10) << "map_write adding trailing bh " << *final << dendl;
} else {
final->set_length( final->length() + max );
}
continue;
}
- dout(10) << "p is " << *p->second << endl;
+ dout(10) << "p is " << *p->second << dendl;
if (p->first <= cur) {
BufferHead *bh = p->second;
- dout(10) << "map_write bh " << *bh << " intersected" << endl;
+ dout(10) << "map_write bh " << *bh << " intersected" << dendl;
if (p->first < cur) {
assert(final == 0);
// gap!
off_t next = p->first;
off_t glen = MIN(next - cur, max);
- dout(10) << "map_write gap " << cur << "~" << glen << endl;
+ dout(10) << "map_write gap " << cur << "~" << glen << dendl;
if (final) {
final->set_length( final->length() + glen );
} else {
// set versoin
assert(final);
- dout(10) << "map_write final is " << *final << endl;
+ dout(10) << "map_write final is " << *final << dendl;
return final;
}
void ObjectCacher::Object::truncate(off_t s)
{
- dout(10) << "truncate to " << s << endl;
+ dout(10) << "truncate to " << s << dendl;
while (!data.empty()) {
BufferHead *bh = data.rbegin()->second;
/*** ObjectCacher ***/
#undef dout
-#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
+#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << dbeginl << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
void ObjectCacher::close_object(Object *ob)
{
- dout(10) << "close_object " << *ob << endl;
+ dout(10) << "close_object " << *ob << dendl;
assert(ob->can_close());
// ok!
void ObjectCacher::bh_read(BufferHead *bh)
{
- dout(7) << "bh_read on " << *bh << endl;
+ dout(7) << "bh_read on " << *bh << dendl;
mark_rx(bh);
<< oid
<< " " << start << "~" << length
<< " (bl is " << bl.length() << ")"
- << endl;
+ << dendl;
if (bl.length() < length) {
bufferptr bp(length - bl.length());
bp.zero();
dout(7) << "bh_read_finish " << oid << " padding " << start << "~" << length
- << " with " << bp.length() << " bytes of zeroes" << endl;
+ << " with " << bp.length() << " bytes of zeroes" << dendl;
bl.push_back(bp);
}
if (objects.count(oid) == 0) {
- dout(7) << "bh_read_finish no object cache" << endl;
+ dout(7) << "bh_read_finish no object cache" << dendl;
} else {
Object *ob = objects[oid];
if (bh->start() > opos) {
dout(1) << "weirdness: gap when applying read results, "
<< opos << "~" << bh->start() - opos
- << endl;
+ << dendl;
opos = bh->start();
continue;
}
if (!bh->is_rx()) {
- dout(10) << "bh_read_finish skipping non-rx " << *bh << endl;
+ dout(10) << "bh_read_finish skipping non-rx " << *bh << dendl;
opos = bh->end();
p++;
continue;
opos-bh->start(),
bh->length());
mark_clean(bh);
- dout(10) << "bh_read_finish read " << *bh << endl;
+ dout(10) << "bh_read_finish read " << *bh << dendl;
opos = bh->end();
p++;
void ObjectCacher::bh_write(BufferHead *bh)
{
- dout(7) << "bh_write " << *bh << endl;
+ dout(7) << "bh_write " << *bh << dendl;
// finishers
C_WriteAck *onack = new C_WriteAck(this, bh->ob->get_oid(), bh->start(), bh->length());
object_t oid = *i;
if (objects.count(oid) == 0) {
- dout(7) << "lock_ack no object cache" << endl;
+ dout(7) << "lock_ack no object cache" << dendl;
assert(0);
}
assert(tid <= ob->last_write_tid);
if (ob->last_write_tid == tid) {
dout(10) << "lock_ack " << *ob
- << " tid " << tid << endl;
+ << " tid " << tid << dendl;
switch (ob->lock_state) {
case Object::LOCK_RDUNLOCKING:
close_object(ob);
} else {
dout(10) << "lock_ack " << *ob
- << " tid " << tid << " obsolete" << endl;
+ << " tid " << tid << " obsolete" << dendl;
}
// waiters?
<< oid
<< " tid " << tid
<< " " << start << "~" << length
- << endl;
+ << dendl;
if (objects.count(oid) == 0) {
- dout(7) << "bh_write_ack no object cache" << endl;
+ dout(7) << "bh_write_ack no object cache" << dendl;
assert(0);
} else {
Object *ob = objects[oid];
if (bh->start() < start &&
bh->end() > start+(off_t)length) {
- dout(20) << "bh_write_ack skipping " << *bh << endl;
+ dout(20) << "bh_write_ack skipping " << *bh << dendl;
continue;
}
// make sure bh is tx
if (!bh->is_tx()) {
- dout(10) << "bh_write_ack skipping non-tx " << *bh << endl;
+ dout(10) << "bh_write_ack skipping non-tx " << *bh << dendl;
continue;
}
// make sure bh tid matches
if (bh->last_write_tid != tid) {
assert(bh->last_write_tid > tid);
- dout(10) << "bh_write_ack newer tid on " << *bh << endl;
+ dout(10) << "bh_write_ack newer tid on " << *bh << dendl;
continue;
}
// ok! mark bh clean.
mark_clean(bh);
- dout(10) << "bh_write_ack clean " << *bh << endl;
+ dout(10) << "bh_write_ack clean " << *bh << dendl;
}
// update object last_ack.
<< oid
<< " tid " << tid
<< " " << start << "~" << length
- << endl;
+ << dendl;
if (objects.count(oid) == 0) {
- dout(7) << "bh_write_commit no object cache" << endl;
+ dout(7) << "bh_write_commit no object cache" << dendl;
//assert(0);
} else {
Object *ob = objects[oid];
utime_t cutoff = g_clock.now();
//cutoff.sec_ref() -= g_conf.client_oc_max_dirty_age;
- dout(10) << "flush " << amount << endl;
+ dout(10) << "flush " << amount << dendl;
/*
* NOTE: we aren't actually pulling things off the LRU here, just looking at the
dout(10) << "trim start: max " << max
<< " clean " << get_stat_clean()
- << endl;
+ << dendl;
while (get_stat_clean() > max) {
BufferHead *bh = (BufferHead*) lru_rest.lru_expire();
if (!bh) break;
- dout(10) << "trim trimming " << *bh << endl;
+ dout(10) << "trim trimming " << *bh << dendl;
assert(bh->is_clean());
Object *ob = bh->ob;
delete bh;
if (ob->can_close()) {
- dout(10) << "trim trimming " << *ob << endl;
+ dout(10) << "trim trimming " << *ob << dendl;
close_object(ob);
}
}
dout(10) << "trim finish: max " << max
<< " clean " << get_stat_clean()
- << endl;
+ << dendl;
}
for (list<ObjectExtent>::iterator ex_it = rd->extents.begin();
ex_it != rd->extents.end();
ex_it++) {
- dout(10) << "readx " << *ex_it << endl;
+ dout(10) << "readx " << *ex_it << dendl;
// get Object cache
Object *o = get_object(ex_it->oid, ino, ex_it->layout);
bh_read(bh_it->second);
if (success) {
dout(10) << "readx missed, waiting on " << *bh_it->second
- << " off " << bh_it->first << endl;
+ << " off " << bh_it->first << dendl;
success = false;
bh_it->second->waitfor_read[bh_it->first].push_back( new C_RetryRead(this, rd, ino, onfinish) );
}
touch_bh(bh_it->second); // bump in lru, so we don't lose it.
if (success) {
dout(10) << "readx missed, waiting on " << *bh_it->second
- << " off " << bh_it->first << endl;
+ << " off " << bh_it->first << dendl;
success = false;
bh_it->second->waitfor_read[bh_it->first].push_back( new C_RetryRead(this, rd, ino, onfinish) );
}
for (map<off_t, BufferHead*>::iterator bh_it = hits.begin();
bh_it != hits.end();
bh_it++) {
- dout(10) << "readx hit bh " << *bh_it->second << endl;
+ dout(10) << "readx hit bh " << *bh_it->second << dendl;
hit_ls.push_back(bh_it->second);
}
dout(10) << "readx rmap opos " << opos
<< ": " << *bh << " +" << bhoff
<< " frag " << f_it->first << "~" << f_it->second << " +" << foff
- << endl;
+ << dendl;
size_t len = MIN(f_it->second - foff,
bh->length() - bhoff);
// no misses... success! do the read.
assert(!hit_ls.empty());
- dout(10) << "readx has all buffers" << endl;
+ dout(10) << "readx has all buffers" << dendl;
// ok, assemble into result buffer.
rd->bl->clear();
i != stripe_map.end();
i++) {
assert(pos == i->first);
- dout(10) << "readx adding buffer len " << i->second.length() << " at " << pos << endl;
+ dout(10) << "readx adding buffer len " << i->second.length() << " at " << pos << dendl;
pos += i->second.length();
rd->bl->claim_append(i->second);
assert(rd->bl->length() == pos);
}
- dout(10) << "readx result is " << rd->bl->length() << endl;
+ dout(10) << "readx result is " << rd->bl->length() << dendl;
// done with read.
delete rd;
for (map<size_t,size_t>::iterator f_it = ex_it->buffer_extents.begin();
f_it != ex_it->buffer_extents.end();
f_it++) {
- dout(10) << "writex writing " << f_it->first << "~" << f_it->second << " into " << *bh << " at " << opos << endl;
+ dout(10) << "writex writing " << f_it->first << "~" << f_it->second << " into " << *bh << " at " << opos << dendl;
size_t bhoff = bh->start() - opos;
assert(f_it->second <= bh->length() - bhoff);
void ObjectCacher::wait_for_write(size_t len, Mutex& lock)
{
while (get_stat_dirty() > g_conf.client_oc_max_dirty) {
- dout(10) << "wait_for_write waiting" << endl;
+ dout(10) << "wait_for_write waiting" << dendl;
flusher_cond.Signal();
stat_waiter++;
stat_cond.Wait(lock);
stat_waiter--;
- dout(10) << "wait_for_write woke up" << endl;
+ dout(10) << "wait_for_write woke up" << dendl;
}
}
void ObjectCacher::flusher_entry()
{
- dout(10) << "flusher start" << endl;
+ dout(10) << "flusher start" << dendl;
lock.Lock();
while (!flusher_stop) {
while (!flusher_stop) {
<< get_stat_rx() << " rx, "
<< get_stat_clean() << " clean, "
<< get_stat_dirty() << " / " << g_conf.client_oc_max_dirty << " dirty"
- << endl;
+ << dendl;
if (get_stat_dirty() > g_conf.client_oc_max_dirty) {
// flush some dirty pages
dout(10) << "flusher "
<< get_stat_dirty() << " / " << g_conf.client_oc_max_dirty << " dirty,"
- << " flushing some dirty bhs" << endl;
+ << " flushing some dirty bhs" << dendl;
flush(get_stat_dirty() - g_conf.client_oc_max_dirty);
}
else {
BufferHead *bh = 0;
while ((bh = (BufferHead*)lru_dirty.lru_get_next_expire()) != 0 &&
bh->last_write < cutoff) {
- dout(10) << "flusher flushing aged dirty bh " << *bh << endl;
+ dout(10) << "flusher flushing aged dirty bh " << *bh << dendl;
bh_write(bh);
}
break;
flusher_cond.WaitInterval(lock, utime_t(1,0));
}
lock.Unlock();
- dout(10) << "flusher finish" << endl;
+ dout(10) << "flusher finish" << dendl;
}
{
dout(10) << "atomic_sync_readx " << rd
<< " in " << ino
- << endl;
+ << dendl;
if (rd->extents.size() == 1) {
// single object.
{
dout(10) << "atomic_sync_writex " << wr
<< " in " << ino
- << endl;
+ << dendl;
if (wr->extents.size() == 1 &&
wr->extents.front().length <= g_conf.client_oc_max_sync_write) {
dout(10) << "atomic_sync_writex " << wr
<< " in " << ino
<< " doing sync write"
- << endl;
+ << dendl;
Cond cond;
bool done = false;
if (o->lock_state == Object::LOCK_NONE ||
o->lock_state == Object::LOCK_RDUNLOCKING ||
o->lock_state == Object::LOCK_WRUNLOCKING) {
- dout(10) << "rdlock rdlock " << *o << endl;
+ dout(10) << "rdlock rdlock " << *o << dendl;
o->lock_state = Object::LOCK_RDLOCKING;
// wait?
if (o->lock_state == Object::LOCK_RDLOCKING ||
o->lock_state == Object::LOCK_WRLOCKING) {
- dout(10) << "rdlock waiting for rdlock|wrlock on " << *o << endl;
+ dout(10) << "rdlock waiting for rdlock|wrlock on " << *o << dendl;
Cond cond;
bool done = false;
o->waitfor_rd.push_back(new C_SafeCond(&lock, &cond, &done));
if (o->lock_state != Object::LOCK_WRLOCK &&
o->lock_state != Object::LOCK_WRLOCKING &&
o->lock_state != Object::LOCK_UPGRADING) {
- dout(10) << "wrlock wrlock " << *o << endl;
+ dout(10) << "wrlock wrlock " << *o << dendl;
int op = 0;
if (o->lock_state == Object::LOCK_RDLOCK) {
// wait?
if (o->lock_state == Object::LOCK_WRLOCKING ||
o->lock_state == Object::LOCK_UPGRADING) {
- dout(10) << "wrlock waiting for wrlock on " << *o << endl;
+ dout(10) << "wrlock waiting for wrlock on " << *o << dendl;
Cond cond;
bool done = false;
o->waitfor_wr.push_back(new C_SafeCond(&lock, &cond, &done));
void ObjectCacher::rdunlock(Object *o)
{
- dout(10) << "rdunlock " << *o << endl;
+ dout(10) << "rdunlock " << *o << dendl;
assert(o->lock_state == Object::LOCK_RDLOCK ||
o->lock_state == Object::LOCK_WRLOCK ||
o->lock_state == Object::LOCK_UPGRADING ||
o->rdlock_ref--;
if (o->rdlock_ref > 0 ||
o->wrlock_ref > 0) {
- dout(10) << "rdunlock " << *o << " still has rdlock|wrlock refs" << endl;
+ dout(10) << "rdunlock " << *o << " still has rdlock|wrlock refs" << dendl;
return;
}
void ObjectCacher::wrunlock(Object *o)
{
- dout(10) << "wrunlock " << *o << endl;
+ dout(10) << "wrunlock " << *o << dendl;
assert(o->lock_state == Object::LOCK_WRLOCK);
assert(o->wrlock_ref > 0);
o->wrlock_ref--;
if (o->wrlock_ref > 0) {
- dout(10) << "wrunlock " << *o << " still has wrlock refs" << endl;
+ dout(10) << "wrunlock " << *o << " still has wrlock refs" << dendl;
return;
}
int op = 0;
if (o->rdlock_ref > 0) {
- dout(10) << "wrunlock rdlock " << *o << endl;
+ dout(10) << "wrunlock rdlock " << *o << dendl;
op = OSD_OP_DNLOCK;
o->lock_state = Object::LOCK_DOWNGRADING;
} else {
- dout(10) << "wrunlock wrunlock " << *o << endl;
+ dout(10) << "wrunlock wrunlock " << *o << dendl;
op = OSD_OP_WRUNLOCK;
o->lock_state = Object::LOCK_WRUNLOCKING;
}
// purge. non-blocking. violently removes dirty buffers from cache.
void ObjectCacher::purge(Object *ob)
{
- dout(10) << "purge " << *ob << endl;
+ dout(10) << "purge " << *ob << dendl;
for (map<off_t,BufferHead*>::iterator p = ob->data.begin();
p != ob->data.end();
p++) {
BufferHead *bh = p->second;
if (!bh->is_clean())
- dout(0) << "purge forcibly removing " << *ob << " " << *bh << endl;
+ dout(0) << "purge forcibly removing " << *ob << " " << *bh << dendl;
bh_remove(ob, bh);
delete bh;
}
if (ob->can_close()) {
- dout(10) << "trim trimming " << *ob << endl;
+ dout(10) << "trim trimming " << *ob << dendl;
close_object(ob);
}
}
bool ObjectCacher::flush_set(inodeno_t ino, Context *onfinish)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "flush_set on " << ino << " dne" << endl;
+ dout(10) << "flush_set on " << ino << " dne" << dendl;
return true;
}
- dout(10) << "flush_set " << ino << endl;
+ dout(10) << "flush_set " << ino << dendl;
C_Gather *gather = 0; // we'll need to wait for all objects to flush!
dout(10) << "flush_set " << ino << " will wait for ack tid "
<< ob->last_write_tid
<< " on " << *ob
- << endl;
+ << dendl;
if (gather)
ob->waitfor_ack[ob->last_write_tid].push_back(gather->new_sub());
}
}
if (safe) {
- dout(10) << "flush_set " << ino << " has no dirty|tx bhs" << endl;
+ dout(10) << "flush_set " << ino << " has no dirty|tx bhs" << dendl;
return true;
}
return false;
assert(onfinish); // doesn't make any sense otherwise.
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "commit_set on " << ino << " dne" << endl;
+ dout(10) << "commit_set on " << ino << " dne" << dendl;
return true;
}
- dout(10) << "commit_set " << ino << endl;
+ dout(10) << "commit_set " << ino << dendl;
C_Gather *gather = 0; // we'll need to wait for all objects to commit
if (ob->last_write_tid > ob->last_commit_tid) {
dout(10) << "commit_set " << ino << " " << *ob
<< " will finish on commit tid " << ob->last_write_tid
- << endl;
+ << dendl;
if (!gather && onfinish) gather = new C_Gather(onfinish);
safe = false;
if (gather)
}
if (safe) {
- dout(10) << "commit_set " << ino << " all committed" << endl;
+ dout(10) << "commit_set " << ino << " all committed" << dendl;
return true;
}
return false;
void ObjectCacher::purge_set(inodeno_t ino)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "purge_set on " << ino << " dne" << endl;
+ dout(10) << "purge_set on " << ino << " dne" << dendl;
return;
}
- dout(10) << "purge_set " << ino << endl;
+ dout(10) << "purge_set " << ino << dendl;
set<Object*>& s = objects_by_ino[ino];
for (set<Object*>::iterator i = s.begin();
}
if (ob->can_close()) {
- dout(10) << "trim trimming " << *ob << endl;
+ dout(10) << "trim trimming " << *ob << dendl;
close_object(ob);
}
off_t unclean = 0;
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "release_set on " << ino << " dne" << endl;
+ dout(10) << "release_set on " << ino << " dne" << dendl;
return 0;
}
- dout(10) << "release_set " << ino << endl;
+ dout(10) << "release_set " << ino << dendl;
set<Object*> s = objects_by_ino[ino];
for (set<Object*>::iterator i = s.begin();
if (o_unclean)
dout(10) << "release_set " << ino << " " << *ob
<< " has " << o_unclean << " bytes left"
- << endl;
+ << dendl;
}
if (unclean) {
dout(10) << "release_set " << ino
- << ", " << unclean << " bytes left" << endl;
+ << ", " << unclean << " bytes left" << dendl;
}
return unclean;
void ObjectCacher::truncate_set(inodeno_t ino, list<ObjectExtent>& exls)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "truncate_set on " << ino << " dne" << endl;
+ dout(10) << "truncate_set on " << ino << " dne" << dendl;
return;
}
- dout(10) << "truncate_set " << ino << endl;
+ dout(10) << "truncate_set " << ino << dendl;
for (list<ObjectExtent>::iterator p = exls.begin();
p != exls.end();
// purge or truncate?
if (ex.start == 0) {
- dout(10) << "truncate_set purging " << *ob << endl;
+ dout(10) << "truncate_set purging " << *ob << dendl;
purge(ob);
} else {
// hrm, truncate object
- dout(10) << "truncate_set truncating " << *ob << " at " << ex.start << endl;
+ dout(10) << "truncate_set truncating " << *ob << " at " << ex.start << dendl;
ob->truncate(ex.start);
if (ob->can_close()) {
- dout(10) << "truncate_set trimming " << *ob << endl;
+ dout(10) << "truncate_set trimming " << *ob << dendl;
close_object(ob);
}
}
void ObjectCacher::kick_sync_writers(inodeno_t ino)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "kick_sync_writers on " << ino << " dne" << endl;
+ dout(10) << "kick_sync_writers on " << ino << " dne" << dendl;
return;
}
- dout(10) << "kick_sync_writers on " << ino << endl;
+ dout(10) << "kick_sync_writers on " << ino << dendl;
list<Context*> ls;
void ObjectCacher::kick_sync_readers(inodeno_t ino)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "kick_sync_readers on " << ino << " dne" << endl;
+ dout(10) << "kick_sync_readers on " << ino << " dne" << dendl;
return;
}
- dout(10) << "kick_sync_readers on " << ino << endl;
+ dout(10) << "kick_sync_readers on " << ino << dendl;
list<Context*> ls;
#include <errno.h>
#include "config.h"
-#undef dout
-#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << messenger->get_myname() << ".objecter "
-#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << messenger->get_myname() << ".objecter "
+
+#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
+#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << dbeginl << g_clock.now() << " " << messenger->get_myname() << ".objecter "
// messages ------------------------------
break;
default:
- dout(1) << "don't know message type " << m->get_type() << endl;
+ dout(1) << "don't know message type " << m->get_type() << dendl;
assert(0);
}
}
if (m->get_last() <= osdmap->get_epoch()) {
dout(3) << "handle_osd_map ignoring epochs ["
<< m->get_first() << "," << m->get_last()
- << "] <= " << osdmap->get_epoch() << endl;
+ << "] <= " << osdmap->get_epoch() << dendl;
}
else {
dout(3) << "handle_osd_map got epochs ["
<< m->get_first() << "," << m->get_last()
<< "] > " << osdmap->get_epoch()
- << endl;
+ << dendl;
set<pg_t> changed_pgs;
e <= m->get_last();
e++) {
if (m->incremental_maps.count(e)) {
- dout(3) << "handle_osd_map decoding incremental epoch " << e << endl;
+ dout(3) << "handle_osd_map decoding incremental epoch " << e << dendl;
OSDMap::Incremental inc;
int off = 0;
inc.decode(m->incremental_maps[e], off);
}
else if (m->maps.count(e)) {
- dout(3) << "handle_osd_map decoding full epoch " << e << endl;
+ dout(3) << "handle_osd_map decoding full epoch " << e << dendl;
osdmap->decode(m->maps[e]);
}
else {
- dout(3) << "handle_osd_map requesting missing epoch " << osdmap->get_epoch()+1 << endl;
+ dout(3) << "handle_osd_map requesting missing epoch " << osdmap->get_epoch()+1 << dendl;
int mon = monmap->pick_mon();
messenger->send_message(new MOSDGetMap(osdmap->get_epoch()+1),
monmap->get_inst(mon));
void Objecter::scan_pgs(set<pg_t>& changed_pgs)
{
- dout(10) << "scan_pgs" << endl;
+ dout(10) << "scan_pgs" << dendl;
for (hash_map<pg_t,PG>::iterator i = pg_map.begin();
i != pg_map.end();
dout(10) << "scan_pgs pg " << pgid
<< " (" << pg.active_tids << ")"
<< " " << other << " -> " << pg.acting
- << endl;
+ << dendl;
changed_pgs.insert(pgid);
}
}
void Objecter::kick_requests(set<pg_t>& changed_pgs)
{
- dout(10) << "kick_requests in pgs " << changed_pgs << endl;
+ dout(10) << "kick_requests in pgs " << changed_pgs << dendl;
for (set<pg_t>::iterator i = changed_pgs.begin();
i != changed_pgs.end();
if (wr->tid_version.count(tid)) {
if (wr->op == OSD_OP_WRITE &&
!g_conf.objecter_buffer_uncommitted) {
- dout(0) << "kick_requests missing commit, cannot replay: objecter_buffer_uncommitted == FALSE" << endl;
+ dout(0) << "kick_requests missing commit, cannot replay: objecter_buffer_uncommitted == FALSE" << dendl;
} else {
dout(3) << "kick_requests missing commit, replay write " << tid
- << " v " << wr->tid_version[tid] << endl;
+ << " v " << wr->tid_version[tid] << dendl;
modifyx_submit(wr, wr->waitfor_commit[tid], tid);
}
}
else if (wr->waitfor_ack.count(tid)) {
- dout(3) << "kick_requests missing ack, resub write " << tid << endl;
+ dout(3) << "kick_requests missing ack, resub write " << tid << dendl;
modifyx_submit(wr, wr->waitfor_ack[tid], tid);
}
}
// READ
OSDRead *rd = op_read[tid];
op_read.erase(tid);
- dout(3) << "kick_requests resub read " << tid << endl;
+ dout(3) << "kick_requests resub read " << tid << dendl;
// resubmit
readx_submit(rd, rd->ops[tid], true);
OSDStat *st = op_stat[tid];
op_stat.erase(tid);
- dout(3) << "kick_requests resub stat " << tid << endl;
+ dout(3) << "kick_requests resub stat " << tid << dendl;
// resubmit
stat_submit(st);
<< " oid " << ex.oid
<< " " << ex.layout
<< " osd" << pg.acker()
- << endl;
+ << dendl;
if (pg.acker() >= 0) {
MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, last_tid,
tid_t tid = m->get_tid();
if (op_stat.count(tid) == 0) {
- dout(7) << "handle_osd_stat_reply " << tid << " ... stray" << endl;
+ dout(7) << "handle_osd_stat_reply " << tid << " ... stray" << dendl;
delete m;
return;
}
dout(7) << "handle_osd_stat_reply " << tid
<< " r=" << m->get_result()
<< " size=" << m->get_object_size()
- << endl;
+ << dendl;
OSDStat *st = op_stat[ tid ];
op_stat.erase( tid );
// success?
if (m->get_result() == -EAGAIN) {
- dout(7) << " got -EAGAIN, resubmitting" << endl;
+ dout(7) << " got -EAGAIN, resubmitting" << dendl;
stat_submit(st);
delete m;
return;
<< " (" << ex.buffer_extents.size() << " buffer fragments)"
<< " " << ex.layout
<< " osd" << pg.acker()
- << endl;
+ << dendl;
if (pg.acker() >= 0) {
MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, last_tid,
int replica = messenger->get_myname().num() % pg.acting.size();
who = pg.acting[replica];
dout(-10) << "readx_submit reading from random replica " << replica
- << " = osd" << who << endl;
+ << " = osd" << who << dendl;
}
messenger->send_message(m, osdmap->get_inst(who));
}
tid_t tid = m->get_tid();
if (op_read.count(tid) == 0) {
- dout(7) << "handle_osd_read_reply " << tid << " ... stray" << endl;
+ dout(7) << "handle_osd_read_reply " << tid << " ... stray" << dendl;
delete m;
return;
}
- dout(7) << "handle_osd_read_reply " << tid << endl;
+ dout(7) << "handle_osd_read_reply " << tid << dendl;
OSDRead *rd = op_read[ tid ];
op_read.erase( tid );
// success?
if (m->get_result() == -EAGAIN) {
- dout(7) << " got -EAGAIN, resubmitting" << endl;
+ dout(7) << " got -EAGAIN, resubmitting" << dendl;
readx_submit(rd, rd->ops[tid], true);
delete m;
return;
// what buffer offset are we?
dout(7) << " got frag from " << m->get_oid() << " "
<< m->get_offset() << "~" << m->get_length()
- << ", still have " << rd->ops.size() << " more ops" << endl;
+ << ", still have " << rd->ops.size() << " more ops" << dendl;
if (rd->ops.empty()) {
// all done
size_t bytes_read = 0;
if (rd->read_data.size()) {
- dout(15) << " assembling frags" << endl;
+ dout(15) << " assembling frags" << dendl;
/** FIXME This doesn't handle holes efficiently.
* It allocates zero buffers to fill whole buffer, and
for (map<size_t,size_t>::iterator bit = eit->buffer_extents.begin();
bit != eit->buffer_extents.end();
bit++) {
- dout(21) << " object " << eit->oid << " extent " << eit->start << "~" << eit->length << " : ox offset " << ox_off << " -> buffer extent " << bit->first << "~" << bit->second << endl;
+ dout(21) << " object " << eit->oid << " extent " << eit->start << "~" << eit->length << " : ox offset " << ox_off << " -> buffer extent " << bit->first << "~" << bit->second << dendl;
by_off[bit->first] = new bufferlist;
if (ox_off + bit->second <= ox_len) {
bytes_read = bit->first + ox_len-ox_off;
// zero end of bx
- dout(21) << " adding some zeros to the end " << ox_off + bit->second-ox_len << endl;
+ dout(21) << " adding some zeros to the end " << ox_off + bit->second-ox_len << dendl;
bufferptr z(ox_off + bit->second - ox_len);
z.zero();
by_off[bit->first]->append( z );
} else {
// we got none of this bx. zero whole thing.
assert(ox_off >= ox_len);
- dout(21) << " adding all zeros for this bit " << bit->second << endl;
+ dout(21) << " adding all zeros for this bit " << bit->second << dendl;
bufferptr z(bit->second);
z.zero();
by_off[bit->first]->append( z );
it++) {
assert(it->second->length());
if (it->first < (off_t)bytes_read) {
- dout(21) << " concat buffer frag off " << it->first << " len " << it->second->length() << endl;
+ dout(21) << " concat buffer frag off " << it->first << " len " << it->second->length() << dendl;
rd->bl->claim_append(*(it->second));
} else {
- dout(21) << " NO concat zero buffer frag off " << it->first << " len " << it->second->length() << endl;
+ dout(21) << " NO concat zero buffer frag off " << it->first << " len " << it->second->length() << dendl;
}
delete it->second;
}
// trim trailing zeros?
if (rd->bl->length() > bytes_read) {
dout(10) << " trimming off trailing zeros . bytes_read=" << bytes_read
- << " len=" << rd->bl->length() << endl;
+ << " len=" << rd->bl->length() << dendl;
rd->bl->splice(bytes_read, rd->bl->length() - bytes_read);
assert(bytes_read == rd->bl->length());
}
delete it->second;
}
} else {
- dout(15) << " only one frag" << endl;
+ dout(15) << " only one frag" << dendl;
// only one fragment, easy
rd->bl->claim( m->get_data() );
dout(7) << " " << bytes_read << " bytes "
<< rd->bl->length()
- << endl;
+ << dendl;
// done
delete rd;
<< " " << ex.start << "~" << ex.length
<< " " << ex.layout
<< " osd" << pg.primary()
- << endl;
+ << dendl;
if (pg.primary() >= 0) {
MOSDOp *m = new MOSDOp(messenger->get_myinst(), client_inc, tid,
ex.oid, ex.layout, osdmap->get_epoch(),
messenger->send_message(m, osdmap->get_inst(pg.primary()));
}
- dout(5) << num_unacked << " unacked, " << num_uncommitted << " uncommitted" << endl;
+ dout(5) << num_unacked << " unacked, " << num_uncommitted << " uncommitted" << dendl;
return tid;
}
if (op_modify.count(tid) == 0) {
dout(7) << "handle_osd_modify_reply " << tid
<< (m->get_commit() ? " commit":" ack")
- << " ... stray" << endl;
+ << " ... stray" << dendl;
delete m;
return;
}
dout(7) << "handle_osd_modify_reply " << tid
<< (m->get_commit() ? " commit":" ack")
<< " v " << m->get_version()
- << endl;
+ << dendl;
OSDModify *wr = op_modify[ tid ];
Context *onack = 0;
// ignore?
if (pg.acker() != m->get_source().num()) {
- dout(7) << " ignoring ack|commit from non-acker" << endl;
+ dout(7) << " ignoring ack|commit from non-acker" << dendl;
delete m;
return;
}
// ack or commit?
if (m->get_commit()) {
- //dout(15) << " handle_osd_write_reply commit on " << tid << endl;
+ //dout(15) << " handle_osd_write_reply commit on " << tid << dendl;
assert(wr->tid_version.count(tid) == 0 ||
m->get_version() == wr->tid_version[tid]);
}
} else {
// ack.
- //dout(15) << " handle_osd_write_reply ack on " << tid << endl;
+ //dout(15) << " handle_osd_write_reply ack on " << tid << dendl;
assert(wr->waitfor_ack.count(tid));
wr->waitfor_ack.erase(tid);
if (wr->tid_version.count(tid) &&
wr->tid_version[tid].version != m->get_version().version) {
dout(-10) << "handle_osd_modify_reply WARNING: replay of tid " << tid
- << " did not achieve previous ordering" << endl;
+ << " did not achieve previous ordering" << dendl;
}
wr->tid_version[tid] = m->get_version();
int mon = monmap->pick_mon(true);
dout(0) << "ms_handle_failure " << dest << " inst " << inst
<< ", resending to mon" << mon
- << endl;
+ << dendl;
messenger->send_message(m, monmap->get_inst(mon));
}
else if (dest.is_osd()) {
int mon = monmap->pick_mon();
dout(0) << "ms_handle_failure " << dest << " inst " << inst
<< ", dropping and reporting to mon" << mon
- << endl;
+ << dendl;
messenger->send_message(new MOSDFailure(messenger->get_myinst(), inst, osdmap->get_epoch()),
monmap->get_inst(mon));
delete m;
} else {
dout(0) << "ms_handle_failure " << dest << " inst " << inst
- << ", dropping" << endl;
+ << ", dropping" << dendl;
delete m;
}
}
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+
+my %ns; # parent -> fn -> ino
+my %nlink; # num links to each ino
+my %since; # when it got its second link
+
+my @ignore = ('ll_getattr','ll_setattr','ll_forget','ll_fsync','ll_readlink','ll_statfs','ll_opendir','ll_releasedir','ll_flush','ll_release','ll_open','ll_read','ll_write');
+
+my $when;
+
+my $sumage;
+my $numage;
+
+sub unlink {
+ my ($p,$n) = @_;
+ my $i = $ns{$p}->{$n};
+ my $new = --$nlink{$i};
+ if ($new == 1) {
+ my $age = $when - $since{$i};
+ #print "$since{$i} to $when on $i\t$age\n";
+ delete $since{$i};
+
+ $numage++;
+ $sumage += $age;
+
+ } elsif ($new == 0) {
+ delete $nlink{$i};
+ }
+ delete $ns{$p}->{$n};
+}
+
+
+my ($sec, $usec, $cmd);
+$_ = <>;
+while (1) {
+ # read trace record
+ chomp;
+ last unless $_ eq '@';
+
+ chomp(my $sec = <>);
+ chomp(my $usec = <>);
+ $when = sprintf("%d.%06d",$sec,$usec);# + ($usec / 1000000);
+ #$when = "$sec.$usec";
+
+ chomp($cmd = <>);
+
+ #print "cmd $cmd\n";
+
+ if ($cmd eq 'll_lookup') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ chomp(my $r = <>);
+ $ns{$p}->{$n} = $r;
+ }
+
+ elsif ($cmd eq 'll_create') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ <>; <>; <>;
+ chomp(my $r = <>);
+ $ns{$p}->{$n} = $r;
+ $nlink{$r} = 1;
+ }
+ elsif ($cmd eq 'll_mknod') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ <>; <>;
+ chomp(my $r = <>);
+ $ns{$p}->{$n} = $r;
+ $nlink{$r} = 1;
+ }
+ elsif ($cmd eq 'll_mkdir') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ <>;
+ chomp(my $r = <>);
+ $ns{$p}->{$n} = $r;
+ $nlink{$r} = 1;
+ }
+ elsif ($cmd eq 'll_symlink') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ <>;
+ chomp(my $r = <>);
+ $ns{$p}->{$n} = $r;
+ $nlink{$r} = 1;
+ }
+ elsif ($cmd eq 'll_link') {
+ chomp(my $i = <>);
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ $ns{$p}->{$n} = $i;
+ if (++$nlink{$i} == 2) {
+ $since{$i} = $when;
+ }
+ }
+ elsif ($cmd eq 'll_unlink' ||
+ $cmd eq 'll_rmdir') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ &unlink($p, $n);
+ }
+ elsif ($cmd eq 'll_rename') {
+ chomp(my $p = <>);
+ chomp(my $n = <>);
+ chomp(my $np = <>);
+ chomp(my $nn = <>);
+ if ($ns{$np}->{$nn}) {
+ &unlink($np, $nn);
+ }
+ $ns{$np}->{$nn} = $ns{$p}->{$n};
+ delete $ns{$p}->{$n};
+ }
+
+ # skip to @
+ while (<>) {
+ last if $_ eq "@\n";
+ print "$cmd: $_"
+ unless grep {$_ eq $cmd} @ignore;
+ }
+}
+
+print "num $numage .. sum $sumage .. avg lifetime " . ($sumage / $numage) . "\n";
+
+# dump hard link inos
+for my $ino (keys %nlink) {
+ next if $nlink{$ino} < 2;
+ print "$ino\t$nlink{$ino}\n";
+}