From: Racz Zoltan <racz.zoli@gmail.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, Racz Zoltan <racz.zoli@gmail.com>
Subject: [PATCH 1/6] btrfs-progs: Added rowspec struct and neccesary include file for json output format
Date: Fri, 14 Feb 2025 18:47:04 +0200 [thread overview]
Message-ID: <20250214164709.51465-2-racz.zoli@gmail.com> (raw)
In-Reply-To: <20250214164709.51465-1-racz.zoli@gmail.com>
---
cmds/scrub.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/cmds/scrub.c b/cmds/scrub.c
index f769188a..f049e1ed 100644
--- a/cmds/scrub.c
+++ b/cmds/scrub.c
@@ -53,6 +53,7 @@
#include "common/sysfs-utils.h"
#include "common/string-table.h"
#include "common/string-utils.h"
+#include "common/format-output.h"
#include "common/help.h"
#include "cmds/commands.h"
@@ -124,6 +125,41 @@ struct scrub_fs_stat {
int i;
};
+struct format_ctx fctx;
+
+static const struct rowspec scrub_status_rowspec[] = {
+ { .key = "uuid", .fmt = "%s", .out_json = "uuid"},
+ { .key = "dev", .fmt = "%s", .out_json = "dev"},
+ { .key = "id", .fmt = "%llu", .out_json = "id"},
+ { .key = "status", .fmt = "%s", .out_json = "status"},
+ { .key = "duration", .fmt = "duration", .out_json = "duration"},
+ { .key = "started-at", .fmt = "date-time", .out_json = "started-at"},
+ { .key = "resumed-at", .fmt = "date-time", .out_json = "resumed-at"},
+ { .key = "data-extents-scrubbed", .fmt = "%llu", .out_json = "data-extents-scrubbed"},
+ { .key = "tree-extents-scrubbed", .fmt = "%llu", .out_json = "tree-extents-scrubbed"},
+ { .key = "data-bytes-scrubbed", .fmt = "%llu", .out_json = "data-bytes-scrubbed"},
+ { .key = "tree-bytes-scrubbed", .fmt = "%llu", .out_json = "tree-bytes-scrubbed"},
+ { .key = "read-errors", .fmt = "%llu", .out_json = "read-errors"},
+ { .key = "csum-errors", .fmt = "%llu", .out_json = "csum-errors"},
+ { .key = "verify-errors", .fmt = "%llu", .out_json = "verify-errors"},
+ { .key = "no-csum", .fmt = "%llu", .out_json = "no-csum"},
+ { .key = "csum-discards", .fmt = "%llu", .out_json = "csum-discards"},
+ { .key = "super-errors", .fmt = "%llu", .out_json = "super-errors"},
+ { .key = "malloc-errors", .fmt = "%llu", .out_json = "malloc-errors"},
+ { .key = "uncorrectable-errors", .fmt = "%llu", .out_json = "uncorrectable-errors"},
+ { .key = "unverified-errors", .fmt = "%llu", .out_json = "unverified-errors"},
+ { .key = "corrected-errors", .fmt = "%llu", .out_json = "corrected-errors"},
+ { .key = "last-physical", .fmt = "%llu", .out_json = "last-physical"},
+ { .key = "time-left", .fmt = "duration", .out_json = "time-left"},
+ { .key = "eta", .fmt = "date-time", .out_json = "eta"},
+ { .key = "total-bytes-to-scrub", .fmt = "%llu", .out_json = "total-bytes-to-scrub"},
+ { .key = "bytes-scrubbed", .fmt = "%llu", .out_json = "bytes-scrubbed"},
+ { .key = "rate", .fmt = "%llu", .out_json = "rate"},
+ { .key = "limit", .fmt = "%llu", .out_json = "limit"},
+
+ ROWSPEC_END
+};
+
static void print_scrub_full(struct btrfs_scrub_progress *sp)
{
pr_verbose(LOG_DEFAULT, "\tdata_extents_scrubbed: %llu\n", sp->data_extents_scrubbed);
--
2.48.1
next prev parent reply other threads:[~2025-02-14 16:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 16:47 [PATCH 0/6] btrfs-progs: V2 scrub status: add json output format Racz Zoltan
2025-02-14 16:47 ` Racz Zoltan [this message]
2025-02-14 16:47 ` [PATCH 2/6] btrfs-progs: Added json output format for print_scrub_full Racz Zoltan
2025-02-14 16:47 ` [PATCH 3/6] btrfs-progs: Added json output format for print_scrub_summary Racz Zoltan
2025-02-14 16:47 ` [PATCH 4/6] btrfs-progs: Added json output format for _print_scrub_ss and print_scrub_dev Racz Zoltan
2025-02-14 16:47 ` [PATCH 5/6] btrfs-progs: Added json output format for cmd_scrub_status Racz Zoltan
2025-02-14 16:47 ` [PATCH 6/6] btrfs-progs: Corrected a minor JSON string error in print_scrub_dev Racz Zoltan
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=20250214164709.51465-2-racz.zoli@gmail.com \
--to=racz.zoli@gmail.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/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