From 2405f5948119cdc1c28697fd3110124dad974898 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 26 Apr 2011 09:49:32 +0300 Subject: UBIFS: remove duplicated code We have duplicated code in 'ubifs_garbage_collect()' and 'ubifs_rcvry_gc_commit()', which is about handling the special case of free LEB. In both cases we just want to garbage-collect the LEB using 'ubifs_garbage_collect_leb()'. This patch teaches 'ubifs_garbage_collect_leb()' to handle free LEB's so that the caller does not have to do this and the duplicated code is removed. Signed-off-by: Artem Bityutskiy --- fs/ubifs/recovery.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'fs/ubifs/recovery.c') diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 3dbad6fbd1eb..1a72046efed5 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -1125,25 +1125,10 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c) } return err; } + ubifs_assert(!(lp.flags & LPROPS_INDEX)); lnum = lp.lnum; - if (lp.free + lp.dirty == c->leb_size) { - /* An empty LEB was returned */ - if (lp.free != c->leb_size) { - err = ubifs_change_one_lp(c, lnum, c->leb_size, - 0, 0, 0, 0); - if (err) - return err; - } - err = ubifs_leb_unmap(c, lnum); - if (err) - return err; - c->gc_lnum = lnum; - dbg_rcvry("allocated LEB %d for GC", lnum); - /* Run the commit */ - dbg_rcvry("committing"); - return ubifs_run_commit(c); - } + /* * There was no empty LEB so the used space in the dirtiest LEB must fit * in the GC head LEB. -- cgit v1.2.3-59-g8ed1b