summaryrefslogtreecommitdiff
path: root/fs/ubifs
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2008-05-30 14:48:56 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-06-06 18:50:38 +0300
commit4e523c884b681db0c73ec6acd41172f9a4933bba (patch)
treeccf0dd44a832134a92f962aba02b1baf94dd2cce /fs/ubifs
parentd6a9b62c4b0305f0c7d38f6250d0fca7d52494a1 (diff)
UBIFS: tweak scan_for_dirty and asserts
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/find.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 624983caa561..c70e5cd7c0f2 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -111,10 +111,11 @@ static int scan_for_dirty_cb(struct ubifs_info *c,
if (data->exclude_index && lprops->flags & LPROPS_INDEX)
return ret;
/* If specified, exclude empty or freeable LEBs */
- if (!data->pick_free && lprops->free + lprops->dirty == c->leb_size)
- return ret;
+ if (lprops->free + lprops->dirty == c->leb_size) {
+ if (!data->pick_free)
+ return ret;
/* Exclude LEBs with too little dirty space (unless it is empty) */
- if (lprops->dirty < c->dead_wm && lprops->free != c->leb_size)
+ } else if (lprops->dirty < c->dead_wm)
return ret;
/* Finally we found space */
data->lnum = lprops->lnum;
@@ -189,7 +190,9 @@ static const struct ubifs_lprops *scan_for_dirty(struct ubifs_info *c,
return lprops;
ubifs_assert(lprops->lnum == data.lnum);
ubifs_assert(lprops->free + lprops->dirty >= min_space);
- ubifs_assert(lprops->dirty >= c->dead_wm);
+ ubifs_assert(lprops->dirty >= c->dead_wm ||
+ (pick_free &&
+ lprops->free + lprops->dirty == c->leb_size));
ubifs_assert(!(lprops->flags & LPROPS_TAKEN));
ubifs_assert(!(lprops->flags & LPROPS_INDEX));
return lprops;
@@ -320,7 +323,8 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
err = PTR_ERR(lp);
goto out;
}
- ubifs_assert(lp->dirty >= c->dead_wm);
+ ubifs_assert(lp->dirty >= c->dead_wm ||
+ (pick_free && lp->free + lp->dirty == c->leb_size));
found:
dbg_find("found LEB %d, free %d, dirty %d, flags %#x",