ext4: convert some BUG_ON's in mballoc to use WARN_RATELIMITED instead
In cases where we have an obvious way of continuing, let's use WARN_RATELIMITED() instead of BUG_ON(). Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
91a48aaf59
commit
19b8b035a7
|
@ -1487,7 +1487,13 @@ ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
|
|||
put_page(page);
|
||||
page = find_or_create_page(inode->i_mapping, pnum, gfp);
|
||||
if (page) {
|
||||
BUG_ON(page->mapping != inode->i_mapping);
|
||||
if (WARN_RATELIMIT(page->mapping != inode->i_mapping,
|
||||
"ext4: bitmap's paging->mapping != inode->i_mapping\n")) {
|
||||
/* should never happen */
|
||||
unlock_page(page);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
if (!PageUptodate(page)) {
|
||||
ret = ext4_mb_init_cache(page, NULL, gfp);
|
||||
if (ret) {
|
||||
|
@ -1523,7 +1529,13 @@ ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
|
|||
put_page(page);
|
||||
page = find_or_create_page(inode->i_mapping, pnum, gfp);
|
||||
if (page) {
|
||||
BUG_ON(page->mapping != inode->i_mapping);
|
||||
if (WARN_RATELIMIT(page->mapping != inode->i_mapping,
|
||||
"ext4: buddy bitmap's page->mapping != inode->i_mapping\n")) {
|
||||
/* should never happen */
|
||||
unlock_page(page);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
if (!PageUptodate(page)) {
|
||||
ret = ext4_mb_init_cache(page, e4b->bd_bitmap,
|
||||
gfp);
|
||||
|
@ -2221,7 +2233,9 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac,
|
|||
continue;
|
||||
|
||||
buddy = mb_find_buddy(e4b, i, &max);
|
||||
BUG_ON(buddy == NULL);
|
||||
if (WARN_RATELIMIT(buddy == NULL,
|
||||
"ext4: mb_simple_scan_group: mb_find_buddy failed, (%d)\n", i))
|
||||
continue;
|
||||
|
||||
k = mb_find_next_zero_bit(buddy, max, 0);
|
||||
if (k >= max) {
|
||||
|
@ -4229,15 +4243,14 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
|
|||
if (ac->ac_f_ex.fe_len == 0)
|
||||
return;
|
||||
err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b);
|
||||
if (err) {
|
||||
if (WARN_RATELIMIT(err,
|
||||
"ext4: mb_load_buddy failed (%d)", err))
|
||||
/*
|
||||
* This should never happen since we pin the
|
||||
* pages in the ext4_allocation_context so
|
||||
* ext4_mb_load_buddy() should never fail.
|
||||
*/
|
||||
WARN(1, "mb_load_buddy failed (%d)", err);
|
||||
return;
|
||||
}
|
||||
ext4_lock_group(ac->ac_sb, ac->ac_f_ex.fe_group);
|
||||
mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start,
|
||||
ac->ac_f_ex.fe_len);
|
||||
|
|
Loading…
Reference in New Issue