summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-25 16:55:21 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2008-04-25 16:55:21 -0400
commit083faf794fd87a7897545a2a16a15599f62beffb (patch)
tree6ad1c8046d93fefd2e0614da0137f6f1f8294260 /volumes.c
parent4415143185b8c3ac799301a72a9cdbbd746fc723 (diff)
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.
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c4
1 files changed, 4 insertions, 0 deletions
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;