]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Properly call btrfs_search_slot while shrinking
authorChris Mason <chris.mason@oracle.com>
Fri, 4 Jan 2008 14:34:54 +0000 (09:34 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:59 +0000 (11:03 -0400)
The shrinking code used btrfs_next_leaf to find the next item, but
this does not cow the blocks it touches.  This fix calls search_slot after
finding the next item to do appropriate cow and balancing.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index 426a0222e12f7c4474d3aa0077af69b8808369a4..c390fd847a27c9658d00d713ce7493afb1ded49a 100644 (file)
@@ -2434,7 +2434,15 @@ bg_next:
                                break;
                        }
                        leaf = path->nodes[0];
-                       nritems = btrfs_header_nritems(leaf);
+                       btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
+
+                       /*
+                        * btrfs_next_leaf doesn't cow buffers, we have to
+                        * do the search again
+                        */
+                       memcpy(&key, &found_key, sizeof(key));
+                       btrfs_release_path(root, path);
+                       continue;
                }
 
                btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);