Btrfs: allow more metadata chunk preallocation
authorChris Mason <chris.mason@oracle.com>
Wed, 11 Nov 2009 15:16:57 +0000 (10:16 -0500)
committerChris Mason <chris.mason@oracle.com>
Wed, 11 Nov 2009 19:20:20 +0000 (14:20 -0500)
On an FS where all of the space has not been allocated into chunks yet,
the enospc can return enospc just because the existing metadata chunks
are full.

We get around this by allowing more metadata chunks to be allocated up
to a certain limit, and finding the right limit is a little fuzzy.  The
problem is the reservations for delalloc would preallocate way too much
of the FS as metadata.  We need to start saying no and just force some
IO to happen.

But we also need to let a reasonable amount of the FS become metadata.
This bumps the hard limit up, later releases will have a better system.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index 2a4cdce..8d1fd6d 100644 (file)
@@ -2976,10 +2976,10 @@ static int maybe_allocate_chunk(struct btrfs_root *root,
 
        free_space = btrfs_super_total_bytes(disk_super);
        /*
-        * we allow the metadata to grow to a max of either 5gb or 5% of the
+        * we allow the metadata to grow to a max of either 10gb or 5% of the
         * space in the volume.
         */
-       min_metadata = min((u64)5 * 1024 * 1024 * 1024,
+       min_metadata = min((u64)10 * 1024 * 1024 * 1024,
                             div64_u64(free_space * 5, 100));
        if (info->total_bytes >= min_metadata) {
                spin_unlock(&info->lock);