linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OCFS2: remove useless err
@ 2020-01-21  3:37 Alex Shi
  2020-01-26  1:52 ` Joseph Qi
  2020-02-05  8:41 ` Joseph Qi
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Shi @ 2020-01-21  3:37 UTC (permalink / raw)
  Cc: Mark Fasheh, Joel Becker, Joseph Qi, Andrew Morton,
	Greg Kroah-Hartman, Kate Stewart, ChenGang, Richard Fontana,
	Thomas Gleixner, ocfs2-devel, linux-kernel

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

Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com> 
Cc: Joel Becker <jlbec@evilplan.org> 
Cc: Joseph Qi <joseph.qi@linux.alibaba.com> 
Cc: Andrew Morton <akpm@linux-foundation.org> 
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
Cc: Kate Stewart <kstewart@linuxfoundation.org> 
Cc: ChenGang <cg.chen@huawei.com> 
Cc: Richard Fontana <rfontana@redhat.com> 
Cc: Thomas Gleixner <tglx@linutronix.de> 
Cc: ocfs2-devel@oss.oracle.com 
Cc: linux-kernel@vger.kernel.org 
---
 fs/ocfs2/cluster/tcp.c | 3 +--
 fs/ocfs2/dir.c         | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 48a3398f0bf5..9261c1f06a9f 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -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();
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index bdef72c0f099..5761060d2ba8 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -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;
 			}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] OCFS2: remove useless err
  2020-01-21  3:37 [PATCH] OCFS2: remove useless err Alex Shi
@ 2020-01-26  1:52 ` Joseph Qi
  2020-02-04 10:59   ` Alex Shi
  2020-02-05  8:41 ` Joseph Qi
  1 sibling, 1 reply; 6+ messages in thread
From: Joseph Qi @ 2020-01-26  1:52 UTC (permalink / raw)
  To: Alex Shi
  Cc: Mark Fasheh, Joel Becker, Andrew Morton, Greg Kroah-Hartman,
	Kate Stewart, ChenGang, Richard Fontana, Thomas Gleixner,
	ocfs2-devel, linux-kernel



On 20/1/21 11:37, Alex Shi wrote:
> We don't need 'err' in these 2 places, better to remove them.
> 
> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
> Cc: Mark Fasheh <mark@fasheh.com> 
> Cc: Joel Becker <jlbec@evilplan.org> 
> Cc: Joseph Qi <joseph.qi@linux.alibaba.com> 
> Cc: Andrew Morton <akpm@linux-foundation.org> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
> Cc: Kate Stewart <kstewart@linuxfoundation.org> 
> Cc: ChenGang <cg.chen@huawei.com> 
> Cc: Richard Fontana <rfontana@redhat.com> 
> Cc: Thomas Gleixner <tglx@linutronix.de> 
> Cc: ocfs2-devel@oss.oracle.com 
> Cc: linux-kernel@vger.kernel.org 
> ---
>  fs/ocfs2/cluster/tcp.c | 3 +--
>  fs/ocfs2/dir.c         | 4 ++--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
> index 48a3398f0bf5..9261c1f06a9f 100644
> --- a/fs/ocfs2/cluster/tcp.c
> +++ b/fs/ocfs2/cluster/tcp.c
> @@ -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();
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index bdef72c0f099..5761060d2ba8 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -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);

Umm... missing error checking here?

Thanks,
Joseph
>  				bh_use[ra_max] = bh;
>  			}
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] OCFS2: remove useless err
  2020-01-26  1:52 ` Joseph Qi
@ 2020-02-04 10:59   ` Alex Shi
  2020-02-04 11:34     ` Joseph Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Shi @ 2020-02-04 10:59 UTC (permalink / raw)
  To: Joseph Qi
  Cc: Mark Fasheh, Joel Becker, Andrew Morton, Greg Kroah-Hartman,
	Kate Stewart, ChenGang, Richard Fontana, Thomas Gleixner,
	ocfs2-devel, linux-kernel



在 2020/1/26 上午9:52, Joseph Qi 写道:
> 

