diff options
author | Qu Wenruo <wqu@suse.com> | 2022-06-13 10:06:34 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-07-25 18:45:36 +0300 |
commit | 37f85ec320e6d73b92c8f8b5b2ddf33077970a23 (patch) | |
tree | 45bf2097d56215c00b0ca9766e3e878ca4d989c7 /fs/btrfs/volumes.c | |
parent | bfceac7fd3c47175fec75c32071051de5969a34c (diff) | |
download | linux-37f85ec320e6d73b92c8f8b5b2ddf33077970a23.tar.xz |
btrfs: use named constant for reserved device space
There's a reserved space on each device of size 1MiB that can be used by
bootloaders or to avoid accidental overwrite. Use a symbolic constant
with the explaining comment instead of hard coding the value and
multiple comments.
Note: since btrfs-progs v4.1, mkfs.btrfs will reserve the first 1MiB for
the primary super block (at offset 64KiB), until then the range could
have been used by mistake. Kernel has been always respecting the 1MiB
range for writes.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 80636fbf28b7..e6af960a6961 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1403,12 +1403,7 @@ static u64 dev_extent_search_start(struct btrfs_device *device, u64 start) { switch (device->fs_devices->chunk_alloc_policy) { case BTRFS_CHUNK_ALLOC_REGULAR: - /* - * We don't want to overwrite the superblock on the drive nor - * any area used by the boot loader (grub for example), so we - * make sure to start at an offset of at least 1MB. - */ - return max_t(u64, start, SZ_1M); + return max_t(u64, start, BTRFS_DEVICE_RANGE_RESERVED); case BTRFS_CHUNK_ALLOC_ZONED: /* * We don't care about the starting region like regular |