diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-12 12:14:00 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-12 12:14:00 -0400 |
commit | b4100d64241fed93a3f821ddf59d11ab4443a3ba (patch) | |
tree | 57d3cb2367b5852a9017ec9ff58653338ef45a9f /fs/btrfs/super.c | |
parent | 8352d8a473ac84bf7a1c69690b626946d744ca58 (diff) | |
download | lwn-b4100d64241fed93a3f821ddf59d11ab4443a3ba.tar.gz lwn-b4100d64241fed93a3f821ddf59d11ab4443a3ba.zip |
Btrfs: add a device id to device items
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index c46d7eafcf62..8dcf600e39ef 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1840,7 +1840,9 @@ static int add_disk(struct btrfs_root *root, char *name, int namelen) u16 item_size; u64 num_blocks; u64 new_blocks; + u64 device_id; int ret; + printk("adding disk %s\n", name); path = btrfs_alloc_path(); if (!path) @@ -1875,9 +1877,14 @@ printk("insert failed %d\n", ret); path->slots[0], struct btrfs_device_item); btrfs_set_device_pathlen(dev_item, namelen); memcpy(dev_item + 1, name, namelen); + + device_id = btrfs_super_last_device_id(root->fs_info->disk_super) + 1; + btrfs_set_super_last_device_id(root->fs_info->disk_super, device_id); + btrfs_set_device_id(dev_item, device_id); mark_buffer_dirty(path->nodes[0]); - ret = btrfs_insert_dev_radix(root, bdev, num_blocks, new_blocks); + ret = btrfs_insert_dev_radix(root, bdev, device_id, num_blocks, + new_blocks); if (!ret) { btrfs_set_super_total_blocks(root->fs_info->disk_super, |