[PATCH 05/11] ocfs2: Less error log repetition in ocfs2_begin_truncate_log_recovery()
From: SF Markus Elfring
Date: Sun Jul 05 2015 - 09:34:09 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Jul 2015 17:23:08 +0200
Delete three direct calls of the mlog_errno() function
within ocfs2_begin_truncate_log_recovery().
A single logging call can be sufficient.
Drop initialisation for the variables "tl_inode" and "tl_bh" then.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
fs/ocfs2/alloc.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index f36dcaa..59e639e 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -6147,8 +6147,8 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
struct ocfs2_dinode **tl_copy)
{
int status;
- struct inode *tl_inode = NULL;
- struct buffer_head *tl_bh = NULL;
+ struct inode *tl_inode;
+ struct buffer_head *tl_bh;
struct ocfs2_dinode *di;
struct ocfs2_truncate_log *tl;
@@ -6157,10 +6157,8 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
trace_ocfs2_begin_truncate_log_recovery(slot_num);
status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh);
- if (status < 0) {
- mlog_errno(status);
- goto bail;
- }
+ if (status < 0)
+ goto log_error;
di = (struct ocfs2_dinode *) tl_bh->b_data;
@@ -6176,7 +6174,6 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
*tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL);
if (!(*tl_copy)) {
status = -ENOMEM;
- mlog_errno(status);
goto bail;
}
@@ -6191,7 +6188,6 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check);
status = ocfs2_write_block(osb, tl_bh, INODE_CACHE(tl_inode));
if (status < 0) {
- mlog_errno(status);
goto bail;
}
}
@@ -6200,9 +6196,12 @@ bail:
iput(tl_inode);
brelse(tl_bh);
- if (status < 0 && (*tl_copy)) {
- kfree(*tl_copy);
- *tl_copy = NULL;
+ if (status < 0) {
+ if (*tl_copy) {
+ kfree(*tl_copy);
+ *tl_copy = NULL;
+ }
+log_error:
mlog_errno(status);
}
--
2.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/