Bug #1435 » LOCAL-verbose-track-layout.patch
src/mds/CDir.cc | ||
---|---|---|
continue;
|
||
} else {
|
||
// inode
|
||
in = new CInode(cache, true, first, last);
|
||
in = new CInode(inode.ino, cache, true, first, last);
|
||
in->inode = inode;
|
||
|
||
// symlink?
|
||
... | ... | |
// add
|
||
cache->add_inode( in );
|
||
in->check_layout("CDir::fetched");
|
||
|
||
// link
|
||
dn = add_primary_dentry(dname, in, first, last);
|
src/mds/CInode.cc | ||
---|---|---|
}
|
||
projected_nodes.back()->xattrs = px;
|
||
dout(15) << "project_inode " << projected_nodes.back()->inode << dendl;
|
||
check_layout("project_inode", projected_nodes.back()->dir_layout);
|
||
return projected_nodes.back()->inode;
|
||
}
|
||
... | ... | |
if (projected_nodes.front()->dir_layout != default_layout) {
|
||
delete default_layout;
|
||
check_layout("will pop projected_inode");
|
||
default_layout = projected_nodes.front()->dir_layout;
|
||
check_layout("popped projected_inode");
|
||
}
|
||
if (projected_nodes.front()->snapnode)
|
||
... | ... | |
case CEPH_LOCK_IPOLICY:
|
||
if (inode.is_dir()) {
|
||
check_layout("encode lock ipolicy");
|
||
::encode((default_layout ? true : false), bl);
|
||
if (default_layout)
|
||
encode(*default_layout, bl);
|
||
... | ... | |
default_layout = new default_file_layout;
|
||
decode(*default_layout, p);
|
||
}
|
||
check_layout("decode lock ipolicy");
|
||
}
|
||
break;
|
||
... | ... | |
e.layout = i->layout;
|
||
} else if (is_dir()) {
|
||
ceph_file_layout *l = ppolicy ? get_projected_dir_layout() : ( default_layout ? &default_layout->layout : NULL );
|
||
check_layout("encode inode_stat");
|
||
if (l)
|
||
e.layout = *l;
|
||
else
|
src/mds/CInode.h | ||
---|---|---|
//bool hack_accessed;
|
||
//utime_t hack_load_stamp;
|
||
private:
|
||
default_file_layout *default_layout;
|
||
public:
|
||
default_file_layout *&default_layout_() { return default_layout; }
|
||
/**
|
||
* Projection methods, used to store inode changes until they have been journaled,
|
||
... | ... | |
return projected_nodes.back();
|
||
}
|
||
bool check_layout(const char *s,
|
||
default_file_layout *layout = (default_file_layout*)-1) {
|
||
if (inode.ino.val > 1099511627788
|
||
|| inode.ino.val < 1099511627776
|
||
|| inode.ino.val == 1099511627777)
|
||
return true;
|
||
if (layout == (default_file_layout*)-1)
|
||
layout = default_layout;
|
||
generic_dout(0) << s << " dir " << inode.ino.val - 1099511627776
|
||
<< " layout pool "
|
||
<< (!layout ? 0 : int(layout->layout.fl_pg_pool))
|
||
<< " inode pool " << int(inode.layout.fl_pg_pool)
|
||
<< dendl;
|
||
return layout && int(layout->layout.fl_pg_pool);
|
||
}
|
||
ceph_file_layout *get_projected_dir_layout() {
|
||
if (!inode.is_dir())
|
||
return NULL;
|
||
if (projected_nodes.empty()) {
|
||
check_layout("get not projected");
|
||
if (default_layout)
|
||
return &default_layout->layout;
|
||
else
|
||
return NULL;
|
||
}
|
||
else if (projected_nodes.back()->dir_layout)
|
||
else {
|
||
check_layout("get projected", projected_nodes.back()->dir_layout);
|
||
if (projected_nodes.back()->dir_layout)
|
||
return &projected_nodes.back()->dir_layout->layout;
|
||
else
|
||
return NULL;
|
||
}
|
||
}
|
||
version_t get_projected_version() {
|
||
... | ... | |
public:
|
||
// ---------------------------
|
||
CInode(MDCache *c, bool auth=true, snapid_t f=2, snapid_t l=CEPH_NOSNAP) :
|
||
CInode(inodeno_t i,
|
||
MDCache *c, bool auth=true, snapid_t f=2, snapid_t l=CEPH_NOSNAP) :
|
||
mdcache(c),
|
||
snaprealm(0), containing_realm(0),
|
||
first(f), last(l),
|
||
... | ... | |
g_num_inoa++;
|
||
state = 0;
|
||
if (auth) state_set(STATE_AUTH);
|
||
inode.ino = i;
|
||
check_layout("CInode ctor");
|
||
inode.ino = 0;
|
||
};
|
||
~CInode() {
|
||
check_layout(" CInode dtor");
|
||
g_num_ino--;
|
||
g_num_inos++;
|
||
close_dirfrags();
|
||
... | ... | |
::encode(snapbl, bl);
|
||
::encode(old_inodes, bl);
|
||
if (inode.is_dir()) {
|
||
check_layout("encode store");
|
||
::encode((default_layout ? true : false), bl);
|
||
if (default_layout)
|
||
::encode(*default_layout, bl);
|
||
... | ... | |
default_layout = new default_file_layout;
|
||
::decode(*default_layout, bl);
|
||
}
|
||
check_layout("decode store");
|
||
}
|
||
}
|
||
... | ... | |
_encode_base(bl);
|
||
_encode_locks_state_for_replica(bl);
|
||
if (inode.is_dir()) {
|
||
check_layout("encode replica");
|
||
::encode((default_layout ? true : false), bl);
|
||
if (default_layout)
|
||
::encode(*default_layout, bl);
|
||
... | ... | |
default_layout = new default_file_layout;
|
||
::decode(*default_layout, p);
|
||
}
|
||
check_layout("decode replica");
|
||
}
|
||
}
|
||
src/mds/MDCache.cc | ||
---|---|---|
CInode *MDCache::create_system_inode(inodeno_t ino, int mode)
|
||
{
|
||
dout(0) << "creating system inode with ino:" << ino << dendl;
|
||
CInode *in = new CInode(this);
|
||
CInode *in = new CInode(ino, this);
|
||
in->inode.ino = ino;
|
||
in->inode.version = 1;
|
||
in->inode.mode = 0500 | mode;
|
||
... | ... | |
}
|
||
|
||
add_inode(in);
|
||
in->check_layout("create_system_inode");
|
||
return in;
|
||
}
|
||
CInode *MDCache::create_root_inode()
|
||
{
|
||
CInode *i = create_system_inode(MDS_INO_ROOT, S_IFDIR|0755);
|
||
i->default_layout = new struct default_file_layout;
|
||
i->default_layout_() = new struct default_file_layout;
|
||
i->default_layout->layout = default_file_layout;
|
||
i->default_layout->layout.fl_pg_pool = mds->mdsmap->get_data_pg_pool();
|
||
return i;
|
||
... | ... | |
{
|
||
assert(last >= in->first);
|
||
CInode *oldin = new CInode(this, true, in->first, last);
|
||
CInode *oldin = new CInode(in->get_previous_projected_inode()->ino,
|
||
this, true, in->first, last);
|
||
oldin->inode = *in->get_previous_projected_inode();
|
||
oldin->symlink = in->symlink;
|
||
oldin->xattrs = *in->get_previous_projected_xattrs();
|
||
... | ... | |
dout(10) << "cow_inode " << *in << " to " << *oldin << dendl;
|
||
add_inode(oldin);
|
||
oldin->check_layout("cow_inode oldin");
|
||
in->check_layout("cow_inode in");
|
||
|
||
SnapRealm *realm = in->find_snaprealm();
|
||
const set<snapid_t>& snaps = realm->get_snaps();
|
||
... | ... | |
CInode *MDCache::rejoin_invent_inode(inodeno_t ino, snapid_t last)
|
||
{
|
||
CInode *in = new CInode(this, true, 1, last);
|
||
CInode *in = new CInode(ino, this, true, 1, last);
|
||
in->inode.ino = ino;
|
||
in->state_set(CInode::STATE_REJOINUNDEF);
|
||
add_inode(in);
|
||
rejoin_undef_inodes.insert(in);
|
||
dout(10) << " invented " << *in << dendl;
|
||
in->check_layout(" rejoin_invent_inode");
|
||
return in;
|
||
}
|
||
... | ... | |
CInode *in = get_inode(q->second.ino, q->first.snapid);
|
||
assert(in == 0); // a rename would have been caught be the resolve stage.
|
||
// barebones inode; the full inode loop below will clean up.
|
||
in = new CInode(this, false, q->second.first, q->first.snapid);
|
||
in = new CInode(q->second.ino,
|
||
this, false, q->second.first, q->first.snapid);
|
||
in->inode.ino = q->second.ino;
|
||
add_inode(in);
|
||
in->check_layout("handle_cache_rejoin_ack init");
|
||
dn->dir->link_primary_inode(dn, in);
|
||
}
|
||
}
|
||
... | ... | |
in->_decode_locks_rejoin(q, rejoin_waiters);
|
||
in->state_clear(CInode::STATE_REJOINING);
|
||
dout(10) << " got inode locks " << *in << dendl;
|
||
in->check_layout("handle_cache_rejoin_ack fini");
|
||
}
|
||
// done?
|
||
... | ... | |
::decode(last, p);
|
||
CInode *in = get_inode(ino, last);
|
||
if (!in) {
|
||
in = new CInode(this, false, 1, last);
|
||
in = new CInode(ino, this, false, 1, last);
|
||
in->decode_replica(p, true);
|
||
add_inode(in);
|
||
in->check_layout("add_replica_inode");
|
||
if (in->ino() == MDS_INO_ROOT)
|
||
in->inode_auth.first = 0;
|
||
else if (in->is_mdsdir())
|
src/mds/Migrator.cc | ||
---|---|---|
bool added = false;
|
||
CInode *in = cache->get_inode(ino, last);
|
||
if (!in) {
|
||
in = new CInode(mds->mdcache, true, 1, last);
|
||
in = new CInode(ino, mds->mdcache, true, 1, last);
|
||
added = true;
|
||
} else {
|
||
in->state_set(CInode::STATE_AUTH);
|
||
... | ... | |
dout(10) << " had " << *in << dendl;
|
||
}
|
||
in->check_layout("decode_import_node");
|
||
if (in->inode.is_dirty_rstat())
|
||
in->mark_dirty_rstat();
|
||
|
src/mds/Server.cc | ||
---|---|---|
CInode* Server::prepare_new_inode(MDRequest *mdr, CDir *dir, inodeno_t useino, unsigned mode,
|
||
ceph_file_layout *layout)
|
||
{
|
||
CInode *in = new CInode(mdcache);
|
||
CInode *in = new CInode(useino, mdcache);
|
||
|
||
// assign ino
|
||
if (mdr->session->prealloc_inos.size()) {
|
||
... | ... | |
mdcache->add_inode(in); // add
|
||
dout(10) << "prepare_new_inode " << *in << dendl;
|
||
in->check_layout("prepare_new_inode");
|
||
return in;
|
||
}
|
||
src/mds/events/EMetaBlob.h | ||
---|---|---|
if (in->is_dir())
|
||
default_layout = (in->get_projected_node() ?
|
||
in->get_projected_node()->dir_layout :
|
||
in->default_layout);
|
||
in->default_layout_());
|
||
in->check_layout("add primary dentry", default_layout);
|
||
bufferlist snapbl;
|
||
sr_t *sr = in->get_projected_srnode();
|
||
... | ... | |
if (in->is_dir())
|
||
default_layout = (in->get_projected_node() ?
|
||
in->get_projected_node()->dir_layout :
|
||
in->default_layout);
|
||
in->default_layout_());
|
||
in->check_layout("add root", default_layout);
|
||
bufferlist snapbl;
|
||
if (psnapbl)
|
src/mds/journal.cc | ||
---|---|---|
in->force_dirfrags();
|
||
}
|
||
delete in->default_layout;
|
||
in->default_layout = dir_layout;
|
||
delete in->default_layout_();
|
||
in->default_layout_() = dir_layout;
|
||
in->check_layout("update inode");
|
||
dir_layout = NULL;
|
||
/*
|
||
* we can do this before linking hte inode bc the split_at would
|
||
... | ... | |
CInode *in = mds->mdcache->get_inode(root->inode.ino);
|
||
bool isnew = in ? false:true;
|
||
if (!in)
|
||
in = new CInode(mds->mdcache, true);
|
||
in = new CInode(root->inode.ino, mds->mdcache, true);
|
||
root->update_inode(mds, in);
|
||
if (isnew)
|
||
mds->mdcache->add_inode(in);
|
||
if (root->dirty) in->_mark_dirty(logseg);
|
||
dout(10) << "EMetaBlob.replay " << (isnew ? " added root ":" updated root ") << *in << dendl;
|
||
in->check_layout("EMetaBlob.replay root");
|
||
}
|
||
CInode *renamed_diri = 0;
|
||
... | ... | |
CInode *in = mds->mdcache->get_inode(p->inode.ino, p->dnlast);
|
||
if (!in) {
|
||
in = new CInode(mds->mdcache, true, p->dnfirst, p->dnlast);
|
||
in = new CInode(p->inode.ino, mds->mdcache, true, p->dnfirst, p->dnlast);
|
||
p->update_inode(mds, in);
|
||
mds->mdcache->add_inode(in);
|
||
in->check_layout("EMetaBlob.replay dentry");
|
||
if (!dn->get_linkage()->is_null()) {
|
||
if (dn->get_linkage()->is_primary()) {
|
||
CInode *old_in = dn->get_linkage()->get_inode();
|