]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: wait for ordered extents if we didn't reclaim enough
authorJosef Bacik <josef@redhat.com>
Fri, 7 Oct 2011 15:55:34 +0000 (11:55 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:30 +0000 (21:20 -0500)
I noticed recently that my overcommit patch was causing one of my enospc tests
to fail 25% of the time with early ENOSPC.  This is because my overcommit patch
was letting us go way over board, but it wasn't waiting long enough to let the
delalloc shrinker do it's job.  The problem is we just start writeback and wait
a little bit hoping we flush enough, but we only free up delalloc space by
having the writes complete all the way.  We do this by waiting for ordered
extents, which we do but only if we already free'd enough for the reservation,
which isn't right, we should flush ordered extents if we didn't reclaim enough
in case that will push us over the edge.  With this patch I've not seen a
failure in this enospc test after running it in a loop for an hour.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
(cherry picked from commit 4b91c14f913f649d4302b3677b85c4ce87a3d8e7)

fs/btrfs/extent-tree.c

index a9da0d23e9d9835f35608c61e511cc47523d029f..f87f832917682dc66b5508e38252b323a815e978 100644 (file)
@@ -3406,7 +3406,7 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans,
                }
 
        }
-       if (reclaimed >= to_reclaim && !trans)
+       if (reclaimed < to_reclaim && !trans)
                btrfs_wait_ordered_extents(root, 0, 0);
        return reclaimed >= to_reclaim;
 }