linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4/mballoc: Remove unneeded variable "err"
@ 2018-08-04 11:04 zhong jiang
  2018-08-04 21:24 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: zhong jiang @ 2018-08-04 11:04 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel

The err is not used after initalization. So just remove the variable.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 fs/ext4/mballoc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 8b24d3d..e29fce2 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3801,7 +3801,6 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
 	ext4_group_t group;
 	ext4_grpblk_t bit;
 	unsigned long long grp_blk_start;
-	int err = 0;
 	int free = 0;
 
 	BUG_ON(pa->pa_deleted == 0);
@@ -3842,7 +3841,7 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
 	}
 	atomic_add(free, &sbi->s_mb_discarded);
 
-	return err;
+	return 0;
 }
 
 static noinline_for_stack int
-- 
1.7.12.4


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

* Re: [PATCH] ext4/mballoc: Remove unneeded variable "err"
  2018-08-04 11:04 [PATCH] ext4/mballoc: Remove unneeded variable "err" zhong jiang
@ 2018-08-04 21:24 ` Theodore Y. Ts'o
  2018-08-05 12:59   ` zhong jiang
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Y. Ts'o @ 2018-08-04 21:24 UTC (permalink / raw)
  To: zhong jiang; +Cc: adilger.kernel, linux-ext4, linux-kernel

On Sat, Aug 04, 2018 at 07:04:56PM +0800, zhong jiang wrote:
> The err is not used after initalization. So just remove the variable.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>

I'll apply this patch, but how did you generate the diff?  The
function name here is all wrong:

> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 8b24d3d..e29fce2 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3801,7 +3801,6 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^

The lines in question are from ext4_mb_release_inode_pa(), *not*
ext4_mb_new_preallocation().  So when I inspected the patch visually,
my first reaction was, "there's no way this patch would apply".

But then I looked at the C code changed by the patch, and I was
surprised to see that it applied correctly in a completely different
function, and when I regenerated the patch, the line numbers matched
yours --- so the only thing "wrong" in your patch is the function name.

So that raises the question --- how did you create the diff in this
patch?  What version of git?  And what version of the kernel?

Regards,

					- Ted

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

* Re: [PATCH] ext4/mballoc: Remove unneeded variable "err"
  2018-08-04 21:24 ` Theodore Y. Ts'o
@ 2018-08-05 12:59   ` zhong jiang
  2018-08-05 14:49     ` Theodore Y. Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: zhong jiang @ 2018-08-05 12:59 UTC (permalink / raw)
  To: Theodore Y. Ts'o, adilger.kernel, linux-ext4, linux-kernel

On 2018/8/5 5:24, Theodore Y. Ts'o wrote:
> On Sat, Aug 04, 2018 at 07:04:56PM +0800, zhong jiang wrote:
>> The err is not used after initalization. So just remove the variable.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> I'll apply this patch, but how did you generate the diff?  The
> function name here is all wrong:
>
>> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
>> index 8b24d3d..e29fce2 100644
>> --- a/fs/ext4/mballoc.c
>> +++ b/fs/ext4/mballoc.c
>> @@ -3801,7 +3801,6 @@ static int ext4_mb_new_preallocation(struct ext4_allocation_context *ac)
>                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> The lines in question are from ext4_mb_release_inode_pa(), *not*
> ext4_mb_new_preallocation().  So when I inspected the patch visually,
> my first reaction was, "there's no way this patch would apply".
>
> But then I looked at the C code changed by the patch, and I was
> surprised to see that it applied correctly in a completely different
> function, and when I regenerated the patch, the line numbers matched
> yours --- so the only thing "wrong" in your patch is the function name.
>
> So that raises the question --- how did you create the diff in this-rc
> patch?  What version of git?  And what version of the kernel?
>
> Regards,
>
> 					- Ted
>
> .
>
 I  create the diff in this patch again ,but get the same result .  the git version is git version 1.7.12.4
 but I create  the diff in git version 1.8.3.1. It shows the correct function name.

The kernel version is  4.18-rc7.   I will upgrade the git version.

Thanks,
zhong jiang


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

* Re: [PATCH] ext4/mballoc: Remove unneeded variable "err"
  2018-08-05 12:59   ` zhong jiang
@ 2018-08-05 14:49     ` Theodore Y. Ts'o
  0 siblings, 0 replies; 4+ messages in thread
From: Theodore Y. Ts'o @ 2018-08-05 14:49 UTC (permalink / raw)
  To: zhong jiang; +Cc: adilger.kernel, linux-ext4, linux-kernel

On Sun, Aug 05, 2018 at 08:59:33PM +0800, zhong jiang wrote:
>  I create the diff in this patch again ,but get the same result .
>  the git version is git version 1.7.12.4 but I create the diff in
>  git version 1.8.3.1. It shows the correct function name.

Ah, OK, so it was a git bug.  Whew!  Glad to have that mystery solved.  :-)

        	      	    	      	     - Ted

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

end of thread, other threads:[~2018-08-05 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-04 11:04 [PATCH] ext4/mballoc: Remove unneeded variable "err" zhong jiang
2018-08-04 21:24 ` Theodore Y. Ts'o
2018-08-05 12:59   ` zhong jiang
2018-08-05 14:49     ` Theodore Y. Ts'o

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).