set_cache_size(g_conf.client_cache_size);
// file handles
- free_fh_set.map_insert(10, 1<<30);
+ free_fh_set.insert(10, 1<<30);
// set up messengers
messenger = m;
it != fh_map.end();
it++) {
Fh *fh = it->second;
- dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << hex << fh->inode->inode.ino << dec << endl;
+ dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << endl;
put_inode(fh->inode);
delete fh;
}
void Client::dump_inode(Inode *in, set<Inode*>& did)
{
- dout(1) << "dump_inode: inode " << hex << in->ino() << dec << " ref " << in->ref << " dir " << in->dir << endl;
+ dout(1) << "dump_inode: inode " << in->ino() << " ref " << in->ref << " dir " << in->dir << endl;
if (in->dir) {
dout(1) << " dir size " << in->dir->dentries.size() << endl;
it++) {
if (did.count(it->second)) continue;
- dout(1) << "dump_cache: inode " << hex << it->first << dec
+ dout(1) << "dump_cache: inode " << it->first
<< " ref " << it->second->ref
<< " dir " << it->second->dir << endl;
if (it->second->dir) {
Dentry *dn = (Dentry*)lru.lru_expire();
if (!dn) break; // done
- //dout(10) << "trim_cache unlinking dn " << dn->name << " in dir " << hex << dn->dir->inode->inode.ino << dec << endl;
+ //dout(10) << "trim_cache unlinking dn " << dn->name << " in dir " << hex << dn->dir->inode->inode.ino << endl;
unlink(dn);
}
if (dir->dentries.count(dname))
dn = dir->dentries[dname];
- dout(12) << "insert_inode " << dname << " ino " << hex << st->inode.ino << dec
+ dout(12) << "insert_inode " << dname << " ino " << st->inode.ino
<< " size " << st->inode.size
<< " mtime " << st->inode.mtime
<< " hashed " << st->hashed
if (dn->inode->inode.ino == st->inode.ino) {
touch_dn(dn);
dout(12) << " had dentry " << dname
- << " with correct ino " << hex << dn->inode->inode.ino << dec
+ << " with correct ino " << dn->inode->inode.ino
<< endl;
} else {
dout(12) << " had dentry " << dname
- << " with WRONG ino " << hex << dn->inode->inode.ino << dec
+ << " with WRONG ino " << dn->inode->inode.ino
<< endl;
unlink(dn);
dn = NULL;
assert(in);
if (in->dn) {
- dout(12) << " had ino " << hex << in->inode.ino << dec
+ dout(12) << " had ino " << in->inode.ino
<< " linked at wrong position, unlinking"
<< endl;
dn = relink(in->dn, dir, dname);
} else {
// link
- dout(12) << " had ino " << hex << in->inode.ino << dec
+ dout(12) << " had ino " << in->inode.ino
<< " unlinked, linking" << endl;
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 " << hex << st->inode.ino << dec << endl;
+ dout(12) << " new dentry+node with ino " << st->inode.ino << endl;
} else {
// actually update info
dout(12) << " stat inode mask is " << st->inode.mask << endl;
// dir replication
if (st->spec_defined) {
if (st->dist.empty() && !in->dir_contacts.empty())
- dout(9) << "lost dist spec for " << hex << in->inode.ino << dec
+ dout(9) << "lost dist spec for " << in->inode.ino
<< " " << st->dist << endl;
if (!st->dist.empty() && in->dir_contacts.empty())
- dout(9) << "got dist spec for " << hex << in->inode.ino << dec
+ dout(9) << "got dist spec for " << in->inode.ino
<< " " << st->dist << endl;
in->dir_contacts = st->dist;
}
}
} else {
// not root.
- dout(10) << "insert_trace dn " << *pdn << " ino " << hex << (*pin)->inode.ino << dec << endl;
+ dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << endl;
Dir *dir = cur->open_dir();
cur = this->insert_inode(dir, *pin, *pdn);
++pdn;
}
if (dn) {
- dout(11) << "lookup '" << path << "' found " << dn->name << " inode " << hex << dn->inode->inode.ino << dec << " 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<< endl;
}
return dn;
break;
}
- dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << hex << diri->inode.ino << dec << " " << req->get_filepath()[i] << endl;
+ dout(7) << " have path seg " << i << " on " << diri->dir_auth << " ino " << diri->inode.ino << " " << req->get_filepath()[i] << endl;
if (i == depth-1) { // last one!
item = dir->dentries[ req->get_filepath()[i] ]->inode;
int other = m->get_mds();
if (in && in->stale_caps.count(other)) {
- dout(5) << "handle_file_caps on ino " << hex << m->get_ino() << dec << " 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 << endl;
// fresh from new mds?
if (!in->caps.count(mds)) {
// fall-thru!
} else {
- dout(5) << "handle_file_caps on ino " << hex << m->get_ino() << dec << " 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 << endl;
// delay!
cap_reap_queue[in->ino()][other] = m;
return;
// stale?
if (m->get_special() == MClientFileCaps::FILECAP_STALE) {
- dout(5) << "handle_file_caps on ino " << hex << m->get_ino() << dec << " 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" << endl;
// 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 " << hex << m->get_ino() << dec << " 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() << endl;
// process delayed reap
handle_file_caps( cap_reap_queue[in->ino()][mds] );
// release?
if (m->get_special() == MClientFileCaps::FILECAP_RELEASE) {
- dout(5) << "handle_file_caps on ino " << hex << m->get_ino() << dec << " from mds" << mds << " release" << endl;
+ dout(5) << "handle_file_caps on ino " << m->get_ino() << " from mds" << mds << " release" << endl;
assert(in->caps.count(mds));
in->caps.erase(mds);
for (map<int,InodeCap>::iterator p = in->caps.begin();
// don't want?
if (in->file_caps_wanted() == 0) {
- dout(5) << "handle_file_caps on ino " << hex << m->get_ino() << dec
+ 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;
const int new_caps = m->get_caps();
in->caps[mds].caps = new_caps;
in->caps[mds].seq = m->get_seq();
- dout(5) << "handle_file_caps on in " << hex << m->get_ino() << dec
+ 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;
void Client::release_caps(Inode *in,
int retain)
{
- dout(5) << "releasing caps on ino " << hex << in->inode.ino << dec
+ dout(5) << "releasing caps on ino " << in->inode.ino << dec
<< " had " << cap_string(in->file_caps())
<< " retaining " << cap_string(retain)
<< endl;
if (!in->caps.empty()) {
in->fc.release_clean();
if (in->fc.is_dirty()) {
- dout(10) << "unmount residual caps on " << hex << in->ino() << dec << ", flushing" << endl;
+ dout(10) << "unmount residual caps on " << in->ino() << ", flushing" << endl;
in->fc.empty(new C_Client_CloseRelease(this, in));
} else {
- dout(10) << "unmount residual caps on " << hex << in->ino() << dec << ", releasing" << endl;
+ dout(10) << "unmount residual caps on " << in->ino() << ", releasing" << endl;
release_caps(in);
}
}
if (res == 0) {
assert(in);
fill_stat(in->inode,stbuf);
- dout(10) << "stat sez size = " << in->inode.size << " ino = " << hex << stbuf->st_ino << dec << endl;
+ dout(10) << "stat sez size = " << in->inode.size << " ino = " << stbuf->st_ino << endl;
}
trim_cache();
if (res == 0) {
fill_statlite(in->inode,stl);
- dout(10) << "stat sez size = " << in->inode.size << " ino = " << hex << in->inode.ino << dec << endl;
+ dout(10) << "stat sez size = " << in->inode.size << " ino = " << in->inode.ino << endl;
}
trim_cache();
int mds = MSG_ADDR_NUM(reply->get_source());
if (f->inode->caps.empty()) {// first caps?
- dout(7) << " first caps on " << hex << f->inode->inode.ino << dec << endl;
+ dout(7) << " first caps on " << f->inode->inode.ino << endl;
f->inode->get();
}
assert(reply->get_file_caps_seq() >= f->inode->caps[mds].seq);
if (reply->get_file_caps_seq() > f->inode->caps[mds].seq) {
dout(7) << "open got caps " << cap_string(new_caps)
- << " for " << hex << f->inode->ino() << dec
+ << " for " << f->inode->ino()
<< " seq " << reply->get_file_caps_seq()
<< " from mds" << mds << endl;
} else {
dout(7) << "open got SAME caps " << cap_string(new_caps)
- << " for " << hex << f->inode->ino() << dec
+ << " for " << f->inode->ino()
<< " seq " << reply->get_file_caps_seq()
<< " from mds" << mds << endl;
}
void Client::close_release(Inode *in)
{
- dout(10) << "close_release on " << hex << in->ino() << dec << endl;
+ dout(10) << "close_release on " << in->ino() << endl;
if (!in->num_open_rd)
in->fc.release_clean();
void Client::close_safe(Inode *in)
{
- dout(10) << "close_safe on " << hex << in->ino() << dec << endl;
+ dout(10) << "close_safe on " << in->ino() << endl;
put_inode(in);
if (unmounting)
mount_cond.Signal();
// pin until safe?
if (in->num_open_wr == 0 && !in->fc.all_safe()) {
- dout(10) << "pinning ino " << hex << in->ino() << dec << " until safe" << endl;
+ dout(10) << "pinning ino " << in->ino() << " until safe" << endl;
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 " << hex << in->ino() << dec << endl;
+ dout(10) << " releasing caps on " << in->ino() << endl;
release_caps(in); // release caps now.
}
}
Fh *f = fh_map[fh];
Inode *in = f->inode;
- dout(3) << "fsync fh " << fh << " ino " << hex << in->inode.ino << dec << " syncdataonly " << syncdataonly << endl;
+ dout(3) << "fsync fh " << fh << " ino " << in->inode.ino << " syncdataonly " << syncdataonly << endl;
// metadata?
if (!syncdataonly) {
#include "include/types.h"
#include "include/lru.h"
#include "include/filepath.h"
-#include "include/rangeset.h"
+#include "include/interval_set.h"
#include "common/Mutex.h"
// file handles, etc.
string cwd;
- rangeset<fh_t> free_fh_set; // unused fh's
+ interval_set<fh_t> free_fh_set; // unused fh's
hash_map<fh_t, Fh*> fh_map;
fh_t get_fh() {
- fh_t fh = free_fh_set.first();
- free_fh_set.erase(fh);
+ fh_t fh = free_fh_set.start();
+ free_fh_set.erase(fh, 1);
return fh;
}
void put_fh(fh_t fh) {
- free_fh_set.insert(fh);
+ free_fh_set.insert(fh, 1);
}
void mkabspath(const char *rel, string& abs) {
// ceph stuff
#include "include/types.h"
-#include "include/rangeset.h"
#include "Client.h"
return res;
}
-static int ceph_mknod(const char *path, mode_t mode, dev_t rdev)
+static int ceph_mknod(const char *path, mode_t mode, dev_t rdev)
{
return client->mknod(path, mode);
}
// -- inode --
-/** object id
- * msb[ ino bits | ono bits ]lsb
- * from LSB to MSB
- */
+//typedef __uint64_t inodeno_t;
+
+struct inodeno_t {
+ __uint64_t val;
+ inodeno_t() : val() {}
+ inodeno_t(__uint64_t v) : val(v) {}
+ inodeno_t operator+=(inodeno_t o) { val += o.val; return *this; }
+ operator __uint64_t() const { return val; }
+};
-#define OID_ONO_BITS 32 // 1mb * 10^9 = 1 petabyte files
-#define OID_INO_BITS (64-32) // 2^34 =~ 16 billion files
+inline ostream& operator<<(ostream& out, inodeno_t ino) {
+ return out << hex << ino.val << dec;
+}
-typedef __uint64_t inodeno_t; // 34-bit ino (for now!)
+namespace __gnu_cxx {
+ template<> struct hash< inodeno_t >
+ {
+ size_t operator()( const inodeno_t& x ) const
+ {
+ static hash<__uint64_t> H;
+ return H(x.val);
+ }
+ };
+}
typedef __uint64_t version_t;
+
#define INODE_MODE_FILE 0100000 // S_IFREG
#define INODE_MODE_SYMLINK 0120000 // S_IFLNK
#define INODE_MODE_DIR 0040000 // S_IFDIR
// osd types
-typedef __uint32_t ps_t; // placement seed
-typedef __uint32_t pg_t; // placement group
+//typedef __uint32_t ps_t; // placement seed
+//typedef __uint32_t pg_t; // placement group
typedef __uint64_t coll_t; // collection id
typedef __uint64_t tid_t; // transaction id
typedef __uint32_t epoch_t; // map epoch (32bits -> 13 epochs/second for 10 years)
+// placement group id
+struct pg_t {
+ __uint32_t val;
+ pg_t() : val() {}
+ pg_t(__uint32_t v) : val(v) {}
+ pg_t operator=(__uint32_t v) { val = v; return *this; }
+ pg_t operator&=(__uint32_t v) { val &= v; return *this; }
+ pg_t operator+=(pg_t o) { val += o.val; return *this; }
+ pg_t operator-=(pg_t o) { val -= o.val; return *this; }
+ pg_t operator++() { ++val; return *this; }
+ operator __uint32_t() const { return val; }
+};
+
+inline ostream& operator<<(ostream& out, pg_t pg) {
+ return out << hex << pg.val << dec;
+}
+
+namespace __gnu_cxx {
+ template<> struct hash< pg_t >
+ {
+ size_t operator()( const pg_t& x ) const
+ {
+ static hash<__uint32_t> H;
+ return H(x.val);
+ }
+ };
+}
+
+typedef pg_t ps_t; // placement seed
+
+
// compound rados version type
class eversion_t {
{
string path;
dir.get_inode()->make_path(path);
- out << "[dir " << hex << dir.ino() << dec << " " << path << "/";
+ out << "[dir " << dir.ino() << " " << path << "/";
if (dir.is_dirty()) out << " dirty";
if (dir.is_import()) out << " import";
if (dir.is_export()) out << " export";
{
string path;
in.make_path(path);
- out << "[inode " << hex << in.inode.ino << dec << " " << path << (in.is_dir() ? "/ ":" ");
+ out << "[inode " << in.inode.ino << " " << path << (in.is_dir() ? "/ ":" ");
if (in.is_auth()) {
out << "auth";
if (in.is_cached_by_anyone()) {
if (parent) {
parent->dir->inode->make_anchor_trace(trace);
- dout(7) << "make_anchor_trace adding " << hex << ino() << " dirino " << parent->dir->inode->ino() << dec << " dn " << parent->name << endl;
+ dout(7) << "make_anchor_trace adding " << ino() << " dirino " << parent->dir->inode->ino() << " dn " << parent->name << endl;
trace.push_back( new Anchor(ino(),
parent->dir->inode->ino(),
parent->name) );
}
else if (state_test(CINODE_STATE_DANGLING)) {
- dout(7) << "make_anchor_trace dangling " << hex << ino() << dec << " on mds " << dangling_auth << endl;
+ dout(7) << "make_anchor_trace dangling " << ino() << " on mds " << dangling_auth << endl;
string ref_dn;
trace.push_back( new Anchor(ino(),
MDS_INO_INODEFILE_OFFSET+dangling_auth,
#include "events/EDirUpdate.h"
#include "events/EUnlink.h"
#include "events/EAlloc.h"
+#include "events/EMknod.h"
LogEvent *LogEvent::decode(bufferlist& bl)
{
// parse type, length
int off = 0;
- __uint32_t type;
+ int type;
bl.copy(off, sizeof(type), (char*)&type);
off += sizeof(type);
le = new EAlloc();
break;
+ case EVENT_MKNOD:
+ le = new EMknod();
+ break;
+
default:
dout(1) << "uh oh, unknown event type " << type << endl;
assert(0);
#define EVENT_DIRUPDATE 3
#define EVENT_UNLINK 4
#define EVENT_ALLOC 5
+#define EVENT_MKNOD 6
#include <string>
dout(7) << "linking in remote in " << *in << endl;
dn->link_remote(in);
} else {
- dout(7) << "remote link to " << hex << dn->get_remote_ino() << dec << ", which i don't have" << endl;
+ dout(7) << "remote link to " << dn->get_remote_ino() << ", which i don't have" << endl;
open_remote_ino(dn->get_remote_ino(), req,
ondelay);
return 1;
// forwarder wants replicas?
if (is_client_req && ((MClientRequest*)req)->get_mds_wants_replica_in_dirino()) {
- dout(30) << "traverse: REP is here, " << hex << ((MClientRequest*)req)->get_mds_wants_replica_in_dirino() << " vs " << cur->dir->ino() << dec << endl;
+ dout(30) << "traverse: REP is here, " << ((MClientRequest*)req)->get_mds_wants_replica_in_dirino() << " vs " << cur->dir->ino() << endl;
if (((MClientRequest*)req)->get_mds_wants_replica_in_dirino() == cur->dir->ino() &&
cur->dir->is_auth() &&
cur = get_inode(m->get_base_ino());
if (!cur) {
- dout(7) << "discover_reply don't have base ino " << hex << m->get_base_ino() << dec << ", dropping" << endl;
+ dout(7) << "discover_reply don't have base ino " << m->get_base_ino() << ", dropping" << endl;
delete m;
return;
}
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 " << hex << m->get_ino() << dec << ", don't have it, sending expire" << endl;
+ dout(7) << "inode_update on " << m->get_ino() << ", don't have it, sending expire" << endl;
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);
int nonce = it->second;
if (!in) {
- dout(0) << "inode_expire on " << hex << it->first << dec << " from " << from << ", don't have it" << endl;
+ dout(0) << "inode_expire on " << it->first << " from " << from << ", don't have it" << endl;
assert(in); // i should be authority, or proxy .. and pinned
}
if (!in->is_auth()) {
{
CInode *in = get_inode(m->get_ino());
if (!in || !in->dir) {
- dout(5) << "dir_update on " << hex << m->get_ino() << dec << ", don't have it" << endl;
+ dout(5) << "dir_update on " << m->get_ino() << ", don't have it" << endl;
// discover it?
if (m->should_discover()) {
if (diri) dir = diri->dir;
if (!diri || !dir) {
- dout(7) << "handle_dentry_unlink don't have dir " << hex << m->get_dirino() << dec << endl;
+ dout(7) << "handle_dentry_unlink don't have dir " << m->get_dirino() << endl;
}
else {
CDentry *dn = dir->lookup(m->get_dn());
#include "events/EInodeUpdate.h"
#include "events/EDirUpdate.h"
+#include "events/EMknod.h"
#include "include/filepath.h"
#include "common/Timer.h"
newi->mark_dirty();
// journal it
- mdlog->submit_entry(new EDirUpdate(dir)); // FIXME WRONG EVENT
+ mdlog->submit_entry(new EMknod(newi));
// ok!
return newi;
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+/*
+ * 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 __EMKNOD_H
+#define __EMKNOD_H
+
+#include <assert.h>
+#include "config.h"
+#include "include/types.h"
+
+#include "ETraced.h"
+#include "../MDStore.h"
+
+
+class EMknod : public ETraced {
+ protected:
+ public:
+ EMknod(CInode *in) : ETraced(EVENT_MKNOD, in) {
+ }
+ EMknod() : ETraced(EVENT_MKNOD) { }
+
+ void print(ostream& out) {
+ out << "mknod ";
+ ETraced::print(out);
+ }
+
+ virtual void encode_payload(bufferlist& bl) {
+ encode_trace(bl);
+ }
+ void decode_payload(bufferlist& bl, int& off) {
+ decode_trace(bl, off);
+ }
+
+ bool can_expire(MDS *mds) {
+ // am i obsolete?
+ CInode *diri = mds->mdcache->get_inode( trace.back().dirino );
+ if (!diri) return true;
+ CDir *dir = diri->dir;
+ if (!dir) return true;
+
+ if (!dir->is_auth()) return true; // not mine!
+ if (dir->is_frozen()) return true; // frozen -> exporting -> obsolete? FIXME
+
+ if (!dir->is_dirty()) return true;
+
+ if (dir->get_committing_version() > trace.back().dirv)
+ return true;
+
+ return false;
+ }
+
+ virtual void retire(MDS *mds, Context *c) {
+ // commit directory
+ CInode *in = mds->mdcache->get_inode( trace.back().dirino );
+ assert(in);
+ CDir *dir = in->dir;
+ assert(dir);
+
+ dout(10) << "EMknod committing dir " << *dir << endl;
+ mds->mdstore->commit_dir(dir, c);
+ }
+
+};
+
+#endif
for (list<bit>::iterator p = trace.begin();
p != trace.end();
p++) {
- if (p != trace.begin()) out << "/";
- out << p->dn;
+ if (p == trace.begin())
+ out << "[" << p->dirino << "]/" << p->dn;
+ else
+ out << "/" << p->dn;
}
}
// my local store
ObjectStore *store;
- const static inodeno_t INO_ELECTOR = 1;
- const static inodeno_t INO_MON_MAP = 2;
- const static inodeno_t INO_OSD_MAP = 10;
- const static inodeno_t INO_OSD_INC_MAP = 11;
- const static inodeno_t INO_MDS_MAP = 20;
-
+ const static int INO_ELECTOR = 1;
+ const static int INO_MON_MAP = 2;
+ const static int INO_OSD_MAP = 10;
+ const static int INO_OSD_INC_MAP = 11;
+ const static int INO_MDS_MAP = 20;
// elector
Elector elector;
if (pg_lock.count(pgid)) {
Cond c;
- dout(15) << "lock_pg " << hex << pgid << dec << " waiting as " << &c << endl;
- //cerr << "lock_pg " << hex << pgid << dec << " waiting as " << &c << endl;
+ dout(15) << "lock_pg " << pgid << " waiting as " << &c << endl;
+ //cerr << "lock_pg " << pgid << " waiting as " << &c << endl;
list<Cond*>& ls = pg_lock_waiters[pgid]; // this is commit, right?
ls.push_back(&c);
pg_lock_waiters.erase(pgid);
}
- dout(15) << "lock_pg " << hex << pgid << dec << endl;
+ dout(15) << "lock_pg " << pgid << endl;
pg_lock.insert(pgid);
return pg_map[pgid];
// someone is in line
Cond *c = pg_lock_waiters[pgid].front();
assert(c);
- dout(15) << "unlock_pg " << hex << pgid << dec << " waking up next guy " << c << endl;
+ dout(15) << "unlock_pg " << pgid << " waking up next guy " << c << endl;
c->Signal();
} else {
// nobody waiting
- dout(15) << "unlock_pg " << hex << pgid << dec << endl;
+ dout(15) << "unlock_pg " << pgid << endl;
}
}
void OSD::_remove_pg(pg_t pgid)
{
- dout(10) << "_remove_pg " << hex << pgid << dec << endl;
+ dout(10) << "_remove_pg " << pgid << endl;
// remove from store
list<object_t> olist;
for (int nrep = 1;
nrep <= MIN(g_conf.num_osd, g_conf.osd_max_rep); // for low osd counts.. hackish bleh
nrep++) {
- for (pg_t ps = 0; ps < maxps; ps++) {
+ for (pg_t ps = 0; ps < maxps; ++ps) {
pg_t pgid = osdmap->ps_nrep_to_pg(ps, nrep);
vector<int> acting;
int nrep = osdmap->pg_to_acting_osds(pgid, acting);
*/
void OSD::project_pg_history(pg_t pgid, PG::Info::History& h, epoch_t from)
{
- dout(15) << "project_pg_history " << hex << pgid << dec
+ dout(15) << "project_pg_history " << pgid
<< " from " << from << " to " << osdmap->get_epoch()
<< ", start " << h
<< endl;
// acting set change?
if (acting != last &&
e <= h.same_since) {
- dout(15) << "project_pg_history " << hex << pgid << dec << " changed in " << e+1
+ dout(15) << "project_pg_history " << pgid << " changed in " << e+1
<< " from " << acting << " -> " << last << endl;
h.same_since = e+1;
}
// primary change?
if (!(!acting.empty() && !last.empty() && acting[0] == last[0]) &&
e <= h.same_primary_since) {
- dout(15) << "project_pg_history " << hex << pgid << dec << " primary changed in " << e+1 << endl;
+ dout(15) << "project_pg_history " << pgid << " primary changed in " << e+1 << endl;
h.same_primary_since = e+1;
if (g_conf.osd_rep == OSD_REP_PRIMARY)
if (g_conf.osd_rep != OSD_REP_PRIMARY) {
if (!(!acting.empty() && !last.empty() && acting[acting.size()-1] == last[last.size()-1]) &&
e <= h.same_acker_since) {
- dout(15) << "project_pg_history " << hex << pgid << dec << " acker changed in " << e+1 << endl;
+ dout(15) << "project_pg_history " << pgid << " acker changed in " << e+1 << endl;
h.same_acker_since = e+1;
}
}
project_pg_history(pgid, history, m->get_epoch());
if (m->get_epoch() < history.same_primary_since) {
- dout(10) << "handle_pg_notify pg " << hex << pgid << dec << " dne, and primary changed in "
+ dout(10) << "handle_pg_notify pg " << pgid << " dne, and primary changed in "
<< history.same_primary_since << " (msg from " << m->get_epoch() << ")" << endl;
continue;
}
if (!require_same_or_newer_map(m, m->get_epoch())) return;
if (pg_map.count(pgid) == 0) {
- dout(10) << "handle_pg_log don't have pg " << hex << pgid << dec << ", dropping" << endl;
+ dout(10) << "handle_pg_log don't have pg " << pgid << ", dropping" << endl;
assert(m->get_epoch() < osdmap->get_epoch());
delete m;
return;
project_pg_history(pgid, history, m->get_epoch());
if (m->get_epoch() < history.same_since) {
- dout(10) << " pg " << hex << pgid << dec << " dne, and pg has changed in "
+ dout(10) << " pg " << pgid << " dne, and pg has changed in "
<< history.same_primary_since << " (msg from " << m->get_epoch() << ")" << endl;
continue;
}
int role = osdmap->calc_pg_role(whoami, acting, nrep);
if (role < 0) {
- dout(10) << " pg " << hex << pgid << dec << " dne, and i am not an active replica" << endl;
+ dout(10) << " pg " << pgid << " dne, and i am not an active replica" << endl;
PG::Info empty(pgid);
notify_list[from].push_back(empty);
continue;
PG *pg;
if (pg_map.count(pgid) == 0) {
- dout(10) << " don't have pg " << hex << pgid << dec << endl;
+ dout(10) << " don't have pg " << pgid << endl;
continue;
}
// have pg?
if (!pg) {
dout(7) << "hit non-existent pg "
- << hex << pgid << dec
+ << pgid
<< ", waiting" << endl;
waiting_for_pg[pgid].push_back(op);
return;
// have pg?
if (!pg) {
derr(-7) << "handle_rep_op " << *op
- << " pgid " << hex << pgid << dec << " dne" << endl;
+ << " pgid " << pgid << " dne" << endl;
delete op;
//assert(0); // wtf, shouldn't happen.
return;
ls.pop_front();
if (pgid) {
- dout(10) << "dequeue_op " << op << " write pg " << hex << pgid << dec
+ dout(10) << "dequeue_op " << op << " write pg " << pgid
<< ls.size() << " / " << (pending_ops-1) << " more pending" << endl;
} else {
dout(10) << "dequeue_op " << op << " read "
put_repop_gather(pg, repop);
dout(10) << "op_modify_commit done on " << repop << endl;
} else {
- dout(10) << "op_modify_commit pg " << hex << pgid << dec << " rep_tid " << rep_tid << " dne" << endl;
+ dout(10) << "op_modify_commit pg " << pgid << " rep_tid " << rep_tid << " dne" << endl;
}
unlock_pg(pgid);
} else {
- dout(10) << "op_modify_commit pg " << hex << pgid << dec << " dne" << endl;
+ dout(10) << "op_modify_commit pg " << pgid << " dne" << endl;
}
}
int ObjectCacher::atomic_sync_readx(Objecter::OSDRead *rd, inodeno_t ino, Mutex& lock)
{
dout(10) << "atomic_sync_readx " << rd
- << " in " << hex << ino << dec
+ << " in " << ino
<< endl;
if (rd->extents.size() == 1) {
int ObjectCacher::atomic_sync_writex(Objecter::OSDWrite *wr, inodeno_t ino, Mutex& lock)
{
dout(10) << "atomic_sync_writex " << wr
- << " in " << hex << ino << dec
+ << " in " << ino
<< endl;
if (wr->extents.size() == 1 &&
o->lock_state != Object::LOCK_UPGRADING)) {
// just write synchronously.
dout(10) << "atomic_sync_writex " << wr
- << " in " << hex << ino << dec
+ << " in " << ino
<< " doing sync write"
<< endl;
bool ObjectCacher::flush_set(inodeno_t ino, Context *onfinish)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "flush_set on " << hex << ino << dec << " dne" << endl;
+ dout(10) << "flush_set on " << ino << " dne" << endl;
return true;
}
- dout(10) << "flush_set " << hex << ino << dec << endl;
+ dout(10) << "flush_set " << ino << endl;
C_Gather *gather = 0; // we'll need to wait for all objects to flush!
gather = new C_Gather(onfinish);
safe = false;
- dout(10) << "flush_set " << hex << ino << dec << " will wait for ack tid "
+ dout(10) << "flush_set " << ino << " will wait for ack tid "
<< ob->last_write_tid
<< " on " << *ob
<< endl;
}
if (safe) {
- dout(10) << "flush_set " << hex << ino << dec << " has no dirty|tx bhs" << endl;
+ dout(10) << "flush_set " << ino << " has no dirty|tx bhs" << endl;
return true;
}
return false;
assert(onfinish); // doesn't make any sense otherwise.
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "commit_set on " << hex << ino << dec << " dne" << endl;
+ dout(10) << "commit_set on " << ino << " dne" << endl;
return true;
}
- dout(10) << "commit_set " << hex << ino << dec << endl;
+ dout(10) << "commit_set " << ino << endl;
C_Gather *gather = 0; // we'll need to wait for all objects to commit
flush_set(ino);
if (ob->last_write_tid > ob->last_commit_tid) {
- dout(10) << "commit_set " << hex << ino << dec << " " << *ob
+ dout(10) << "commit_set " << ino << " " << *ob
<< " will finish on commit tid " << ob->last_write_tid
<< endl;
if (!gather && onfinish) gather = new C_Gather(onfinish);
}
if (safe) {
- dout(10) << "commit_set " << hex << ino << dec << " all committed" << endl;
+ dout(10) << "commit_set " << ino << " all committed" << endl;
return true;
}
return false;
off_t unclean = 0;
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "release_set on " << hex << ino << dec << " dne" << endl;
+ dout(10) << "release_set on " << ino << " dne" << endl;
return 0;
}
- dout(10) << "release_set " << hex << ino << dec << endl;
+ dout(10) << "release_set " << ino << endl;
set<Object*>& s = objects_by_ino[ino];
for (set<Object*>::iterator i = s.begin();
unclean += o_unclean;
if (o_unclean)
- dout(10) << "release_set " << hex << ino << dec << " " << *ob
+ dout(10) << "release_set " << ino << " " << *ob
<< " has " << o_unclean << " bytes left"
<< endl;
}
if (unclean) {
- dout(10) << "release_set " << hex << ino << dec
+ dout(10) << "release_set " << ino
<< ", " << unclean << " bytes left" << endl;
}
void ObjectCacher::kick_sync_writers(inodeno_t ino)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "kick_sync_writers on " << hex << ino << dec << " dne" << endl;
+ dout(10) << "kick_sync_writers on " << ino << " dne" << endl;
return;
}
- dout(10) << "kick_sync_writers on " << hex << ino << dec << endl;
+ dout(10) << "kick_sync_writers on " << ino << endl;
list<Context*> ls;
void ObjectCacher::kick_sync_readers(inodeno_t ino)
{
if (objects_by_ino.count(ino) == 0) {
- dout(10) << "kick_sync_readers on " << hex << ino << dec << " dne" << endl;
+ dout(10) << "kick_sync_readers on " << ino << " dne" << endl;
return;
}
- dout(10) << "kick_sync_readers on " << hex << ino << dec << endl;
+ dout(10) << "kick_sync_readers on " << ino << endl;
list<Context*> ls;
}
// changed significantly.
- dout(10) << "scan_pgs pg " << hex << pgid << dec
+ dout(10) << "scan_pgs pg " << pgid
<< " (" << pg.active_tids << ")"
<< " " << other << " -> " << pg.acting
<< endl;
void Objecter::kick_requests(set<pg_t>& changed_pgs)
{
- dout(10) << "kick_requests in pgs " << hex << changed_pgs << dec << endl;
+ dout(10) << "kick_requests in pgs " << changed_pgs << endl;
for (set<pg_t>::iterator i = changed_pgs.begin();
i != changed_pgs.end();
OSD_OP_STAT);
dout(10) << "stat_submit " << st << " tid " << last_tid
<< " oid " << ex.oid
- << " pg " << hex << ex.pgid << dec
+ << " pg " << ex.pgid
<< " osd" << pg.acker()
<< endl;
dout(10) << "readx_submit " << rd << " tid " << last_tid
<< " oid " << ex.oid << " " << ex.start << "~" << ex.length
<< " (" << ex.buffer_extents.size() << " buffer fragments)"
- << " pg " << hex << ex.pgid << dec
+ << " pg " << ex.pgid
<< " osd" << pg.acker()
<< endl;
dout(10) << "modifyx_submit " << MOSDOp::get_opname(wr->op) << " tid " << tid
<< " oid " << ex.oid
<< " " << ex.start << "~" << ex.length
- << " pg " << hex << ex.pgid << dec
+ << " pg " << ex.pgid
<< " osd" << pg.primary()
<< endl;
if (pg.primary() >= 0)