aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-09-16 14:29:55 -0400
committerJosef Bacik <josef@redhat.com>2010-10-22 15:54:51 -0400
commita1f765061e1491d5ec467429d0d6adfd9df2f6d9 (patch)
tree0263688d261b69aedf2dad690ac1d93f875eec78 /fs
parent9fe6206f400646a2322096b56c59891d530e8d51 (diff)
downloadkernel_samsung_aries-a1f765061e1491d5ec467429d0d6adfd9df2f6d9.zip
kernel_samsung_aries-a1f765061e1491d5ec467429d0d6adfd9df2f6d9.tar.gz
kernel_samsung_aries-a1f765061e1491d5ec467429d0d6adfd9df2f6d9.tar.bz2
Btrfs: stop trying to shrink delalloc if there are no inodes to reclaim
In very severe ENOSPC cases we can run out of inodes to do delalloc on, which means we'll just keep looping trying to shrink delalloc. Instead, if we fail to shrink delalloc 3 times in a row break out since we're not likely to make any progress. Tested this with a 100mb fs an xfstests test 13. Before the patch it would hang the box, with the patch we get -ENOSPC like we should. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 32d0940..c6a5d90 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3115,6 +3115,7 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans,
u64 reserved;
u64 max_reclaim;
u64 reclaimed = 0;
+ int no_reclaim = 0;
int pause = 1;
int ret;
@@ -3131,12 +3132,16 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans,
while (1) {
ret = btrfs_start_one_delalloc_inode(root, trans ? 1 : 0);
if (!ret) {
+ if (no_reclaim > 2)
+ break;
+ no_reclaim++;
__set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(pause);
pause <<= 1;
if (pause > HZ / 10)
pause = HZ / 10;
} else {
+ no_reclaim = 0;
pause = 1;
}