mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 02:02:28 +09:00
Btrfs: set right total device count for seeding support
commit 298658414a upstream.
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: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
372fad07b9
commit
2d857bc05e
@@ -1837,7 +1837,6 @@ static int btrfs_prepare_sprout(struct btrfs_root *root)
|
||||
fs_devices->seeding = 0;
|
||||
fs_devices->num_devices = 0;
|
||||
fs_devices->open_devices = 0;
|
||||
fs_devices->total_devices = 0;
|
||||
fs_devices->seed = seed_devices;
|
||||
|
||||
generate_random_uuid(fs_devices->fsid);
|
||||
|
||||
Reference in New Issue
Block a user