mirror of
https://github.com/ceph/ceph
synced 2025-01-20 18:21:57 +00:00
mds: cleanup rename_prepare a bit
Use *srci tmp. Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
0bcd9ac73c
commit
7ca240bf6d
@ -5074,9 +5074,10 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
|
||||
CDentry::linkage_t *srcdnl = srcdn->get_projected_linkage();
|
||||
CDentry::linkage_t *destdnl = destdn->get_projected_linkage();
|
||||
CInode *srci = srcdnl->get_inode();
|
||||
|
||||
// primary+remote link merge?
|
||||
bool linkmerge = (srcdnl->get_inode() == destdnl->get_inode() &&
|
||||
bool linkmerge = (srci == destdnl->get_inode() &&
|
||||
(srcdnl->is_primary() || destdnl->is_primary()));
|
||||
bool silent = srcdn->get_dir()->inode->is_stray();
|
||||
if (linkmerge && !silent) {
|
||||
@ -5118,9 +5119,9 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
mdr->more()->pvmap[destdn] = destdn->pre_dirty();
|
||||
destdn->push_projected_linkage(srcdnl->get_remote_ino(), srcdnl->get_remote_d_type());
|
||||
}
|
||||
if (srcdnl->get_inode()->is_auth()) {
|
||||
pi = srcdnl->get_inode()->project_inode();
|
||||
pi->version = srcdnl->get_inode()->pre_dirty();
|
||||
if (srci->is_auth()) {
|
||||
pi = srci->project_inode();
|
||||
pi->version = srci->pre_dirty();
|
||||
}
|
||||
} else {
|
||||
dout(10) << " will merge remote onto primary link" << dendl;
|
||||
@ -5133,13 +5134,13 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
if (destdn->is_auth()) {
|
||||
version_t oldpv;
|
||||
if (srcdn->is_auth())
|
||||
oldpv = srcdnl->get_inode()->get_projected_version();
|
||||
oldpv = srci->get_projected_version();
|
||||
else
|
||||
oldpv = _rename_prepare_import(mdr, srcdn, client_map_bl);
|
||||
pi = srcdnl->get_inode()->project_inode(); // project snaprealm if srcdnl->is_primary
|
||||
pi = srci->project_inode(); // project snaprealm if srcdnl->is_primary
|
||||
// & srcdnl->snaprealm
|
||||
pi->version = mdr->more()->pvmap[destdn] = destdn->pre_dirty(oldpv);
|
||||
destdn->push_projected_linkage(srcdnl->get_inode());
|
||||
destdn->push_projected_linkage(srci);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5176,9 +5177,9 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
int predirty_primary = (srcdnl->is_primary() && srcdn->get_dir() != destdn->get_dir()) ? PREDIRTY_PRIMARY:0;
|
||||
int flags = predirty_dir | predirty_primary;
|
||||
if (srcdn->is_auth())
|
||||
mdcache->predirty_journal_parents(mdr, metablob, srcdnl->get_inode(), srcdn->get_dir(), PREDIRTY_SHALLOW|flags, -1);
|
||||
mdcache->predirty_journal_parents(mdr, metablob, srci, srcdn->get_dir(), PREDIRTY_SHALLOW|flags, -1);
|
||||
if (destdn->is_auth())
|
||||
mdcache->predirty_journal_parents(mdr, metablob, srcdnl->get_inode(), destdn->get_dir(), flags, 1);
|
||||
mdcache->predirty_journal_parents(mdr, metablob, srci, destdn->get_dir(), flags, 1);
|
||||
|
||||
SnapRealm *dest_realm = destdn->get_dir()->inode->find_snaprealm();
|
||||
snapid_t next_dest_snap = dest_realm->get_newest_seq() + 1;
|
||||
@ -5208,9 +5209,9 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
else
|
||||
destdn->first = MAX(destdn->first, next_dest_snap);
|
||||
metablob->add_remote_dentry(destdn, true, srcdnl->get_remote_ino(), srcdnl->get_remote_d_type());
|
||||
if (srcdnl->get_inode()->is_auth()) {
|
||||
mdcache->journal_cow_dentry(mdr, metablob, srcdnl->get_inode()->get_parent_dn(), CEPH_NOSNAP, 0, srcdnl);
|
||||
ji = metablob->add_primary_dentry(srcdnl->get_inode()->get_parent_dn(), true, srcdnl->get_inode());
|
||||
if (srci->is_auth()) {
|
||||
mdcache->journal_cow_dentry(mdr, metablob, srci->get_parent_dn(), CEPH_NOSNAP, 0, srcdnl);
|
||||
ji = metablob->add_primary_dentry(srci->get_parent_dn(), true, srci);
|
||||
}
|
||||
} else {
|
||||
if (!destdnl->is_null())
|
||||
@ -5222,14 +5223,14 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
} else if (srcdnl->is_primary()) {
|
||||
// project snap parent update?
|
||||
bufferlist snapbl;
|
||||
if (destdn->is_auth() && srcdnl->get_inode()->snaprealm)
|
||||
srcdnl->get_inode()->project_past_snaprealm_parent(dest_realm, snapbl);
|
||||
if (destdn->is_auth() && srci->snaprealm)
|
||||
srci->project_past_snaprealm_parent(dest_realm, snapbl);
|
||||
|
||||
if (!destdnl->is_null())
|
||||
mdcache->journal_cow_dentry(mdr, metablob, destdn, CEPH_NOSNAP, 0, destdnl);
|
||||
else
|
||||
destdn->first = MAX(destdn->first, next_dest_snap);
|
||||
ji = metablob->add_primary_dentry(destdn, true, srcdnl->get_inode(), 0, &snapbl);
|
||||
ji = metablob->add_primary_dentry(destdn, true, srci, 0, &snapbl);
|
||||
}
|
||||
|
||||
// src
|
||||
@ -5242,7 +5243,7 @@ void Server::_rename_prepare(MDRequest *mdr,
|
||||
|
||||
// make renamed inode first track the dn
|
||||
if (srcdnl->is_primary() && destdn->is_auth())
|
||||
srcdnl->get_inode()->first = destdn->first;
|
||||
srci->first = destdn->first;
|
||||
|
||||
// do inode updates in journal, even if we aren't auth (hmm, is this necessary?)
|
||||
if (!silent) {
|
||||
|
Loading…
Reference in New Issue
Block a user