@@ -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);