Skip to contentSkip to conversation

OCFS2: remove useless err

PATCH Applied Alex Shi 2 participants 6 messages Jan 21, 2020 – Feb 5, 2020 OCFS2

lore
Share & tools
lore

Alex Shi

author
#0 lore raw

PATCH 1/1 OCFS2: remove useless err

We don't need 'err' in these 2 places, better to remove them.

Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Joseph Qi <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Kate Stewart <[email protected]>
Cc ChenGang <[email protected]>
Cc Richard Fontana <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 fs/ocfs2/cluster/tcp.c | 3 +--
 fs/ocfs2/dir.c         | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
fs/ocfs2/cluster/tcp.c +1 -2
index 48a3398f0bf5..9261c1f06a9f 100644
@@ -1948,7 +1948,6 @@ static void o2net_accept_many(struct work_struct *work)
 {
 	struct socket *sock = o2net_listen_sock;
 	int	more;
-	int	err;
 
 	/*
 	 * It is critical to note that due to interrupt moderation
@@ -1963,7 +1962,7 @@ static void o2net_accept_many(struct work_struct *work)
 	 */
 
 	for (;;) {
-		err = o2net_accept_one(sock, &more);
+		o2net_accept_one(sock, &more);
 		if (!more)
 			break;
 		cond_resched();
fs/ocfs2/dir.c +2 -2
index bdef72c0f099..5761060d2ba8 100644
@@ -676,7 +676,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 	int ra_ptr = 0;		/* Current index into readahead
 				   buffer */
 	int num = 0;
-	int nblocks, i, err;
+	int nblocks, i;
 
 	sb = dir->i_sb;
 
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);
 				bh_use[ra_max] = bh;
 			}
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 54 lines · Alex Shi

We don't need 'err' in these 2 places, better to remove them.

Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Joseph Qi <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Kate Stewart <[email protected]>
Cc ChenGang <[email protected]>
Cc Richard Fontana <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc ocfs2-devel at oss.oracle.com
Cc linux-kernel at vger.kernel.org
---
 fs/ocfs2/cluster/tcp.c | 3 +--
 fs/ocfs2/dir.c         | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
fs/ocfs2/cluster/tcp.c +1 -2
index 48a3398f0bf5..9261c1f06a9f 100644
@@ -1948,7 +1948,6 @@ static void o2net_accept_many(struct work_struct *work)
 {
 	struct socket *sock = o2net_listen_sock;
 	int	more;
-	int	err;
 
 	/*
 	 * It is critical to note that due to interrupt moderation
@@ -1963,7 +1962,7 @@ static void o2net_accept_many(struct work_struct *work)
 	 */
 
 	for (;;) {
-		err = o2net_accept_one(sock, &more);
+		o2net_accept_one(sock, &more);
 		if (!more)
 			break;
 		cond_resched();
fs/ocfs2/dir.c +1 -1
index bdef72c0f099..5761060d2ba8 100644
@@ -676,7 +676,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 	int ra_ptr = 0;		/* Current index into readahead
 				   buffer */
 	int num = 0;
-	int nblocks, i, err;
+	int nblocks, i;
 
 	sb = dir->i_sb;
 

fs/ocfs2/dir.c static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, · line 712

Quoted 6 lines
fs/ocfs2/dir.c +1 -1
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);

Umm... missing error checking here?

Thanks,
Joseph

Quoted 3 lines
fs/ocfs2/dir.c +0 -0
 				bh_use[ra_max] = bh;
 			}
author
#2 lore raw
Quoted 6 lines · Joseph Qi
Quoted 6 lines
(quoted diff) +0 -0
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
Quoted 6 lines

fs/ocfs2/dir.c static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, · line 712

Quoted 4 lines
fs/ocfs2/dir.c +1 -1
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);

Umm... missing error checking here?

/*
* This function forces all errors to -EIO for consistency with its
* predecessor, ocfs2_bread(). We haven't audited what returning the
* real error codes would do to callers. We log the real codes with
* mlog_errno() before we squash them.
*/
static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
struct buffer_head **bh, int flags)

