]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix broken snaprealm split optimization for (unlinked) files
authorSage Weil <sage@newdream.net>
Wed, 14 Apr 2010 18:08:38 +0000 (11:08 -0700)
committerSage Weil <sage@newdream.net>
Wed, 14 Apr 2010 18:31:52 +0000 (11:31 -0700)
Splitting a file is trivial; do it.  No special case for 'stray'.

src/mds/CInode.cc
src/mds/snap.cc

index f905e0c1c626ef4c48662d8baa6b63a6bb6abab2..5ec7c55a3d042304b615ae4dc288cb099239a7d5 100644 (file)
@@ -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);
     }
index de9147c918c000285c9c618ccaea82b3b9155a69..65e4755c7a267fd8a5355cc719ffaaf9006ac021 100644 (file)
@@ -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<SnapRealm*>::iterator p = open_children.begin();