Lines Matching refs:aeb
181 struct ubi_ainf_peb *aeb; in ubi_alloc_aeb() local
183 aeb = kmem_cache_zalloc(ai->aeb_slab_cache, GFP_KERNEL); in ubi_alloc_aeb()
184 if (!aeb) in ubi_alloc_aeb()
187 aeb->pnum = pnum; in ubi_alloc_aeb()
188 aeb->ec = ec; in ubi_alloc_aeb()
189 aeb->vol_id = UBI_UNKNOWN; in ubi_alloc_aeb()
190 aeb->lnum = UBI_UNKNOWN; in ubi_alloc_aeb()
192 return aeb; in ubi_alloc_aeb()
203 void ubi_free_aeb(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb) in ubi_free_aeb() argument
205 kmem_cache_free(ai->aeb_slab_cache, aeb); in ubi_free_aeb()
232 struct ubi_ainf_peb *aeb; in add_to_list() local
244 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_to_list()
245 if (!aeb) in add_to_list()
248 aeb->vol_id = vol_id; in add_to_list()
249 aeb->lnum = lnum; in add_to_list()
251 list_add(&aeb->u.list, list); in add_to_list()
253 list_add_tail(&aeb->u.list, list); in add_to_list()
270 struct ubi_ainf_peb *aeb; in add_corrupted() local
274 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_corrupted()
275 if (!aeb) in add_corrupted()
279 list_add(&aeb->u.list, &ai->corr); in add_corrupted()
299 struct ubi_ainf_peb *aeb; in add_fastmap() local
301 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_fastmap()
302 if (!aeb) in add_fastmap()
305 aeb->vol_id = be32_to_cpu(vid_hdr->vol_id); in add_fastmap()
306 aeb->sqnum = be64_to_cpu(vid_hdr->sqnum); in add_fastmap()
307 list_add(&aeb->u.list, &ai->fastmap); in add_fastmap()
310 aeb->vol_id, aeb->sqnum); in add_fastmap()
438 int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, in ubi_compare_lebs() argument
446 if (sqnum2 == aeb->sqnum) { in ubi_compare_lebs()
460 second_is_newer = (sqnum2 > aeb->sqnum); in ubi_compare_lebs()
479 if (!aeb->copy_flag) { in ubi_compare_lebs()
490 pnum = aeb->pnum; in ubi_compare_lebs()
569 struct ubi_ainf_peb *aeb; in ubi_add_to_av() local
595 aeb = rb_entry(parent, struct ubi_ainf_peb, u.rb); in ubi_add_to_av()
596 if (lnum != aeb->lnum) { in ubi_add_to_av()
597 if (lnum < aeb->lnum) in ubi_add_to_av()
610 aeb->pnum, aeb->sqnum, aeb->ec); in ubi_add_to_av()
625 if (aeb->sqnum == sqnum && sqnum != 0) { in ubi_add_to_av()
628 ubi_dump_aeb(aeb, 0); in ubi_add_to_av()
637 cmp_res = ubi_compare_lebs(ubi, aeb, pnum, vid_hdr); in ubi_add_to_av()
650 err = add_to_list(ai, aeb->pnum, aeb->vol_id, in ubi_add_to_av()
651 aeb->lnum, aeb->ec, cmp_res & 4, in ubi_add_to_av()
656 aeb->ec = ec; in ubi_add_to_av()
657 aeb->pnum = pnum; in ubi_add_to_av()
658 aeb->vol_id = vol_id; in ubi_add_to_av()
659 aeb->lnum = lnum; in ubi_add_to_av()
660 aeb->scrub = ((cmp_res & 2) || bitflips); in ubi_add_to_av()
661 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
662 aeb->sqnum = sqnum; in ubi_add_to_av()
688 aeb = ubi_alloc_aeb(ai, pnum, ec); in ubi_add_to_av()
689 if (!aeb) in ubi_add_to_av()
692 aeb->vol_id = vol_id; in ubi_add_to_av()
693 aeb->lnum = lnum; in ubi_add_to_av()
694 aeb->scrub = bitflips; in ubi_add_to_av()
695 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
696 aeb->sqnum = sqnum; in ubi_add_to_av()
704 rb_link_node(&aeb->u.rb, parent, p); in ubi_add_to_av()
705 rb_insert_color(&aeb->u.rb, &av->root); in ubi_add_to_av()
822 struct ubi_ainf_peb *aeb, *tmp_aeb; in ubi_early_get_peb() local
825 aeb = list_entry(ai->free.next, struct ubi_ainf_peb, u.list); in ubi_early_get_peb()
826 list_del(&aeb->u.list); in ubi_early_get_peb()
827 dbg_bld("return free PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
828 return aeb; in ubi_early_get_peb()
837 list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) { in ubi_early_get_peb()
838 if (aeb->ec == UBI_UNKNOWN) in ubi_early_get_peb()
839 aeb->ec = ai->mean_ec; in ubi_early_get_peb()
841 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); in ubi_early_get_peb()
845 aeb->ec += 1; in ubi_early_get_peb()
846 list_del(&aeb->u.list); in ubi_early_get_peb()
847 dbg_bld("return PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
848 return aeb; in ubi_early_get_peb()
1209 struct ubi_ainf_peb *aeb; in late_analysis() local
1224 list_for_each_entry(aeb, &ai->corr, u.list) in late_analysis()
1225 pr_cont(" %d", aeb->pnum); in late_analysis()
1280 struct ubi_ainf_peb *aeb; in destroy_av() local
1289 aeb = rb_entry(this, struct ubi_ainf_peb, u.rb); in destroy_av()
1292 if (this->rb_left == &aeb->u.rb) in destroy_av()
1299 list_add_tail(&aeb->u.list, list); in destroy_av()
1301 ubi_free_aeb(ai, aeb); in destroy_av()
1313 struct ubi_ainf_peb *aeb, *aeb_tmp; in destroy_ai() local
1317 list_for_each_entry_safe(aeb, aeb_tmp, &ai->alien, u.list) { in destroy_ai()
1318 list_del(&aeb->u.list); in destroy_ai()
1319 ubi_free_aeb(ai, aeb); in destroy_ai()
1321 list_for_each_entry_safe(aeb, aeb_tmp, &ai->erase, u.list) { in destroy_ai()
1322 list_del(&aeb->u.list); in destroy_ai()
1323 ubi_free_aeb(ai, aeb); in destroy_ai()
1325 list_for_each_entry_safe(aeb, aeb_tmp, &ai->corr, u.list) { in destroy_ai()
1326 list_del(&aeb->u.list); in destroy_ai()
1327 ubi_free_aeb(ai, aeb); in destroy_ai()
1329 list_for_each_entry_safe(aeb, aeb_tmp, &ai->free, u.list) { in destroy_ai()
1330 list_del(&aeb->u.list); in destroy_ai()
1331 ubi_free_aeb(ai, aeb); in destroy_ai()
1333 list_for_each_entry_safe(aeb, aeb_tmp, &ai->fastmap, u.list) { in destroy_ai()
1334 list_del(&aeb->u.list); in destroy_ai()
1335 ubi_free_aeb(ai, aeb); in destroy_ai()
1380 struct ubi_ainf_peb *aeb; in scan_all() local
1416 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in scan_all()
1417 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1418 aeb->ec = ai->mean_ec; in scan_all()
1421 list_for_each_entry(aeb, &ai->free, u.list) { in scan_all()
1422 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1423 aeb->ec = ai->mean_ec; in scan_all()
1426 list_for_each_entry(aeb, &ai->corr, u.list) in scan_all()
1427 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1428 aeb->ec = ai->mean_ec; in scan_all()
1430 list_for_each_entry(aeb, &ai->erase, u.list) in scan_all()
1431 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1432 aeb->ec = ai->mean_ec; in scan_all()
1665 struct ubi_ainf_peb *aeb, *last_aeb; in self_check_ai() local
1717 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1720 last_aeb = aeb; in self_check_ai()
1723 if (aeb->pnum < 0 || aeb->ec < 0) { in self_check_ai()
1728 if (aeb->ec < ai->min_ec) { in self_check_ai()
1730 ai->min_ec, aeb->ec); in self_check_ai()
1734 if (aeb->ec > ai->max_ec) { in self_check_ai()
1736 ai->max_ec, aeb->ec); in self_check_ai()
1740 if (aeb->pnum >= ubi->peb_count) { in self_check_ai()
1742 aeb->pnum, ubi->peb_count); in self_check_ai()
1747 if (aeb->lnum >= av->used_ebs) { in self_check_ai()
1758 if (aeb->lnum > av->highest_lnum) { in self_check_ai()
1773 aeb = last_aeb; in self_check_ai()
1775 if (aeb->lnum != av->highest_lnum) { in self_check_ai()
1790 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1795 last_aeb = aeb; in self_check_ai()
1797 err = ubi_io_read_vid_hdr(ubi, aeb->pnum, vidb, 1); in self_check_ai()
1813 if (aeb->sqnum != be64_to_cpu(vidh->sqnum)) { in self_check_ai()
1814 ubi_err(ubi, "bad sqnum %llu", aeb->sqnum); in self_check_ai()
1828 if (aeb->lnum != be32_to_cpu(vidh->lnum)) { in self_check_ai()
1829 ubi_err(ubi, "bad lnum %d", aeb->lnum); in self_check_ai()
1877 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in self_check_ai()
1878 buf[aeb->pnum] = 1; in self_check_ai()
1880 list_for_each_entry(aeb, &ai->free, u.list) in self_check_ai()
1881 buf[aeb->pnum] = 1; in self_check_ai()
1883 list_for_each_entry(aeb, &ai->corr, u.list) in self_check_ai()
1884 buf[aeb->pnum] = 1; in self_check_ai()
1886 list_for_each_entry(aeb, &ai->erase, u.list) in self_check_ai()
1887 buf[aeb->pnum] = 1; in self_check_ai()
1889 list_for_each_entry(aeb, &ai->alien, u.list) in self_check_ai()
1890 buf[aeb->pnum] = 1; in self_check_ai()
1905 ubi_err(ubi, "bad attaching information about LEB %d", aeb->lnum); in self_check_ai()
1906 ubi_dump_aeb(aeb, 0); in self_check_ai()