aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs
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
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')
-rw-r--r--fs/btrfs/extent-tree.c20
-rw-r--r--fs/btrfs/volumes.c2
2 files changed, 19 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index db996f0edf0..df95fb660d4 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,
btrfs_file_extent_disk_bytenr(leaf,
file_extent);
}
- } else if (ret == 0) {
+ } else if (!file_key) {
if (path->nodes[level])
found_bytenr = path->nodes[level]->start;
}
@@ -2797,14 +2797,25 @@ int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 shrink_start)
root = root->fs_info->extent_root;
path->reada = 2;
+ printk("btrfs relocating block group %llu flags %llu\n",
+ (unsigned long long)shrink_start,
+ (unsigned long long)shrink_block_group->flags);
+
again:
if (btrfs_block_group_used(&shrink_block_group->item) > 0) {
+ u64 calc;
+
trans = btrfs_start_transaction(root, 1);
new_alloc_flags = update_block_group_flags(root,
shrink_block_group->flags);
+ if (new_alloc_flags != shrink_block_group->flags) {
+ calc =
+ btrfs_block_group_used(&shrink_block_group->item);
+ } else {
+ calc = shrink_block_group->key.offset;
+ }
do_chunk_alloc(trans, root->fs_info->extent_root,
- btrfs_block_group_used(&shrink_block_group->item) +
- 2 * 1024 * 1024, new_alloc_flags);
+ calc + 2 * 1024 * 1024, new_alloc_flags);
btrfs_end_transaction(trans, root);
}
shrink_block_group->ro = 1;
@@ -2888,6 +2899,9 @@ next:
btrfs_release_path(root, path);
if (total_found > 0) {
+ printk("btrfs relocate found %llu last extent was %llu\n",
+ (unsigned long long)total_found,
+ (unsigned long long)found_key.objectid);
trans = btrfs_start_transaction(tree_root, 1);
btrfs_commit_transaction(trans, tree_root);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index aa001b08ced..b5d7bd1915b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1011,6 +1011,8 @@ int btrfs_relocate_chunk(struct btrfs_root *root,
int ret;
int i;
+ printk("btrfs relocating chunk %llu\n",
+ (unsigned long long)chunk_offset);
root = root->fs_info->chunk_root;
extent_root = root->fs_info->extent_root;
em_tree = &root->fs_info->mapping_tree.map_tree;