aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-04 15:27:52 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-04 15:27:52 -0400
commitb1a4d96509a78ad234d94e0b914b289c60d2969d (patch)
treea6e9ff68dc1ff89097bf56355585f23bec70f847 /fs/btrfs/extent-tree.c
parente8f05c4508aed906146919f2efa89242a7f90a8b (diff)
Btrfs: tweak the inode-map and free extent search starts on cold mount
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cd40a08dd8a6..688aa861a928 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -339,13 +339,30 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
339 int total_needed = num_blocks; 339 int total_needed = num_blocks;
340 int level; 340 int level;
341 341
342 path = btrfs_alloc_path();
343 ins->flags = 0;
344 btrfs_set_key_type(ins, BTRFS_EXTENT_ITEM_KEY);
345
342 level = btrfs_header_level(btrfs_buffer_header(root->node)); 346 level = btrfs_header_level(btrfs_buffer_header(root->node));
343 total_needed += (level + 1) * 3; 347 total_needed += (level + 1) * 3;
348 if (root->fs_info->last_insert.objectid == 0 && search_end == (u64)-1) {
349 struct btrfs_disk_key *last_key;
350 btrfs_init_path(path);
351 ins->objectid = (u64)-1;
352 ins->offset = (u64)-1;
353 ret = btrfs_search_slot(trans, root, ins, path, 0, 0);
354 if (ret < 0)
355 goto error;
356 BUG_ON(ret == 0);
357 if (path->slots[0] > 0)
358 path->slots[0]--;
359 l = btrfs_buffer_leaf(path->nodes[0]);
360 last_key = &l->items[path->slots[0]].key;
361 search_start = btrfs_disk_key_objectid(last_key);
362 }
344 if (root->fs_info->last_insert.objectid > search_start) 363 if (root->fs_info->last_insert.objectid > search_start)
345 search_start = root->fs_info->last_insert.objectid; 364 search_start = root->fs_info->last_insert.objectid;
346 365
347 ins->flags = 0;
348 btrfs_set_key_type(ins, BTRFS_EXTENT_ITEM_KEY);
349 path = btrfs_alloc_path(); 366 path = btrfs_alloc_path();
350 367
351check_failed: 368check_failed: