Re: [PATCH v2 1/3] btrfs: balance: prefix kernel logs
On Wed, May 16, 2018 at 10:51:26AM +0800, Anand Jain wrote: > Kernel logs are very important for the forensic investigations of the > issues in general make it easy to use it. This patch adds 'balance:' > prefix so that it can be easily searched. > > Signed-off-by: Anand JainAdded to next, thanks. Please stick to the coding style and add an empty newlines between declarations and statements and un-indent long printk strings so they fit 80 columns. I've fixed that for now. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] btrfs: balance: prefix kernel logs
On 16.05.2018 05:51, Anand Jain wrote: > Kernel logs are very important for the forensic investigations of the > issues in general make it easy to use it. This patch adds 'balance:' > prefix so that it can be easily searched. > > Signed-off-by: Anand JainStraightforward: Reviewed-by: Nikolay Borisov > --- > v1-v2: Change log update. > fs/btrfs/volumes.c | 34 -- > 1 file changed, 20 insertions(+), 14 deletions(-) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index 9773bc143650..27da66c47ef2 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -3801,7 +3801,7 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, > !(bctl->flags & BTRFS_BALANCE_METADATA) || > memcmp(>data, >meta, sizeof(bctl->data))) { > btrfs_err(fs_info, > - "with mixed groups data and metadata balance > options must be the same"); > + "balance: mixed groups data and metadata > options must be the same"); > ret = -EINVAL; > goto out; > } > @@ -3823,23 +3823,26 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, > allowed |= (BTRFS_BLOCK_GROUP_RAID10 | > BTRFS_BLOCK_GROUP_RAID6); > if (validate_convert_profile(>data, allowed)) { > + int index = btrfs_bg_flags_to_raid_index(bctl->data.target); > btrfs_err(fs_info, > - "unable to start balance with target data profile > %llu", > - bctl->data.target); > + "balance: invalid convert data profile %s", > + get_raid_name(index)); > ret = -EINVAL; > goto out; > } > if (validate_convert_profile(>meta, allowed)) { > + int index = btrfs_bg_flags_to_raid_index(bctl->meta.target); > btrfs_err(fs_info, > - "unable to start balance with target metadata profile > %llu", > - bctl->meta.target); > + "balance: invalid convert metadata profile %s", > + get_raid_name(index)); > ret = -EINVAL; > goto out; > } > if (validate_convert_profile(>sys, allowed)) { > + int index = btrfs_bg_flags_to_raid_index(bctl->sys.target); > btrfs_err(fs_info, > - "unable to start balance with target system profile > %llu", > - bctl->sys.target); > + "balance: invalid convert system profile %s", > + get_raid_name(index)); > ret = -EINVAL; > goto out; > } > @@ -3860,10 +3863,10 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, >!(bctl->meta.target & allowed))) { > if (bctl->flags & BTRFS_BALANCE_FORCE) { > btrfs_info(fs_info, > -"force reducing metadata integrity"); > +"balance: force reducing metadata > integrity"); > } else { > btrfs_err(fs_info, > - "balance will reduce metadata > integrity, use force if you want this"); > + "balance: reduces metadata integrity, > use force if you want this"); > ret = -EINVAL; > goto out; > } > @@ -3877,9 +3880,11 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, > bctl->data.target : fs_info->avail_data_alloc_bits; > if (btrfs_get_num_tolerated_disk_barrier_failures(meta_target) < > btrfs_get_num_tolerated_disk_barrier_failures(data_target)) { > + int meta_index = btrfs_bg_flags_to_raid_index(meta_target); > + int data_index = btrfs_bg_flags_to_raid_index(data_target); > btrfs_warn(fs_info, > -"metadata profile 0x%llx has lower redundancy than > data profile 0x%llx", > -meta_target, data_target); > +"balance: metadata profile %s has lower redundancy > than data profile %s", > +get_raid_name(meta_index), > get_raid_name(data_index)); > } > > ret = insert_balance_item(fs_info, bctl); > @@ -3939,7 +3944,7 @@ static int balance_kthread(void *data) > > mutex_lock(_info->balance_mutex); > if (fs_info->balance_ctl) { > - btrfs_info(fs_info, "continuing balance"); > + btrfs_info(fs_info, "balance: resuming"); > ret = btrfs_balance(fs_info, fs_info->balance_ctl, NULL); > } > mutex_unlock(_info->balance_mutex); > @@
[PATCH v2 1/3] btrfs: balance: prefix kernel logs
Kernel logs are very important for the forensic investigations of the issues in general make it easy to use it. This patch adds 'balance:' prefix so that it can be easily searched. Signed-off-by: Anand Jain--- v1-v2: Change log update. fs/btrfs/volumes.c | 34 -- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9773bc143650..27da66c47ef2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3801,7 +3801,7 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, !(bctl->flags & BTRFS_BALANCE_METADATA) || memcmp(>data, >meta, sizeof(bctl->data))) { btrfs_err(fs_info, - "with mixed groups data and metadata balance options must be the same"); + "balance: mixed groups data and metadata options must be the same"); ret = -EINVAL; goto out; } @@ -3823,23 +3823,26 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, allowed |= (BTRFS_BLOCK_GROUP_RAID10 | BTRFS_BLOCK_GROUP_RAID6); if (validate_convert_profile(>data, allowed)) { + int index = btrfs_bg_flags_to_raid_index(bctl->data.target); btrfs_err(fs_info, - "unable to start balance with target data profile %llu", - bctl->data.target); + "balance: invalid convert data profile %s", + get_raid_name(index)); ret = -EINVAL; goto out; } if (validate_convert_profile(>meta, allowed)) { + int index = btrfs_bg_flags_to_raid_index(bctl->meta.target); btrfs_err(fs_info, - "unable to start balance with target metadata profile %llu", - bctl->meta.target); + "balance: invalid convert metadata profile %s", + get_raid_name(index)); ret = -EINVAL; goto out; } if (validate_convert_profile(>sys, allowed)) { + int index = btrfs_bg_flags_to_raid_index(bctl->sys.target); btrfs_err(fs_info, - "unable to start balance with target system profile %llu", - bctl->sys.target); + "balance: invalid convert system profile %s", + get_raid_name(index)); ret = -EINVAL; goto out; } @@ -3860,10 +3863,10 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, !(bctl->meta.target & allowed))) { if (bctl->flags & BTRFS_BALANCE_FORCE) { btrfs_info(fs_info, - "force reducing metadata integrity"); + "balance: force reducing metadata integrity"); } else { btrfs_err(fs_info, - "balance will reduce metadata integrity, use force if you want this"); + "balance: reduces metadata integrity, use force if you want this"); ret = -EINVAL; goto out; } @@ -3877,9 +3880,11 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, bctl->data.target : fs_info->avail_data_alloc_bits; if (btrfs_get_num_tolerated_disk_barrier_failures(meta_target) < btrfs_get_num_tolerated_disk_barrier_failures(data_target)) { + int meta_index = btrfs_bg_flags_to_raid_index(meta_target); + int data_index = btrfs_bg_flags_to_raid_index(data_target); btrfs_warn(fs_info, - "metadata profile 0x%llx has lower redundancy than data profile 0x%llx", - meta_target, data_target); + "balance: metadata profile %s has lower redundancy than data profile %s", + get_raid_name(meta_index), get_raid_name(data_index)); } ret = insert_balance_item(fs_info, bctl); @@ -3939,7 +3944,7 @@ static int balance_kthread(void *data) mutex_lock(_info->balance_mutex); if (fs_info->balance_ctl) { - btrfs_info(fs_info, "continuing balance"); + btrfs_info(fs_info, "balance: resuming"); ret = btrfs_balance(fs_info, fs_info->balance_ctl, NULL); } mutex_unlock(_info->balance_mutex); @@ -3959,7 +3964,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info) mutex_unlock(_info->balance_mutex); if (btrfs_test_opt(fs_info, SKIP_BALANCE)) { -