aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-08-01 17:41:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-08-01 17:41:35 -0400
commit9d8b9ec44234b2f6e0225300632d250210c04f11 (patch)
tree8b07c2cd2f664ebd2772e3d2299ef69e8c5a1e74 /fs
parentf18a5f21c25707b4fe64b326e2b4d150565e7300 (diff)
ext4: use ext4_msg() instead of printk in mballoc
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/mballoc.c79
1 files changed, 42 insertions, 37 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d5021e82f8cc..70d1b3e64284 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -493,10 +493,11 @@ static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap)
493 b2 = (unsigned char *) bitmap; 493 b2 = (unsigned char *) bitmap;
494 for (i = 0; i < e4b->bd_sb->s_blocksize; i++) { 494 for (i = 0; i < e4b->bd_sb->s_blocksize; i++) {
495 if (b1[i] != b2[i]) { 495 if (b1[i] != b2[i]) {
496 printk(KERN_ERR "corruption in group %u " 496 ext4_msg(e4b->bd_sb, KERN_ERR,
497 "at byte %u(%u): %x in copy != %x " 497 "corruption in group %u "
498 "on disk/prealloc\n", 498 "at byte %u(%u): %x in copy != %x "
499 e4b->bd_group, i, i * 8, b1[i], b2[i]); 499 "on disk/prealloc",
500 e4b->bd_group, i, i * 8, b1[i], b2[i]);
500 BUG(); 501 BUG();
501 } 502 }
502 } 503 }
@@ -2224,8 +2225,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
2224 EXT4_DESC_PER_BLOCK_BITS(sb); 2225 EXT4_DESC_PER_BLOCK_BITS(sb);
2225 meta_group_info = kmalloc(metalen, GFP_KERNEL); 2226 meta_group_info = kmalloc(metalen, GFP_KERNEL);
2226 if (meta_group_info == NULL) { 2227 if (meta_group_info == NULL) {
2227 printk(KERN_ERR "EXT4-fs: can't allocate mem for a " 2228 ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate mem "
2228 "buddy group\n"); 2229 "for a buddy group");
2229 goto exit_meta_group_info; 2230 goto exit_meta_group_info;
2230 } 2231 }
2231 sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] = 2232 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 2239
2239 meta_group_info[i] = kmem_cache_alloc(cachep, GFP_KERNEL); 2240 meta_group_info[i] = kmem_cache_alloc(cachep, GFP_KERNEL);
2240 if (meta_group_info[i] == NULL) { 2241 if (meta_group_info[i] == NULL) {
2241 printk(KERN_ERR "EXT4-fs: can't allocate buddy mem\n"); 2242 ext4_msg(sb, KERN_ERR, "EXT4-fs: can't allocate buddy mem");
2242 goto exit_group_info; 2243 goto exit_group_info;
2243 } 2244 }
2244 memset(meta_group_info[i], 0, kmem_cache_size(cachep)); 2245 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 * So a two level scheme suffices for now. */ 2334 * So a two level scheme suffices for now. */
2334 sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL); 2335 sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL);
2335 if (sbi->s_group_info == NULL) { 2336 if (sbi->s_group_info == NULL) {
2336 printk(KERN_ERR "EXT4-fs: can't allocate buddy meta group\n"); 2337 ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
2337 return -ENOMEM; 2338 return -ENOMEM;
2338 } 2339 }
2339 sbi->s_buddy_cache = new_inode(sb); 2340 sbi->s_buddy_cache = new_inode(sb);
2340 if (sbi->s_buddy_cache == NULL) { 2341 if (sbi->s_buddy_cache == NULL) {
2341 printk(KERN_ERR "EXT4-fs: can't get new inode\n"); 2342 ext4_msg(sb, KERN_ERR, "can't get new inode");
2342 goto err_freesgi; 2343 goto err_freesgi;
2343 } 2344 }
2344 sbi->s_buddy_cache->i_ino = get_next_ino(); 2345 sbi->s_buddy_cache->i_ino = get_next_ino();
@@ -2346,8 +2347,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
2346 for (i = 0; i < ngroups; i++) { 2347 for (i = 0; i < ngroups; i++) {
2347 desc = ext4_get_group_desc(sb, i, NULL); 2348 desc = ext4_get_group_desc(sb, i, NULL);
2348 if (desc == NULL) { 2349 if (desc == NULL) {
2349 printk(KERN_ERR 2350 ext4_msg(sb, KERN_ERR, "can't read descriptor %u", i);
2350 "EXT4-fs: can't read descriptor %u\n", i);
2351 goto err_freebuddy; 2351 goto err_freebuddy;
2352 } 2352 }
2353 if (ext4_mb_add_groupinfo(sb, i, desc) != 0) 2353 if (ext4_mb_add_groupinfo(sb, i, desc) != 0)
@@ -2411,7 +2411,8 @@ static int ext4_groupinfo_create_slab(size_t size)
2411 2411
2412 mutex_unlock(&ext4_grpinfo_slab_create_mutex); 2412 mutex_unlock(&ext4_grpinfo_slab_create_mutex);
2413 if (!cachep) { 2413 if (!cachep) {
2414 printk(KERN_EMERG "EXT4: no memory for groupinfo slab cache\n"); 2414 printk(KERN_EMERG
2415 "EXT4-fs: no memory for groupinfo slab cache\n");
2415 return -ENOMEM; 2416 return -ENOMEM;
2416 } 2417 }
2417 2418
@@ -2566,25 +2567,25 @@ int ext4_mb_release(struct super_block *sb)
2566 if (sbi->s_buddy_cache) 2567 if (sbi->s_buddy_cache)
2567 iput(sbi->s_buddy_cache); 2568 iput(sbi->s_buddy_cache);
2568 if (sbi->s_mb_stats) { 2569 if (sbi->s_mb_stats) {
2569 printk(KERN_INFO 2570 ext4_msg(sb, KERN_INFO,
2570 "EXT4-fs: mballoc: %u blocks %u reqs (%u success)\n", 2571 "mballoc: %u blocks %u reqs (%u success)",
2571 atomic_read(&sbi->s_bal_allocated), 2572 atomic_read(&sbi->s_bal_allocated),
2572 atomic_read(&sbi->s_bal_reqs), 2573 atomic_read(&sbi->s_bal_reqs),
2573 atomic_read(&sbi->s_bal_success)); 2574 atomic_read(&sbi->s_bal_success));
2574 printk(KERN_INFO 2575 ext4_msg(sb, KERN_INFO,
2575 "EXT4-fs: mballoc: %u extents scanned, %u goal hits, " 2576 "mballoc: %u extents scanned, %u goal hits, "
2576 "%u 2^N hits, %u breaks, %u lost\n", 2577 "%u 2^N hits, %u breaks, %u lost",
2577 atomic_read(&sbi->s_bal_ex_scanned), 2578 atomic_read(&sbi->s_bal_ex_scanned),
2578 atomic_read(&sbi->s_bal_goals), 2579 atomic_read(&sbi->s_bal_goals),
2579 atomic_read(&sbi->s_bal_2orders), 2580 atomic_read(&sbi->s_bal_2orders),
2580 atomic_read(&sbi->s_bal_breaks), 2581 atomic_read(&sbi->s_bal_breaks),
2581 atomic_read(&sbi->s_mb_lost_chunks)); 2582 atomic_read(&sbi->s_mb_lost_chunks));
2582 printk(KERN_INFO 2583 ext4_msg(sb, KERN_INFO,
2583 "EXT4-fs: mballoc: %lu generated and it took %Lu\n", 2584 "mballoc: %lu generated and it took %Lu",
2584 sbi->s_mb_buddies_generated, 2585 sbi->s_mb_buddies_generated,
2585 sbi->s_mb_generation_time); 2586 sbi->s_mb_generation_time);
2586 printk(KERN_INFO 2587 ext4_msg(sb, KERN_INFO,
2587 "EXT4-fs: mballoc: %u preallocated, %u discarded\n", 2588 "mballoc: %u preallocated, %u discarded",
2588 atomic_read(&sbi->s_mb_preallocated), 2589 atomic_read(&sbi->s_mb_preallocated),
2589 atomic_read(&sbi->s_mb_discarded)); 2590 atomic_read(&sbi->s_mb_discarded));
2590 } 2591 }
@@ -3024,9 +3025,10 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
3024 3025
3025 if (start + size <= ac->ac_o_ex.fe_logical && 3026 if (start + size <= ac->ac_o_ex.fe_logical &&
3026 start > ac->ac_o_ex.fe_logical) { 3027 start > ac->ac_o_ex.fe_logical) {
3027 printk(KERN_ERR "start %lu, size %lu, fe_logical %lu\n", 3028 ext4_msg(ac->ac_sb, KERN_ERR,
3028 (unsigned long) start, (unsigned long) size, 3029 "start %lu, size %lu, fe_logical %lu",
3029 (unsigned long) ac->ac_o_ex.fe_logical); 3030 (unsigned long) start, (unsigned long) size,
3031 (unsigned long) ac->ac_o_ex.fe_logical);
3030 } 3032 }
3031 BUG_ON(start + size <= ac->ac_o_ex.fe_logical && 3033 BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
3032 start > ac->ac_o_ex.fe_logical); 3034 start > ac->ac_o_ex.fe_logical);
@@ -3607,10 +3609,11 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
3607 bit = next + 1; 3609 bit = next + 1;
3608 } 3610 }
3609 if (free != pa->pa_free) { 3611 if (free != pa->pa_free) {
3610 printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n", 3612 ext4_msg(e4b->bd_sb, KERN_CRIT,
3611 pa, (unsigned long) pa->pa_lstart, 3613 "pa %p: logic %lu, phys. %lu, len %lu",
3612 (unsigned long) pa->pa_pstart, 3614 pa, (unsigned long) pa->pa_lstart,
3613 (unsigned long) pa->pa_len); 3615 (unsigned long) pa->pa_pstart,
3616 (unsigned long) pa->pa_len);
3614 ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u", 3617 ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u",
3615 free, pa->pa_free); 3618 free, pa->pa_free);
3616 /* 3619 /*
@@ -3798,7 +3801,8 @@ repeat:
3798 * use preallocation while we're discarding it */ 3801 * use preallocation while we're discarding it */
3799 spin_unlock(&pa->pa_lock); 3802 spin_unlock(&pa->pa_lock);
3800 spin_unlock(&ei->i_prealloc_lock); 3803 spin_unlock(&ei->i_prealloc_lock);
3801 printk(KERN_ERR "uh-oh! used pa while discarding\n"); 3804 ext4_msg(sb, KERN_ERR,
3805 "uh-oh! used pa while discarding");
3802 WARN_ON(1); 3806 WARN_ON(1);
3803 schedule_timeout_uninterruptible(HZ); 3807 schedule_timeout_uninterruptible(HZ);
3804 goto repeat; 3808 goto repeat;
@@ -3875,12 +3879,13 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
3875 (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)) 3879 (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED))
3876 return; 3880 return;
3877 3881
3878 printk(KERN_ERR "EXT4-fs: Can't allocate:" 3882 ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: Can't allocate:"
3879 " Allocation context details:\n"); 3883 " Allocation context details:");
3880 printk(KERN_ERR "EXT4-fs: status %d flags %d\n", 3884 ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: status %d flags %d",
3881 ac->ac_status, ac->ac_flags); 3885 ac->ac_status, ac->ac_flags);
3882 printk(KERN_ERR "EXT4-fs: orig %lu/%lu/%lu@%lu, goal %lu/%lu/%lu@%lu, " 3886 ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: orig %lu/%lu/%lu@%lu, "
3883 "best %lu/%lu/%lu@%lu cr %d\n", 3887 "goal %lu/%lu/%lu@%lu, "
3888 "best %lu/%lu/%lu@%lu cr %d",
3884 (unsigned long)ac->ac_o_ex.fe_group, 3889 (unsigned long)ac->ac_o_ex.fe_group,
3885 (unsigned long)ac->ac_o_ex.fe_start, 3890 (unsigned long)ac->ac_o_ex.fe_start,
3886 (unsigned long)ac->ac_o_ex.fe_len, 3891 (unsigned long)ac->ac_o_ex.fe_len,
@@ -3894,9 +3899,9 @@ static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
3894 (unsigned long)ac->ac_b_ex.fe_len, 3899 (unsigned long)ac->ac_b_ex.fe_len,
3895 (unsigned long)ac->ac_b_ex.fe_logical, 3900 (unsigned long)ac->ac_b_ex.fe_logical,
3896 (int)ac->ac_criteria); 3901 (int)ac->ac_criteria);
3897 printk(KERN_ERR "EXT4-fs: %lu scanned, %d found\n", ac->ac_ex_scanned, 3902 ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: %lu scanned, %d found",
3898 ac->ac_found); 3903 ac->ac_ex_scanned, ac->ac_found);
3899 printk(KERN_ERR "EXT4-fs: groups: \n"); 3904 ext4_msg(ac->ac_sb, KERN_ERR, "EXT4-fs: groups: ");
3900 ngroups = ext4_get_groups_count(sb); 3905 ngroups = ext4_get_groups_count(sb);
3901 for (i = 0; i < ngroups; i++) { 3906 for (i = 0; i < ngroups; i++) {
3902 struct ext4_group_info *grp = ext4_get_group_info(sb, i); 3907 struct ext4_group_info *grp = ext4_get_group_info(sb, i);