Commit 877da174 authored by Josef Bacik's avatar Josef Bacik

Btrfs: allow shrink_delalloc flush the needed reclaimed pages

Currently we only allow a maximum of 2 megabytes of pages to be flushed at a
time.  This was ok before, but now we have overcommit which will screw us in a
heartbeat if we are quickly filling the disk.  So instead pick either 2
megabytes or the number of pages we need to reclaim to be safe again, which ever
is larger.  Thanks,
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
parent f104d044
...@@ -3343,7 +3343,7 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, ...@@ -3343,7 +3343,7 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans,
u64 max_reclaim; u64 max_reclaim;
u64 reclaimed = 0; u64 reclaimed = 0;
long time_left; long time_left;
int nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; unsigned long nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT;
int loops = 0; int loops = 0;
unsigned long progress; unsigned long progress;
...@@ -3366,7 +3366,8 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, ...@@ -3366,7 +3366,8 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans,
} }
max_reclaim = min(reserved, to_reclaim); max_reclaim = min(reserved, to_reclaim);
nr_pages = max_t(unsigned long, nr_pages,
max_reclaim >> PAGE_CACHE_SHIFT);
while (loops < 1024) { while (loops < 1024) {
/* have the flusher threads jump in and do some IO */ /* have the flusher threads jump in and do some IO */
smp_mb(); smp_mb();
......
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