/* BTRFS_BALANCE_ARGS_LIMIT value */
__le64 limit;
- __le64 unused[7];
+ /* btrfs stripes filter */
+ __le64 sstart;
+ __le64 send;
+
+ __le64 unused[5];
} __attribute__ ((__packed__));
/*
return 1;
}
+static int chunk_stripes_filter(struct extent_buffer *leaf,
+ struct btrfs_chunk *chunk,
+ struct btrfs_balance_args *bargs)
+{
+ int num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
+
+ if (bargs->sstart <= num_stripes && num_stripes <= bargs->send)
+ return 0;
+
+ return 1;
+}
+
static int chunk_soft_convert_filter(u64 chunk_type,
struct btrfs_balance_args *bargs)
{
return 0;
}
+ /* stripes filter */
+ if ((bargs->flags & BTRFS_BALANCE_ARGS_STRIPES) &&
+ chunk_stripes_filter(leaf, chunk, bargs)) {
+ return 0;
+ }
+
/* soft profile changing mode */
if ((bargs->flags & BTRFS_BALANCE_ARGS_SOFT) &&
chunk_soft_convert_filter(chunk_type, bargs)) {
#define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
#define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
#define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
+#define BTRFS_BALANCE_ARGS_STRIPES (1ULL << 6)
/*
* Profile changing flags. When SOFT is set we won't relocate chunk if