Commit 9d8b9ec4 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: use ext4_msg() instead of printk in mballoc

Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent f18a5f21
...@@ -493,9 +493,10 @@ static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) ...@@ -493,9 +493,10 @@ static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap)
b2 = (unsigned char *) bitmap; b2 = (unsigned char *) bitmap;
for (i = 0; i < e4b->bd_sb->s_blocksize; i++) { for (i = 0; i < e4b->bd_sb->s_blocksize; i++) {
if (b1[i] != b2[i]) { if (b1[i] != b2[i]) {
printk(KERN_ERR "corruption in group %u " ext4_msg(e4b->bd_sb, KERN_ERR,
"corruption in group %u "
"at byte %u(%u): %x in copy != %x " "at byte %u(%u): %x in copy != %x "
"on disk/prealloc\n", "on disk/prealloc",
e4b->bd_group, i, i * 8, b1[i], b2[i]); e4b->bd_group, i, i * 8, b1[i], b2[i]);
BUG(); BUG();
} }
...@@ -2224,8 +2225,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group, ...@@ -2224,8 +2225,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
EXT4_DESC_PER_BLOCK_BITS(sb); EXT4_DESC_PER_BLOCK_BITS(sb);
meta_group_info = kmalloc(metalen, GFP_KERNEL); meta_group_info = kmalloc(metalen, GFP_KERNEL);
if (meta_group_info == NULL) { if (meta_group_info == NULL) {
printk(KERN_ERR "EXT4-fs: can't allocate mem for a " ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate mem "
"buddy group\n"); "for a buddy group");
goto exit_meta_group_info; goto exit_meta_group_info;
} }
sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] = sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] =
...@@ -2238,7 +2239,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group, ...@@ -2238,7 +2239,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
meta_group_info[i] = kmem_cache_alloc(cachep, GFP_KERNEL); meta_group_info[i] = kmem_cache_alloc(cachep, GFP_KERNEL);
if (meta_group_info[i] == NULL) { if (meta_group_info[i] == NULL) {
printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n"); ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate buddy mem");
goto exit_group_info; goto exit_group_info;
} }
memset(meta_group_info[i], 0, kmem_cache_size(cachep)); memset(meta_group_info[i], 0, kmem_cache_size(cachep));
...@@ -2333,12 +2334,12 @@ static int ext4_mb_init_backend(struct super_block *sb) ...@@ -2333,12 +2334,12 @@ static int ext4_mb_init_backend(struct super_block *sb)
* So a two level scheme suffices for now. */ * So a two level scheme suffices for now. */
sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL); sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL);
if (sbi->s_group_info == NULL) { if (sbi->s_group_info == NULL) {
printk(KERN_ERR "EXT4-fs: can't allocate buddy meta group\n"); ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
return -ENOMEM; return -ENOMEM;
} }
sbi->s_buddy_cache = new_inode(sb); sbi->s_buddy_cache = new_inode(sb);
if (sbi->s_buddy_cache == NULL) { if (sbi->s_buddy_cache == NULL) {
printk(KERN_ERR "EXT4-fs: can't get new inode\n"); ext4_msg(sb, KERN_ERR, "can't get new inode");
goto err_freesgi; goto err_freesgi;
} }
sbi->s_buddy_cache->i_ino = get_next_ino(); sbi->s_buddy_cache->i_ino = get_next_ino();
...@@ -2346,8 +2347,7 @@ static int ext4_mb_init_backend(struct super_block *sb) ...@@ -2346,8 +2347,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
desc = ext4_get_group_desc(sb, i, NULL); desc = ext4_get_group_desc(sb, i, NULL);
if (desc == NULL) { if (desc == NULL) {
printk(KERN_ERR ext4_msg(sb, KERN_ERR, "can't read descriptor %u", i);
"EXT4-fs: can't read descriptor %u\n", i);
goto err_freebuddy; goto err_freebuddy;
} }
if (ext4_mb_add_groupinfo(sb, i, desc) != 0) if (ext4_mb_add_groupinfo(sb, i, desc) != 0)
...@@ -2411,7 +2411,8 @@ static int ext4_groupinfo_create_slab(size_t size) ...@@ -2411,7 +2411,8 @@ static int ext4_groupinfo_create_slab(size_t size)
mutex_unlock(&ext4_grpinfo_slab_create_mutex); mutex_unlock(&ext4_grpinfo_slab_create_mutex);
if (!cachep) { if (!cachep) {
printk(KERN_EMERG "EXT4: no memory for groupinfo slab cache\n"); printk(KERN_EMERG
"EXT4-fs: no memory for groupinfo slab cache\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -2566,25 +2567,25 @@ int ext4_mb_release(struct super_block *sb) ...@@ -2566,25 +2567,25 @@ int ext4_mb_release(struct super_block *sb)
if (sbi->s_buddy_cache) if (sbi->s_buddy_cache)
iput(sbi->s_buddy_cache); iput(sbi->s_buddy_cache);
if (sbi->s_mb_stats) { if (sbi->s_mb_stats) {
printk(KERN_INFO ext4_msg(sb, KERN_INFO,
"EXT4-fs: mballoc: %u blocks %u reqs (%u success)\n", "mballoc: %u blocks %u reqs (%u success)",
atomic_read(&sbi->s_bal_allocated), atomic_read(&sbi->s_bal_allocated),
atomic_read(&sbi->s_bal_reqs), atomic_read(&sbi->s_bal_reqs),
atomic_read(&sbi->s_bal_success)); atomic_read(&sbi->s_bal_success));
printk(KERN_INFO ext4_msg(sb, KERN_INFO,
"EXT4-fs: mballoc: %u extents scanned, %u goal hits, " "mballoc: %u extents scanned, %u goal hits, "
"%u 2^N hits, %u breaks, %u lost\n", "%u 2^N hits, %u breaks, %u lost",
atomic_read(&sbi->s_bal_ex_scanned), atomic_read(&sbi->s_bal_ex_scanned),
atomic_read(&sbi->s_bal_goals), atomic_read(&sbi->s_bal_goals),
atomic_read(&sbi->s_bal_2orders), atomic_read(&sbi->s_bal_2orders),
atomic_read(&sbi->s_bal_breaks), atomic_read(&sbi->s_bal_breaks),
atomic_read(&sbi->s_mb_lost_chunks)); atomic_read(&sbi->s_mb_lost_chunks));
printk(KERN_INFO ext4_msg(sb, KERN_INFO,
"EXT4-fs: mballoc: %lu generated and it took %Lu\n", "mballoc: %lu generated and it took %Lu",
sbi->s_mb_buddies_generated, sbi->s_mb_buddies_generated,
sbi->s_mb_generation_time); sbi->s_mb_generation_time);
printk(KERN_INFO ext4_msg(sb, KERN_INFO,
"EXT4-fs: mballoc: %u preallocated, %u discarded\n", "mballoc: %u preallocated, %u discarded",
atomic_read(&sbi->s_mb_preallocated), atomic_read(&sbi->s_mb_preallocated),
atomic_read(&sbi->s_mb_discarded)); atomic_read(&sbi->s_mb_discarded));
} }
...@@ -3024,7 +3025,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac, ...@@ -3024,7 +3025,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
if (start + size <= ac->ac_o_ex.fe_logical && if (start + size <= ac->ac_o_ex.fe_logical &&
start > ac->ac_o_ex.fe_logical) { start > ac->ac_o_ex.fe_logical) {
printk(KERN_ERR "start %lu, size %lu, fe_logical %lu\n", ext4_msg(ac->ac_sb, KERN_ERR,
"start %lu, size %lu, fe_logical %lu",
(unsigned long) start, (unsigned long) size, (unsigned long) start, (unsigned long) size,
(unsigned long) ac->ac_o_ex.fe_logical); (unsigned long) ac->ac_o_ex.fe_logical);
} }
...@@ -3607,7 +3609,8 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, ...@@ -3607,7 +3609,8 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
bit = next + 1; bit = next + 1;
} }
if (free != pa->pa_free) { if (free != pa->pa_free) {
printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n", ext4_msg(e4b->bd_sb, KERN_CRIT,
"pa %p: logic %lu, phys. %lu, len %lu",
pa, (unsigned long) pa->pa_lstart, pa, (unsigned long) pa->pa_lstart,
(unsigned long) pa->pa_pstart, (unsigned long) pa->pa_pstart,
(unsigned long) pa->pa_len); (unsigned long) pa->pa_len);
...@@ -3798,7 +3801,8 @@ void ext4_discard_preallocations(struct inode *inode) ...@@ -3798,7 +3801,8 @@ void ext4_discard_preallocations(struct inode *inode)
* use preallocation while we're discarding it */ * use preallocation while we're discarding it */
spin_unlock(&pa->pa_lock); spin_unlock(&pa->pa_lock);
spin_unlock(&ei->i_prealloc_lock); spin_unlock(&ei->i_prealloc_lock);
printk(KERN_ERR "uh-oh! used pa while discarding\n"); ext4_msg(sb, KERN_ERR,
"uh-oh! used pa while discarding");
WARN_ON(1); WARN_ON(1);
schedule_timeout_uninterruptible(HZ); schedule_timeout_uninterruptible(HZ);
goto repeat; goto repeat;
...@@ -3875,12 +3879,13 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac) ...@@ -3875,12 +3879,13 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
(EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)) (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED))
return; return;
printk(KERN_ERR "EXT4-fs: Can't allocate:" ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: Can't allocate:"
" Allocation context details:\n"); " Allocation context details:");
printk(KERN_ERR "EXT4-fs: status %d flags %d\n", ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: status %d flags %d",
ac->ac_status, ac->ac_flags); ac->ac_status, ac->ac_flags);
printk(KERN_ERR "EXT4-fs: orig %lu/%lu/%lu@%lu, goal %lu/%lu/%lu@%lu, " ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: orig %lu/%lu/%lu@%lu, "
"best %lu/%lu/%lu@%lu cr %d\n", "goal %lu/%lu/%lu@%lu, "
"best %lu/%lu/%lu@%lu cr %d",
(unsigned long)ac->ac_o_ex.fe_group, (unsigned long)ac->ac_o_ex.fe_group,
(unsigned long)ac->ac_o_ex.fe_start, (unsigned long)ac->ac_o_ex.fe_start,
(unsigned long)ac->ac_o_ex.fe_len, (unsigned long)ac->ac_o_ex.fe_len,
...@@ -3894,9 +3899,9 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac) ...@@ -3894,9 +3899,9 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
(unsigned long)ac->ac_b_ex.fe_len, (unsigned long)ac->ac_b_ex.fe_len,
(unsigned long)ac->ac_b_ex.fe_logical, (unsigned long)ac->ac_b_ex.fe_logical,
(int)ac->ac_criteria); (int)ac->ac_criteria);
printk(KERN_ERR "EXT4-fs: %lu scanned, %d found\n", ac->ac_ex_scanned, ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: %lu scanned, %d found",
ac->ac_found); ac->ac_ex_scanned, ac->ac_found);
printk(KERN_ERR "EXT4-fs: groups: \n"); ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: groups: ");
ngroups = ext4_get_groups_count(sb); ngroups = ext4_get_groups_count(sb);
for (i = 0; i < ngroups; i++) { for (i = 0; i < ngroups; i++) {
struct ext4_group_info *grp = ext4_get_group_info(sb, i); struct ext4_group_info *grp = ext4_get_group_info(sb, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment