Skip to content

Commit a9c9bf6

Browse files
author
Arne Jansen
committed
btrfs: heed alloc_start
currently alloc_start is disregarded if the requested chunk size is bigger than (device size - alloc_start), but smaller than the device size. The only situation where I see this could have made sense was when a chunk equal the size of the device has been requested. This was possible as the allocator failed to take alloc_start into account when calculating the request chunk size. As this gets fixed by this patch, the workaround is not necessary anymore.
1 parent bcd5374 commit a9c9bf6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/btrfs/volumes.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,10 +849,7 @@ int find_free_dev_extent(struct btrfs_trans_handle *trans,
849849
/* we don't want to overwrite the superblock on the drive,
850850
* so we make sure to start at an offset of at least 1MB
851851
*/
852-
search_start = 1024 * 1024;
853-
854-
if (root->fs_info->alloc_start + num_bytes <= search_end)
855-
search_start = max(root->fs_info->alloc_start, search_start);
852+
search_start = max(root->fs_info->alloc_start, 1024ull * 1024);
856853

857854
max_hole_start = search_start;
858855
max_hole_size = 0;

0 commit comments

Comments
 (0)