linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
@ 2013-08-15 10:54 wang.bo116
  2013-08-15 21:15 ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: wang.bo116 @ 2013-08-15 10:54 UTC (permalink / raw)
  To: linux-mtd; +Cc: artem.bityutskiy


Hi,
	In ubifs_garbage_collect, "space_before" calculate twice, i think the
first one is unnecessary.


Signed-off-by: wang bo <wang.bo116@zte.com.cn>
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 76ca53c..38dc67d 100755
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -668,7 +668,7 @@ int ubifs_garbage_collect(struct ubifs_info *c, int
anyway)
 	ubifs_assert(!wbuf->used);

 	for (i = 0; ; i++) {
-		int space_before = c->leb_size - wbuf->offs - wbuf->used;
+		int space_before;
 		int space_after;

 		cond_resched();

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

* Re: [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
  2013-08-15 10:54 wang.bo116
@ 2013-08-15 21:15 ` Ezequiel Garcia
  0 siblings, 0 replies; 6+ messages in thread
From: Ezequiel Garcia @ 2013-08-15 21:15 UTC (permalink / raw)
  To: wang.bo116; +Cc: artem.bityutskiy, linux-mtd

Hi,

First of all: thanks for contributing!

On Thu, Aug 15, 2013 at 06:54:26PM +0800, wang.bo116@zte.com.cn wrote:
> 
> Hi,
> 	In ubifs_garbage_collect, "space_before" calculate twice, i think the
> first one is unnecessary.
> 

Mmm... this is not the way patches are contributed, although you were
close.

Please read: Documentation/SubmittingPatches and maybe see this video
as well:

http://www.youtube.com/watch?v=XXix80GCvpo

Thanks!

> 
> Signed-off-by: wang bo <wang.bo116@zte.com.cn>
> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
> index 76ca53c..38dc67d 100755
> --- a/fs/ubifs/gc.c
> +++ b/fs/ubifs/gc.c
> @@ -668,7 +668,7 @@ int ubifs_garbage_collect(struct ubifs_info *c, int
> anyway)
>  	ubifs_assert(!wbuf->used);
> 
>  	for (i = 0; ; i++) {
> -		int space_before = c->leb_size - wbuf->offs - wbuf->used;
> +		int space_before;
>  		int space_after;
> 
>  		cond_resched();
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
@ 2013-08-16  7:43 wang.bo116
  2013-09-17  1:51 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: wang.bo116 @ 2013-08-16  7:43 UTC (permalink / raw)
  To: linux-mtd



Hi,
	In ubifs_garbage_collect,local variable "space_before" calculate twice. In fact, at the
beginning of the loop, there is no need to calculate this variable. Calculate it before call
"ubifs_garbage_collect_leb" is enough. This patch just remove the unnecessary calculate code.



Signed-off-by: wang bo <wang.bo116@zte.com.cn>
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 76ca53c..38dc67d 100755
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -668,7 +668,7 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
 	ubifs_assert(!wbuf->used);

 	for (i = 0; ; i++) {
-		int space_before = c->leb_size - wbuf->offs - wbuf->used;
+		int space_before;
 		int space_after;

 		cond_resched();

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

* Re: [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
  2013-08-16  7:43 [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect wang.bo116
@ 2013-09-17  1:51 ` Brian Norris
  2013-10-19 13:27   ` Ezequiel Garcia
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2013-09-17  1:51 UTC (permalink / raw)
  To: wang.bo116; +Cc: linux-mtd

On Fri, Aug 16, 2013 at 03:43:36PM +0800, wang.bo116@zte.com.cn wrote:
> Hi,
> 	In ubifs_garbage_collect,local variable "space_before" calculate twice. In fact, at the
> beginning of the loop, there is no need to calculate this variable. Calculate it before call
> "ubifs_garbage_collect_leb" is enough. This patch just remove the unnecessary calculate code.
> 
> 
> 
> Signed-off-by: wang bo <wang.bo116@zte.com.cn>

Acked-by: Brian Norris <computersforpeace@gmail.com>

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

* Re: [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
  2013-09-17  1:51 ` Brian Norris
@ 2013-10-19 13:27   ` Ezequiel Garcia
  2013-10-22 14:44     ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Ezequiel Garcia @ 2013-10-19 13:27 UTC (permalink / raw)
  To: linux-mtd; +Cc: wang.bo116, Brian Norris, linux-mtd, Artem Bityutskiy

(Ccing Artem who might have missed this one)

On Mon, Sep 16, 2013 at 06:51:05PM -0700, Brian Norris wrote:
> On Fri, Aug 16, 2013 at 03:43:36PM +0800, wang.bo116@zte.com.cn wrote:
> > Hi,
> > 	In ubifs_garbage_collect,local variable "space_before" calculate twice. In fact, at the
> > beginning of the loop, there is no need to calculate this variable. Calculate it before call
> > "ubifs_garbage_collect_leb" is enough. This patch just remove the unnecessary calculate code.
> > 
> > 
> > 
> > Signed-off-by: wang bo <wang.bo116@zte.com.cn>
> 
> Acked-by: Brian Norris <computersforpeace@gmail.com>
> 

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect
  2013-10-19 13:27   ` Ezequiel Garcia
@ 2013-10-22 14:44     ` Artem Bityutskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2013-10-22 14:44 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: wang.bo116, Brian Norris, linux-mtd

On Sat, 2013-10-19 at 10:27 -0300, Ezequiel Garcia wrote:
> (Ccing Artem who might have missed this one)
> 
> On Mon, Sep 16, 2013 at 06:51:05PM -0700, Brian Norris wrote:
> > On Fri, Aug 16, 2013 at 03:43:36PM +0800, wang.bo116@zte.com.cn wrote:
> > > Hi,
> > > 	In ubifs_garbage_collect,local variable "space_before" calculate twice. In fact, at the
> > > beginning of the loop, there is no need to calculate this variable. Calculate it before call
> > > "ubifs_garbage_collect_leb" is enough. This patch just remove the unnecessary calculate code.
> > > 
> > > 
> > > 
> > > Signed-off-by: wang bo <wang.bo116@zte.com.cn>
> > 
> > Acked-by: Brian Norris <computersforpeace@gmail.com>

Pushed to linux-ubifs.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

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

end of thread, other threads:[~2013-10-22 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16  7:43 [PATCH] UBIFS: remove unnecessary code in ubifs_garbage_collect wang.bo116
2013-09-17  1:51 ` Brian Norris
2013-10-19 13:27   ` Ezequiel Garcia
2013-10-22 14:44     ` Artem Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2013-08-15 10:54 wang.bo116
2013-08-15 21:15 ` Ezequiel Garcia

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