Lines Matching refs:aeb

194 	struct ubi_ainf_peb *aeb;  in ubi_alloc_aeb()  local
196 aeb = kmem_cache_zalloc(ai->aeb_slab_cache, GFP_KERNEL); in ubi_alloc_aeb()
197 if (!aeb) in ubi_alloc_aeb()
200 aeb->pnum = pnum; in ubi_alloc_aeb()
201 aeb->ec = ec; in ubi_alloc_aeb()
202 aeb->vol_id = UBI_UNKNOWN; in ubi_alloc_aeb()
203 aeb->lnum = UBI_UNKNOWN; in ubi_alloc_aeb()
205 return aeb; in ubi_alloc_aeb()
216 void ubi_free_aeb(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb) in ubi_free_aeb() argument
218 kmem_cache_free(ai->aeb_slab_cache, aeb); in ubi_free_aeb()
245 struct ubi_ainf_peb *aeb; in add_to_list() local
257 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_to_list()
258 if (!aeb) in add_to_list()
261 aeb->vol_id = vol_id; in add_to_list()
262 aeb->lnum = lnum; in add_to_list()
264 list_add(&aeb->u.list, list); in add_to_list()
266 list_add_tail(&aeb->u.list, list); in add_to_list()
283 struct ubi_ainf_peb *aeb; in add_corrupted() local
287 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_corrupted()
288 if (!aeb) in add_corrupted()
292 list_add(&aeb->u.list, &ai->corr); in add_corrupted()
312 struct ubi_ainf_peb *aeb; in add_fastmap() local
314 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_fastmap()
315 if (!aeb) in add_fastmap()
318 aeb->vol_id = be32_to_cpu(vid_hdr->vol_id); in add_fastmap()
319 aeb->sqnum = be64_to_cpu(vid_hdr->sqnum); in add_fastmap()
320 list_add(&aeb->u.list, &ai->fastmap); in add_fastmap()
323 aeb->vol_id, aeb->sqnum); in add_fastmap()
451 int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, in ubi_compare_lebs() argument
459 if (sqnum2 == aeb->sqnum) { in ubi_compare_lebs()
473 second_is_newer = (sqnum2 > aeb->sqnum); in ubi_compare_lebs()
492 if (!aeb->copy_flag) { in ubi_compare_lebs()
503 pnum = aeb->pnum; in ubi_compare_lebs()
582 struct ubi_ainf_peb *aeb; in ubi_add_to_av() local
608 aeb = rb_entry(parent, struct ubi_ainf_peb, u.rb); in ubi_add_to_av()
609 if (lnum != aeb->lnum) { in ubi_add_to_av()
610 if (lnum < aeb->lnum) in ubi_add_to_av()
623 aeb->pnum, aeb->sqnum, aeb->ec); in ubi_add_to_av()
638 if (aeb->sqnum == sqnum && sqnum != 0) { in ubi_add_to_av()
641 ubi_dump_aeb(aeb, 0); in ubi_add_to_av()
650 cmp_res = ubi_compare_lebs(ubi, aeb, pnum, vid_hdr); in ubi_add_to_av()
663 err = add_to_list(ai, aeb->pnum, aeb->vol_id, in ubi_add_to_av()
664 aeb->lnum, aeb->ec, cmp_res & 4, in ubi_add_to_av()
669 aeb->ec = ec; in ubi_add_to_av()
670 aeb->pnum = pnum; in ubi_add_to_av()
671 aeb->vol_id = vol_id; in ubi_add_to_av()
672 aeb->lnum = lnum; in ubi_add_to_av()
673 aeb->scrub = ((cmp_res & 2) || bitflips); in ubi_add_to_av()
674 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
675 aeb->sqnum = sqnum; in ubi_add_to_av()
701 aeb = ubi_alloc_aeb(ai, pnum, ec); in ubi_add_to_av()
702 if (!aeb) in ubi_add_to_av()
705 aeb->vol_id = vol_id; in ubi_add_to_av()
706 aeb->lnum = lnum; in ubi_add_to_av()
707 aeb->scrub = bitflips; in ubi_add_to_av()
708 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
709 aeb->sqnum = sqnum; in ubi_add_to_av()
717 rb_link_node(&aeb->u.rb, parent, p); in ubi_add_to_av()
718 rb_insert_color(&aeb->u.rb, &av->root); in ubi_add_to_av()
835 struct ubi_ainf_peb *aeb, *tmp_aeb; in ubi_early_get_peb() local
838 aeb = list_entry(ai->free.next, struct ubi_ainf_peb, u.list); in ubi_early_get_peb()
839 list_del(&aeb->u.list); in ubi_early_get_peb()
840 dbg_bld("return free PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
841 return aeb; in ubi_early_get_peb()
850 list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) { in ubi_early_get_peb()
851 if (aeb->ec == UBI_UNKNOWN) in ubi_early_get_peb()
852 aeb->ec = ai->mean_ec; in ubi_early_get_peb()
854 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); in ubi_early_get_peb()
858 aeb->ec += 1; in ubi_early_get_peb()
859 list_del(&aeb->u.list); in ubi_early_get_peb()
860 dbg_bld("return PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
861 return aeb; in ubi_early_get_peb()
1221 struct ubi_ainf_peb *aeb; in late_analysis() local
1236 list_for_each_entry(aeb, &ai->corr, u.list) in late_analysis()
1237 pr_cont(" %d", aeb->pnum); in late_analysis()
1292 struct ubi_ainf_peb *aeb; in destroy_av() local
1301 aeb = rb_entry(this, struct ubi_ainf_peb, u.rb); in destroy_av()
1304 if (this->rb_left == &aeb->u.rb) in destroy_av()
1311 list_add_tail(&aeb->u.list, list); in destroy_av()
1313 ubi_free_aeb(ai, aeb); in destroy_av()
1325 struct ubi_ainf_peb *aeb, *aeb_tmp; in destroy_ai() local
1329 list_for_each_entry_safe(aeb, aeb_tmp, &ai->alien, 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->erase, u.list) { in destroy_ai()
1334 list_del(&aeb->u.list); in destroy_ai()
1335 ubi_free_aeb(ai, aeb); in destroy_ai()
1337 list_for_each_entry_safe(aeb, aeb_tmp, &ai->corr, u.list) { in destroy_ai()
1338 list_del(&aeb->u.list); in destroy_ai()
1339 ubi_free_aeb(ai, aeb); in destroy_ai()
1341 list_for_each_entry_safe(aeb, aeb_tmp, &ai->free, u.list) { in destroy_ai()
1342 list_del(&aeb->u.list); in destroy_ai()
1343 ubi_free_aeb(ai, aeb); in destroy_ai()
1345 list_for_each_entry_safe(aeb, aeb_tmp, &ai->fastmap, u.list) { in destroy_ai()
1346 list_del(&aeb->u.list); in destroy_ai()
1347 ubi_free_aeb(ai, aeb); in destroy_ai()
1392 struct ubi_ainf_peb *aeb; in scan_all() local
1428 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in scan_all()
1429 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1430 aeb->ec = ai->mean_ec; in scan_all()
1433 list_for_each_entry(aeb, &ai->free, u.list) { in scan_all()
1434 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1435 aeb->ec = ai->mean_ec; in scan_all()
1438 list_for_each_entry(aeb, &ai->corr, u.list) in scan_all()
1439 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1440 aeb->ec = ai->mean_ec; in scan_all()
1442 list_for_each_entry(aeb, &ai->erase, u.list) in scan_all()
1443 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1444 aeb->ec = ai->mean_ec; in scan_all()
1677 struct ubi_ainf_peb *aeb, *last_aeb; in self_check_ai() local
1729 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1732 last_aeb = aeb; in self_check_ai()
1735 if (aeb->pnum < 0 || aeb->ec < 0) { in self_check_ai()
1740 if (aeb->ec < ai->min_ec) { in self_check_ai()
1742 ai->min_ec, aeb->ec); in self_check_ai()
1746 if (aeb->ec > ai->max_ec) { in self_check_ai()
1748 ai->max_ec, aeb->ec); in self_check_ai()
1752 if (aeb->pnum >= ubi->peb_count) { in self_check_ai()
1754 aeb->pnum, ubi->peb_count); in self_check_ai()
1759 if (aeb->lnum >= av->used_ebs) { in self_check_ai()
1770 if (aeb->lnum > av->highest_lnum) { in self_check_ai()
1785 aeb = last_aeb; in self_check_ai()
1787 if (aeb->lnum != av->highest_lnum) { in self_check_ai()
1802 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1807 last_aeb = aeb; in self_check_ai()
1809 err = ubi_io_read_vid_hdr(ubi, aeb->pnum, vidb, 1); in self_check_ai()
1825 if (aeb->sqnum != be64_to_cpu(vidh->sqnum)) { in self_check_ai()
1826 ubi_err(ubi, "bad sqnum %llu", aeb->sqnum); in self_check_ai()
1840 if (aeb->lnum != be32_to_cpu(vidh->lnum)) { in self_check_ai()
1841 ubi_err(ubi, "bad lnum %d", aeb->lnum); in self_check_ai()
1889 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in self_check_ai()
1890 buf[aeb->pnum] = 1; in self_check_ai()
1892 list_for_each_entry(aeb, &ai->free, u.list) in self_check_ai()
1893 buf[aeb->pnum] = 1; in self_check_ai()
1895 list_for_each_entry(aeb, &ai->corr, u.list) in self_check_ai()
1896 buf[aeb->pnum] = 1; in self_check_ai()
1898 list_for_each_entry(aeb, &ai->erase, u.list) in self_check_ai()
1899 buf[aeb->pnum] = 1; in self_check_ai()
1901 list_for_each_entry(aeb, &ai->alien, u.list) in self_check_ai()
1902 buf[aeb->pnum] = 1; in self_check_ai()
1917 ubi_err(ubi, "bad attaching information about LEB %d", aeb->lnum); in self_check_ai()
1918 ubi_dump_aeb(aeb, 0); in self_check_ai()