linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "Guilherme G. Piccoli" <gpiccoli@igalia.com>, Qu Wenruo <wqu@suse.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-fsdevel@vger.kernel.org, kernel@gpiccoli.net,
	kernel-dev@igalia.com, vivek@collabora.com,
	ludovico.denittis@collabora.com, johns@valvesoftware.com,
	linux-btrfs@vger.kernel.org, Anand Jain <anand.jain@oracle.com>
Subject: Re: [PATCH 1/2] btrfs: Introduce the virtual_fsid feature
Date: Thu, 6 Jul 2023 08:53:39 +0800	[thread overview]
Message-ID: <0d6dc2f3-75a5-bc72-f3b5-2a3749db1683@gmx.com> (raw)
In-Reply-To: <bc897780-2c81-fe1f-a8d4-148a08962a20@igalia.com>



On 2023/7/6 06:52, Guilherme G. Piccoli wrote:
> On 05/05/2023 04:21, Qu Wenruo wrote:
>> [...]
>> I would prefer a much simpler but more explicit method.
>>
>> Just introduce a new compat_ro feature, maybe call it SINGLE_DEV.
>>
>> By this, we can avoid multiple meanings of the same super member, nor
>> need any special mount option.
>> Remember, mount option is never a good way to enable/disable a new feature.
>>
>> The better method to enable/disable a feature should be mkfs and btrfstune.
>>
>> Then go mostly the same of your patch, but maybe with something extra:
>>
>> - Disbale multi-dev code
>>     Include device add/replace/removal, this is already done in your
>>     patch.
>>
>> - Completely skip device scanning
>>     I see no reason to keep btrfs with SINGLE_DEV feature to be added to
>>     the device list at all.
>>     It only needs to be scanned at mount time, and never be kept in the
>>     in-memory device list.
>>
>
> Hi Qu, I'm implementing this compat_ro idea of yours, but I'd like to
> ask your input in some "design decisions" I'm facing here.
>
> (a) I've skipped the device_list_add() step of adding the recent created
> fs_devices struct to fs_uuids list, but I kept the btrfs_device creation
> step. With that, the mount of two filesystems with same fsid fails..at
> sysfs directory creation!
>
> Of course - because it tries to add the same folder name to
> /sys/fs/btrfs/ !!! I have some options here:
>
> (I) Should I keep using a random generated fsid for single_dev devices,
> in order we can mount many of them while not messing too much with the
> code? I'd continue "piggybacking" on metadata_uuid idea if (I) is the
> proper choice.
>
> (II) Or maybe track down all fsid usage in the code (like this sysfs
> case) and deal with that? In the sysfs case, we could change that folder
> name to some other format, like fsid.NUM for single_dev devices, whereas
> NUM is an incremental value for devices mounted with same fsid.
>
> I'm not too fond of this alternative due to its complexity and "API"
> breakage - userspace already expects /sys/fs/btrfs/ entries to be the fsid.
>
> (III) Should we hide the filesystem from sysfs (and other potential
> conflicts that come from same fsid mounting points)? Seems a hideous
> approach, due to API breakage and bug potentials.

Personally speaking, I would go one of the following solution:

- Keep the sysfs, but adds a refcount to the sysfs related structures
   If we still go register the sysfs interface, then we have to keep a
   refcount, or any of the same fsid got unmounted, we would remove the
   whole sysfs entry.

- Skip the sysfs entry completely for any fs with the new compat_ro flag
   This would your idea (III), but the sysfs interface itself is not that
   critical (we add and remove entries from time to time), so I believe
   it's feasible to hide the sysfs for certain features.

>
> Maybe there are other choices, better than mine - lemme know if you have
> some ideas!
>
> Also, one last question/confirmation: you mentioned that "The better
> method to enable/disable a feature should be mkfs" - you mean the same
> way mkfs could be used to set features like "raid56" or "no-holes"?

Yes.

>
> By checking "mkfs.btrfs -O list-all", I don't see metadata_uuid for
> example, which is confined to btrfstune it seems. I'm already modifying
> btrfs-progs/mkfs, but since I'm emailing you, why not confirm, right? heh

I'm not familiar with metadata_uuid, but there are similar features like
seeding, which is only available in btrfstune, but not in mkfs.

It's not that uncommon, but yeah, you have found something we should
improve on.

Thanks,
Qu

>
> Thanks again for the advice and suggestions - much appreciated!
> Cheers,
>
>
> Guilherme

  reply	other threads:[~2023-07-06  0:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 17:07 [PATCH 0/2] Supporting same fsid filesystems mounting on btrfs Guilherme G. Piccoli
2023-05-04 17:07 ` [PATCH 1/2] btrfs: Introduce the virtual_fsid feature Guilherme G. Piccoli
2023-05-05  7:21   ` Qu Wenruo
2023-05-05 13:38     ` David Sterba
2023-05-08 11:27       ` Anand Jain
2023-05-08 11:50         ` Qu Wenruo
2023-05-11 11:51           ` David Sterba
2023-05-11 14:12             ` Anand Jain
2023-05-14 21:25             ` Guilherme G. Piccoli
2023-05-05 15:51     ` Guilherme G. Piccoli
2023-05-05 22:15       ` Qu Wenruo
2023-05-08 22:49         ` Guilherme G. Piccoli
2023-05-05 17:34     ` Goffredo Baroncelli
2023-05-05 22:31       ` Qu Wenruo
2023-05-06 17:30         ` Goffredo Baroncelli
2023-05-06 23:00           ` Qu Wenruo
2023-07-05 22:52     ` Guilherme G. Piccoli
2023-07-06  0:53       ` Qu Wenruo [this message]
2023-07-06 22:32         ` Guilherme G. Piccoli
2023-05-05 13:18   ` David Sterba
2023-05-05 16:18     ` Guilherme G. Piccoli
2023-05-05 23:00       ` David Sterba
2023-05-08 22:59         ` Guilherme G. Piccoli
2023-05-08 23:18           ` Qu Wenruo
2023-05-08 23:49             ` Guilherme G. Piccoli
2023-05-09  0:02               ` Qu Wenruo
2023-05-04 17:07 ` [PATCH 2/2] btrfs: Add module parameter to enable non-mount scan skipping Guilherme G. Piccoli
2023-05-04 19:28 ` [PATCH 0/2] Supporting same fsid filesystems mounting on btrfs Goffredo Baroncelli
2023-05-04 20:10   ` Guilherme G. Piccoli
2023-05-04 21:09     ` Goffredo Baroncelli
2023-05-05 16:21       ` Guilherme G. Piccoli
2023-05-05  5:16 ` Anand Jain
2023-05-05 16:27   ` Guilherme G. Piccoli
2023-05-05 17:37     ` Goffredo Baroncelli
2023-05-05 18:15     ` Vivek Dasmohapatra
2023-05-07 23:10 ` Dave Chinner
2023-05-08 22:45   ` Guilherme G. Piccoli
2023-08-03 15:47 ` Guilherme G. Piccoli

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=0d6dc2f3-75a5-bc72-f3b5-2a3749db1683@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=gpiccoli@igalia.com \
    --cc=johns@valvesoftware.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ludovico.denittis@collabora.com \
    --cc=vivek@collabora.com \
    --cc=wqu@suse.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).