linux-safety.lists.elisa.tech archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/ext4: Remove unecessary deadstores
@ 2021-12-06 15:01 Milan Lakhani
  2021-12-06 15:01 ` [linux-safety] " Milan Lakhani
  2021-12-06 15:36 ` Lukas Bulwahn
  0 siblings, 2 replies; 6+ messages in thread
From: Milan Lakhani @ 2021-12-06 15:01 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn, nghialm78; +Cc: Milan Lakhani

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 fs/ext4/namei.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 52c9bd154122..f341478e9740 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 	if (err != -ENOSPC)
 		goto cleanup;
 
-	err = 0;
 	/* Block full, should compress but for now just split */
 	dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
 		       dx_get_count(entries), dx_get_limit(entries)));
@@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 			/* Which index block gets the new entry? */
 			if (at - entries >= icount1) {
 				frame->at = at - entries - icount1 + entries2;
-				frame->entries = entries = entries2;
+				frame->entries;
 				swap(frame->bh, bh2);
 			}
 			dx_insert_block((frame - 1), hash2, newblock);
@@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
 		retval = ext4_mark_inode_dirty(handle, dir);
 		if (retval)
 			goto out;
-	} else {
-		retval = 0;
 	}
 	if (inode->i_nlink == 0)
 		ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
-- 
2.25.1



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

* [linux-safety] [PATCH] fs/ext4: Remove unecessary deadstores
  2021-12-06 15:01 [PATCH] fs/ext4: Remove unecessary deadstores Milan Lakhani
@ 2021-12-06 15:01 ` Milan Lakhani
  2021-12-06 15:36 ` Lukas Bulwahn
  1 sibling, 0 replies; 6+ messages in thread
From: Milan Lakhani @ 2021-12-06 15:01 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn, nghialm78; +Cc: Milan Lakhani

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 fs/ext4/namei.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 52c9bd154122..f341478e9740 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 	if (err != -ENOSPC)
 		goto cleanup;
 
-	err = 0;
 	/* Block full, should compress but for now just split */
 	dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
 		       dx_get_count(entries), dx_get_limit(entries)));
@@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 			/* Which index block gets the new entry? */
 			if (at - entries >= icount1) {
 				frame->at = at - entries - icount1 + entries2;
-				frame->entries = entries = entries2;
+				frame->entries;
 				swap(frame->bh, bh2);
 			}
 			dx_insert_block((frame - 1), hash2, newblock);
@@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
 		retval = ext4_mark_inode_dirty(handle, dir);
 		if (retval)
 			goto out;
-	} else {
-		retval = 0;
 	}
 	if (inode->i_nlink == 0)
 		ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#265): https://lists.elisa.tech/g/linux-safety/message/265
Mute This Topic: https://lists.elisa.tech/mt/87541425/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [linux-safety] [PATCH] fs/ext4: Remove unecessary deadstores
  2021-12-06 15:01 [PATCH] fs/ext4: Remove unecessary deadstores Milan Lakhani
  2021-12-06 15:01 ` [linux-safety] " Milan Lakhani
@ 2021-12-06 15:36 ` Lukas Bulwahn
  2021-12-06 15:36   ` Lukas Bulwahn
  2021-12-06 16:09   ` Milan Lakhani
  1 sibling, 2 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2021-12-06 15:36 UTC (permalink / raw)
  To: Milan Lakhani; +Cc: linux-safety, Nghia Le

On Mon, Dec 6, 2021 at 4:01 PM Milan Lakhani
<milan.lakhani@codethink.co.uk> wrote:
>

I think you do need to provide a commit message. The change looks
reasonable, except dropping the assignment to frame->entries.

The commit message should explain why this should be dropped.

> Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
> ---
>  fs/ext4/namei.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 52c9bd154122..f341478e9740 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>         if (err != -ENOSPC)
>                 goto cleanup;
>
> -       err = 0;
>         /* Block full, should compress but for now just split */
>         dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
>                        dx_get_count(entries), dx_get_limit(entries)));
> @@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>                         /* Which index block gets the new entry? */
>                         if (at - entries >= icount1) {
>                                 frame->at = at - entries - icount1 + entries2;
> -                               frame->entries = entries = entries2;
> +                               frame->entries;

This looks strange: you still want to assign frame->entries = entries2, right?

>                                 swap(frame->bh, bh2);
>                         }
>                         dx_insert_block((frame - 1), hash2, newblock);
> @@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
>                 retval = ext4_mark_inode_dirty(handle, dir);
>                 if (retval)
>                         goto out;
> -       } else {
> -               retval = 0;
>         }
>         if (inode->i_nlink == 0)
>                 ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
> --
> 2.25.1
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#265): https://lists.elisa.tech/g/linux-safety/message/265
> Mute This Topic: https://lists.elisa.tech/mt/87541425/1714638
> Group Owner: linux-safety+owner@lists.elisa.tech
> Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [lukas.bulwahn@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>


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

* Re: [linux-safety] [PATCH] fs/ext4: Remove unecessary deadstores
  2021-12-06 15:36 ` Lukas Bulwahn
@ 2021-12-06 15:36   ` Lukas Bulwahn
  2021-12-06 16:09   ` Milan Lakhani
  1 sibling, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2021-12-06 15:36 UTC (permalink / raw)
  To: Milan Lakhani; +Cc: linux-safety, Nghia Le

On Mon, Dec 6, 2021 at 4:01 PM Milan Lakhani
<milan.lakhani@codethink.co.uk> wrote:
>

I think you do need to provide a commit message. The change looks
reasonable, except dropping the assignment to frame->entries.

The commit message should explain why this should be dropped.

> Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
> ---
>  fs/ext4/namei.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 52c9bd154122..f341478e9740 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>         if (err != -ENOSPC)
>                 goto cleanup;
>
> -       err = 0;
>         /* Block full, should compress but for now just split */
>         dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
>                        dx_get_count(entries), dx_get_limit(entries)));
> @@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>                         /* Which index block gets the new entry? */
>                         if (at - entries >= icount1) {
>                                 frame->at = at - entries - icount1 + entries2;
> -                               frame->entries = entries = entries2;
> +                               frame->entries;

This looks strange: you still want to assign frame->entries = entries2, right?

>                                 swap(frame->bh, bh2);
>                         }
>                         dx_insert_block((frame - 1), hash2, newblock);
> @@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
>                 retval = ext4_mark_inode_dirty(handle, dir);
>                 if (retval)
>                         goto out;
> -       } else {
> -               retval = 0;
>         }
>         if (inode->i_nlink == 0)
>                 ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
> --
> 2.25.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#266): https://lists.elisa.tech/g/linux-safety/message/266
Mute This Topic: https://lists.elisa.tech/mt/87541425/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [linux-safety] [PATCH] fs/ext4: Remove unecessary deadstores
  2021-12-06 15:36 ` Lukas Bulwahn
  2021-12-06 15:36   ` Lukas Bulwahn
@ 2021-12-06 16:09   ` Milan Lakhani
  2021-12-06 16:09     ` Milan Lakhani
  1 sibling, 1 reply; 6+ messages in thread
From: Milan Lakhani @ 2021-12-06 16:09 UTC (permalink / raw)
  To: Lukas Bulwahn; +Cc: linux-safety, Nghia Le

Thanks, got it, it should still be assigned to entries2.

On 06/12/2021 15:36, Lukas Bulwahn wrote:
> On Mon, Dec 6, 2021 at 4:01 PM Milan Lakhani
> <milan.lakhani@codethink.co.uk> wrote:
> I think you do need to provide a commit message. The change looks
> reasonable, except dropping the assignment to frame->entries.
>
> The commit message should explain why this should be dropped.
>
>> Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
>> ---
>>   fs/ext4/namei.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
>> index 52c9bd154122..f341478e9740 100644
>> --- a/fs/ext4/namei.c
>> +++ b/fs/ext4/namei.c
>> @@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>>          if (err != -ENOSPC)
>>                  goto cleanup;
>>
>> -       err = 0;
>>          /* Block full, should compress but for now just split */
>>          dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
>>                         dx_get_count(entries), dx_get_limit(entries)));
>> @@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>>                          /* Which index block gets the new entry? */
>>                          if (at - entries >= icount1) {
>>                                  frame->at = at - entries - icount1 + entries2;
>> -                               frame->entries = entries = entries2;
>> +                               frame->entries;
> This looks strange: you still want to assign frame->entries = entries2, right?
>
>>                                  swap(frame->bh, bh2);
>>                          }
>>                          dx_insert_block((frame - 1), hash2, newblock);
>> @@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
>>                  retval = ext4_mark_inode_dirty(handle, dir);
>>                  if (retval)
>>                          goto out;
>> -       } else {
>> -               retval = 0;
>>          }
>>          if (inode->i_nlink == 0)
>>                  ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
>> --
>> 2.25.1
>>
>>
>>
>>
>>
>>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#266): https://lists.elisa.tech/g/linux-safety/message/266
> Mute This Topic: https://lists.elisa.tech/mt/87541425/4617862
> Group Owner: linux-safety+owner@lists.elisa.tech
> Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [milan.lakhani@codethink.co.uk]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
>
-- 
Milan Lakhani
Codethink Ltd.
3rd Floor Dale House,
35 Dale Street,
Manchester, M1 2HF
United Kingdom



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

* Re: [linux-safety] [PATCH] fs/ext4: Remove unecessary deadstores
  2021-12-06 16:09   ` Milan Lakhani
@ 2021-12-06 16:09     ` Milan Lakhani
  0 siblings, 0 replies; 6+ messages in thread
From: Milan Lakhani @ 2021-12-06 16:09 UTC (permalink / raw)
  To: Lukas Bulwahn; +Cc: linux-safety, Nghia Le

Thanks, got it, it should still be assigned to entries2.

On 06/12/2021 15:36, Lukas Bulwahn wrote:
> On Mon, Dec 6, 2021 at 4:01 PM Milan Lakhani
> <milan.lakhani@codethink.co.uk> wrote:
> I think you do need to provide a commit message. The change looks
> reasonable, except dropping the assignment to frame->entries.
>
> The commit message should explain why this should be dropped.
>
>> Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
>> ---
>>   fs/ext4/namei.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
>> index 52c9bd154122..f341478e9740 100644
>> --- a/fs/ext4/namei.c
>> +++ b/fs/ext4/namei.c
>> @@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>>          if (err != -ENOSPC)
>>                  goto cleanup;
>>
>> -       err = 0;
>>          /* Block full, should compress but for now just split */
>>          dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
>>                         dx_get_count(entries), dx_get_limit(entries)));
>> @@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>>                          /* Which index block gets the new entry? */
>>                          if (at - entries >= icount1) {
>>                                  frame->at = at - entries - icount1 + entries2;
>> -                               frame->entries = entries = entries2;
>> +                               frame->entries;
> This looks strange: you still want to assign frame->entries = entries2, right?
>
>>                                  swap(frame->bh, bh2);
>>                          }
>>                          dx_insert_block((frame - 1), hash2, newblock);
>> @@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
>>                  retval = ext4_mark_inode_dirty(handle, dir);
>>                  if (retval)
>>                          goto out;
>> -       } else {
>> -               retval = 0;
>>          }
>>          if (inode->i_nlink == 0)
>>                  ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
>> --
>> 2.25.1
>>
>>
>>
>>
>>
>>
>
> 
>
>
>
-- 
Milan Lakhani
Codethink Ltd.
3rd Floor Dale House,
35 Dale Street,
Manchester, M1 2HF
United Kingdom



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#268): https://lists.elisa.tech/g/linux-safety/message/268
Mute This Topic: https://lists.elisa.tech/mt/87541425/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2021-12-06 16:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 15:01 [PATCH] fs/ext4: Remove unecessary deadstores Milan Lakhani
2021-12-06 15:01 ` [linux-safety] " Milan Lakhani
2021-12-06 15:36 ` Lukas Bulwahn
2021-12-06 15:36   ` Lukas Bulwahn
2021-12-06 16:09   ` Milan Lakhani
2021-12-06 16:09     ` Milan Lakhani

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