From: Sage Weil Date: Wed, 14 Apr 2010 18:08:38 +0000 (-0700) Subject: mds: fix broken snaprealm split optimization for (unlinked) files X-Git-Tag: v0.20~59 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=96befd4a5ad568fe34faab0c56edbd3a4a92a6c3;p=ceph.git mds: fix broken snaprealm split optimization for (unlinked) files Splitting a file is trivial; do it. No special case for 'stray'. --- diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index f905e0c1c62..5ec7c55a3d0 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -1533,9 +1533,7 @@ void CInode::open_snaprealm(bool nosplit) << dendl; dout(30) << " siblings are " << parent->open_children << dendl; snaprealm->parent = parent; - if (!nosplit && - is_dir() && - !get_parent_dir()->get_inode()->is_stray()) // optimization + if (!nosplit) parent->split_at(snaprealm); parent->open_children.insert(snaprealm); } diff --git a/src/mds/snap.cc b/src/mds/snap.cc index de9147c918c..65e4755c7a2 100644 --- a/src/mds/snap.cc +++ b/src/mds/snap.cc @@ -362,6 +362,16 @@ void SnapRealm::split_at(SnapRealm *child) dout(10) << "split_at " << *child << " on " << *child->inode << dendl; + if (!child->inode->is_dir()) { + // it's not a dir: + // - no open children. + // - only need to move this child's inode's caps. + child->inode->move_to_containing_realm(child); + return; + } + + // it's a dir. + // split open_children dout(10) << " open_children are " << open_children << dendl; for (set::iterator p = open_children.begin();