Commit 7ecef14a authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

ocfs2: neaten do_error, ocfs2_error and ocfs2_abort

These uses sometimes do and sometimes don't have '\n' terminations.  Make
the uses consistently use '\n' terminations and remove the newline from
the functions.

Miscellanea:

o Coalesce formats
o Realign arguments
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarMark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d0c97d52
This diff is collapsed.
...@@ -227,7 +227,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page, ...@@ -227,7 +227,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) { if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) {
ocfs2_error(inode->i_sb, "Inode %llu lost inline data flag", ocfs2_error(inode->i_sb, "Inode %llu lost inline data flag\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno); (unsigned long long)OCFS2_I(inode)->ip_blkno);
return -EROFS; return -EROFS;
} }
...@@ -237,7 +237,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page, ...@@ -237,7 +237,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
if (size > PAGE_CACHE_SIZE || if (size > PAGE_CACHE_SIZE ||
size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) { size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Inode %llu has with inline data has bad size: %Lu", "Inode %llu has with inline data has bad size: %Lu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno, (unsigned long long)OCFS2_I(inode)->ip_blkno,
(unsigned long long)size); (unsigned long long)size);
return -EROFS; return -EROFS;
......
...@@ -481,16 +481,14 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh) ...@@ -481,16 +481,14 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh)
trailer = ocfs2_trailer_from_bh(bh, dir->i_sb); trailer = ocfs2_trailer_from_bh(bh, dir->i_sb);
if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) { if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) {
rc = ocfs2_error(dir->i_sb, rc = ocfs2_error(dir->i_sb,
"Invalid dirblock #%llu: " "Invalid dirblock #%llu: signature = %.*s\n",
"signature = %.*s\n",
(unsigned long long)bh->b_blocknr, 7, (unsigned long long)bh->b_blocknr, 7,
trailer->db_signature); trailer->db_signature);
goto out; goto out;
} }
if (le64_to_cpu(trailer->db_blkno) != bh->b_blocknr) { if (le64_to_cpu(trailer->db_blkno) != bh->b_blocknr) {
rc = ocfs2_error(dir->i_sb, rc = ocfs2_error(dir->i_sb,
"Directory block #%llu has an invalid " "Directory block #%llu has an invalid db_blkno of %llu\n",
"db_blkno of %llu",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)le64_to_cpu(trailer->db_blkno)); (unsigned long long)le64_to_cpu(trailer->db_blkno));
goto out; goto out;
...@@ -498,9 +496,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh) ...@@ -498,9 +496,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh)
if (le64_to_cpu(trailer->db_parent_dinode) != if (le64_to_cpu(trailer->db_parent_dinode) !=
OCFS2_I(dir)->ip_blkno) { OCFS2_I(dir)->ip_blkno) {
rc = ocfs2_error(dir->i_sb, rc = ocfs2_error(dir->i_sb,
"Directory block #%llu on dinode " "Directory block #%llu on dinode #%llu has an invalid parent_dinode of %llu\n",
"#%llu has an invalid parent_dinode "
"of %llu",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)OCFS2_I(dir)->ip_blkno, (unsigned long long)OCFS2_I(dir)->ip_blkno,
(unsigned long long)le64_to_cpu(trailer->db_blkno)); (unsigned long long)le64_to_cpu(trailer->db_blkno));
...@@ -602,7 +598,7 @@ static int ocfs2_validate_dx_root(struct super_block *sb, ...@@ -602,7 +598,7 @@ static int ocfs2_validate_dx_root(struct super_block *sb,
if (!OCFS2_IS_VALID_DX_ROOT(dx_root)) { if (!OCFS2_IS_VALID_DX_ROOT(dx_root)) {
ret = ocfs2_error(sb, ret = ocfs2_error(sb,
"Dir Index Root # %llu has bad signature %.*s", "Dir Index Root # %llu has bad signature %.*s\n",
(unsigned long long)le64_to_cpu(dx_root->dr_blkno), (unsigned long long)le64_to_cpu(dx_root->dr_blkno),
7, dx_root->dr_signature); 7, dx_root->dr_signature);
} }
...@@ -644,7 +640,7 @@ static int ocfs2_validate_dx_leaf(struct super_block *sb, ...@@ -644,7 +640,7 @@ static int ocfs2_validate_dx_leaf(struct super_block *sb,
} }
if (!OCFS2_IS_VALID_DX_LEAF(dx_leaf)) { if (!OCFS2_IS_VALID_DX_LEAF(dx_leaf)) {
ret = ocfs2_error(sb, "Dir Index Leaf has bad signature %.*s", ret = ocfs2_error(sb, "Dir Index Leaf has bad signature %.*s\n",
7, dx_leaf->dl_signature); 7, dx_leaf->dl_signature);
} }
...@@ -808,8 +804,8 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, ...@@ -808,8 +804,8 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ret = ocfs2_error(inode->i_sb, ret = ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in btree tree block %llu\n",
"btree tree block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
goto out; goto out;
} }
...@@ -826,8 +822,9 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, ...@@ -826,8 +822,9 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode,
} }
if (!found) { if (!found) {
ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent " ret = ocfs2_error(inode->i_sb,
"record (%u, %u, 0) in btree", inode->i_ino, "Inode %lu has bad extent record (%u, %u, 0) in btree\n",
inode->i_ino,
le32_to_cpu(rec->e_cpos), le32_to_cpu(rec->e_cpos),
ocfs2_rec_clusters(el, rec)); ocfs2_rec_clusters(el, rec));
goto out; goto out;
......
...@@ -305,8 +305,8 @@ static int ocfs2_last_eb_is_empty(struct inode *inode, ...@@ -305,8 +305,8 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in leaf block %llu\n",
"leaf block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
ret = -EROFS; ret = -EROFS;
goto out; goto out;
...@@ -441,8 +441,8 @@ static int ocfs2_get_clusters_nocache(struct inode *inode, ...@@ -441,8 +441,8 @@ static int ocfs2_get_clusters_nocache(struct inode *inode,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in leaf block %llu\n",
"leaf block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
ret = -EROFS; ret = -EROFS;
goto out; goto out;
...@@ -475,8 +475,9 @@ static int ocfs2_get_clusters_nocache(struct inode *inode, ...@@ -475,8 +475,9 @@ static int ocfs2_get_clusters_nocache(struct inode *inode,
BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos)); BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos));
if (!rec->e_blkno) { if (!rec->e_blkno) {
ocfs2_error(inode->i_sb, "Inode %lu has bad extent " ocfs2_error(inode->i_sb,
"record (%u, %u, 0)", inode->i_ino, "Inode %lu has bad extent record (%u, %u, 0)\n",
inode->i_ino,
le32_to_cpu(rec->e_cpos), le32_to_cpu(rec->e_cpos),
ocfs2_rec_clusters(el, rec)); ocfs2_rec_clusters(el, rec));
ret = -EROFS; ret = -EROFS;
...@@ -564,8 +565,8 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, ...@@ -564,8 +565,8 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in xattr leaf block %llu\n",
"xattr leaf block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
ret = -EROFS; ret = -EROFS;
goto out; goto out;
...@@ -582,8 +583,9 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, ...@@ -582,8 +583,9 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos)); BUG_ON(v_cluster < le32_to_cpu(rec->e_cpos));
if (!rec->e_blkno) { if (!rec->e_blkno) {
ocfs2_error(inode->i_sb, "Inode %lu has bad extent " ocfs2_error(inode->i_sb,
"record (%u, %u, 0) in xattr", inode->i_ino, "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
inode->i_ino,
le32_to_cpu(rec->e_cpos), le32_to_cpu(rec->e_cpos),
ocfs2_rec_clusters(el, rec)); ocfs2_rec_clusters(el, rec));
ret = -EROFS; ret = -EROFS;
......
...@@ -374,7 +374,7 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) ...@@ -374,7 +374,7 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
mlog_errno(PTR_ERR(handle)); mlog_errno(PTR_ERR(handle));
if (is_journal_aborted(journal)) { if (is_journal_aborted(journal)) {
ocfs2_abort(osb->sb, "Detected aborted journal"); ocfs2_abort(osb->sb, "Detected aborted journal\n");
handle = ERR_PTR(-EROFS); handle = ERR_PTR(-EROFS);
} }
} else { } else {
......
...@@ -665,8 +665,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -665,8 +665,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
#ifdef CONFIG_OCFS2_DEBUG_FS #ifdef CONFIG_OCFS2_DEBUG_FS
if (le32_to_cpu(alloc->id1.bitmap1.i_used) != if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
ocfs2_local_alloc_count_bits(alloc)) { ocfs2_local_alloc_count_bits(alloc)) {
ocfs2_error(osb->sb, "local alloc inode %llu says it has " ocfs2_error(osb->sb, "local alloc inode %llu says it has %u used bits, but a count shows %u\n",
"%u used bits, but a count shows %u",
(unsigned long long)le64_to_cpu(alloc->i_blkno), (unsigned long long)le64_to_cpu(alloc->i_blkno),
le32_to_cpu(alloc->id1.bitmap1.i_used), le32_to_cpu(alloc->id1.bitmap1.i_used),
ocfs2_local_alloc_count_bits(alloc)); ocfs2_local_alloc_count_bits(alloc));
......
...@@ -100,8 +100,7 @@ static int __ocfs2_move_extent(handle_t *handle, ...@@ -100,8 +100,7 @@ static int __ocfs2_move_extent(handle_t *handle,
index = ocfs2_search_extent_list(el, cpos); index = ocfs2_search_extent_list(el, cpos);
if (index == -1) { if (index == -1) {
ret = ocfs2_error(inode->i_sb, ret = ocfs2_error(inode->i_sb,
"Inode %llu has an extent at cpos %u which can no " "Inode %llu has an extent at cpos %u which can no longer be found\n",
"longer be found.\n",
(unsigned long long)ino, cpos); (unsigned long long)ino, cpos);
goto out; goto out;
} }
......
...@@ -138,8 +138,7 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block, ...@@ -138,8 +138,7 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) { if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) {
ocfs2_error(inode->i_sb, ocfs2_error(inode->i_sb,
"Quota file %llu is probably corrupted! Requested " "Quota file %llu is probably corrupted! Requested to read block %Lu but file has size only %Lu\n",
"to read block %Lu but file has size only %Lu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno, (unsigned long long)OCFS2_I(inode)->ip_blkno,
(unsigned long long)v_block, (unsigned long long)v_block,
(unsigned long long)i_size_read(inode)); (unsigned long long)i_size_read(inode));
......
...@@ -103,7 +103,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb, ...@@ -103,7 +103,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb,
if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) {
rc = ocfs2_error(sb, rc = ocfs2_error(sb,
"Refcount block #%llu has bad signature %.*s", "Refcount block #%llu has bad signature %.*s\n",
(unsigned long long)bh->b_blocknr, 7, (unsigned long long)bh->b_blocknr, 7,
rb->rf_signature); rb->rf_signature);
goto out; goto out;
...@@ -111,8 +111,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb, ...@@ -111,8 +111,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb,
if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) {
rc = ocfs2_error(sb, rc = ocfs2_error(sb,
"Refcount block #%llu has an invalid rf_blkno " "Refcount block #%llu has an invalid rf_blkno of %llu\n",
"of %llu",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)le64_to_cpu(rb->rf_blkno)); (unsigned long long)le64_to_cpu(rb->rf_blkno));
goto out; goto out;
...@@ -120,8 +119,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb, ...@@ -120,8 +119,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb,
if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) {
rc = ocfs2_error(sb, rc = ocfs2_error(sb,
"Refcount block #%llu has an invalid " "Refcount block #%llu has an invalid rf_fs_generation of #%u\n",
"rf_fs_generation of #%u",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le32_to_cpu(rb->rf_fs_generation)); le32_to_cpu(rb->rf_fs_generation));
goto out; goto out;
...@@ -1103,8 +1101,7 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci, ...@@ -1103,8 +1101,7 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ret = ocfs2_error(sb, ret = ocfs2_error(sb,
"refcount tree %llu has non zero tree " "refcount tree %llu has non zero tree depth in leaf btree tree block %llu\n",
"depth in leaf btree tree block %llu\n",
(unsigned long long)ocfs2_metadata_cache_owner(ci), (unsigned long long)ocfs2_metadata_cache_owner(ci),
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
goto out; goto out;
...@@ -2358,9 +2355,8 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode, ...@@ -2358,9 +2355,8 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode,
cpos, len, phys); cpos, len, phys);
if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
"tree, but the feature bit is not set in the " inode->i_ino);
"super block.", inode->i_ino);
goto out; goto out;
} }
...@@ -2543,9 +2539,8 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, ...@@ -2543,9 +2539,8 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno); u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno);
if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
"tree, but the feature bit is not set in the " inode->i_ino);
"super block.", inode->i_ino);
goto out; goto out;
} }
...@@ -2670,8 +2665,8 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode, ...@@ -2670,8 +2665,8 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ret = ocfs2_error(inode->i_sb, ret = ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in leaf block %llu\n",
"leaf block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
goto out; goto out;
} }
...@@ -3103,8 +3098,7 @@ static int ocfs2_clear_ext_refcount(handle_t *handle, ...@@ -3103,8 +3098,7 @@ static int ocfs2_clear_ext_refcount(handle_t *handle,
index = ocfs2_search_extent_list(el, cpos); index = ocfs2_search_extent_list(el, cpos);
if (index == -1) { if (index == -1) {
ret = ocfs2_error(sb, ret = ocfs2_error(sb,
"Inode %llu has an extent at cpos %u which can no " "Inode %llu has an extent at cpos %u which can no longer be found\n",
"longer be found.\n",
(unsigned long long)ino, cpos); (unsigned long long)ino, cpos);
goto out; goto out;
} }
...@@ -3371,9 +3365,8 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) ...@@ -3371,9 +3365,8 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context)
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount tree, but the feature bit is not set in the super block\n",
"tree, but the feature bit is not set in the " inode->i_ino);
"super block.", inode->i_ino);
} }
ocfs2_init_dealloc_ctxt(&context->dealloc); ocfs2_init_dealloc_ctxt(&context->dealloc);
......
...@@ -167,12 +167,12 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl) ...@@ -167,12 +167,12 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl)
} }
#define do_error(fmt, ...) \ #define do_error(fmt, ...) \
do{ \ do { \
if (resize) \ if (resize) \
mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \ mlog(ML_ERROR, fmt, ##__VA_ARGS__); \
else \ else \
return ocfs2_error(sb, fmt, ##__VA_ARGS__); \ return ocfs2_error(sb, fmt, ##__VA_ARGS__); \
} while (0) } while (0)
static int ocfs2_validate_gd_self(struct super_block *sb, static int ocfs2_validate_gd_self(struct super_block *sb,
struct buffer_head *bh, struct buffer_head *bh,
...@@ -181,36 +181,32 @@ static int ocfs2_validate_gd_self(struct super_block *sb, ...@@ -181,36 +181,32 @@ static int ocfs2_validate_gd_self(struct super_block *sb,
struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
if (!OCFS2_IS_VALID_GROUP_DESC(gd)) { if (!OCFS2_IS_VALID_GROUP_DESC(gd)) {
do_error("Group descriptor #%llu has bad signature %.*s", do_error("Group descriptor #%llu has bad signature %.*s\n",
(unsigned long long)bh->b_blocknr, 7, (unsigned long long)bh->b_blocknr, 7,
gd->bg_signature); gd->bg_signature);
} }
if (le64_to_cpu(gd->bg_blkno) != bh->b_blocknr) { if (le64_to_cpu(gd->bg_blkno) != bh->b_blocknr) {
do_error("Group descriptor #%llu has an invalid bg_blkno " do_error("Group descriptor #%llu has an invalid bg_blkno of %llu\n",
"of %llu",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)le64_to_cpu(gd->bg_blkno)); (unsigned long long)le64_to_cpu(gd->bg_blkno));
} }
if (le32_to_cpu(gd->bg_generation) != OCFS2_SB(sb)->fs_generation) { if (le32_to_cpu(gd->bg_generation) != OCFS2_SB(sb)->fs_generation) {
do_error("Group descriptor #%llu has an invalid " do_error("Group descriptor #%llu has an invalid fs_generation of #%u\n",
"fs_generation of #%u",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le32_to_cpu(gd->bg_generation)); le32_to_cpu(gd->bg_generation));
} }
if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) { if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) {
do_error("Group descriptor #%llu has bit count %u but " do_error("Group descriptor #%llu has bit count %u but claims that %u are free\n",
"claims that %u are free",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le16_to_cpu(gd->bg_bits), le16_to_cpu(gd->bg_bits),
le16_to_cpu(gd->bg_free_bits_count)); le16_to_cpu(gd->bg_free_bits_count));
} }
if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) { if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) {
do_error("Group descriptor #%llu has bit count %u but " do_error("Group descriptor #%llu has bit count %u but max bitmap bits of %u\n",
"max bitmap bits of %u",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le16_to_cpu(gd->bg_bits), le16_to_cpu(gd->bg_bits),
8 * le16_to_cpu(gd->bg_size)); 8 * le16_to_cpu(gd->bg_size));
...@@ -228,8 +224,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, ...@@ -228,8 +224,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb,
struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
if (di->i_blkno != gd->bg_parent_dinode) { if (di->i_blkno != gd->bg_parent_dinode) {
do_error("Group descriptor #%llu has bad parent " do_error("Group descriptor #%llu has bad parent pointer (%llu, expected %llu)\n",
"pointer (%llu, expected %llu)",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)le64_to_cpu(gd->bg_parent_dinode), (unsigned long long)le64_to_cpu(gd->bg_parent_dinode),
(unsigned long long)le64_to_cpu(di->i_blkno)); (unsigned long long)le64_to_cpu(di->i_blkno));
...@@ -237,7 +232,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, ...@@ -237,7 +232,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb,
max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc);
if (le16_to_cpu(gd->bg_bits) > max_bits) { if (le16_to_cpu(gd->bg_bits) > max_bits) {
do_error("Group descriptor #%llu has bit count of %u", do_error("Group descriptor #%llu has bit count of %u\n",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le16_to_cpu(gd->bg_bits)); le16_to_cpu(gd->bg_bits));
} }
...@@ -247,7 +242,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, ...@@ -247,7 +242,7 @@ static int ocfs2_validate_gd_parent(struct super_block *sb,
le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) || le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) ||
((le16_to_cpu(gd->bg_chain) == ((le16_to_cpu(gd->bg_chain) ==
le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) && !resize)) { le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) && !resize)) {
do_error("Group descriptor #%llu has bad chain %u", do_error("Group descriptor #%llu has bad chain %u\n",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le16_to_cpu(gd->bg_chain)); le16_to_cpu(gd->bg_chain));
} }
...@@ -376,8 +371,8 @@ static int ocfs2_block_group_fill(handle_t *handle, ...@@ -376,8 +371,8 @@ static int ocfs2_block_group_fill(handle_t *handle,
struct super_block * sb = alloc_inode->i_sb; struct super_block * sb = alloc_inode->i_sb;
if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) { if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) {
status = ocfs2_error(alloc_inode->i_sb, "group block (%llu) != " status = ocfs2_error(alloc_inode->i_sb,
"b_blocknr (%llu)", "group block (%llu) != b_blocknr (%llu)\n",
(unsigned long long)group_blkno, (unsigned long long)group_blkno,
(unsigned long long) bg_bh->b_blocknr); (unsigned long long) bg_bh->b_blocknr);
goto bail; goto bail;
...@@ -825,7 +820,8 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, ...@@ -825,7 +820,8 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) { if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) {
status = ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator %llu", status = ocfs2_error(alloc_inode->i_sb,
"Invalid chain allocator %llu\n",
(unsigned long long)le64_to_cpu(fe->i_blkno)); (unsigned long long)le64_to_cpu(fe->i_blkno));
goto bail; goto bail;
} }
...@@ -1360,11 +1356,11 @@ int ocfs2_block_group_set_bits(handle_t *handle, ...@@ -1360,11 +1356,11 @@ int ocfs2_block_group_set_bits(handle_t *handle,
le16_add_cpu(&bg->bg_free_bits_count, -num_bits); le16_add_cpu(&bg->bg_free_bits_count, -num_bits);
if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) {
return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
" count %u but claims %u are freed. num_bits %d",
(unsigned long long)le64_to_cpu(bg->bg_blkno), (unsigned long long)le64_to_cpu(bg->bg_blkno),
le16_to_cpu(bg->bg_bits), le16_to_cpu(bg->bg_bits),
le16_to_cpu(bg->bg_free_bits_count), num_bits); le16_to_cpu(bg->bg_free_bits_count),
num_bits);
} }
while(num_bits--) while(num_bits--)
ocfs2_set_bit(bit_off++, bitmap); ocfs2_set_bit(bit_off++, bitmap);
...@@ -1895,8 +1891,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, ...@@ -1895,8 +1891,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
if (le32_to_cpu(fe->id1.bitmap1.i_used) >= if (le32_to_cpu(fe->id1.bitmap1.i_used) >=
le32_to_cpu(fe->id1.bitmap1.i_total)) { le32_to_cpu(fe->id1.bitmap1.i_total)) {
status = ocfs2_error(ac->ac_inode->i_sb, status = ocfs2_error(ac->ac_inode->i_sb,
"Chain allocator dinode %llu has %u used " "Chain allocator dinode %llu has %u used bits but only %u total\n",
"bits but only %u total.",
(unsigned long long)le64_to_cpu(fe->i_blkno), (unsigned long long)le64_to_cpu(fe->i_blkno),
le32_to_cpu(fe->id1.bitmap1.i_used), le32_to_cpu(fe->id1.bitmap1.i_used),
le32_to_cpu(fe->id1.bitmap1.i_total)); le32_to_cpu(fe->id1.bitmap1.i_total));
...@@ -2417,11 +2412,11 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, ...@@ -2417,11 +2412,11 @@ static int ocfs2_block_group_clear_bits(handle_t *handle,
} }
le16_add_cpu(&bg->bg_free_bits_count, num_bits); le16_add_cpu(&bg->bg_free_bits_count, num_bits);
if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) {
return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",
" count %u but claims %u are freed. num_bits %d",
(unsigned long long)le64_to_cpu(bg->bg_blkno), (unsigned long long)le64_to_cpu(bg->bg_blkno),
le16_to_cpu(bg->bg_bits), le16_to_cpu(bg->bg_bits),
le16_to_cpu(bg->bg_free_bits_count), num_bits); le16_to_cpu(bg->bg_free_bits_count),
num_bits);
} }
if (undo_fn) if (undo_fn)
......
...@@ -2600,7 +2600,7 @@ int __ocfs2_error(struct super_block *sb, const char *function, ...@@ -2600,7 +2600,7 @@ int __ocfs2_error(struct super_block *sb, const char *function,
/* Not using mlog here because we want to show the actual /* Not using mlog here because we want to show the actual
* function the error came from. */ * function the error came from. */
printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %pV\n", printk(KERN_CRIT "OCFS2: ERROR (device %s): %s: %pV",
sb->s_id, function, &vaf); sb->s_id, function, &vaf);
va_end(args); va_end(args);
...@@ -2622,7 +2622,7 @@ void __ocfs2_abort(struct super_block *sb, const char *function, ...@@ -2622,7 +2622,7 @@ void __ocfs2_abort(struct super_block *sb, const char *function,
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
printk(KERN_CRIT "OCFS2: abort (device %s): %s: %pV\n", printk(KERN_CRIT "OCFS2: abort (device %s): %s: %pV",
sb->s_id, function, &vaf); sb->s_id, function, &vaf);
va_end(args); va_end(args);
......
...@@ -35,13 +35,15 @@ __printf(3, 4) ...@@ -35,13 +35,15 @@ __printf(3, 4)
int __ocfs2_error(struct super_block *sb, const char *function, int __ocfs2_error(struct super_block *sb, const char *function,
const char *fmt, ...); const char *fmt, ...);
#define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##args) #define ocfs2_error(sb, fmt, ...) \
__ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##__VA_ARGS__)
__printf(3, 4) __printf(3, 4)
void __ocfs2_abort(struct super_block *sb, const char *function, void __ocfs2_abort(struct super_block *sb, const char *function,
const char *fmt, ...); const char *fmt, ...);
#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) #define ocfs2_abort(sb, fmt, ...) \
__ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##__VA_ARGS__)
/* /*
* Void signal blockers, because in-kernel sigprocmask() only fails * Void signal blockers, because in-kernel sigprocmask() only fails
......
...@@ -500,24 +500,21 @@ static int ocfs2_validate_xattr_block(struct super_block *sb, ...@@ -500,24 +500,21 @@ static int ocfs2_validate_xattr_block(struct super_block *sb,
if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) { if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
return ocfs2_error(sb, return ocfs2_error(sb,
"Extended attribute block #%llu has bad " "Extended attribute block #%llu has bad signature %.*s\n",
"signature %.*s",
(unsigned long long)bh->b_blocknr, 7, (unsigned long long)bh->b_blocknr, 7,
xb->xb_signature); xb->xb_signature);
} }
if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) { if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) {
return ocfs2_error(sb, return ocfs2_error(sb,
"Extended attribute block #%llu has an " "Extended attribute block #%llu has an invalid xb_blkno of %llu\n",
"invalid xb_blkno of %llu",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
(unsigned long long)le64_to_cpu(xb->xb_blkno)); (unsigned long long)le64_to_cpu(xb->xb_blkno));
} }
if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) { if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) {
return ocfs2_error(sb, return ocfs2_error(sb,
"Extended attribute block #%llu has an invalid " "Extended attribute block #%llu has an invalid xb_fs_generation of #%u\n",
"xb_fs_generation of #%u",
(unsigned long long)bh->b_blocknr, (unsigned long long)bh->b_blocknr,
le32_to_cpu(xb->xb_fs_generation)); le32_to_cpu(xb->xb_fs_generation));
} }
...@@ -3692,8 +3689,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode, ...@@ -3692,8 +3689,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
if (el->l_tree_depth) { if (el->l_tree_depth) {
ret = ocfs2_error(inode->i_sb, ret = ocfs2_error(inode->i_sb,
"Inode %lu has non zero tree depth in " "Inode %lu has non zero tree depth in xattr tree block %llu\n",
"xattr tree block %llu\n", inode->i_ino, inode->i_ino,
(unsigned long long)eb_bh->b_blocknr); (unsigned long long)eb_bh->b_blocknr);
goto out; goto out;
} }
...@@ -3709,8 +3706,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode, ...@@ -3709,8 +3706,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
} }
if (!e_blkno) { if (!e_blkno) {
ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent " ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
"record (%u, %u, 0) in xattr", inode->i_ino, inode->i_ino,
le32_to_cpu(rec->e_cpos), le32_to_cpu(rec->e_cpos),
ocfs2_rec_clusters(el, rec)); ocfs2_rec_clusters(el, rec));
goto out; goto out;
......
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