aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-05-13 10:32:11 -0400
committerJosef Bacik <josef@redhat.com>2011-05-23 13:03:14 -0400
commit026fd317828500524cdc7e5ff9e8e7923abb2868 (patch)
treed303bffbd895c307f49286cd90186cf58223dde2 /fs/btrfs/relocation.c
parent589d8ade83f07c0f11c8191c0ca309f34d7a2c14 (diff)
Btrfs: don't always do readahead
Our readahead is sort of sloppy, and really isn't always needed. For example if ls is doing a stating ls (which is the default) it's going to stat in non-disk order, so if say you have a directory with a stupid amount of files, readahead is going to do nothing but waste time in the case of doing the stat. Taking the unconditional readahead out made my test go from 57 minutes to 36 minutes. This means that everywhere we do loop through the tree we want to make sure we do set path->reada properly, so I went through and found all of the places where we loop through the path and set reada to 1. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 09c30d37d43e..5872b41581f4 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -676,6 +676,8 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
676 err = -ENOMEM; 676 err = -ENOMEM;
677 goto out; 677 goto out;
678 } 678 }
679 path1->reada = 1;
680 path2->reada = 2;
679 681
680 node = alloc_backref_node(cache); 682 node = alloc_backref_node(cache);
681 if (!node) { 683 if (!node) {
@@ -1996,6 +1998,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
1996 path = btrfs_alloc_path(); 1998 path = btrfs_alloc_path();
1997 if (!path) 1999 if (!path)
1998 return -ENOMEM; 2000 return -ENOMEM;
2001 path->reada = 1;
1999 2002
2000 reloc_root = root->reloc_root; 2003 reloc_root = root->reloc_root;
2001 root_item = &reloc_root->root_item; 2004 root_item = &reloc_root->root_item;
@@ -3297,6 +3300,7 @@ static int find_data_references(struct reloc_control *rc,
3297 path = btrfs_alloc_path(); 3300 path = btrfs_alloc_path();
3298 if (!path) 3301 if (!path)
3299 return -ENOMEM; 3302 return -ENOMEM;
3303 path->reada = 1;
3300 3304
3301 root = read_fs_root(rc->extent_root->fs_info, ref_root); 3305 root = read_fs_root(rc->extent_root->fs_info, ref_root);
3302 if (IS_ERR(root)) { 3306 if (IS_ERR(root)) {
@@ -3665,6 +3669,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
3665 path = btrfs_alloc_path(); 3669 path = btrfs_alloc_path();
3666 if (!path) 3670 if (!path)
3667 return -ENOMEM; 3671 return -ENOMEM;
3672 path->reada = 1;
3668 3673
3669 ret = prepare_to_relocate(rc); 3674 ret = prepare_to_relocate(rc);
3670 if (ret) { 3675 if (ret) {
@@ -4090,6 +4095,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
4090 path = btrfs_alloc_path(); 4095 path = btrfs_alloc_path();
4091 if (!path) 4096 if (!path)
4092 return -ENOMEM; 4097 return -ENOMEM;
4098 path->reada = -1;
4093 4099
4094 key.objectid = BTRFS_TREE_RELOC_OBJECTID; 4100 key.objectid = BTRFS_TREE_RELOC_OBJECTID;
4095 key.type = BTRFS_ROOT_ITEM_KEY; 4101 key.type = BTRFS_ROOT_ITEM_KEY;