Commit d3ee29e3 authored by Miao Xie's avatar Miao Xie Committed by Chris Mason

Btrfs: remove unnecessary initialization and memory barrior in shrink_delalloc()

Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 3b7a016f
...@@ -4034,15 +4034,14 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, ...@@ -4034,15 +4034,14 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
u64 delalloc_bytes; u64 delalloc_bytes;
u64 max_reclaim; u64 max_reclaim;
long time_left; long time_left;
unsigned long nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; unsigned long nr_pages;
int loops = 0; int loops;
enum btrfs_reserve_flush_enum flush; enum btrfs_reserve_flush_enum flush;
trans = (struct btrfs_trans_handle *)current->journal_info; trans = (struct btrfs_trans_handle *)current->journal_info;
block_rsv = &root->fs_info->delalloc_block_rsv; block_rsv = &root->fs_info->delalloc_block_rsv;
space_info = block_rsv->space_info; space_info = block_rsv->space_info;
smp_mb();
delalloc_bytes = percpu_counter_sum_positive( delalloc_bytes = percpu_counter_sum_positive(
&root->fs_info->delalloc_bytes); &root->fs_info->delalloc_bytes);
if (delalloc_bytes == 0) { if (delalloc_bytes == 0) {
...@@ -4052,6 +4051,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, ...@@ -4052,6 +4051,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
return; return;
} }
loops = 0;
while (delalloc_bytes && loops < 3) { while (delalloc_bytes && loops < 3) {
max_reclaim = min(delalloc_bytes, to_reclaim); max_reclaim = min(delalloc_bytes, to_reclaim);
nr_pages = max_reclaim >> PAGE_CACHE_SHIFT; nr_pages = max_reclaim >> PAGE_CACHE_SHIFT;
...@@ -4082,7 +4082,6 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, ...@@ -4082,7 +4082,6 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
if (time_left) if (time_left)
break; break;
} }
smp_mb();
delalloc_bytes = percpu_counter_sum_positive( delalloc_bytes = percpu_counter_sum_positive(
&root->fs_info->delalloc_bytes); &root->fs_info->delalloc_bytes);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment