Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 005C8CA0FFA for ; Tue, 5 Sep 2023 17:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjIERdA (ORCPT ); Tue, 5 Sep 2023 13:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238889AbjIERc1 (ORCPT ); Tue, 5 Sep 2023 13:32:27 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E826E25BCE; Tue, 5 Sep 2023 09:58:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B24D61FF20; Tue, 5 Sep 2023 16:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1693933041; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W5h9wEuj2OvpyevspO1CnSSyEtrmVRTY4erZFDV2WBM=; b=o0+zqJYvfTZS8oHl/0cVIszz8ngQkNQ3czh9uS9VTysZHwGuvBRHHglMoqnGPMLb23QqPS 3evPRD3Y9zzohN4vFbI+AQpAgJZVhO57ZnGb851Of4iZWux4uqdgjmJYGqYgxPDtFy0OcY g0GOlmE+JqyanTF5E5peo/nlcU+rG6E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1693933041; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W5h9wEuj2OvpyevspO1CnSSyEtrmVRTY4erZFDV2WBM=; b=seZCsN/8j0T1rVa1lDdPK86u4V+v9o3Isg5MAxLc3OlBdXPO6vLfbIVUqONy3AfY7RSOVu dyZJfVszLrEVrDBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5DEB713911; Tue, 5 Sep 2023 16:57:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pqUKFvFd92TtKQAAMHmgww (envelope-from ); Tue, 05 Sep 2023 16:57:21 +0000 Date: Tue, 5 Sep 2023 18:50:41 +0200 From: David Sterba To: "Guilherme G. Piccoli" Cc: linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-fsdevel@vger.kernel.org, kernel@gpiccoli.net, kernel-dev@igalia.com, anand.jain@oracle.com, david@fromorbit.com, kreijack@libero.it, johns@valvesoftware.com, ludovico.denittis@collabora.com, quwenruo.btrfs@gmx.com, wqu@suse.com, vivek@collabora.com Subject: Re: [PATCH V3 2/2] btrfs: Introduce the single-dev feature Message-ID: <20230905165041.GF14420@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20230831001544.3379273-1-gpiccoli@igalia.com> <20230831001544.3379273-3-gpiccoli@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230831001544.3379273-3-gpiccoli@igalia.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Aug 30, 2023 at 09:12:34PM -0300, Guilherme G. Piccoli wrote: > Btrfs doesn't currently support to mount 2 different devices holding the > same filesystem - the fsid is exposed as a unique identifier by the > driver. This case is supported though in some other common filesystems, > like ext4. > > Supporting the same-fsid mounts has the advantage of allowing btrfs to > be used in A/B partitioned devices, like mobile phones or the Steam Deck > for example. Without this support, it's not safe for users to keep the > same "image version" in both A and B partitions, a setup that is quite > common for development, for example. Also, as a big bonus, it allows fs > integrity check based on block devices for RO devices (whereas currently > it is required that both have different fsid, breaking the block device > hash comparison). > > Such same-fsid mounting is hereby added through the usage of the > filesystem feature "single-dev" - when such feature is used, btrfs > generates a random fsid for the filesystem and leverages the long-term > present metadata_uuid infrastructure to enable the usage of this > secondary virtual fsid, effectively requiring few non-invasive changes > to the code and no new potential corner cases. > > In order to prevent more code complexity and corner cases, given > the nature of this mechanism (single devices), the single-dev feature > is not allowed when the metadata_uuid flag is already present on the > fs, or if the device is on fsid-change state. Device removal/replace > is also disabled for devices presenting the single-dev feature. > > Suggested-by: John Schoenick > Suggested-by: Qu Wenruo > Signed-off-by: Guilherme G. Piccoli I'd like to pick this as a feature for 6.7, it's extending code we already have for metadata_uuid so this is a low risk feature. The only problem I see for now is the name, using the word 'single'. We have single as a block group profile name and a filesystem can exist on a single device too, this is would be confusing when referring to it. Single-dev can be a working name but for a final release we should really try to pick something more unique. I don't have a suggestion for now. The plan for now is that I'll add the patch to a topic branch and add it to for-next so it could be tested but there might be some updates still needed. Either as changes to this patch or as separate patches, that depends.