Skip to content

Commit f7fb93f

Browse files
committed
btrfs-progs: remove old syntax of 'balance /path'
There was a support for a short syntax of 'btrfs balance' that accepted a path where normally would be the mandatory subcommand. This was a heuristic and nowadays everybody should be using the 'btrfs balance action' syntax. The warning was in place for a year, it's time to remove the short syntax completely. Issue: #517 Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c9ebef4 commit f7fb93f

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

cmds/balance.c

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
static const char * const balance_cmd_group_usage[] = {
3838
"btrfs balance <command> [options] <path>",
39-
"btrfs balance <path> (deprecated, use 'btrfs balance start')",
4039
NULL
4140
};
4241

@@ -862,37 +861,4 @@ static const struct cmd_group balance_cmd_group = {
862861
}
863862
};
864863

865-
static int cmd_balance(const struct cmd_struct *cmd, int argc, char **argv)
866-
{
867-
bool old_syntax = true;
868-
869-
/*
870-
* Exclude all valid subcommands from being potentially confused as path
871-
* for the obsolete syntax: btrfs balance <path>
872-
*/
873-
if (argc == 2) {
874-
for (int i = 0; balance_cmd_group.commands[i] != NULL; i++) {
875-
if (strcmp(argv[1], balance_cmd_group.commands[i]->token) == 0) {
876-
old_syntax = false;
877-
break;
878-
}
879-
}
880-
} else {
881-
old_syntax = false;
882-
}
883-
884-
if (old_syntax) {
885-
struct btrfs_ioctl_balance_args args;
886-
887-
warning("deprecated syntax, please use 'btrfs balance start'");
888-
memset(&args, 0, sizeof(args));
889-
args.flags |= BTRFS_BALANCE_TYPE_MASK;
890-
891-
/* No enqueueing supported for the obsolete syntax */
892-
return do_balance(argv[1], &args, 0, false);
893-
}
894-
895-
return handle_command_group(cmd, argc, argv);
896-
}
897-
898-
DEFINE_COMMAND(balance, "balance", cmd_balance, NULL, &balance_cmd_group, 0);
864+
DEFINE_GROUP_COMMAND_TOKEN(balance);

tests/cli-tests/002-balance-full-no-filters/test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ run_check_mount_test_dev
1515

1616
run_check $SUDO_HELPER "$TOP/btrfs" balance start --full-balance "$TEST_MNT"
1717
run_check $SUDO_HELPER "$TOP/btrfs" balance start "$TEST_MNT"
18-
run_check $SUDO_HELPER "$TOP/btrfs" balance --full-balance "$TEST_MNT"
19-
run_check $SUDO_HELPER "$TOP/btrfs" balance "$TEST_MNT"
2018

2119
# grep below can't use -q else this could lead to SIGPIPE
2220
run_check_stdout $SUDO_HELPER "$TOP/btrfs" balance start --background "$TEST_MNT" |

0 commit comments

Comments
 (0)