Message ID | 568CD827.3060601@yahoo.co.uk (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Wed, Jan 06, 2016 at 09:02:31AM +0000, sam tygier wrote: > From: Sam Tygier <samtygier@yahoo.co.uk> > Date: Wed, 6 Jan 2016 08:46:12 +0000 > Subject: [PATCH] Btrfs: Check metadata redundancy on balance > > When converting a filesystem via balance check that metadata mode > is at least as redundant as the data mode. For example give warning > when: > -dconvert=raid1 -mconvert=single > > Signed-off-by: Sam Tygier <samtygier@yahoo.co.uk> > --- > v3: > Use btrfs_warn() > Mention profiles in message > v2: > Use btrfs_get_num_tolerated_disk_barrier_failures() > --- > fs/btrfs/volumes.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index a23399e..be91458 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -3756,6 +3756,14 @@ int btrfs_balance(struct btrfs_balance_control *bctl, > } > } while (read_seqretry(&fs_info->profiles_lock, seq)); > > + if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) < > + btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) { > + btrfs_warn(fs_info, > + "Warning: metatdata profile %llu has lower redundancy " > + "than data profile %llu\n", bctl->meta.target, Thanks. FYI, I made some minor adjustments to the message ("warning" is not necessary, numer format looks better in hexa, no ending \n). -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a23399e..be91458 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3756,6 +3756,14 @@ int btrfs_balance(struct btrfs_balance_control *bctl, } } while (read_seqretry(&fs_info->profiles_lock, seq)); + if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) < + btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) { + btrfs_warn(fs_info, + "Warning: metatdata profile %llu has lower redundancy " + "than data profile %llu\n", bctl->meta.target, + bctl->data.target); + } + if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { fs_info->num_tolerated_disk_barrier_failures = min( btrfs_calc_num_tolerated_disk_barrier_failures(fs_info),