From 083faf794fd87a7897545a2a16a15599f62beffb Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Fri, 25 Apr 2008 16:55:21 -0400 Subject: Add mkfs.btrfs -A offset to control allocation start on devices This is a utility option for the resizer, it makes sure to allocate at offset bytes in the disk or higher. It ensures the resizer will have something to move when testing it. --- volumes.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'volumes.c') diff --git a/volumes.c b/volumes.c index 0a9ee02c..2d04f643 100644 --- a/volumes.c +++ b/volumes.c @@ -252,6 +252,10 @@ static int find_free_dev_extent(struct btrfs_trans_handle *trans, * so we make sure to start at an offset of at least 1MB */ search_start = max((u64)1024 * 1024, search_start); + + if (root->fs_info->alloc_start + num_bytes <= device->total_bytes) + search_start = max(root->fs_info->alloc_start, search_start); + key.objectid = device->devid; key.offset = search_start; key.type = BTRFS_DEV_EXTENT_KEY; -- cgit v1.2.3