mirror of
https://github.com/ceph/ceph
synced 2025-01-18 09:02:08 +00:00
mds: fix CInode::get_dirfrags_under()
make the function work when opened dirfrags don't match the dirfragtree. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
This commit is contained in:
parent
1080fa4571
commit
ee0ab2b733
@ -460,13 +460,31 @@ bool CInode::get_dirfrags_under(frag_t fg, list<CDir*>& ls)
|
||||
bool all = true;
|
||||
list<frag_t> fglist;
|
||||
dirfragtree.get_leaves_under(fg, fglist);
|
||||
for (list<frag_t>::iterator p = fglist.begin();
|
||||
p != fglist.end();
|
||||
++p)
|
||||
for (list<frag_t>::iterator p = fglist.begin(); p != fglist.end(); ++p)
|
||||
if (dirfrags.count(*p))
|
||||
ls.push_back(dirfrags[*p]);
|
||||
else
|
||||
all = false;
|
||||
|
||||
if (all)
|
||||
return all;
|
||||
|
||||
fragtree_t tmpdft;
|
||||
tmpdft.force_to_leaf(g_ceph_context, fg);
|
||||
for (map<frag_t,CDir*>::iterator p = dirfrags.begin(); p != dirfrags.end(); ++p) {
|
||||
tmpdft.force_to_leaf(g_ceph_context, p->first);
|
||||
if (fg.contains(p->first) && !dirfragtree.is_leaf(p->first))
|
||||
ls.push_back(p->second);
|
||||
}
|
||||
|
||||
all = true;
|
||||
tmpdft.get_leaves_under(fg, fglist);
|
||||
for (list<frag_t>::iterator p = fglist.begin(); p != fglist.end(); ++p)
|
||||
if (!dirfrags.count(*p)) {
|
||||
all = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user