From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com
Subject: Re: [PATCH 2/2] btrfs: sysfs add devinfo/fsid to retrieve fsid from the device
Date: Thu, 21 Oct 2021 16:55:43 +0800 [thread overview]
Message-ID: <616b83ff-8320-185e-1c8b-a8a0ebe77e8f@oracle.com> (raw)
In-Reply-To: <12503a1b-a28f-cc26-f07d-0914d6952207@oracle.com>
On 21/10/2021 12:03, Anand Jain wrote:
> On 21/10/2021 02:59, David Sterba wrote:
>> On Tue, Oct 19, 2021 at 08:22:10AM +0800, Anand Jain wrote:
>>> In the case of the seed device, the fsid can be different from the
>>> mounted
>>> sprout fsid. The userland has to read the device superblock to know the
>>> fsid but, that idea fails if the device is missing. So add a sysfs
>>> interface devinfo/<devid>/fsid to show the fsid of the device.
>>>
>>> For example:
>>> $ cd /sys/fs/btrfs/b10b02a5-f9de-4276-b9e8-2bfd09a578a8
>>>
>>> $ cat devinfo/1/fsid
>>> c44d771f-639d-4df3-99ec-5bc7ad2af93b
>>> $ cat devinfo/3/fsid
>>> b10b02a5-f9de-4276-b9e8-2bfd09a578a8
>>
>> How do you create such setup? I can't reproduce it.
>>
>> The simplest seeding:
>>
>> mkfs.btrfs /dev/sdx
>> btrfstune -S 1 /dev/sdx
>> mount /dev/sdx mnt
>> ... the device has the same FSID as is the sysfs directory name
>>
>> With a new device and removed the seeding one:
>>
>> btrfs device add /dev/sdy mnt
>
> At this step, we generate a new fsid for the writeable FS. Let's call
> it sprout-fsid. (If you check the sys-fs fsid, you will have two fsid
> here).
>
> Also, at this step,
> the
> fs_info->fs_devices->fsid
> changes from seed-fsid to the sprout-fsid.
> So, we should make the <mnt> also a writeable without the need to call
> 'remount,rw' explicitly IMO. What do you think?
>
More importantly, the fs_info->super_copy is of sprout device.
So there isn't any reason that we should maintain the new
sprout fs as readonly after the device add.
>> mount -o remount,rw mnt
>> btrfs device delete /dev/sdx mnt
>> ... both devices have the same fsid as well
>
>
> Thanks, Anand
>
>
>
>
next prev parent reply other threads:[~2021-10-21 8:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 0:22 [PATCH 0/2] provide fsid in sysfs devinfo Anand Jain
2021-10-19 0:22 ` [PATCH 1/2] btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit Anand Jain
2021-10-21 13:35 ` [btrfs] 0f80799866: WARNING:at_fs/sysfs/file.c:#sysfs_emit kernel test robot
2021-10-21 13:35 ` kernel test robot
2021-10-21 15:30 ` Anand Jain
2021-10-21 15:30 ` Anand Jain
2021-10-21 16:06 ` David Sterba
2021-10-21 16:06 ` David Sterba
2021-10-21 16:18 ` Anand Jain
2021-10-21 16:18 ` Anand Jain
2021-10-21 16:00 ` [PATCH 1/2] btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit David Sterba
2021-10-21 16:15 ` Anand Jain
2021-10-19 0:22 ` [PATCH 2/2] btrfs: sysfs add devinfo/fsid to retrieve fsid from the device Anand Jain
2021-10-20 18:59 ` David Sterba
2021-10-21 4:03 ` Anand Jain
2021-10-21 8:55 ` Anand Jain [this message]
2021-10-19 13:57 ` [PATCH 0/2] provide fsid in sysfs devinfo Josef Bacik
2021-10-20 2:26 ` Anand Jain
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=616b83ff-8320-185e-1c8b-a8a0ebe77e8f@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.