Patchwork UBIFS: remove unnecessary code in ubifs_garbage_collect

login
register
mail settings
Submitter wang.bo116@zte.com.cn
Date Aug. 16, 2013, 7:43 a.m.
Message ID <OF476A1E1E.10D82F3D-ON48257BC9.002911AE-48257BC9.002A75A8@zte.com.cn>
Download mbox | patch
Permalink /patch/267566/
State New
Headers show

Comments

wang.bo116@zte.com.cn - Aug. 16, 2013, 7:43 a.m.
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>
Brian Norris - Sept. 17, 2013, 1:51 a.m.
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 Garcia - Oct. 19, 2013, 1:27 p.m.
(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>
>
Artem Bityutskiy - Oct. 22, 2013, 2:44 p.m.
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!

Patch

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();