Commit 1693918e authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: Use ext4_msg() for ext4_da_writepage() errors

This allows the user to see what filesystem was involved with a
particular ext4_da_writepage() error.  Also, use KERN_CRIT which is
more appropriate than KERN_EMERG.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 83653888
...@@ -2092,17 +2092,17 @@ static void ext4_da_block_invalidatepages(struct mpage_da_data *mpd, ...@@ -2092,17 +2092,17 @@ static void ext4_da_block_invalidatepages(struct mpage_da_data *mpd,
static void ext4_print_free_blocks(struct inode *inode) static void ext4_print_free_blocks(struct inode *inode)
{ {
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
printk(KERN_EMERG "Total free blocks count %lld\n", printk(KERN_CRIT "Total free blocks count %lld\n",
ext4_count_free_blocks(inode->i_sb)); ext4_count_free_blocks(inode->i_sb));
printk(KERN_EMERG "Free/Dirty block details\n"); printk(KERN_CRIT "Free/Dirty block details\n");
printk(KERN_EMERG "free_blocks=%lld\n", printk(KERN_CRIT "free_blocks=%lld\n",
(long long)percpu_counter_sum(&sbi->s_freeblocks_counter)); (long long) percpu_counter_sum(&sbi->s_freeblocks_counter));
printk(KERN_EMERG "dirty_blocks=%lld\n", printk(KERN_CRIT "dirty_blocks=%lld\n",
(long long)percpu_counter_sum(&sbi->s_dirtyblocks_counter)); (long long) percpu_counter_sum(&sbi->s_dirtyblocks_counter));
printk(KERN_EMERG "Block reservation details\n"); printk(KERN_CRIT "Block reservation details\n");
printk(KERN_EMERG "i_reserved_data_blocks=%u\n", printk(KERN_CRIT "i_reserved_data_blocks=%u\n",
EXT4_I(inode)->i_reserved_data_blocks); EXT4_I(inode)->i_reserved_data_blocks);
printk(KERN_EMERG "i_reserved_meta_blocks=%u\n", printk(KERN_CRIT "i_reserved_meta_blocks=%u\n",
EXT4_I(inode)->i_reserved_meta_blocks); EXT4_I(inode)->i_reserved_meta_blocks);
return; return;
} }
...@@ -2189,13 +2189,13 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd) ...@@ -2189,13 +2189,13 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd)
* writepage and writepages will again try to write * writepage and writepages will again try to write
* the same. * the same.
*/ */
printk(KERN_EMERG "%s block allocation failed for inode %lu " ext4_msg(mpd->inode->i_sb, KERN_CRIT,
"at logical offset %llu with max blocks " "delayed block allocation failed for inode %lu at "
"%zd with error %d\n", "logical offset %llu with max blocks %zd with "
__func__, mpd->inode->i_ino, "error %d\n", mpd->inode->i_ino,
(unsigned long long)next, (unsigned long long) next,
mpd->b_size >> mpd->inode->i_blkbits, err); mpd->b_size >> mpd->inode->i_blkbits, err);
printk(KERN_EMERG "This should not happen.!! " printk(KERN_CRIT "This should not happen!! "
"Data will be lost\n"); "Data will be lost\n");
if (err == -ENOSPC) { if (err == -ENOSPC) {
ext4_print_free_blocks(mpd->inode); ext4_print_free_blocks(mpd->inode);
...@@ -2822,10 +2822,9 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2822,10 +2822,9 @@ static int ext4_da_writepages(struct address_space *mapping,
handle = ext4_journal_start(inode, needed_blocks); handle = ext4_journal_start(inode, needed_blocks);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
printk(KERN_CRIT "%s: jbd2_start: " ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: "
"%ld pages, ino %lu; err %d\n", __func__, "%ld pages, ino %lu; err %d\n", __func__,
wbc->nr_to_write, inode->i_ino, ret); wbc->nr_to_write, inode->i_ino, ret);
dump_stack();
goto out_writepages; goto out_writepages;
} }
...@@ -2897,7 +2896,8 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2897,7 +2896,8 @@ static int ext4_da_writepages(struct address_space *mapping,
goto retry; goto retry;
} }
if (pages_skipped != wbc->pages_skipped) if (pages_skipped != wbc->pages_skipped)
printk(KERN_EMERG "This should not happen leaving %s " ext4_msg(inode->i_sb, KERN_CRIT,
"This should not happen leaving %s "
"with nr_to_write = %ld ret = %d\n", "with nr_to_write = %ld ret = %d\n",
__func__, wbc->nr_to_write, ret); __func__, wbc->nr_to_write, ret);
......
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