Skip to contentSkip to conversation

btrfs-progs: balance: usage range filter not working

PATCH In review Illia Bobyr 2 participants 2 messages Feb 18 – Mar 17 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: balance: usage range filter not working

When range support was added to the usage filter, a bug was introduced, as BTRFS_BALANCE_ARGS_USAGE is set unconditionally, even when BTRFS_BALANCE_ARGS_USAGE_RANGE is also set.

If BTRFS_BALANCE_ARGS_USAGE is set, BTRFS_BALANCE_ARGS_USAGE_RANGE is ignored, see fs/btrfs/volumes.c:should_balance_chunk().

---
 cmds/balance.c | 1 -
 1 file changed, 1 deletion(-)
cmds/balance.c +0 -1
index 25c5e..d6296 100644
@@ -141,7 +141,6 @@ static int parse_filters(char *filters, struct btrfs_balance_args *args)
 				args->flags &= ~BTRFS_BALANCE_ARGS_USAGE_RANGE;
 				args->flags |= BTRFS_BALANCE_ARGS_USAGE;
 			}
-			args->flags |= BTRFS_BALANCE_ARGS_USAGE;
 		} else if (strcmp(this_char, "devid") == 0) {
 			if (!value || !*value) {
 				error("the devid filter requires an argument");
Signature · 1 line
2.51.0
#1 lore raw
Quoted 8 lines · Illia Bobyr

When range support was added to the usage filter, a bug was introduced, as BTRFS_BALANCE_ARGS_USAGE is set unconditionally, even when BTRFS_BALANCE_ARGS_USAGE_RANGE is also set.

If BTRFS_BALANCE_ARGS_USAGE is set, BTRFS_BALANCE_ARGS_USAGE_RANGE is ignored, see fs/btrfs/volumes.c:should_balance_chunk().

Added to devel, thanks.