Btrfs: increase the global block reserve estimates
authorLiu Bo <liubo2009@cn.fujitsu.com>
Thu, 23 Feb 2012 15:49:04 +0000 (10:49 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 23 Feb 2012 15:49:04 +0000 (10:49 -0500)
When doing IO with large amounts of data fragmentation, the global block
reserve calulations are too low.  This increases them to avoid
ENOSPC crashes.

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

index dc083f55bcfd6d59b1dfdabe7d854d53093ee037..079e5a1c343c53652b38460185cac442d0dd9887 100644 (file)
@@ -4108,7 +4108,7 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info)
        num_bytes += div64_u64(data_used + meta_used, 50);
 
        if (num_bytes * 3 > meta_used)
-               num_bytes = div64_u64(meta_used, 3);
+               num_bytes = div64_u64(meta_used, 3) * 2;
 
        return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10);
 }