[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    Btrfs: increase the size of the free space cache
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2012-08-29 18:41:08
Message-ID: 20120829184108.34DF63404D9 () ra ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/;a=commit;h=6fc823b10f333313deb0b5d9069cbfd3a3f99f3a
Commit:     6fc823b10f333313deb0b5d9069cbfd3a3f99f3a
Parent:     66657b318e0e443ada229fccd40c8be86cfebdbf
Author:     Josef Bacik <jbacik@fusionio.com>
AuthorDate: Mon Aug 6 13:46:38 2012 -0600
Committer:  Chris Mason <chris.mason@oracle.com>
CommitDate: Tue Aug 28 16:53:34 2012 -0400

    Btrfs: increase the size of the free space cache
    
    Arne was complaining about the space cache having mismatching generation
    numbers when debugging a deadlock.  This is because we can run out of space
    in our preallocated range for our space cache if you have a pretty
    fragmented amount of space in your pinned space.  So just increase the
    amount of space we preallocate for space cache so we can be sure to have
    enough space.  This will only really affect data ranges since their the only
    chunks that end up larger than 256MB.  Thanks,
    
    Signed-off-by: Josef Bacik <jbacik@fusionio.com>
    Signed-off-by: Chris Mason <chris.mason@fusionio.com>
---
 fs/btrfs/extent-tree.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d3df65f..1bb408f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2975,17 +2975,16 @@ again:
 	}
 	spin_unlock(&block_group->lock);
 
-	num_pages = (int)div64_u64(block_group->key.offset, 1024 * 1024 * 1024);
+	/*
+	 * Try to preallocate enough space based on how big the block group is.
+	 * Keep in mind this has to include any pinned space which could end up
+	 * taking up quite a bit since it's not folded into the other space
+	 * cache.
+	 */
+	num_pages = (int)div64_u64(block_group->key.offset, 256 * 1024 * 1024);
 	if (!num_pages)
 		num_pages = 1;
 
-	/*
-	 * Just to make absolutely sure we have enough space, we're going to
-	 * preallocate 12 pages worth of space for each block group.  In
-	 * practice we ought to use at most 8, but we need extra space so we can
-	 * add our header and have a terminator between the extents and the
-	 * bitmaps.
-	 */
 	num_pages *= 16;
 	num_pages *= PAGE_CACHE_SIZE;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic