aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-05-09 11:46:48 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commit323da79c9f096ed4da04e5ea00f766f75b28aeaa (patch)
tree3a94e375f76e91ce7829a15f0e887ad5d39197b2 /fs/btrfs/extent-tree.c
parentbbaf549e0c3d28399fc5abd68020d4025ae5c3a7 (diff)
Btrfs: Chunk relocation fine tuning, and add a few printks to show progress
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index db996f0edf0b..df95fb660d49 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2493,7 +2493,7 @@ static int find_root_for_ref(struct btrfs_root *root,
2493 btrfs_file_extent_disk_bytenr(leaf, 2493 btrfs_file_extent_disk_bytenr(leaf,
2494 file_extent); 2494 file_extent);
2495 } 2495 }
2496 } else if (ret == 0) { 2496 } else if (!file_key) {
2497 if (path->nodes[level]) 2497 if (path->nodes[level])
2498 found_bytenr = path->nodes[level]->start; 2498 found_bytenr = path->nodes[level]->start;
2499 } 2499 }
@@ -2797,14 +2797,25 @@ int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 shrink_start)
2797 root = root->fs_info->extent_root; 2797 root = root->fs_info->extent_root;
2798 path->reada = 2; 2798 path->reada = 2;
2799 2799
2800 printk("btrfs relocating block group %llu flags %llu\n",
2801 (unsigned long long)shrink_start,
2802 (unsigned long long)shrink_block_group->flags);
2803
2800again: 2804again:
2801 if (btrfs_block_group_used(&shrink_block_group->item) > 0) { 2805 if (btrfs_block_group_used(&shrink_block_group->item) > 0) {
2806 u64 calc;
2807
2802 trans = btrfs_start_transaction(root, 1); 2808 trans = btrfs_start_transaction(root, 1);
2803 new_alloc_flags = update_block_group_flags(root, 2809 new_alloc_flags = update_block_group_flags(root,
2804 shrink_block_group->flags); 2810 shrink_block_group->flags);
2811 if (new_alloc_flags != shrink_block_group->flags) {
2812 calc =
2813 btrfs_block_group_used(&shrink_block_group->item);
2814 } else {
2815 calc = shrink_block_group->key.offset;
2816 }
2805 do_chunk_alloc(trans, root->fs_info->extent_root, 2817 do_chunk_alloc(trans, root->fs_info->extent_root,
2806 btrfs_block_group_used(&shrink_block_group->item) + 2818 calc + 2 * 1024 * 1024, new_alloc_flags);
2807 2 * 1024 * 1024, new_alloc_flags);
2808 btrfs_end_transaction(trans, root); 2819 btrfs_end_transaction(trans, root);
2809 } 2820 }
2810 shrink_block_group->ro = 1; 2821 shrink_block_group->ro = 1;
@@ -2888,6 +2899,9 @@ next:
2888 btrfs_release_path(root, path); 2899 btrfs_release_path(root, path);
2889 2900
2890 if (total_found > 0) { 2901 if (total_found > 0) {
2902 printk("btrfs relocate found %llu last extent was %llu\n",
2903 (unsigned long long)total_found,
2904 (unsigned long long)found_key.objectid);
2891 trans = btrfs_start_transaction(tree_root, 1); 2905 trans = btrfs_start_transaction(tree_root, 1);
2892 btrfs_commit_transaction(trans, tree_root); 2906 btrfs_commit_transaction(trans, tree_root);
2893 2907