aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c2
-rw-r--r--fs/btrfs/inode.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b3ecca447ddf..d2b3a5e9a621 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6143,7 +6143,7 @@ again:
6143 if (ret == -ENOSPC) { 6143 if (ret == -ENOSPC) {
6144 if (!final_tried) { 6144 if (!final_tried) {
6145 num_bytes = num_bytes >> 1; 6145 num_bytes = num_bytes >> 1;
6146 num_bytes = num_bytes & ~(root->sectorsize - 1); 6146 num_bytes = round_down(num_bytes, root->sectorsize);
6147 num_bytes = max(num_bytes, min_alloc_size); 6147 num_bytes = max(num_bytes, min_alloc_size);
6148 if (num_bytes == min_alloc_size) 6148 if (num_bytes == min_alloc_size)
6149 final_tried = true; 6149 final_tried = true;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4e6a11c2cfdd..3bc62b181ef8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7894,8 +7894,9 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
7894 } 7894 }
7895 } 7895 }
7896 7896
7897 ret = btrfs_reserve_extent(trans, root, num_bytes, min_size, 7897 ret = btrfs_reserve_extent(trans, root,
7898 0, *alloc_hint, &ins, 1); 7898 min(num_bytes, 256ULL * 1024 * 1024),
7899 min_size, 0, *alloc_hint, &ins, 1);
7899 if (ret) { 7900 if (ret) {
7900 if (own_trans) 7901 if (own_trans)
7901 btrfs_end_transaction(trans, root); 7902 btrfs_end_transaction(trans, root);