summaryrefslogtreecommitdiff
path: root/cmd_format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-07 17:23:13 -0400
committerHunter Shaffer <huntershaffer182456@gmail.com>2023-10-08 21:06:07 -0400
commit1251ea58a84e365db3754e6f5f57bd442484dc89 (patch)
tree2f568a8130f83f7a9d05fa70a2466f89ac772a3d /cmd_format.c
parent6b175a022496572416918bd38d083120c23ba5f2 (diff)
Update bcachefs sources to 7bf1ac0d46 bcachefs: Correctly initialize new buckets on device resize
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
Diffstat (limited to 'cmd_format.c')
-rw-r--r--cmd_format.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd_format.c b/cmd_format.c
index 26a1cd9f..4b1dcbe2 100644
--- a/cmd_format.c
+++ b/cmd_format.c
@@ -245,7 +245,7 @@ int cmd_format(int argc, char *argv[])
buf.human_readable_units = true;
- bch2_sb_to_text(&buf, sb, false, 1 << BCH_SB_FIELD_members);
+ bch2_sb_to_text(&buf, sb, false, 1 << BCH_SB_FIELD_members_v2);
printf("%s", buf.buf);
printbuf_exit(&buf);
@@ -305,8 +305,9 @@ int cmd_show_super(int argc, char *argv[])
{ "help", 0, NULL, 'h' },
{ NULL }
};
- unsigned fields = 1 << BCH_SB_FIELD_members;
+ unsigned fields = 0;
bool print_layout = false;
+ bool print_default_fields = true;
int opt;
while ((opt = getopt_long(argc, argv, "f:lh", longopts, NULL)) != -1)
@@ -316,6 +317,7 @@ int cmd_show_super(int argc, char *argv[])
? ~0
: read_flag_list_or_die(optarg,
bch2_sb_fields, "superblock field");
+ print_default_fields = false;
break;
case 'l':
print_layout = true;
@@ -342,6 +344,11 @@ int cmd_show_super(int argc, char *argv[])
if (ret)
die("Error opening %s: %s", dev, bch2_err_str(ret));
+ if (print_default_fields)
+ fields = bch2_sb_get_members_v2(sb.sb)
+ ? 1 << BCH_SB_FIELD_members_v2
+ : 1 << BCH_SB_FIELD_members_v1;
+
struct printbuf buf = PRINTBUF;
buf.human_readable_units = true;