summaryrefslogtreecommitdiff
path: root/mkfs.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-03-24 15:05:44 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2008-03-24 15:05:44 -0400
commit0dcfa3b8270f38edacee1c62f308129c36073d0c (patch)
tree74e084b5cceed48161b5ca1508a88afd6f8ca8b1 /mkfs.c
parent26afd0f31d59853f51120622b0121cdfc72cd398 (diff)
Walk all block devices looking for btrfs
Diffstat (limited to 'mkfs.c')
-rw-r--r--mkfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mkfs.c b/mkfs.c
index 6de35cc6..49f73083 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -59,7 +59,7 @@ static u64 parse_size(char *s)
return atol(s) * mult;
}
-static int make_root_dir(int fd) {
+static int make_root_dir(int fd, const char *device_name) {
struct btrfs_root *root;
struct btrfs_trans_handle *trans;
struct btrfs_key location;
@@ -68,7 +68,7 @@ static int make_root_dir(int fd) {
u64 chunk_size = 0;
int ret;
- root = open_ctree_fd(fd, 0);
+ root = open_ctree_fd(fd, device_name, 0);
if (!root) {
fprintf(stderr, "ctree init failed\n");
@@ -217,7 +217,7 @@ int main(int ac, char **av)
fprintf(stderr, "error during mkfs %d\n", ret);
exit(1);
}
- ret = make_root_dir(fd);
+ ret = make_root_dir(fd, file);
if (ret) {
fprintf(stderr, "failed to setup the root directory\n");
exit(1);
@@ -229,6 +229,7 @@ int main(int ac, char **av)
if (ac == 0)
goto done;
+ btrfs_register_one_device(file);
root = open_ctree(file, 0);
if (!root) {
@@ -255,6 +256,7 @@ int main(int ac, char **av)
sectorsize, sectorsize, sectorsize);
BUG_ON(ret);
close(fd);
+ btrfs_register_one_device(file);
}
btrfs_commit_transaction(trans, root);
ret = close_ctree(root);