[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5599335F.6020309@users.sourceforge.net>
Date: Sun, 05 Jul 2015 15:38:39 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Joel Becker <jlbec@...lplan.org>, Mark Fasheh <mfasheh@...e.com>,
ocfs2-devel@....oracle.com
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 09/11] ocfs2: One function call less in ocfs2_trylock_journal()
after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 4 Jul 2015 22:34:43 +0200
The iput() function was called in one case by the
ocfs2_trylock_journal() function during error handling even
if the passed variable "inode" contained still a null pointer.
* Return directly if a call of the ocfs2_get_system_file_inode() function
failed at the beginning.
* Rename a jump label according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
fs/ocfs2/journal.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index c644997..c343e36 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1749,21 +1749,18 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb,
int slot_num)
{
int status, flags;
- struct inode *inode = NULL;
+ struct inode *inode;
inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE,
slot_num);
if (inode == NULL) {
mlog(ML_ERROR, "access error\n");
- status = -EACCES;
- goto bail;
+ return -EACCES;
}
if (is_bad_inode(inode)) {
mlog(ML_ERROR, "access error (bad inode)\n");
- iput(inode);
- inode = NULL;
status = -EACCES;
- goto bail;
+ goto put_inode;
}
SET_INODE_JOURNAL(inode);
@@ -1772,11 +1769,11 @@ static int ocfs2_trylock_journal(struct ocfs2_super *osb,
if (status < 0) {
if (status != -EAGAIN)
mlog_errno(status);
- goto bail;
+ goto put_inode;
}
ocfs2_inode_unlock(inode, 1);
-bail:
+put_inode:
iput(inode);
return status;
}
--
2.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists