提交 29865841 编写于 作者: W Wang Shilong 提交者: Chris Mason

Btrfs: set right total device count for seeding support

Seeding device support allows us to create a new filesystem
based on existed filesystem.

However newly created filesystem's @total_devices should include seed
devices. This patch fix the following problem:

 # mkfs.btrfs -f /dev/sdb
 # btrfstune -S 1 /dev/sdb
 # mount /dev/sdb /mnt
 # btrfs device add -f /dev/sdc /mnt --->fs_devices->total_devices = 1
 # umount /mnt
 # mount /dev/sdc /mnt               --->fs_devices->total_devices = 2

This is because we record right @total_devices in superblock, but
@fs_devices->total_devices is reset to be 0 in btrfs_prepare_sprout().

Fix this problem by not resetting @fs_devices->total_devices.
Signed-off-by: NWang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 45ff35d6
...@@ -1934,7 +1934,6 @@ static int btrfs_prepare_sprout(struct btrfs_root *root) ...@@ -1934,7 +1934,6 @@ static int btrfs_prepare_sprout(struct btrfs_root *root)
fs_devices->seeding = 0; fs_devices->seeding = 0;
fs_devices->num_devices = 0; fs_devices->num_devices = 0;
fs_devices->open_devices = 0; fs_devices->open_devices = 0;
fs_devices->total_devices = 0;
fs_devices->seed = seed_devices; fs_devices->seed = seed_devices;
generate_random_uuid(fs_devices->fsid); generate_random_uuid(fs_devices->fsid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册