>>  
>> @@ -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?


/*
 * 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] OCFS2: remove useless err
  2020-02-04 10:59   ` Alex Shi
@ 2020-02-04 11:34     ` Joseph Qi
  2020-02-05  8:40       ` [Ocfs2-devel] " Joseph Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Qi @ 2020-02-04 11:34 UTC (permalink / raw)
  To: Alex Shi
  Cc: Mark Fasheh, Joel Becker, Andrew Morton, Greg Kroah-Hartman,
	Kate Stewart, ChenGang, Richard Fontana, Thomas Gleixner,
	ocfs2-devel, linux-kernel



On 20/2/4 18:59, Alex Shi wrote:
> 
> 
> 在 2020/1/26 上午9:52, Joseph Qi 写道:
>>
> 
>>>  
>>> @@ -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?
> 
> 
> /*
>  * 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? :)
> 
If we got error here, it means the buffer head is invalid.
So how about mark it as NULL and skip it?

Thanks,
Joseph

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Ocfs2-devel] [PATCH] OCFS2: remove useless err
  2020-02-04 11:34     ` Joseph Qi
@ 2020-02-05  8:40       ` Joseph Qi
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Qi @ 2020-02-05  8:40 UTC (permalink / raw)
  To: Alex Shi
  Cc: Kate Stewart, Greg Kroah-Hartman, linux-kernel, Richard Fontana,
	ChenGang, Thomas Gleixner, ocfs2-devel



On 20/2/4 19:34, Joseph Qi wrote:
> 
> 
> On 20/2/4 18:59, Alex Shi wrote:
>>
>>
>> 在 2020/1/26 上午9:52, Joseph Qi 写道:
>>>
>>
>>>>  
>>>> @@ -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?
>>
>>
>> /*
>>  * 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? :)
>>
> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] OCFS2: remove useless err
  2020-01-21  3:37 [PATCH] OCFS2: remove useless err Alex Shi
  2020-01-26  1:52 ` Joseph Qi
@ 2020-02-05  8:41 ` Joseph Qi
  1 sibling, 0 replies; 6+ messages in thread
From: Joseph Qi @ 2020-02-05  8:41 UTC (permalink / raw)
  To: Alex Shi
  Cc: Mark Fasheh, Joel Becker, Andrew Morton, Greg Kroah-Hartman,
	Kate Stewart, ChenGang, Richard Fontana, Thomas Gleixner,
	ocfs2-devel, linux-kernel



On 20/1/21 11:37, Alex Shi wrote:
> We don't need 'err' in these 2 places, better to remove them.
> 
> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
> Cc: Mark Fasheh <mark@fasheh.com> 
> Cc: Joel Becker <jlbec@evilplan.org> 
> Cc: Joseph Qi <joseph.qi@linux.alibaba.com> 
> Cc: Andrew Morton <akpm@linux-foundation.org> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
> Cc: Kate Stewart <kstewart@linuxfoundation.org> 
> Cc: ChenGang <cg.chen@huawei.com> 
> Cc: Richard Fontana <rfontana@redhat.com> 
> Cc: Thomas Gleixner <tglx@linutronix.de> 
> Cc: ocfs2-devel@oss.oracle.com 
> Cc: linux-kernel@vger.kernel.org

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/cluster/tcp.c | 3 +--
>  fs/ocfs2/dir.c         | 4 ++--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
> index 48a3398f0bf5..9261c1f06a9f 100644
> --- a/fs/ocfs2/cluster/tcp.c
> +++ b/fs/ocfs2/cluster/tcp.c
> @@ -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();
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index bdef72c0f099..5761060d2ba8 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -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;
>  			}
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-05  8:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21  3:37 [PATCH] OCFS2: remove useless err Alex Shi
2020-01-26  1:52 ` Joseph Qi
2020-02-04 10:59   ` Alex Shi
2020-02-04 11:34     ` Joseph Qi
2020-02-05  8:40       ` [Ocfs2-devel] " Joseph Qi
2020-02-05  8:41 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).