From: Anand Jain <Anand.Jain@oracle.com>
To: Wang Shilong <wangsl.fnst@cn.fujitsu.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: set right total device count for seeding support
Date: Fri, 16 May 2014 22:14:08 +0800 [thread overview]
Message-ID: <53761D30.6080207@oracle.com> (raw)
In-Reply-To: <1399971906-1237-2-git-send-email-wangsl.fnst@cn.fujitsu.com>
Wang,
There seems to be a problem - after we delete the seed
disk, the total_devices didn't decrement back to 1.
reproducer as in the below test case. (I used btrfs-devlist
(posted) to check fs_devices).
> # 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
mount -o rw,remount /mnt
btrfs dev del /dev/sdb /mnt --> fs_devices->total_devices is still 2
Thanks, Anand
On 13/05/14 17:05, Wang Shilong wrote:
> 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>
> ---
> fs/btrfs/volumes.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 6fd7fe6..19b2d32 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1883,7 +1883,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);
>
next prev parent reply other threads:[~2014-05-16 14:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 9:05 [PATCH] Btrfs-progs: save us an unnecessary ioctl call Wang Shilong
2014-05-13 9:05 ` [PATCH] Btrfs: set right total device count for seeding support Wang Shilong
2014-05-16 14:14 ` Anand Jain [this message]
2014-05-16 14:44 ` Anand Jain
2014-05-16 14:50 ` Shilong Wang
2014-05-16 15:06 ` Anand Jain
2014-05-16 14:45 ` Shilong Wang
2014-05-13 10:48 ` [PATCH] Btrfs-progs: save us an unnecessary ioctl call Stefan Behrens
2014-05-13 11:26 ` Wang Shilong
2014-05-14 5:32 ` Anand Jain
2014-05-15 17:06 ` David Sterba
2014-05-16 4:32 ` Anand Jain
2014-05-16 4:58 ` Wang Shilong
2014-05-16 12:14 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53761D30.6080207@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangsl.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).