mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
client: convert Inode::snapdir_parent to smart pointer
Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
e7920c93f2
commit
89648e7ed5
@ -1267,12 +1267,12 @@ mds_rank_t Client::choose_target_mds(MetaRequest *req)
|
||||
ldout(cct, 10) << "choose_target_mds " << *in << " is snapped, using nonsnap parent" << dendl;
|
||||
while (in->snapid != CEPH_NOSNAP) {
|
||||
if (in->snapid == CEPH_SNAPDIR)
|
||||
in = in->snapdir_parent;
|
||||
in = in->snapdir_parent.get();
|
||||
else if (!in->dn_set.empty())
|
||||
/* In most cases there will only be one dentry, so getting it
|
||||
* will be the correct action. If there are multiple hard links,
|
||||
* I think the MDS should be able to redirect as needed*/
|
||||
in = in->get_first_parent()->dir->parent_inode;
|
||||
in = in->get_first_parent()->dir->parent_inode;
|
||||
else {
|
||||
ldout(cct, 10) << "got unlinked inode, can't look at parent" << dendl;
|
||||
break;
|
||||
@ -2571,11 +2571,10 @@ void Client::put_inode(Inode *in, int n)
|
||||
bool unclean = objectcacher->release_set(&in->oset);
|
||||
assert(!unclean);
|
||||
put_qtree(in);
|
||||
if (in->snapdir_parent)
|
||||
put_inode(in->snapdir_parent);
|
||||
inode_map.erase(in->vino());
|
||||
in->cap_item.remove_myself();
|
||||
in->snaprealm_item.remove_myself();
|
||||
in->snapdir_parent.reset();
|
||||
if (in == root) {
|
||||
root = 0;
|
||||
root_ancestor = 0;
|
||||
@ -8477,7 +8476,6 @@ Inode *Client::open_snapdir(Inode *diri)
|
||||
in->dirfragtree.clear();
|
||||
inode_map[vino] = in;
|
||||
in->snapdir_parent = diri;
|
||||
diri->get();
|
||||
ldout(cct, 10) << "open_snapdir created snapshot inode " << *in << dendl;
|
||||
} else {
|
||||
in = inode_map[vino];
|
||||
|
@ -243,7 +243,7 @@ struct Inode {
|
||||
|
||||
SnapRealm *snaprealm;
|
||||
xlist<Inode*>::item snaprealm_item;
|
||||
Inode *snapdir_parent; // only if we are a snapdir inode
|
||||
InodeRef snapdir_parent; // only if we are a snapdir inode
|
||||
map<snapid_t,CapSnap*> cap_snaps; // pending flush to mds
|
||||
|
||||
//int open_by_mode[CEPH_FILE_MODE_NUM];
|
||||
@ -307,7 +307,7 @@ struct Inode {
|
||||
dirty_caps(0), flushing_caps(0), flushing_cap_seq(0), shared_gen(0), cache_gen(0),
|
||||
snap_caps(0), snap_cap_refs(0),
|
||||
cap_item(this), flushing_cap_item(this), last_flush_tid(0),
|
||||
snaprealm(0), snaprealm_item(this), snapdir_parent(0),
|
||||
snaprealm(0), snaprealm_item(this),
|
||||
oset((void *)this, newlayout->fl_pg_pool, ino),
|
||||
reported_size(0), wanted_max_size(0), requested_max_size(0),
|
||||
_ref(0), ll_ref(0), dir(0), dn_set(),
|
||||
|
Loading…
Reference in New Issue
Block a user