diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c226daefd65d..ca1b767d51f7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2312,6 +2312,7 @@ again: | |||
2312 | key.type = BTRFS_EXTENT_DATA_KEY; | 2312 | key.type = BTRFS_EXTENT_DATA_KEY; |
2313 | key.offset = start; | 2313 | key.offset = start; |
2314 | 2314 | ||
2315 | path->leave_spinning = 1; | ||
2315 | if (merge) { | 2316 | if (merge) { |
2316 | struct btrfs_file_extent_item *fi; | 2317 | struct btrfs_file_extent_item *fi; |
2317 | u64 extent_len; | 2318 | u64 extent_len; |
@@ -2368,6 +2369,7 @@ again: | |||
2368 | 2369 | ||
2369 | btrfs_mark_buffer_dirty(leaf); | 2370 | btrfs_mark_buffer_dirty(leaf); |
2370 | inode_add_bytes(inode, len); | 2371 | inode_add_bytes(inode, len); |
2372 | btrfs_release_path(path); | ||
2371 | 2373 | ||
2372 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, | 2374 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, |
2373 | new->disk_len, 0, | 2375 | new->disk_len, 0, |
@@ -2381,6 +2383,7 @@ again: | |||
2381 | ret = 1; | 2383 | ret = 1; |
2382 | out_free_path: | 2384 | out_free_path: |
2383 | btrfs_release_path(path); | 2385 | btrfs_release_path(path); |
2386 | path->leave_spinning = 0; | ||
2384 | btrfs_end_transaction(trans, root); | 2387 | btrfs_end_transaction(trans, root); |
2385 | out_unlock: | 2388 | out_unlock: |
2386 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, | 2389 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, |
@@ -8502,6 +8505,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | |||
8502 | struct btrfs_key ins; | 8505 | struct btrfs_key ins; |
8503 | u64 cur_offset = start; | 8506 | u64 cur_offset = start; |
8504 | u64 i_size; | 8507 | u64 i_size; |
8508 | u64 cur_bytes; | ||
8505 | int ret = 0; | 8509 | int ret = 0; |
8506 | bool own_trans = true; | 8510 | bool own_trans = true; |
8507 | 8511 | ||
@@ -8516,8 +8520,9 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | |||
8516 | } | 8520 | } |
8517 | } | 8521 | } |
8518 | 8522 | ||
8519 | ret = btrfs_reserve_extent(trans, root, | 8523 | cur_bytes = min(num_bytes, 256ULL * 1024 * 1024); |
8520 | min(num_bytes, 256ULL * 1024 * 1024), | 8524 | cur_bytes = max(cur_bytes, min_size); |
8525 | ret = btrfs_reserve_extent(trans, root, cur_bytes, | ||
8521 | min_size, 0, *alloc_hint, &ins, 1); | 8526 | min_size, 0, *alloc_hint, &ins, 1); |
8522 | if (ret) { | 8527 | if (ret) { |
8523 | if (own_trans) | 8528 | if (own_trans) |