From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CCB01BDEE for ; Thu, 2 Nov 2023 20:07:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="D39+iQ7G"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="rapx8VCo" Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74AA0186; Thu, 2 Nov 2023 13:07:41 -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 7B0101F8D4; Thu, 2 Nov 2023 20:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698955659; 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=P4bCMfteguYoKji2FI9q8fru+pHSFOE8fwUffQBFniQ=; b=D39+iQ7G+ztxbdRfOC6lKk7nz8AMDy32p0cHU+3aQVwCbKhvTuCOMb0yIHCdfGwHqGZLeO VA+g5qcvTVEFqKFi6ZsLDYHymkp0yVYLLS5RqAyVQYMzsDzJDEVz18HR80BwisUlKvVhrd SANQ6VbjK6X0OzjFe+jHDpDUJlYyBeI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698955659; 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=P4bCMfteguYoKji2FI9q8fru+pHSFOE8fwUffQBFniQ=; b=rapx8VCopt/VKBGp2VgoT5x8fU/oEZHcAY7QZuwbxqwJGUajefZ7yfppyhxaRKNneOleFb nyjfidXQTvvYxzBQ== 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 4B51713584; Thu, 2 Nov 2023 20:07:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SjXDEYsBRGVsMAAAMHmgww (envelope-from ); Thu, 02 Nov 2023 20:07:39 +0000 Date: Thu, 2 Nov 2023 21:00:40 +0100 From: David Sterba To: Anand Jain Cc: fstests@vger.kernel.org, fdmanana@kernel.org, linux-btrfs@vger.kernel.org, zlang@redhat.com Subject: Re: [PATCH v4 1/5] common/rc: _fs_sysfs_dname fetch fsid using btrfs tool Message-ID: <20231102200040.GH11264@twin.jikos.cz> Reply-To: dsterba@suse.cz References: Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) On Thu, Nov 02, 2023 at 07:28:18PM +0800, Anand Jain wrote: > Currently _fs_sysfs_dname gets fsid from the findmnt command however > this command provides the metadata_uuid if the device is mounted with > temp-fsid. So instead, use btrfs filesystem show command to know the fsid. > > Signed-off-by: Anand Jain > Reviewed-by: Filipe Manana > --- > v3: add local variable fsid > > common/rc | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index 259a1ffb09b9..7f14c19ca89e 100644 > --- a/common/rc > +++ b/common/rc > @@ -4721,6 +4721,7 @@ _require_statx() > _fs_sysfs_dname() > { > local dev=$1 > + local fsid > > if [ ! -b "$dev" ]; then > _fail "Usage: _fs_sysfs_dname " > @@ -4728,7 +4729,9 @@ _fs_sysfs_dname() > > case "$FSTYP" in > btrfs) > - findmnt -n -o UUID ${dev} ;; > + fsid=$($BTRFS_UTIL_PROG filesystem show ${dev} | grep uuid: | \ > + $AWK_PROG '{print $NF}') This could be also added as a subcommand to 'inspect-internal', ie. from a file to it's filesystem uuid, then it should be easy to get any other id if needed through the sysfs directory.