From patchwork Wed Dec 6 19:32:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 13482206 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tiscali.it header.i=@tiscali.it header.b="G/YGS07D" Received: from smtp.tiscali.it (santino.mail.tiscali.it [213.205.33.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A3755122 for ; Wed, 6 Dec 2023 11:52:27 -0800 (PST) Received: from venice.bhome ([84.220.171.3]) by santino.mail.tiscali.it with id K7rM2B00T04l9eU017rNXC; Wed, 06 Dec 2023 19:51:22 +0000 X-Spam-Final-Verdict: clean X-Spam-State: 0 X-Spam-Score: -100 X-Spam-Verdict: clean x-auth-user: kreijack@tiscali.it From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: David Sterba , Goffredo Baroncelli Subject: [PATCH 2/4] new command: btrfs filesystem info [...] Date: Wed, 6 Dec 2023 20:32:43 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Reply-To: Goffredo Baroncelli Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tiscali.it; s=smtp; t=1701892282; bh=r1+jlvKdEoEeQcNpDbXawfZ20GX41C5akkAdBBVFRTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=G/YGS07D/fCLdWcUVkiJX7hWLaqQxb0PWAroKgwW+3dcL+lFOzT28totDLokRC0Fs btNAK1FG9xw35Nd6MU3Ur7FYb9IA+bKGnDFhHQFVa8esKssCnhtny6l11XRCq/ujjl Y1Ux6U9DNfMoq8q0wVfGOXdycGNfHmPoa2cbLLMM= From: Goffredo Baroncelli This command shows all the main info of a (or all) btrfs filesystem. The argument may be in any of the following form: - btrfs filesystem path - btrfs device - UUID= - UUID_sub= - PARTUUID= If no argument is passed, the informaton of all the filesystem are showed. Typical output --------------------------------------------------- $ btrfs fi info /mnt/btrfs-raid1 UUID: b39b0b27-ff80-4cb4-bf48-0be939ff0788 LABEL: raid1 devices: dev: /dev/sda2 UUID_SUB: 65a4f76b-abaa-4d98-a1d5-4c586ffdcbf0 PARTUUID: fb9c0cc8-02 major: 8 minor: 2 devid: 1 dev: /dev/sdb2 UUID_SUB: 5f7f141f-0bdf-44fb-a910-fdc502a6fa7d PARTUUID: major: 8 minor: 18 devid: 2 mounts: dest: /mnt/btrfs-raid1 rootpath: / subvol: / options: rw,noatime,nodiratime,rw,space_cache,subvolid=5,subvol=/ seq: 93 over: 30 dest: /var/log rootpath: /@log subvol: /@log options: rw,noatime,nodiratime,rw,nossd,discard=async,space_cache,subvolid=447,subvol=/@log seq: 64 over: 30 ----------------------------------------------------- Signed-off-by: Goffredo Baroncelli --- cmds/filesystem.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 1b444b8f..38a0787f 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -55,6 +55,7 @@ #include "common/parse-utils.h" #include "common/filesystem-utils.h" #include "common/format-output.h" +#include "common/btrfs-info.h" #include "cmds/commands.h" #include "cmds/filesystem-usage.h" @@ -1503,6 +1504,48 @@ static int cmd_filesystem_label(const struct cmd_struct *cmd, } static DEFINE_SIMPLE_COMMAND(filesystem_label, "label"); +static const char * const cmd_filesystem_info_usage[] = { + "btrfs filesystem info [UUID=|UUID_SUB=|PARTUUID=|LABEL=