According to ocfs2_read_dir_block comments, caller don't care the err value, func will log it.

So is this patch ok? :)

Thanks
Alex

maintainer
#3 lore raw
Quoted 26 lines · Alex Shi

? 2020/1/26 ??9:52, Joseph Qi ??:

Quoted 6 lines
Quoted 6 lines
(quoted diff) +0 -0
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
Quoted 6 lines

fs/ocfs2/dir.c static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, · line 712

Quoted 4 lines
fs/ocfs2/dir.c +1 -1
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);

Umm... missing error checking here?

/*
* This function forces all errors to -EIO for consistency with its
* predecessor, ocfs2_bread(). We haven't audited what returning the
* real error codes would do to callers. We log the real codes with
* mlog_errno() before we squash them.
*/
static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
struct buffer_head **bh, int flags)

Quoted 4 lines

According to ocfs2_read_dir_block comments, caller don't care the err value, func will log it.

So is this patch ok? :)

If we got error here, it means the buffer head is invalid. So how about mark it as NULL and skip it?

Thanks,
Joseph

maintainer
#4 lore raw
Quoted 29 lines · Joseph Qi
Quoted 26 lines · Alex Shi

? 2020/1/26 ??9:52, Joseph Qi ??:

Quoted 6 lines
Quoted 6 lines
(quoted diff) +0 -0
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
Quoted 6 lines

fs/ocfs2/dir.c static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, · line 712

Quoted 4 lines
fs/ocfs2/dir.c +1 -1
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);

Umm... missing error checking here?

/*
* This function forces all errors to -EIO for consistency with its
* predecessor, ocfs2_bread(). We haven't audited what returning the
* real error codes would do to callers. We log the real codes with
* mlog_errno() before we squash them.
*/
static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
struct buffer_head **bh, int flags)

Quoted 7 lines
Quoted 4 lines

According to ocfs2_read_dir_block comments, caller don't care the err value, func will log it.

So is this patch ok? :)

If we got error here, it means the buffer head is invalid. So how about mark it as NULL and skip it?

Okay, in this case, bh is already NULL and will skip below, so it looks fine to me.

maintainer Reviewed-by on v1 1/1
#5 lore raw
In reply to Alex Shi
Quoted 14 lines · Alex Shi

We don't need 'err' in these 2 places, better to remove them.

Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Joseph Qi <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Kate Stewart <[email protected]>
Cc ChenGang <[email protected]>
Cc Richard Fontana <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc ocfs2-devel at oss.oracle.com
Cc linux-kernel at vger.kernel.org
Quoted 49 lines
---
 fs/ocfs2/cluster/tcp.c | 3 +--
 fs/ocfs2/dir.c         | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)
fs/ocfs2/cluster/tcp.c +1 -2
index 48a3398f0bf5..9261c1f06a9f 100644
@@ -1948,7 +1948,6 @@ static void o2net_accept_many(struct work_struct *work)
 {
 	struct socket *sock = o2net_listen_sock;
 	int	more;
-	int	err;
 
 	/*
 	 * It is critical to note that due to interrupt moderation
@@ -1963,7 +1962,7 @@ static void o2net_accept_many(struct work_struct *work)
 	 */
 
 	for (;;) {
-		err = o2net_accept_one(sock, &more);
+		o2net_accept_one(sock, &more);
 		if (!more)
 			break;
 		cond_resched();
fs/ocfs2/dir.c +2 -2
index bdef72c0f099..5761060d2ba8 100644
@@ -676,7 +676,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 	int ra_ptr = 0;		/* Current index into readahead
 				   buffer */
 	int num = 0;
-	int nblocks, i, err;
+	int nblocks, i;
 
 	sb = dir->i_sb;
 
@@ -708,7 +708,7 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
 				num++;
 
 				bh = NULL;
-				err = ocfs2_read_dir_block(dir, b++, &bh,
+				ocfs2_read_dir_block(dir, b++, &bh,
 							   OCFS2_BH_READAHEAD);
 				bh_use[ra_max] = bh;
 			}