Lines Matching refs:lprops
42 static int valuable(struct ubifs_info *c, const struct ubifs_lprops *lprops) in valuable() argument
44 int n, cat = lprops->flags & LPROPS_CAT_MASK; in valuable()
54 if (lprops->free + lprops->dirty >= c->dark_wm) in valuable()
84 const struct ubifs_lprops *lprops, int in_tree, in scan_for_dirty_cb() argument
90 if (lprops->flags & LPROPS_TAKEN) in scan_for_dirty_cb()
93 if (!in_tree && valuable(c, lprops)) in scan_for_dirty_cb()
96 if (lprops->free + lprops->dirty < data->min_space) in scan_for_dirty_cb()
99 if (data->exclude_index && lprops->flags & LPROPS_INDEX) in scan_for_dirty_cb()
102 if (lprops->free + lprops->dirty == c->leb_size) { in scan_for_dirty_cb()
106 } else if (lprops->dirty < c->dead_wm) in scan_for_dirty_cb()
109 data->lnum = lprops->lnum; in scan_for_dirty_cb()
128 const struct ubifs_lprops *lprops; in scan_for_dirty() local
136 lprops = heap->arr[i]; in scan_for_dirty()
137 if (lprops->free + lprops->dirty < min_space) in scan_for_dirty()
139 if (lprops->dirty < c->dead_wm) in scan_for_dirty()
141 return lprops; in scan_for_dirty()
150 list_for_each_entry(lprops, &c->uncat_list, list) { in scan_for_dirty()
151 if (lprops->flags & LPROPS_TAKEN) in scan_for_dirty()
153 if (lprops->free + lprops->dirty < min_space) in scan_for_dirty()
155 if (exclude_index && (lprops->flags & LPROPS_INDEX)) in scan_for_dirty()
157 if (lprops->dirty < c->dead_wm) in scan_for_dirty()
159 return lprops; in scan_for_dirty()
176 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in scan_for_dirty()
177 if (IS_ERR(lprops)) in scan_for_dirty()
178 return lprops; in scan_for_dirty()
179 ubifs_assert(c, lprops->lnum == data.lnum); in scan_for_dirty()
180 ubifs_assert(c, lprops->free + lprops->dirty >= min_space); in scan_for_dirty()
181 ubifs_assert(c, lprops->dirty >= c->dead_wm || in scan_for_dirty()
183 lprops->free + lprops->dirty == c->leb_size)); in scan_for_dirty()
184 ubifs_assert(c, !(lprops->flags & LPROPS_TAKEN)); in scan_for_dirty()
185 ubifs_assert(c, !exclude_index || !(lprops->flags & LPROPS_INDEX)); in scan_for_dirty()
186 return lprops; in scan_for_dirty()
351 const struct ubifs_lprops *lprops, int in_tree, in scan_for_free_cb() argument
357 if (lprops->flags & LPROPS_TAKEN) in scan_for_free_cb()
360 if (!in_tree && valuable(c, lprops)) in scan_for_free_cb()
363 if (lprops->flags & LPROPS_INDEX) in scan_for_free_cb()
366 if (lprops->free < data->min_space) in scan_for_free_cb()
369 if (!data->pick_free && lprops->free == c->leb_size) in scan_for_free_cb()
377 if (lprops->free + lprops->dirty == c->leb_size && lprops->dirty > 0) in scan_for_free_cb()
380 data->lnum = lprops->lnum; in scan_for_free_cb()
399 const struct ubifs_lprops *lprops; in do_find_free_space() local
405 lprops = ubifs_fast_find_free(c); in do_find_free_space()
406 if (lprops && lprops->free >= min_space) in do_find_free_space()
407 return lprops; in do_find_free_space()
410 lprops = ubifs_fast_find_empty(c); in do_find_free_space()
411 if (lprops) in do_find_free_space()
412 return lprops; in do_find_free_space()
415 lprops = ubifs_fast_find_free(c); in do_find_free_space()
416 if (lprops && lprops->free >= min_space) in do_find_free_space()
417 return lprops; in do_find_free_space()
422 lprops = heap->arr[i]; in do_find_free_space()
423 if (lprops->free >= min_space) in do_find_free_space()
424 return lprops; in do_find_free_space()
433 list_for_each_entry(lprops, &c->uncat_list, list) { in do_find_free_space()
434 if (lprops->flags & LPROPS_TAKEN) in do_find_free_space()
436 if (lprops->flags & LPROPS_INDEX) in do_find_free_space()
438 if (lprops->free >= min_space) in do_find_free_space()
439 return lprops; in do_find_free_space()
455 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in do_find_free_space()
456 if (IS_ERR(lprops)) in do_find_free_space()
457 return lprops; in do_find_free_space()
458 ubifs_assert(c, lprops->lnum == data.lnum); in do_find_free_space()
459 ubifs_assert(c, lprops->free >= min_space); in do_find_free_space()
460 ubifs_assert(c, !(lprops->flags & LPROPS_TAKEN)); in do_find_free_space()
461 ubifs_assert(c, !(lprops->flags & LPROPS_INDEX)); in do_find_free_space()
462 return lprops; in do_find_free_space()
484 const struct ubifs_lprops *lprops; in ubifs_find_free_space() local
528 lprops = do_find_free_space(c, min_space, pick_free, squeeze); in ubifs_find_free_space()
529 if (IS_ERR(lprops)) { in ubifs_find_free_space()
530 err = PTR_ERR(lprops); in ubifs_find_free_space()
534 lnum = lprops->lnum; in ubifs_find_free_space()
535 flags = lprops->flags | LPROPS_TAKEN; in ubifs_find_free_space()
537 lprops = ubifs_change_lp(c, lprops, LPROPS_NC, LPROPS_NC, flags, 0); in ubifs_find_free_space()
538 if (IS_ERR(lprops)) { in ubifs_find_free_space()
539 err = PTR_ERR(lprops); in ubifs_find_free_space()
549 *offs = c->leb_size - lprops->free; in ubifs_find_free_space()
591 const struct ubifs_lprops *lprops, int in_tree, in scan_for_idx_cb() argument
597 if (lprops->flags & LPROPS_TAKEN) in scan_for_idx_cb()
600 if (!in_tree && valuable(c, lprops)) in scan_for_idx_cb()
603 if (lprops->flags & LPROPS_INDEX) in scan_for_idx_cb()
606 if (lprops->free + lprops->dirty != c->leb_size) in scan_for_idx_cb()
613 data->lnum = lprops->lnum; in scan_for_idx_cb()
623 const struct ubifs_lprops *lprops; in scan_for_leb_for_idx() local
635 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in scan_for_leb_for_idx()
636 if (IS_ERR(lprops)) in scan_for_leb_for_idx()
637 return lprops; in scan_for_leb_for_idx()
638 ubifs_assert(c, lprops->lnum == data.lnum); in scan_for_leb_for_idx()
639 ubifs_assert(c, lprops->free + lprops->dirty == c->leb_size); in scan_for_leb_for_idx()
640 ubifs_assert(c, !(lprops->flags & LPROPS_TAKEN)); in scan_for_leb_for_idx()
641 ubifs_assert(c, !(lprops->flags & LPROPS_INDEX)); in scan_for_leb_for_idx()
642 return lprops; in scan_for_leb_for_idx()
663 const struct ubifs_lprops *lprops; in ubifs_find_free_leb_for_idx() local
668 lprops = ubifs_fast_find_empty(c); in ubifs_find_free_leb_for_idx()
669 if (!lprops) { in ubifs_find_free_leb_for_idx()
670 lprops = ubifs_fast_find_freeable(c); in ubifs_find_free_leb_for_idx()
671 if (!lprops) { in ubifs_find_free_leb_for_idx()
682 lprops = scan_for_leb_for_idx(c); in ubifs_find_free_leb_for_idx()
683 if (IS_ERR(lprops)) { in ubifs_find_free_leb_for_idx()
684 err = PTR_ERR(lprops); in ubifs_find_free_leb_for_idx()
691 if (!lprops) { in ubifs_find_free_leb_for_idx()
696 lnum = lprops->lnum; in ubifs_find_free_leb_for_idx()
699 lnum, lprops->free, lprops->dirty, lprops->flags); in ubifs_find_free_leb_for_idx()
701 flags = lprops->flags | LPROPS_TAKEN | LPROPS_INDEX; in ubifs_find_free_leb_for_idx()
702 lprops = ubifs_change_lp(c, lprops, c->leb_size, 0, flags, 0); in ubifs_find_free_leb_for_idx()
703 if (IS_ERR(lprops)) { in ubifs_find_free_leb_for_idx()
704 err = PTR_ERR(lprops); in ubifs_find_free_leb_for_idx()
784 const struct ubifs_lprops *lprops, int in_tree, in scan_dirty_idx_cb() argument
790 if (lprops->flags & LPROPS_TAKEN) in scan_dirty_idx_cb()
793 if (!in_tree && valuable(c, lprops)) in scan_dirty_idx_cb()
796 if (!(lprops->flags & LPROPS_INDEX)) in scan_dirty_idx_cb()
799 if (lprops->free + lprops->dirty < c->min_idx_node_sz) in scan_dirty_idx_cb()
802 data->lnum = lprops->lnum; in scan_dirty_idx_cb()
818 const struct ubifs_lprops *lprops; in find_dirty_idx_leb() local
827 lprops = heap->arr[i]; in find_dirty_idx_leb()
828 ret = scan_dirty_idx_cb(c, lprops, 1, &data); in find_dirty_idx_leb()
832 list_for_each_entry(lprops, &c->frdi_idx_list, list) { in find_dirty_idx_leb()
833 ret = scan_dirty_idx_cb(c, lprops, 1, &data); in find_dirty_idx_leb()
837 list_for_each_entry(lprops, &c->uncat_list, list) { in find_dirty_idx_leb()
838 ret = scan_dirty_idx_cb(c, lprops, 1, &data); in find_dirty_idx_leb()
853 lprops = ubifs_lpt_lookup_dirty(c, data.lnum); in find_dirty_idx_leb()
854 if (IS_ERR(lprops)) in find_dirty_idx_leb()
855 return PTR_ERR(lprops); in find_dirty_idx_leb()
856 ubifs_assert(c, lprops->lnum == data.lnum); in find_dirty_idx_leb()
857 ubifs_assert(c, lprops->free + lprops->dirty >= c->min_idx_node_sz); in find_dirty_idx_leb()
858 ubifs_assert(c, !(lprops->flags & LPROPS_TAKEN)); in find_dirty_idx_leb()
859 ubifs_assert(c, (lprops->flags & LPROPS_INDEX)); in find_dirty_idx_leb()
862 lprops->lnum, lprops->free, lprops->dirty, lprops->flags); in find_dirty_idx_leb()
864 lprops = ubifs_change_lp(c, lprops, LPROPS_NC, LPROPS_NC, in find_dirty_idx_leb()
865 lprops->flags | LPROPS_TAKEN, 0); in find_dirty_idx_leb()
866 if (IS_ERR(lprops)) in find_dirty_idx_leb()
867 return PTR_ERR(lprops); in find_dirty_idx_leb()
869 return lprops->lnum; in find_dirty_idx_leb()