btrfs: convert WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG)) to DEBUG_WARN
Use the conditional warning instead of typing the whole condition. Optional message is printed where it seems clear what could be the problem. Conversion is left out in btree_csum_one_bio() because of the additional condition. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
+1
-1
@@ -2877,7 +2877,7 @@ int btrfs_backref_iter_start(struct btrfs_backref_iter *iter, u64 bytenr)
|
||||
goto release;
|
||||
}
|
||||
if (path->slots[0] == 0) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
ret = -EUCLEAN;
|
||||
goto release;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4436,7 +4436,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
|
||||
set_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags);
|
||||
|
||||
if (btrfs_check_quota_leak(fs_info)) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN("qgroup reserved space leaked");
|
||||
btrfs_err(fs_info, "qgroup reserved space leaked");
|
||||
}
|
||||
|
||||
|
||||
@@ -6397,7 +6397,7 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, u64 *trimmed)
|
||||
|
||||
/* Check if there are any CHUNK_* bits left */
|
||||
if (start > device->total_bytes) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
btrfs_warn_in_rcu(fs_info,
|
||||
"ignoring attempt to trim beyond device size: offset %llu length %llu device %s device size %llu",
|
||||
start, end - start + 1,
|
||||
|
||||
@@ -3697,7 +3697,7 @@ static bool report_eb_range(const struct extent_buffer *eb, unsigned long start,
|
||||
btrfs_warn(eb->fs_info,
|
||||
"access to eb bytenr %llu len %u out of range start %lu len %lu",
|
||||
eb->start, eb->len, start, len);
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-4
@@ -777,9 +777,7 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start,
|
||||
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||
|
||||
if (!btrfs_inode_can_compress(inode)) {
|
||||
WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
|
||||
KERN_ERR "BTRFS: unexpected compression for ino %llu\n",
|
||||
btrfs_ino(inode));
|
||||
DEBUG_WARN("BTRFS: unexpected compression for ino %llu", btrfs_ino(inode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2880,7 +2878,7 @@ int btrfs_writepage_cow_fixup(struct folio *folio)
|
||||
* We should not hit such out-of-band dirty folios anymore.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_BTRFS_EXPERIMENTAL)) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
btrfs_err_rl(fs_info,
|
||||
"root %lld ino %llu folio %llu is marked dirty without notifying the fs",
|
||||
BTRFS_I(inode)->root->root_key.objectid,
|
||||
|
||||
+3
-3
@@ -1823,7 +1823,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
||||
if (qgroup->rsv.values[BTRFS_QGROUP_RSV_DATA] ||
|
||||
qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PREALLOC] ||
|
||||
qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PERTRANS]) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
btrfs_warn_rl(fs_info,
|
||||
"to be deleted qgroup %u/%llu has non-zero numbers, data %llu meta prealloc %llu meta pertrans %llu",
|
||||
btrfs_qgroup_level(qgroup->qgroupid),
|
||||
@@ -1843,7 +1843,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
||||
!(fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT)) {
|
||||
if (qgroup->rfer || qgroup->excl ||
|
||||
qgroup->rfer_cmpr || qgroup->excl_cmpr) {
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
btrfs_warn_rl(fs_info,
|
||||
"to be deleted qgroup %u/%llu has non-zero numbers, rfer %llu rfer_cmpr %llu excl %llu excl_cmpr %llu",
|
||||
btrfs_qgroup_level(qgroup->qgroupid),
|
||||
@@ -4767,7 +4767,7 @@ int btrfs_qgroup_add_swapped_blocks(struct btrfs_root *subvol_root,
|
||||
* Marking qgroup inconsistent should be enough
|
||||
* for end users.
|
||||
*/
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN("duplicated but mismatched entry found");
|
||||
ret = -EEXIST;
|
||||
}
|
||||
kfree(block);
|
||||
|
||||
@@ -2230,8 +2230,7 @@ int btrfs_verify_level_key(struct extent_buffer *eb,
|
||||
|
||||
found_level = btrfs_header_level(eb);
|
||||
if (unlikely(found_level != check->level)) {
|
||||
WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
|
||||
KERN_ERR "BTRFS: tree level check failed\n");
|
||||
DEBUG_WARN();
|
||||
btrfs_err(fs_info,
|
||||
"tree level mismatch detected, bytenr=%llu level expected=%u has=%u",
|
||||
eb->start, check->level, found_level);
|
||||
@@ -2255,7 +2254,7 @@ int btrfs_verify_level_key(struct extent_buffer *eb,
|
||||
btrfs_err(fs_info,
|
||||
"invalid tree nritems, bytenr=%llu nritems=0 expect >0",
|
||||
eb->start);
|
||||
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
|
||||
DEBUG_WARN();
|
||||
return -EUCLEAN;
|
||||
}
|
||||
|
||||
@@ -2266,8 +2265,7 @@ int btrfs_verify_level_key(struct extent_buffer *eb,
|
||||
|
||||
ret = btrfs_comp_cpu_keys(&check->first_key, &found_key);
|
||||
if (unlikely(ret)) {
|
||||
WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
|
||||
KERN_ERR "BTRFS: tree first key check failed\n");
|
||||
DEBUG_WARN();
|
||||
btrfs_err(fs_info,
|
||||
"tree first key mismatch detected, bytenr=%llu parent_transid=%llu key expected=(%llu,%u,%llu) has=(%llu,%u,%llu)",
|
||||
eb->start, check->transid, check->first_key.objectid,
|
||||
|
||||
Reference in New Issue
Block a user