diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-09-24 13:42:00 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-09 09:15:39 -0400 |
commit | 67b0fd63d5466bb710677afd3d2b77926c55f662 (patch) | |
tree | 13dfebfb76aa4bc9bb8c13835ecf552c2a5a8576 /fs/btrfs/extent-tree.c | |
parent | 354aa0fb6d5b97b262e056f7ad7bfc88d7ce0004 (diff) |
Btrfs: run delayed refs first when out of space
Running delayed refs is faster than running delalloc, so lets do that first
to try and reclaim space. This makes my fs_mark test about 20% faster.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 395e222e39ab..3270b1087850 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3817,10 +3817,10 @@ commit: | |||
3817 | } | 3817 | } |
3818 | 3818 | ||
3819 | enum flush_state { | 3819 | enum flush_state { |
3820 | FLUSH_DELALLOC = 1, | 3820 | FLUSH_DELAYED_ITEMS_NR = 1, |
3821 | FLUSH_DELALLOC_WAIT = 2, | 3821 | FLUSH_DELAYED_ITEMS = 2, |
3822 | FLUSH_DELAYED_ITEMS_NR = 3, | 3822 | FLUSH_DELALLOC = 3, |
3823 | FLUSH_DELAYED_ITEMS = 4, | 3823 | FLUSH_DELALLOC_WAIT = 4, |
3824 | ALLOC_CHUNK = 5, | 3824 | ALLOC_CHUNK = 5, |
3825 | COMMIT_TRANS = 6, | 3825 | COMMIT_TRANS = 6, |
3826 | }; | 3826 | }; |
@@ -3834,11 +3834,6 @@ static int flush_space(struct btrfs_root *root, | |||
3834 | int ret = 0; | 3834 | int ret = 0; |
3835 | 3835 | ||
3836 | switch (state) { | 3836 | switch (state) { |
3837 | case FLUSH_DELALLOC: | ||
3838 | case FLUSH_DELALLOC_WAIT: | ||
3839 | shrink_delalloc(root, num_bytes, orig_bytes, | ||
3840 | state == FLUSH_DELALLOC_WAIT); | ||
3841 | break; | ||
3842 | case FLUSH_DELAYED_ITEMS_NR: | 3837 | case FLUSH_DELAYED_ITEMS_NR: |
3843 | case FLUSH_DELAYED_ITEMS: | 3838 | case FLUSH_DELAYED_ITEMS: |
3844 | if (state == FLUSH_DELAYED_ITEMS_NR) { | 3839 | if (state == FLUSH_DELAYED_ITEMS_NR) { |
@@ -3859,6 +3854,11 @@ static int flush_space(struct btrfs_root *root, | |||
3859 | ret = btrfs_run_delayed_items_nr(trans, root, nr); | 3854 | ret = btrfs_run_delayed_items_nr(trans, root, nr); |
3860 | btrfs_end_transaction(trans, root); | 3855 | btrfs_end_transaction(trans, root); |
3861 | break; | 3856 | break; |
3857 | case FLUSH_DELALLOC: | ||
3858 | case FLUSH_DELALLOC_WAIT: | ||
3859 | shrink_delalloc(root, num_bytes, orig_bytes, | ||
3860 | state == FLUSH_DELALLOC_WAIT); | ||
3861 | break; | ||
3862 | case ALLOC_CHUNK: | 3862 | case ALLOC_CHUNK: |
3863 | trans = btrfs_join_transaction(root); | 3863 | trans = btrfs_join_transaction(root); |
3864 | if (IS_ERR(trans)) { | 3864 | if (IS_ERR(trans)) { |
@@ -3903,7 +3903,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root, | |||
3903 | struct btrfs_space_info *space_info = block_rsv->space_info; | 3903 | struct btrfs_space_info *space_info = block_rsv->space_info; |
3904 | u64 used; | 3904 | u64 used; |
3905 | u64 num_bytes = orig_bytes; | 3905 | u64 num_bytes = orig_bytes; |
3906 | int flush_state = FLUSH_DELALLOC; | 3906 | int flush_state = FLUSH_DELAYED_ITEMS_NR; |
3907 | int ret = 0; | 3907 | int ret = 0; |
3908 | bool flushing = false; | 3908 | bool flushing = false; |
3909 | bool committed = false; | 3909 | bool committed = false; |