Commit 12062ddd authored by Eric Sandeen's avatar Eric Sandeen Committed by Theodore Ts'o

ext4: move __func__ into a macro for ext4_warning, ext4_error

Just a pet peeve of mine; we had a mishash of calls with either __func__
or "function_name" and the latter tends to get out of sync.

I think it's easier to just hide the __func__ in a macro, and it'll
be consistent from then on.
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent f710b4b9
...@@ -97,8 +97,8 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, ...@@ -97,8 +97,8 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
/* If checksum is bad mark all blocks used to prevent allocation /* If checksum is bad mark all blocks used to prevent allocation
* essentially implementing a per-group read-only flag. */ * essentially implementing a per-group read-only flag. */
if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
ext4_error(sb, __func__, ext4_error(sb, "Checksum bad for group %u",
"Checksum bad for group %u", block_group); block_group);
ext4_free_blks_set(sb, gdp, 0); ext4_free_blks_set(sb, gdp, 0);
ext4_free_inodes_set(sb, gdp, 0); ext4_free_inodes_set(sb, gdp, 0);
ext4_itable_unused_set(sb, gdp, 0); ext4_itable_unused_set(sb, gdp, 0);
...@@ -210,10 +210,8 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, ...@@ -210,10 +210,8 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
if (block_group >= ngroups) { if (block_group >= ngroups) {
ext4_error(sb, "ext4_get_group_desc", ext4_error(sb, "block_group >= groups_count - block_group = %u,"
"block_group >= groups_count - " " groups_count = %u", block_group, ngroups);
"block_group = %u, groups_count = %u",
block_group, ngroups);
return NULL; return NULL;
} }
...@@ -221,8 +219,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, ...@@ -221,8 +219,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb);
offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1);
if (!sbi->s_group_desc[group_desc]) { if (!sbi->s_group_desc[group_desc]) {
ext4_error(sb, "ext4_get_group_desc", ext4_error(sb, "Group descriptor not loaded - "
"Group descriptor not loaded - "
"block_group = %u, group_desc = %u, desc = %u", "block_group = %u, group_desc = %u, desc = %u",
block_group, group_desc, offset); block_group, group_desc, offset);
return NULL; return NULL;
...@@ -282,9 +279,7 @@ static int ext4_valid_block_bitmap(struct super_block *sb, ...@@ -282,9 +279,7 @@ static int ext4_valid_block_bitmap(struct super_block *sb,
return 1; return 1;
err_out: err_out:
ext4_error(sb, __func__, ext4_error(sb, "Invalid block bitmap - block_group = %d, block = %llu",
"Invalid block bitmap - "
"block_group = %d, block = %llu",
block_group, bitmap_blk); block_group, bitmap_blk);
return 0; return 0;
} }
...@@ -311,8 +306,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) ...@@ -311,8 +306,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
bitmap_blk = ext4_block_bitmap(sb, desc); bitmap_blk = ext4_block_bitmap(sb, desc);
bh = sb_getblk(sb, bitmap_blk); bh = sb_getblk(sb, bitmap_blk);
if (unlikely(!bh)) { if (unlikely(!bh)) {
ext4_error(sb, __func__, ext4_error(sb, "Cannot read block bitmap - "
"Cannot read block bitmap - "
"block_group = %u, block_bitmap = %llu", "block_group = %u, block_bitmap = %llu",
block_group, bitmap_blk); block_group, bitmap_blk);
return NULL; return NULL;
...@@ -354,8 +348,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) ...@@ -354,8 +348,7 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
set_bitmap_uptodate(bh); set_bitmap_uptodate(bh);
if (bh_submit_read(bh) < 0) { if (bh_submit_read(bh) < 0) {
put_bh(bh); put_bh(bh);
ext4_error(sb, __func__, ext4_error(sb, "Cannot read block bitmap - "
"Cannot read block bitmap - "
"block_group = %u, block_bitmap = %llu", "block_group = %u, block_bitmap = %llu",
block_group, bitmap_blk); block_group, bitmap_blk);
return NULL; return NULL;
...@@ -419,8 +412,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, ...@@ -419,8 +412,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) ||
in_range(block + count - 1, ext4_inode_table(sb, desc), in_range(block + count - 1, ext4_inode_table(sb, desc),
sbi->s_itb_per_group)) { sbi->s_itb_per_group)) {
ext4_error(sb, __func__, ext4_error(sb, "Adding blocks in system zones - "
"Adding blocks in system zones - "
"Block = %llu, count = %lu", "Block = %llu, count = %lu",
block, count); block, count);
goto error_return; goto error_return;
...@@ -453,8 +445,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, ...@@ -453,8 +445,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
BUFFER_TRACE(bitmap_bh, "clear bit"); BUFFER_TRACE(bitmap_bh, "clear bit");
if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group), if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group),
bit + i, bitmap_bh->b_data)) { bit + i, bitmap_bh->b_data)) {
ext4_error(sb, __func__, ext4_error(sb, "bit already cleared for block %llu",
"bit already cleared for block %llu",
(ext4_fsblk_t)(block + i)); (ext4_fsblk_t)(block + i));
BUFFER_TRACE(bitmap_bh, "bit already cleared"); BUFFER_TRACE(bitmap_bh, "bit already cleared");
} else { } else {
......
...@@ -83,7 +83,7 @@ int ext4_check_dir_entry(const char *function, struct inode *dir, ...@@ -83,7 +83,7 @@ int ext4_check_dir_entry(const char *function, struct inode *dir,
error_msg = "inode out of bounds"; error_msg = "inode out of bounds";
if (error_msg != NULL) if (error_msg != NULL)
ext4_error(dir->i_sb, function, __ext4_error(dir->i_sb, function,
"bad entry in directory #%lu: %s - " "bad entry in directory #%lu: %s - "
"offset=%u, inode=%u, rec_len=%d, name_len=%d", "offset=%u, inode=%u, rec_len=%d, name_len=%d",
dir->i_ino, error_msg, offset, dir->i_ino, error_msg, offset,
...@@ -150,7 +150,7 @@ static int ext4_readdir(struct file *filp, ...@@ -150,7 +150,7 @@ static int ext4_readdir(struct file *filp,
*/ */
if (!bh) { if (!bh) {
if (!dir_has_error) { if (!dir_has_error) {
ext4_error(sb, __func__, "directory #%lu " ext4_error(sb, "directory #%lu "
"contains a hole at offset %Lu", "contains a hole at offset %Lu",
inode->i_ino, inode->i_ino,
(unsigned long long) filp->f_pos); (unsigned long long) filp->f_pos);
......
...@@ -1486,13 +1486,16 @@ extern int ext4_group_extend(struct super_block *sb, ...@@ -1486,13 +1486,16 @@ extern int ext4_group_extend(struct super_block *sb,
ext4_fsblk_t n_blocks_count); ext4_fsblk_t n_blocks_count);
/* super.c */ /* super.c */
extern void ext4_error(struct super_block *, const char *, const char *, ...) extern void __ext4_error(struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
#define ext4_error(sb, message...) __ext4_error(sb, __func__, ## message)
extern void __ext4_std_error(struct super_block *, const char *, int); extern void __ext4_std_error(struct super_block *, const char *, int);
extern void ext4_abort(struct super_block *, const char *, const char *, ...) extern void ext4_abort(struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
extern void ext4_warning(struct super_block *, const char *, const char *, ...) extern void __ext4_warning(struct super_block *, const char *,
const char *, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
#define ext4_warning(sb, message...) __ext4_warning(sb, __func__, ## message)
extern void ext4_msg(struct super_block *, const char *, const char *, ...) extern void ext4_msg(struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
extern void ext4_grp_locked_error(struct super_block *, ext4_group_t, extern void ext4_grp_locked_error(struct super_block *, ext4_group_t,
......
...@@ -132,7 +132,7 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, ...@@ -132,7 +132,7 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
if (inode && inode_needs_sync(inode)) { if (inode && inode_needs_sync(inode)) {
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) { if (buffer_req(bh) && !buffer_uptodate(bh)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"IO error syncing inode, " "IO error syncing inode, "
"inode=%lu, block=%llu", "inode=%lu, block=%llu",
inode->i_ino, inode->i_ino,
......
...@@ -440,7 +440,7 @@ static int __ext4_ext_check(const char *function, struct inode *inode, ...@@ -440,7 +440,7 @@ static int __ext4_ext_check(const char *function, struct inode *inode,
return 0; return 0;
corrupted: corrupted:
ext4_error(inode->i_sb, function, __ext4_error(inode->i_sb, function,
"bad header/extent in inode #%lu: %s - magic %x, " "bad header/extent in inode #%lu: %s - magic %x, "
"entries %u, max %u(%u), depth %u(%u)", "entries %u, max %u(%u), depth %u(%u)",
inode->i_ino, error_msg, le16_to_cpu(eh->eh_magic), inode->i_ino, error_msg, le16_to_cpu(eh->eh_magic),
...@@ -1538,8 +1538,9 @@ int ext4_ext_try_to_merge(struct inode *inode, ...@@ -1538,8 +1538,9 @@ int ext4_ext_try_to_merge(struct inode *inode,
merge_done = 1; merge_done = 1;
WARN_ON(eh->eh_entries == 0); WARN_ON(eh->eh_entries == 0);
if (!eh->eh_entries) if (!eh->eh_entries)
ext4_error(inode->i_sb, "ext4_ext_try_to_merge", ext4_error(inode->i_sb,
"inode#%lu, eh->eh_entries = 0!", inode->i_ino); "inode#%lu, eh->eh_entries = 0!",
inode->i_ino);
} }
return merge_done; return merge_done;
...@@ -3238,7 +3239,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, ...@@ -3238,7 +3239,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
* this is why assert can't be put in ext4_ext_find_extent() * this is why assert can't be put in ext4_ext_find_extent()
*/ */
if (path[depth].p_ext == NULL && depth != 0) { if (path[depth].p_ext == NULL && depth != 0) {
ext4_error(inode->i_sb, __func__, "bad extent address " ext4_error(inode->i_sb, "bad extent address "
"inode: %lu, iblock: %d, depth: %d", "inode: %lu, iblock: %d, depth: %d",
inode->i_ino, iblock, depth); inode->i_ino, iblock, depth);
err = -EIO; err = -EIO;
......
...@@ -76,8 +76,7 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh, ...@@ -76,8 +76,7 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh,
/* If checksum is bad mark all blocks and inodes use to prevent /* If checksum is bad mark all blocks and inodes use to prevent
* allocation, essentially implementing a per-group read-only flag. */ * allocation, essentially implementing a per-group read-only flag. */
if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
ext4_error(sb, __func__, "Checksum bad for group %u", ext4_error(sb, "Checksum bad for group %u", block_group);
block_group);
ext4_free_blks_set(sb, gdp, 0); ext4_free_blks_set(sb, gdp, 0);
ext4_free_inodes_set(sb, gdp, 0); ext4_free_inodes_set(sb, gdp, 0);
ext4_itable_unused_set(sb, gdp, 0); ext4_itable_unused_set(sb, gdp, 0);
...@@ -111,8 +110,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) ...@@ -111,8 +110,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
bitmap_blk = ext4_inode_bitmap(sb, desc); bitmap_blk = ext4_inode_bitmap(sb, desc);
bh = sb_getblk(sb, bitmap_blk); bh = sb_getblk(sb, bitmap_blk);
if (unlikely(!bh)) { if (unlikely(!bh)) {
ext4_error(sb, __func__, ext4_error(sb, "Cannot read inode bitmap - "
"Cannot read inode bitmap - "
"block_group = %u, inode_bitmap = %llu", "block_group = %u, inode_bitmap = %llu",
block_group, bitmap_blk); block_group, bitmap_blk);
return NULL; return NULL;
...@@ -153,8 +151,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) ...@@ -153,8 +151,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
set_bitmap_uptodate(bh); set_bitmap_uptodate(bh);
if (bh_submit_read(bh) < 0) { if (bh_submit_read(bh) < 0) {
put_bh(bh); put_bh(bh);
ext4_error(sb, __func__, ext4_error(sb, "Cannot read inode bitmap - "
"Cannot read inode bitmap - "
"block_group = %u, inode_bitmap = %llu", "block_group = %u, inode_bitmap = %llu",
block_group, bitmap_blk); block_group, bitmap_blk);
return NULL; return NULL;
...@@ -229,8 +226,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) ...@@ -229,8 +226,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
es = EXT4_SB(sb)->s_es; es = EXT4_SB(sb)->s_es;
if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
ext4_error(sb, "ext4_free_inode", ext4_error(sb, "reserved or nonexistent inode %lu", ino);
"reserved or nonexistent inode %lu", ino);
goto error_return; goto error_return;
} }
block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
...@@ -248,8 +244,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) ...@@ -248,8 +244,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
cleared = ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group), cleared = ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group),
bit, bitmap_bh->b_data); bit, bitmap_bh->b_data);
if (!cleared) if (!cleared)
ext4_error(sb, "ext4_free_inode", ext4_error(sb, "bit already cleared for inode %lu", ino);
"bit already cleared for inode %lu", ino);
else { else {
gdp = ext4_get_group_desc(sb, block_group, &bh2); gdp = ext4_get_group_desc(sb, block_group, &bh2);
...@@ -736,8 +731,7 @@ static int ext4_claim_inode(struct super_block *sb, ...@@ -736,8 +731,7 @@ static int ext4_claim_inode(struct super_block *sb,
if ((group == 0 && ino < EXT4_FIRST_INO(sb)) || if ((group == 0 && ino < EXT4_FIRST_INO(sb)) ||
ino > EXT4_INODES_PER_GROUP(sb)) { ino > EXT4_INODES_PER_GROUP(sb)) {
ext4_unlock_group(sb, group); ext4_unlock_group(sb, group);
ext4_error(sb, __func__, ext4_error(sb, "reserved inode or inode > inodes count - "
"reserved inode or inode > inodes count - "
"block_group = %u, inode=%lu", group, "block_group = %u, inode=%lu", group,
ino + group * EXT4_INODES_PER_GROUP(sb)); ino + group * EXT4_INODES_PER_GROUP(sb));
return 1; return 1;
...@@ -1099,8 +1093,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) ...@@ -1099,8 +1093,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
/* Error cases - e2fsck has already cleaned up for us */ /* Error cases - e2fsck has already cleaned up for us */
if (ino > max_ino) { if (ino > max_ino) {
ext4_warning(sb, __func__, ext4_warning(sb, "bad orphan ino %lu! e2fsck was run?", ino);
"bad orphan ino %lu! e2fsck was run?", ino);
goto error; goto error;
} }
...@@ -1108,8 +1101,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) ...@@ -1108,8 +1101,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb); bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
bitmap_bh = ext4_read_inode_bitmap(sb, block_group); bitmap_bh = ext4_read_inode_bitmap(sb, block_group);
if (!bitmap_bh) { if (!bitmap_bh) {
ext4_warning(sb, __func__, ext4_warning(sb, "inode bitmap error for orphan %lu", ino);
"inode bitmap error for orphan %lu", ino);
goto error; goto error;
} }
...@@ -1141,8 +1133,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) ...@@ -1141,8 +1133,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
err = PTR_ERR(inode); err = PTR_ERR(inode);
inode = NULL; inode = NULL;
bad_orphan: bad_orphan:
ext4_warning(sb, __func__, ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino);
"bad orphan inode %lu! e2fsck was run?", ino);
printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n", printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n",
bit, (unsigned long long)bitmap_bh->b_blocknr, bit, (unsigned long long)bitmap_bh->b_blocknr,
ext4_test_bit(bit, bitmap_bh->b_data)); ext4_test_bit(bit, bitmap_bh->b_data));
......
...@@ -194,7 +194,7 @@ void ext4_delete_inode(struct inode *inode) ...@@ -194,7 +194,7 @@ void ext4_delete_inode(struct inode *inode)
inode->i_size = 0; inode->i_size = 0;
err = ext4_mark_inode_dirty(handle, inode); err = ext4_mark_inode_dirty(handle, inode);
if (err) { if (err) {
ext4_warning(inode->i_sb, __func__, ext4_warning(inode->i_sb,
"couldn't mark inode dirty (err %d)", err); "couldn't mark inode dirty (err %d)", err);
goto stop_handle; goto stop_handle;
} }
...@@ -212,7 +212,7 @@ void ext4_delete_inode(struct inode *inode) ...@@ -212,7 +212,7 @@ void ext4_delete_inode(struct inode *inode)
if (err > 0) if (err > 0)
err = ext4_journal_restart(handle, 3); err = ext4_journal_restart(handle, 3);
if (err != 0) { if (err != 0) {
ext4_warning(inode->i_sb, __func__, ext4_warning(inode->i_sb,
"couldn't extend journal (err %d)", err); "couldn't extend journal (err %d)", err);
stop_handle: stop_handle:
ext4_journal_stop(handle); ext4_journal_stop(handle);
...@@ -323,8 +323,7 @@ static int ext4_block_to_path(struct inode *inode, ...@@ -323,8 +323,7 @@ static int ext4_block_to_path(struct inode *inode,
offsets[n++] = i_block & (ptrs - 1); offsets[n++] = i_block & (ptrs - 1);
final = ptrs; final = ptrs;
} else { } else {
ext4_warning(inode->i_sb, "ext4_block_to_path", ext4_warning(inode->i_sb, "block %lu > max in inode %lu",
"block %lu > max in inode %lu",
i_block + direct_blocks + i_block + direct_blocks +
indirect_blocks + double_blocks, inode->i_ino); indirect_blocks + double_blocks, inode->i_ino);
} }
...@@ -344,7 +343,7 @@ static int __ext4_check_blockref(const char *function, struct inode *inode, ...@@ -344,7 +343,7 @@ static int __ext4_check_blockref(const char *function, struct inode *inode,
if (blk && if (blk &&
unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb),
blk, 1))) { blk, 1))) {
ext4_error(inode->i_sb, function, __ext4_error(inode->i_sb, function,
"invalid block reference %u " "invalid block reference %u "
"in inode #%lu", blk, inode->i_ino); "in inode #%lu", blk, inode->i_ino);
return -EIO; return -EIO;
...@@ -1125,7 +1124,7 @@ static int check_block_validity(struct inode *inode, const char *msg, ...@@ -1125,7 +1124,7 @@ static int check_block_validity(struct inode *inode, const char *msg,
sector_t logical, sector_t phys, int len) sector_t logical, sector_t phys, int len)
{ {
if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) { if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) {
ext4_error(inode->i_sb, msg, __ext4_error(inode->i_sb, msg,
"inode #%lu logical block %llu mapped to %llu " "inode #%lu logical block %llu mapped to %llu "
"(size %d)", inode->i_ino, "(size %d)", inode->i_ino,
(unsigned long long) logical, (unsigned long long) logical,
...@@ -4147,7 +4146,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, ...@@ -4147,7 +4146,7 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode,
if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free, if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free,
count)) { count)) {
ext4_error(inode->i_sb, __func__, "inode #%lu: " ext4_error(inode->i_sb, "inode #%lu: "
"attempt to clear blocks %llu len %lu, invalid", "attempt to clear blocks %llu len %lu, invalid",
inode->i_ino, (unsigned long long) block_to_free, inode->i_ino, (unsigned long long) block_to_free,
count); count);
...@@ -4255,7 +4254,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode, ...@@ -4255,7 +4254,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh)) if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
ext4_handle_dirty_metadata(handle, inode, this_bh); ext4_handle_dirty_metadata(handle, inode, this_bh);
else else
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"circular indirect block detected, " "circular indirect block detected, "
"inode=%lu, block=%llu", "inode=%lu, block=%llu",
inode->i_ino, inode->i_ino,
...@@ -4297,7 +4296,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, ...@@ -4297,7 +4296,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), if (!ext4_data_block_valid(EXT4_SB(inode->i_sb),
nr, 1)) { nr, 1)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"indirect mapped block in inode " "indirect mapped block in inode "
"#%lu invalid (level %d, blk #%lu)", "#%lu invalid (level %d, blk #%lu)",
inode->i_ino, depth, inode->i_ino, depth,
...@@ -4313,7 +4312,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, ...@@ -4313,7 +4312,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
* (should be rare). * (should be rare).
*/ */
if (!bh) { if (!bh) {
ext4_error(inode->i_sb, "ext4_free_branches", ext4_error(inode->i_sb,
"Read failure, inode=%lu, block=%llu", "Read failure, inode=%lu, block=%llu",
inode->i_ino, nr); inode->i_ino, nr);
continue; continue;
...@@ -4628,9 +4627,8 @@ static int __ext4_get_inode_loc(struct inode *inode, ...@@ -4628,9 +4627,8 @@ static int __ext4_get_inode_loc(struct inode *inode,
bh = sb_getblk(sb, block); bh = sb_getblk(sb, block);
if (!bh) { if (!bh) {
ext4_error(sb, "ext4_get_inode_loc", "unable to read " ext4_error(sb, "unable to read inode block - "
"inode block - inode=%lu, block=%llu", "inode=%lu, block=%llu", inode->i_ino, block);
inode->i_ino, block);
return -EIO; return -EIO;
} }
if (!buffer_uptodate(bh)) { if (!buffer_uptodate(bh)) {
...@@ -4728,9 +4726,8 @@ static int __ext4_get_inode_loc(struct inode *inode, ...@@ -4728,9 +4726,8 @@ static int __ext4_get_inode_loc(struct inode *inode,
submit_bh(READ_META, bh); submit_bh(READ_META, bh);
wait_on_buffer(bh); wait_on_buffer(bh);
if (!buffer_uptodate(bh)) { if (!buffer_uptodate(bh)) {
ext4_error(sb, __func__, ext4_error(sb, "unable to read inode block - inode=%lu,"
"unable to read inode block - inode=%lu, " " block=%llu", inode->i_ino, block);
"block=%llu", inode->i_ino, block);
brelse(bh); brelse(bh);
return -EIO; return -EIO;
} }
...@@ -4941,8 +4938,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ...@@ -4941,8 +4938,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
ret = 0; ret = 0;
if (ei->i_file_acl && if (ei->i_file_acl &&
!ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
ext4_error(sb, __func__, ext4_error(sb, "bad extended attribute block %llu inode #%lu",
"bad extended attribute block %llu in inode #%lu",
ei->i_file_acl, inode->i_ino); ei->i_file_acl, inode->i_ino);
ret = -EIO; ret = -EIO;
goto bad_inode; goto bad_inode;
...@@ -4988,8 +4984,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ...@@ -4988,8 +4984,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); new_decode_dev(le32_to_cpu(raw_inode->i_block[1])));
} else { } else {
ret = -EIO; ret = -EIO;
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "bogus i_mode (%o) for inode=%lu",
"bogus i_mode (%o) for inode=%lu",
inode->i_mode, inode->i_ino); inode->i_mode, inode->i_ino);
goto bad_inode; goto bad_inode;
} }
...@@ -5228,10 +5223,8 @@ int ext4_write_inode(struct inode *inode, int wait) ...@@ -5228,10 +5223,8 @@ int ext4_write_inode(struct inode *inode, int wait)
if (wait) if (wait)
sync_dirty_buffer(iloc.bh); sync_dirty_buffer(iloc.bh);
if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "IO error syncing inode, "
"IO error syncing inode, " "inode=%lu, block=%llu", inode->i_ino,
"inode=%lu, block=%llu",
inode->i_ino,
(unsigned long long)iloc.bh->b_blocknr); (unsigned long long)iloc.bh->b_blocknr);
err = -EIO; err = -EIO;
} }
...@@ -5644,7 +5637,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) ...@@ -5644,7 +5637,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
EXT4_STATE_NO_EXPAND); EXT4_STATE_NO_EXPAND);
if (mnt_count != if (mnt_count !=
le16_to_cpu(sbi->s_es->s_mnt_count)) { le16_to_cpu(sbi->s_es->s_mnt_count)) {
ext4_warning(inode->i_sb, __func__, ext4_warning(inode->i_sb,
"Unable to expand inode %lu. Delete" "Unable to expand inode %lu. Delete"
" some EAs or run e2fsck.", " some EAs or run e2fsck.",
inode->i_ino); inode->i_ino);
......
...@@ -2709,8 +2709,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, ...@@ -2709,8 +2709,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
len = ac->ac_b_ex.fe_len; len = ac->ac_b_ex.fe_len;
if (!ext4_data_block_valid(sbi, block, len)) { if (!ext4_data_block_valid(sbi, block, len)) {
ext4_error(sb, __func__, ext4_error(sb, "Allocating blocks %llu-%llu which overlap "
"Allocating blocks %llu-%llu which overlap "
"fs metadata\n", block, block+len); "fs metadata\n", block, block+len);
/* File system mounted not to panic on error /* File system mounted not to panic on error
* Fix the bitmap and repeat the block allocation * Fix the bitmap and repeat the block allocation
...@@ -3623,15 +3622,13 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, ...@@ -3623,15 +3622,13 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
bitmap_bh = ext4_read_block_bitmap(sb, group); bitmap_bh = ext4_read_block_bitmap(sb, group);
if (bitmap_bh == NULL) { if (bitmap_bh == NULL) {
ext4_error(sb, __func__, "Error in reading block " ext4_error(sb, "Error reading block bitmap for %u", group);
"bitmap for %u", group);
return 0; return 0;
} }
err = ext4_mb_load_buddy(sb, group, &e4b); err = ext4_mb_load_buddy(sb, group, &e4b);
if (err) { if (err) {
ext4_error(sb, __func__, "Error in loading buddy " ext4_error(sb, "Error loading buddy information for %u", group);
"information for %u", group);
put_bh(bitmap_bh); put_bh(bitmap_bh);
return 0; return 0;
} }
...@@ -3804,15 +3801,15 @@ void ext4_discard_preallocations(struct inode *inode) ...@@ -3804,15 +3801,15 @@ void ext4_discard_preallocations(struct inode *inode)
err = ext4_mb_load_buddy(sb, group, &e4b); err = ext4_mb_load_buddy(sb, group, &e4b);
if (err) { if (err) {
ext4_error(sb, __func__, "Error in loading buddy " ext4_error(sb, "Error loading buddy information for %u",
"information for %u", group); group);
continue; continue;
} }
bitmap_bh = ext4_read_block_bitmap(sb, group); bitmap_bh = ext4_read_block_bitmap(sb, group);
if (bitmap_bh == NULL) { if (bitmap_bh == NULL) {
ext4_error(sb, __func__, "Error in reading block " ext4_error(sb, "Error reading block bitmap for %u",
"bitmap for %u", group); group);
ext4_mb_release_desc(&e4b); ext4_mb_release_desc(&e4b);
continue; continue;
} }
...@@ -4077,8 +4074,8 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb, ...@@ -4077,8 +4074,8 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL); ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL);
if (ext4_mb_load_buddy(sb, group, &e4b)) { if (ext4_mb_load_buddy(sb, group, &e4b)) {
ext4_error(sb, __func__, "Error in loading buddy " ext4_error(sb, "Error loading buddy information for %u",
"information for %u", group); group);
continue; continue;
} }
ext4_lock_group(sb, group); ext4_lock_group(sb, group);
...@@ -4478,8 +4475,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, ...@@ -4478,8 +4475,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
es = EXT4_SB(sb)->s_es; es = EXT4_SB(sb)->s_es;
if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) && if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
!ext4_data_block_valid(sbi, block, count)) { !ext4_data_block_valid(sbi, block, count)) {
ext4_error(sb, __func__, ext4_error(sb, "Freeing blocks not in datazone - "
"Freeing blocks not in datazone - "
"block = %llu, count = %lu", block, count); "block = %llu, count = %lu", block, count);
goto error_return; goto error_return;
} }
...@@ -4548,8 +4544,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, ...@@ -4548,8 +4544,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
in_range(block + count - 1, ext4_inode_table(sb, gdp), in_range(block + count - 1, ext4_inode_table(sb, gdp),
EXT4_SB(sb)->s_itb_per_group)) { EXT4_SB(sb)->s_itb_per_group)) {
ext4_error(sb, __func__, ext4_error(sb, "Freeing blocks in system zone - "
"Freeing blocks in system zone - "
"Block = %llu, count = %lu", block, count); "Block = %llu, count = %lu", block, count);
/* err = 0. ext4_std_error should be a no op */ /* err = 0. ext4_std_error should be a no op */
goto error_return; goto error_return;
......
...@@ -152,12 +152,12 @@ mext_check_null_inode(struct inode *inode1, struct inode *inode2, ...@@ -152,12 +152,12 @@ mext_check_null_inode(struct inode *inode1, struct inode *inode2,
int ret = 0; int ret = 0;
if (inode1 == NULL) { if (inode1 == NULL) {
ext4_error(inode2->i_sb, function, __ext4_error(inode2->i_sb, function,
"Both inodes should not be NULL: " "Both inodes should not be NULL: "
"inode1 NULL inode2 %lu", inode2->i_ino); "inode1 NULL inode2 %lu", inode2->i_ino);
ret = -EIO; ret = -EIO;
} else if (inode2 == NULL) { } else if (inode2 == NULL) {
ext4_error(inode1->i_sb, function, __ext4_error(inode1->i_sb, function,
"Both inodes should not be NULL: " "Both inodes should not be NULL: "
"inode1 %lu inode2 NULL", inode1->i_ino); "inode1 %lu inode2 NULL", inode1->i_ino);
ret = -EIO; ret = -EIO;
...@@ -526,7 +526,7 @@ mext_leaf_block(handle_t *handle, struct inode *orig_inode, ...@@ -526,7 +526,7 @@ mext_leaf_block(handle_t *handle, struct inode *orig_inode,
* new_ext |-------| * new_ext |-------|
*/ */
if (le32_to_cpu(oext->ee_block) + oext_alen - 1 < new_ext_end) { if (le32_to_cpu(oext->ee_block) + oext_alen - 1 < new_ext_end) {
ext4_error(orig_inode->i_sb, __func__, ext4_error(orig_inode->i_sb,
"new_ext_end(%u) should be less than or equal to " "new_ext_end(%u) should be less than or equal to "
"oext->ee_block(%u) + oext_alen(%d) - 1", "oext->ee_block(%u) + oext_alen(%d) - 1",
new_ext_end, le32_to_cpu(oext->ee_block), new_ext_end, le32_to_cpu(oext->ee_block),
...@@ -689,12 +689,12 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, ...@@ -689,12 +689,12 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
while (1) { while (1) {
/* The extent for donor must be found. */ /* The extent for donor must be found. */
if (!dext) { if (!dext) {
ext4_error(donor_inode->i_sb, __func__, ext4_error(donor_inode->i_sb,
"The extent for donor must be found"); "The extent for donor must be found");
*err = -EIO; *err = -EIO;
goto out; goto out;
} else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) { } else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) {
ext4_error(donor_inode->i_sb, __func__, ext4_error(donor_inode->i_sb,
"Donor offset(%u) and the first block of donor " "Donor offset(%u) and the first block of donor "
"extent(%u) should be equal", "extent(%u) should be equal",
donor_off, donor_off,
...@@ -1351,7 +1351,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, ...@@ -1351,7 +1351,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
if (ret1 < 0) if (ret1 < 0)
break; break;
if (*moved_len > len) { if (*moved_len > len) {
ext4_error(orig_inode->i_sb, __func__, ext4_error(orig_inode->i_sb,
"We replaced blocks too much! " "We replaced blocks too much! "
"sum of replaced: %llu requested: %llu", "sum of replaced: %llu requested: %llu",
*moved_len, len); *moved_len, len);
......
...@@ -383,8 +383,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -383,8 +383,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
if (root->info.hash_version != DX_HASH_TEA && if (root->info.hash_version != DX_HASH_TEA &&
root->info.hash_version != DX_HASH_HALF_MD4 && root->info.hash_version != DX_HASH_HALF_MD4 &&
root->info.hash_version != DX_HASH_LEGACY) { root->info.hash_version != DX_HASH_LEGACY) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb, "Unrecognised inode hash code %d",
"Unrecognised inode hash code %d",
root->info.hash_version); root->info.hash_version);
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
...@@ -399,8 +398,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -399,8 +398,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
hash = hinfo->hash; hash = hinfo->hash;
if (root->info.unused_flags & 1) { if (root->info.unused_flags & 1) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb, "Unimplemented inode hash flags: %#06x",
"Unimplemented inode hash flags: %#06x",
root->info.unused_flags); root->info.unused_flags);
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
...@@ -408,8 +406,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -408,8 +406,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
} }
if ((indirect = root->info.indirect_levels) > 1) { if ((indirect = root->info.indirect_levels) > 1) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
"Unimplemented inode hash depth: %#06x",
root->info.indirect_levels); root->info.indirect_levels);
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
...@@ -421,8 +418,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -421,8 +418,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
if (dx_get_limit(entries) != dx_root_limit(dir, if (dx_get_limit(entries) != dx_root_limit(dir,
root->info.info_length)) { root->info.info_length)) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb, "dx entry: limit != root limit");
"dx entry: limit != root limit");
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
goto fail; goto fail;
...@@ -433,7 +429,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -433,7 +429,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
{ {
count = dx_get_count(entries); count = dx_get_count(entries);
if (!count || count > dx_get_limit(entries)) { if (!count || count > dx_get_limit(entries)) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb,
"dx entry: no count or count > limit"); "dx entry: no count or count > limit");
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
...@@ -478,7 +474,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -478,7 +474,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
goto fail2; goto fail2;
at = entries = ((struct dx_node *) bh->b_data)->entries; at = entries = ((struct dx_node *) bh->b_data)->entries;
if (dx_get_limit(entries) != dx_node_limit (dir)) { if (dx_get_limit(entries) != dx_node_limit (dir)) {
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb,
"dx entry: limit != node limit"); "dx entry: limit != node limit");
brelse(bh); brelse(bh);
*err = ERR_BAD_DX_DIR; *err = ERR_BAD_DX_DIR;
...@@ -494,7 +490,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ...@@ -494,7 +490,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
} }
fail: fail:
if (*err == ERR_BAD_DX_DIR) if (*err == ERR_BAD_DX_DIR)
ext4_warning(dir->i_sb, __func__, ext4_warning(dir->i_sb,
"Corrupt dir inode %ld, running e2fsck is " "Corrupt dir inode %ld, running e2fsck is "
"recommended.", dir->i_ino); "recommended.", dir->i_ino);
return NULL; return NULL;
...@@ -947,9 +943,8 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, ...@@ -947,9 +943,8 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
wait_on_buffer(bh); wait_on_buffer(bh);
if (!buffer_uptodate(bh)) { if (!buffer_uptodate(bh)) {
/* read error, skip block & hope for the best */ /* read error, skip block & hope for the best */
ext4_error(sb, __func__, "reading directory #%lu " ext4_error(sb, "reading directory #%lu offset %lu",
"offset %lu", dir->i_ino, dir->i_ino, (unsigned long)block);
(unsigned long)block);
brelse(bh); brelse(bh);
goto next; goto next;
} }
...@@ -1041,7 +1036,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q ...@@ -1041,7 +1036,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct q
retval = ext4_htree_next_block(dir, hash, frame, retval = ext4_htree_next_block(dir, hash, frame,
frames, NULL); frames, NULL);
if (retval < 0) { if (retval < 0) {
ext4_warning(sb, __func__, ext4_warning(sb,
"error reading index page in directory #%lu", "error reading index page in directory #%lu",
dir->i_ino); dir->i_ino);
*err = retval; *err = retval;
...@@ -1071,14 +1066,13 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru ...@@ -1071,14 +1066,13 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
__u32 ino = le32_to_cpu(de->inode); __u32 ino = le32_to_cpu(de->inode);
brelse(bh); brelse(bh);
if (!ext4_valid_inum(dir->i_sb, ino)) { if (!ext4_valid_inum(dir->i_sb, ino)) {
ext4_error(dir->i_sb, "ext4_lookup", ext4_error(dir->i_sb, "bad inode number: %u", ino);
"bad inode number: %u", ino);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
inode = ext4_iget(dir->i_sb, ino); inode = ext4_iget(dir->i_sb, ino);
if (unlikely(IS_ERR(inode))) { if (unlikely(IS_ERR(inode))) {
if (PTR_ERR(inode) == -ESTALE) { if (PTR_ERR(inode) == -ESTALE) {
ext4_error(dir->i_sb, __func__, ext4_error(dir->i_sb,
"deleted inode referenced: %u", "deleted inode referenced: %u",
ino); ino);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
...@@ -1110,7 +1104,7 @@ struct dentry *ext4_get_parent(struct dentry *child) ...@@ -1110,7 +1104,7 @@ struct dentry *ext4_get_parent(struct dentry *child)
brelse(bh); brelse(bh);
if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { if (!ext4_valid_inum(child->d_inode->i_sb, ino)) {
ext4_error(child->d_inode->i_sb, "ext4_get_parent", ext4_error(child->d_inode->i_sb,
"bad inode number: %u", ino); "bad inode number: %u", ino);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
...@@ -1410,7 +1404,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, ...@@ -1410,7 +1404,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
de = (struct ext4_dir_entry_2 *)((char *)fde + de = (struct ext4_dir_entry_2 *)((char *)fde +
ext4_rec_len_from_disk(fde->rec_len, blocksize)); ext4_rec_len_from_disk(fde->rec_len, blocksize));
if ((char *) de >= (((char *) root) + blocksize)) { if ((char *) de >= (((char *) root) + blocksize)) {
ext4_error(dir->i_sb, __func__, ext4_error(dir->i_sb,
"invalid rec_len for '..' in inode %lu", "invalid rec_len for '..' in inode %lu",
dir->i_ino); dir->i_ino);
brelse(bh); brelse(bh);
...@@ -1575,8 +1569,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry, ...@@ -1575,8 +1569,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
if (levels && (dx_get_count(frames->entries) == if (levels && (dx_get_count(frames->entries) ==
dx_get_limit(frames->entries))) { dx_get_limit(frames->entries))) {
ext4_warning(sb, __func__, ext4_warning(sb, "Directory index full!");
"Directory index full!");
err = -ENOSPC; err = -ENOSPC;
goto cleanup; goto cleanup;
} }
...@@ -1916,11 +1909,11 @@ static int empty_dir(struct inode *inode) ...@@ -1916,11 +1909,11 @@ static int empty_dir(struct inode *inode)
if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) || if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) ||
!(bh = ext4_bread(NULL, inode, 0, 0, &err))) { !(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
if (err) if (err)
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"error %d reading directory #%lu offset 0", "error %d reading directory #%lu offset 0",
err, inode->i_ino); err, inode->i_ino);
else else
ext4_warning(inode->i_sb, __func__, ext4_warning(inode->i_sb,
"bad directory (dir #%lu) - no data block", "bad directory (dir #%lu) - no data block",
inode->i_ino); inode->i_ino);
return 1; return 1;
...@@ -1931,7 +1924,7 @@ static int empty_dir(struct inode *inode) ...@@ -1931,7 +1924,7 @@ static int empty_dir(struct inode *inode)
!le32_to_cpu(de1->inode) || !le32_to_cpu(de1->inode) ||
strcmp(".", de->name) || strcmp(".", de->name) ||
strcmp("..", de1->name)) { strcmp("..", de1->name)) {
ext4_warning(inode->i_sb, "empty_dir", ext4_warning(inode->i_sb,
"bad directory (dir #%lu) - no `.' or `..'", "bad directory (dir #%lu) - no `.' or `..'",
inode->i_ino); inode->i_ino);
brelse(bh); brelse(bh);
...@@ -1949,7 +1942,7 @@ static int empty_dir(struct inode *inode) ...@@ -1949,7 +1942,7 @@ static int empty_dir(struct inode *inode)
offset >> EXT4_BLOCK_SIZE_BITS(sb), 0, &err); offset >> EXT4_BLOCK_SIZE_BITS(sb), 0, &err);
if (!bh) { if (!bh) {
if (err) if (err)
ext4_error(sb, __func__, ext4_error(sb,
"error %d reading directory" "error %d reading directory"
" #%lu offset %u", " #%lu offset %u",
err, inode->i_ino, offset); err, inode->i_ino, offset);
...@@ -2163,7 +2156,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -2163,7 +2156,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
if (retval) if (retval)
goto end_rmdir; goto end_rmdir;
if (!EXT4_DIR_LINK_EMPTY(inode)) if (!EXT4_DIR_LINK_EMPTY(inode))
ext4_warning(inode->i_sb, "ext4_rmdir", ext4_warning(inode->i_sb,
"empty directory has too many links (%d)", "empty directory has too many links (%d)",
inode->i_nlink); inode->i_nlink);
inode->i_version++; inode->i_version++;
...@@ -2215,7 +2208,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) ...@@ -2215,7 +2208,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
goto end_unlink; goto end_unlink;
if (!inode->i_nlink) { if (!inode->i_nlink) {
ext4_warning(inode->i_sb, "ext4_unlink", ext4_warning(inode->i_sb,
"Deleting nonexistent file (%lu), %d", "Deleting nonexistent file (%lu), %d",
inode->i_ino, inode->i_nlink); inode->i_ino, inode->i_nlink);
inode->i_nlink = 1; inode->i_nlink = 1;
...@@ -2462,7 +2455,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -2462,7 +2455,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
} }
} }
if (retval) { if (retval) {
ext4_warning(old_dir->i_sb, "ext4_rename", ext4_warning(old_dir->i_sb,
"Deleting old file (%lu), %d, error=%d", "Deleting old file (%lu), %d, error=%d",
old_dir->i_ino, old_dir->i_nlink, retval); old_dir->i_ino, old_dir->i_nlink, retval);
} }
......
This diff is collapsed.
...@@ -333,7 +333,7 @@ static void ext4_handle_error(struct super_block *sb) ...@@ -333,7 +333,7 @@ static void ext4_handle_error(struct super_block *sb)
sb->s_id); sb->s_id);
} }
void ext4_error(struct super_block *sb, const char *function, void __ext4_error(struct super_block *sb, const char *function,
const char *fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -450,7 +450,7 @@ void ext4_msg (struct super_block * sb, const char *prefix, ...@@ -450,7 +450,7 @@ void ext4_msg (struct super_block * sb, const char *prefix,
va_end(args); va_end(args);
} }
void ext4_warning(struct super_block *sb, const char *function, void __ext4_warning(struct super_block *sb, const char *function,
const char *fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -507,7 +507,7 @@ void ext4_update_dynamic_rev(struct super_block *sb) ...@@ -507,7 +507,7 @@ void ext4_update_dynamic_rev(struct super_block *sb)
if (le32_to_cpu(es->s_rev_level) > EXT4_GOOD_OLD_REV) if (le32_to_cpu(es->s_rev_level) > EXT4_GOOD_OLD_REV)
return; return;
ext4_warning(sb, __func__, ext4_warning(sb,
"updating to rev %d because of new feature flag, " "updating to rev %d because of new feature flag, "
"running e2fsck is recommended", "running e2fsck is recommended",
EXT4_DYNAMIC_REV); EXT4_DYNAMIC_REV);
...@@ -3367,10 +3367,9 @@ static void ext4_clear_journal_err(struct super_block *sb, ...@@ -3367,10 +3367,9 @@ static void ext4_clear_journal_err(struct super_block *sb,
char nbuf[16]; char nbuf[16];
errstr = ext4_decode_error(sb, j_errno, nbuf); errstr = ext4_decode_error(sb, j_errno, nbuf);
ext4_warning(sb, __func__, "Filesystem error recorded " ext4_warning(sb, "Filesystem error recorded "
"from previous mount: %s", errstr); "from previous mount: %s", errstr);
ext4_warning(sb, __func__, "Marking fs in need of " ext4_warning(sb, "Marking fs in need of filesystem check.");
"filesystem check.");
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS); es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
......
...@@ -227,7 +227,8 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name, ...@@ -227,7 +227,8 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
ea_bdebug(bh, "b_count=%d, refcount=%d", ea_bdebug(bh, "b_count=%d, refcount=%d",
atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
if (ext4_xattr_check_block(bh)) { if (ext4_xattr_check_block(bh)) {
bad_block: ext4_error(inode->i_sb, __func__, bad_block:
ext4_error(inode->i_sb,
"inode %lu: bad block %llu", inode->i_ino, "inode %lu: bad block %llu", inode->i_ino,
EXT4_I(inode)->i_file_acl); EXT4_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
...@@ -371,7 +372,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) ...@@ -371,7 +372,7 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
ea_bdebug(bh, "b_count=%d, refcount=%d", ea_bdebug(bh, "b_count=%d, refcount=%d",
atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
if (ext4_xattr_check_block(bh)) { if (ext4_xattr_check_block(bh)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"inode %lu: bad block %llu", inode->i_ino, "inode %lu: bad block %llu", inode->i_ino,
EXT4_I(inode)->i_file_acl); EXT4_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
...@@ -665,9 +666,8 @@ ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i, ...@@ -665,9 +666,8 @@ ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i,
atomic_read(&(bs->bh->b_count)), atomic_read(&(bs->bh->b_count)),
le32_to_cpu(BHDR(bs->bh)->h_refcount)); le32_to_cpu(BHDR(bs->bh)->h_refcount));
if (ext4_xattr_check_block(bs->bh)) { if (ext4_xattr_check_block(bs->bh)) {
ext4_error(sb, __func__, ext4_error(sb, "inode %lu: bad block %llu",
"inode %lu: bad block %llu", inode->i_ino, inode->i_ino, EXT4_I(inode)->i_file_acl);
EXT4_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;
} }
...@@ -880,9 +880,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -880,9 +880,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
goto cleanup; goto cleanup;
bad_block: bad_block:
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "inode %lu: bad block %llu",
"inode %lu: bad block %llu", inode->i_ino, inode->i_ino, EXT4_I(inode)->i_file_acl);
EXT4_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
#undef header #undef header
...@@ -1195,9 +1194,8 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, ...@@ -1195,9 +1194,8 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
if (!bh) if (!bh)
goto cleanup; goto cleanup;
if (ext4_xattr_check_block(bh)) { if (ext4_xattr_check_block(bh)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "inode %lu: bad block %llu",
"inode %lu: bad block %llu", inode->i_ino, inode->i_ino, EXT4_I(inode)->i_file_acl);
EXT4_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;
} }
...@@ -1372,16 +1370,14 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) ...@@ -1372,16 +1370,14 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
goto cleanup; goto cleanup;
bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
if (!bh) { if (!bh) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "inode %lu: block %llu read error",
"inode %lu: block %llu read error", inode->i_ino, inode->i_ino, EXT4_I(inode)->i_file_acl);
EXT4_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
} }
if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) ||
BHDR(bh)->h_blocks != cpu_to_le32(1)) { BHDR(bh)->h_blocks != cpu_to_le32(1)) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb, "inode %lu: bad block %llu",
"inode %lu: bad block %llu", inode->i_ino, inode->i_ino, EXT4_I(inode)->i_file_acl);
EXT4_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
} }
ext4_xattr_release_block(handle, inode, bh); ext4_xattr_release_block(handle, inode, bh);
...@@ -1506,7 +1502,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header, ...@@ -1506,7 +1502,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
} }
bh = sb_bread(inode->i_sb, ce->e_block); bh = sb_bread(inode->i_sb, ce->e_block);
if (!bh) { if (!bh) {
ext4_error(inode->i_sb, __func__, ext4_error(inode->i_sb,
"inode %lu: block %lu read error", "inode %lu: block %lu read error",
inode->i_ino, (unsigned long) ce->e_block); inode->i_ino, (unsigned long) ce->e_block);
} else if (le32_to_cpu(BHDR(bh)->h_refcount) >= } else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
......
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