|
@@ -681,8 +681,16 @@ int ubifs_find_free_leb_for_idx(struct ubifs_info *c)
|
|
|
if (!lprops) {
|
|
|
lprops = ubifs_fast_find_freeable(c);
|
|
|
if (!lprops) {
|
|
|
- ubifs_assert(c->freeable_cnt == 0);
|
|
|
- if (c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {
|
|
|
+ /*
|
|
|
+ * The first condition means the following: go scan the
|
|
|
+ * LPT if there are uncategorized lprops, which means
|
|
|
+ * there may be freeable LEBs there (UBIFS does not
|
|
|
+ * store the information about freeable LEBs in the
|
|
|
+ * master node).
|
|
|
+ */
|
|
|
+ if (c->in_a_category_cnt != c->main_lebs ||
|
|
|
+ c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {
|
|
|
+ ubifs_assert(c->freeable_cnt == 0);
|
|
|
lprops = scan_for_leb_for_idx(c);
|
|
|
if (IS_ERR(lprops)) {
|
|
|
err = PTR_ERR(lprops);
|