summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-11-18 10:40:06 -0500
committerChris Mason <chris.mason@oracle.com>2008-11-18 10:40:06 -0500
commit4d1d3a59d6debe80ce1e2da60e82233ab8f1f886 (patch)
tree896a25411082e009b2699ef63a7dc9ae5d286bc3 /utils.c
parent95470dfaf12dc8aa59bcb6829c4a7f759d2c5ff6 (diff)
update btrfs-progs for seed device support
This patch does the following: 1) Update device management code to match the kernel code. 2) Allocator fixes. 3) Add a program called btrfstune to set/clear the SEEDING super block flags.
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index fa3cef46..4eb9046e 100644
--- a/utils.c
+++ b/utils.c
@@ -96,7 +96,7 @@ int make_btrfs(int fd, const char *device, const char *label,
btrfs_set_super_root(&super, blocks[1]);
btrfs_set_super_chunk_root(&super, blocks[3]);
btrfs_set_super_total_bytes(&super, num_bytes);
- btrfs_set_super_bytes_used(&super, first_free + 5 * leafsize);
+ btrfs_set_super_bytes_used(&super, 5 * leafsize);
btrfs_set_super_sectorsize(&super, sectorsize);
btrfs_set_super_leafsize(&super, leafsize);
btrfs_set_super_nodesize(&super, nodesize);
@@ -252,6 +252,7 @@ int make_btrfs(int fd, const char *device, const char *label,
dev_item = btrfs_item_ptr(buf, nritems, struct btrfs_dev_item);
btrfs_set_device_id(buf, dev_item, 1);
+ btrfs_set_device_generation(buf, dev_item, 0);
btrfs_set_device_total_bytes(buf, dev_item, num_bytes);
btrfs_set_device_bytes_used(buf, dev_item,
BTRFS_MKFS_SYSTEM_GROUP_SIZE);
@@ -263,6 +264,9 @@ int make_btrfs(int fd, const char *device, const char *label,
write_extent_buffer(buf, super.dev_item.uuid,
(unsigned long)btrfs_device_uuid(dev_item),
BTRFS_UUID_SIZE);
+ write_extent_buffer(buf, super.fsid,
+ (unsigned long)btrfs_device_fsid(dev_item),
+ BTRFS_UUID_SIZE);
read_extent_buffer(buf, &super.dev_item, (unsigned long)dev_item,
sizeof(*dev_item));
@@ -456,6 +460,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
device->io_align = io_align;
device->sector_size = sectorsize;
device->fd = fd;
+ device->writeable = 1;
device->total_bytes = block_count;
device->bytes_used = 0;
device->total_ios = 0;
@@ -489,6 +494,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
kfree(buf);
list_add(&device->dev_list, &root->fs_info->fs_devices->devices);
+ device->fs_devices = root->fs_info->fs_devices;
ret = btrfs_bootstrap_super_map(&root->fs_info->mapping_tree,
root->fs_info->fs_devices);
BUG_ON(ret);