diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2014-05-13 05:05:06 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 20:20:50 -0400 |
commit | 298658414a2f0bea1f05a81876a45c1cd96aa2e0 (patch) | |
tree | df33ffc840626aeaace2c02f6821035c9a5ddd48 | |
parent | 45ff35d6b9f301cbfb6b1703466ebe4431c7567f (diff) |
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: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | fs/btrfs/volumes.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 018cde61cf9d..be8d6714494e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1934,7 +1934,6 @@ static int btrfs_prepare_sprout(struct btrfs_root *root) | |||
1934 | fs_devices->seeding = 0; | 1934 | fs_devices->seeding = 0; |
1935 | fs_devices->num_devices = 0; | 1935 | fs_devices->num_devices = 0; |
1936 | fs_devices->open_devices = 0; | 1936 | fs_devices->open_devices = 0; |
1937 | fs_devices->total_devices = 0; | ||
1938 | fs_devices->seed = seed_devices; | 1937 | fs_devices->seed = seed_devices; |
1939 | 1938 | ||
1940 | generate_random_uuid(fs_devices->fsid); | 1939 | generate_random_uuid(fs_devices->fsid); |