Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297900
b: refs/heads/master
c: e4837f8
h: refs/heads/master
v: v3
  • Loading branch information
Ilya Dryomov committed Mar 27, 2012
1 parent dea9c6f commit c8fb689
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6728b198deb02c187b5e5a99eb7d1cc9c8bc65e9
refs/heads/master: e4837f8f3b5d08b8c708533a71439bfb40ede467
13 changes: 9 additions & 4 deletions trunk/fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
{
struct btrfs_fs_info *fs_info = bctl->fs_info;
u64 allowed;
int mixed = 0;
int ret;

if (btrfs_fs_closing(fs_info) ||
Expand All @@ -2659,13 +2660,16 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
goto out;
}

allowed = btrfs_super_incompat_flags(fs_info->super_copy);
if (allowed & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS)
mixed = 1;

/*
* In case of mixed groups both data and meta should be picked,
* and identical options should be given for both of them.
*/
allowed = btrfs_super_incompat_flags(fs_info->super_copy);
if ((allowed & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) &&
(bctl->flags & (BTRFS_BALANCE_DATA | BTRFS_BALANCE_METADATA))) {
allowed = BTRFS_BALANCE_DATA | BTRFS_BALANCE_METADATA;
if (mixed && (bctl->flags & allowed)) {
if (!(bctl->flags & BTRFS_BALANCE_DATA) ||
!(bctl->flags & BTRFS_BALANCE_METADATA) ||
memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) {
Expand Down Expand Up @@ -2713,7 +2717,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
goto out;
}

if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
/* allow dup'ed data chunks only in mixed mode */
if (!mixed && (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) &&
(bctl->data.target & BTRFS_BLOCK_GROUP_DUP)) {
printk(KERN_ERR "btrfs: dup for data is not allowed\n");
ret = -EINVAL;
Expand Down

0 comments on commit c8fb689

Please sign in to comment.