Btrfs: snapshot progress
[linux-2.6-block.git] / fs / btrfs / dir-item.c
index 7aed9f015b557c6691f0f29155a22fe41c86c0e5..0ba46bc0da9a41111aaee9f5f98b3e8ffa412b05 100644 (file)
@@ -55,12 +55,14 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
        btrfs_set_dir_flags(dir_item, 0);
        btrfs_set_dir_name_len(dir_item, name_len);
        name_ptr = (char *)(dir_item + 1);
+
+       btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
+       btrfs_mark_buffer_dirty(path->nodes[0]);
+
        /* FIXME, use some real flag for selecting the extra index */
        if (root == root->fs_info->tree_root)
                goto out;
 
-       btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
-       btrfs_mark_buffer_dirty(path->nodes[0]);
        btrfs_release_path(root, path);
 
        btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);