2.6.35 performance results
diff mbox

Message ID 20100819010031.GI5854@think
State New, archived
Headers show

Commit Message

Chris Mason Aug. 19, 2010, 1 a.m. UTC
None

Patch
diff mbox

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 32d0940..55e1ee0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3681,6 +3681,7 @@  int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv;
 	u64 to_reserve;
+	u64 max_reserve;
 	int nr_extents;
 	int retries = 0;
 	int ret;
@@ -3717,7 +3718,11 @@  again:
 
 	block_rsv_add_bytes(block_rsv, to_reserve, 1);
 
-	if (block_rsv->size > 512 * 1024 * 1024)
+	/* 10% or 2GB */
+	max_reserve = min_t(u64, 2ULL * 1024 * 1024 * 1024,
+		    div_factor(root->fs_info->fs_devices->total_rw_bytes, 1));
+
+	if (block_rsv->size > max_reserve)
 		shrink_delalloc(NULL, root, to_reserve);
 
 	return 0;