On 11/5/23 19:51, David Sterba wrote:
On Mon, May 08, 2023 at 07:50:55PM +0800, Qu Wenruo wrote:
On 2023/5/8 19:27, Anand Jain wrote:
On 05/05/2023 21:38, David Sterba wrote:
On Fri, May 05, 2023 at 03:21:35PM +0800, Qu Wenruo wrote:
On 2023/5/5 01:07, Guilherme G. Piccoli wrote:
This is actually a good point, we can do that already. As a conterpart
to 5f58d783fd7823 ("btrfs: free device in btrfs_close_devices for a
single device filesystem") that drops single device from the list,
single fs devices wouldn't be added to the list but some checks could be
still done like superblock validation for eventual error reporting.
Something similar occurred to me earlier. However, even for a single
device, we need to perform the scan because there may be an unfinished
replace target from a previous reboot, or a sprout Btrfs filesystem may
have a single seed device. If we were to make an exception for replace
targets and seed devices, it would only complicate the scan logic, which
goes against our attempt to simplify it.
If we go SINGLE_DEV compat_ro flags, then no such problem at all, we can
easily reject any multi-dev features from such SINGLE_DEV fs.
For a single device, if we remove device replacement and seeding for a
specific flag, scanning is unnecessary.
With the scanning complications that Anand mentions the compat_ro flag
might make more sense, with all the limitations but allowing a safe use
of the duplicated UUIDs.
The flag would have to be set at mkfs time or by btrfsune on an
unmounted filesystem. Doing that on a mounted filesystem is possible too
but brings problems with updating the state of scanned device,
potentially ongoing operations like dev-replace and more.
Setting the flag at mkfs time is preferable, in my opinion. We could
still support the btrfstune method and/or online method later.
While we are here, I'm taking the opportunity to consolidate the
scattered metadata UUID checking, which has been a long-standing
goal of mine to clean up. This will make adding multi-UUID support
cleaner. If you have any ideas, please share.
Thanks, Anand