Lines Matching refs:aeb

121 	struct ubi_ainf_peb *aeb;  in add_to_list()  local
133 aeb = kmem_cache_alloc(ai->aeb_slab_cache, GFP_KERNEL); in add_to_list()
134 if (!aeb) in add_to_list()
137 aeb->pnum = pnum; in add_to_list()
138 aeb->vol_id = vol_id; in add_to_list()
139 aeb->lnum = lnum; in add_to_list()
140 aeb->ec = ec; in add_to_list()
142 list_add(&aeb->u.list, list); in add_to_list()
144 list_add_tail(&aeb->u.list, list); in add_to_list()
161 struct ubi_ainf_peb *aeb; in add_corrupted() local
165 aeb = kmem_cache_alloc(ai->aeb_slab_cache, GFP_KERNEL); in add_corrupted()
166 if (!aeb) in add_corrupted()
170 aeb->pnum = pnum; in add_corrupted()
171 aeb->ec = ec; in add_corrupted()
172 list_add(&aeb->u.list, &ai->corr); in add_corrupted()
323 int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, in ubi_compare_lebs() argument
331 if (sqnum2 == aeb->sqnum) { in ubi_compare_lebs()
345 second_is_newer = (sqnum2 > aeb->sqnum); in ubi_compare_lebs()
364 if (!aeb->copy_flag) { in ubi_compare_lebs()
375 pnum = aeb->pnum; in ubi_compare_lebs()
454 struct ubi_ainf_peb *aeb; in ubi_add_to_av() local
480 aeb = rb_entry(parent, struct ubi_ainf_peb, u.rb); in ubi_add_to_av()
481 if (lnum != aeb->lnum) { in ubi_add_to_av()
482 if (lnum < aeb->lnum) in ubi_add_to_av()
495 aeb->pnum, aeb->sqnum, aeb->ec); in ubi_add_to_av()
510 if (aeb->sqnum == sqnum && sqnum != 0) { in ubi_add_to_av()
513 ubi_dump_aeb(aeb, 0); in ubi_add_to_av()
522 cmp_res = ubi_compare_lebs(ubi, aeb, pnum, vid_hdr); in ubi_add_to_av()
535 err = add_to_list(ai, aeb->pnum, aeb->vol_id, in ubi_add_to_av()
536 aeb->lnum, aeb->ec, cmp_res & 4, in ubi_add_to_av()
541 aeb->ec = ec; in ubi_add_to_av()
542 aeb->pnum = pnum; in ubi_add_to_av()
543 aeb->vol_id = vol_id; in ubi_add_to_av()
544 aeb->lnum = lnum; in ubi_add_to_av()
545 aeb->scrub = ((cmp_res & 2) || bitflips); in ubi_add_to_av()
546 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
547 aeb->sqnum = sqnum; in ubi_add_to_av()
573 aeb = kmem_cache_alloc(ai->aeb_slab_cache, GFP_KERNEL); in ubi_add_to_av()
574 if (!aeb) in ubi_add_to_av()
577 aeb->ec = ec; in ubi_add_to_av()
578 aeb->pnum = pnum; in ubi_add_to_av()
579 aeb->vol_id = vol_id; in ubi_add_to_av()
580 aeb->lnum = lnum; in ubi_add_to_av()
581 aeb->scrub = bitflips; in ubi_add_to_av()
582 aeb->copy_flag = vid_hdr->copy_flag; in ubi_add_to_av()
583 aeb->sqnum = sqnum; in ubi_add_to_av()
591 rb_link_node(&aeb->u.rb, parent, p); in ubi_add_to_av()
592 rb_insert_color(&aeb->u.rb, &av->root); in ubi_add_to_av()
633 struct ubi_ainf_peb *aeb; in ubi_remove_av() local
638 aeb = rb_entry(rb, struct ubi_ainf_peb, u.rb); in ubi_remove_av()
639 rb_erase(&aeb->u.rb, &av->root); in ubi_remove_av()
640 list_add_tail(&aeb->u.list, &ai->erase); in ubi_remove_av()
712 struct ubi_ainf_peb *aeb, *tmp_aeb; in ubi_early_get_peb() local
715 aeb = list_entry(ai->free.next, struct ubi_ainf_peb, u.list); in ubi_early_get_peb()
716 list_del(&aeb->u.list); in ubi_early_get_peb()
717 dbg_bld("return free PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
718 return aeb; in ubi_early_get_peb()
727 list_for_each_entry_safe(aeb, tmp_aeb, &ai->erase, u.list) { in ubi_early_get_peb()
728 if (aeb->ec == UBI_UNKNOWN) in ubi_early_get_peb()
729 aeb->ec = ai->mean_ec; in ubi_early_get_peb()
731 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); in ubi_early_get_peb()
735 aeb->ec += 1; in ubi_early_get_peb()
736 list_del(&aeb->u.list); in ubi_early_get_peb()
737 dbg_bld("return PEB %d, EC %d", aeb->pnum, aeb->ec); in ubi_early_get_peb()
738 return aeb; in ubi_early_get_peb()
1069 struct ubi_ainf_peb *aeb; in late_analysis() local
1084 list_for_each_entry(aeb, &ai->corr, u.list) in late_analysis()
1085 pr_cont(" %d", aeb->pnum); in late_analysis()
1138 struct ubi_ainf_peb *aeb; in destroy_av() local
1147 aeb = rb_entry(this, struct ubi_ainf_peb, u.rb); in destroy_av()
1150 if (this->rb_left == &aeb->u.rb) in destroy_av()
1156 kmem_cache_free(ai->aeb_slab_cache, aeb); in destroy_av()
1168 struct ubi_ainf_peb *aeb, *aeb_tmp; in destroy_ai() local
1172 list_for_each_entry_safe(aeb, aeb_tmp, &ai->alien, u.list) { in destroy_ai()
1173 list_del(&aeb->u.list); in destroy_ai()
1174 kmem_cache_free(ai->aeb_slab_cache, aeb); in destroy_ai()
1176 list_for_each_entry_safe(aeb, aeb_tmp, &ai->erase, u.list) { in destroy_ai()
1177 list_del(&aeb->u.list); in destroy_ai()
1178 kmem_cache_free(ai->aeb_slab_cache, aeb); in destroy_ai()
1180 list_for_each_entry_safe(aeb, aeb_tmp, &ai->corr, u.list) { in destroy_ai()
1181 list_del(&aeb->u.list); in destroy_ai()
1182 kmem_cache_free(ai->aeb_slab_cache, aeb); in destroy_ai()
1184 list_for_each_entry_safe(aeb, aeb_tmp, &ai->free, u.list) { in destroy_ai()
1185 list_del(&aeb->u.list); in destroy_ai()
1186 kmem_cache_free(ai->aeb_slab_cache, aeb); in destroy_ai()
1232 struct ubi_ainf_peb *aeb; in scan_all() local
1268 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in scan_all()
1269 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1270 aeb->ec = ai->mean_ec; in scan_all()
1273 list_for_each_entry(aeb, &ai->free, u.list) { in scan_all()
1274 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1275 aeb->ec = ai->mean_ec; in scan_all()
1278 list_for_each_entry(aeb, &ai->corr, u.list) in scan_all()
1279 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1280 aeb->ec = ai->mean_ec; in scan_all()
1282 list_for_each_entry(aeb, &ai->erase, u.list) in scan_all()
1283 if (aeb->ec == UBI_UNKNOWN) in scan_all()
1284 aeb->ec = ai->mean_ec; in scan_all()
1508 struct ubi_ainf_peb *aeb, *last_aeb; in self_check_ai() local
1560 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1563 last_aeb = aeb; in self_check_ai()
1566 if (aeb->pnum < 0 || aeb->ec < 0) { in self_check_ai()
1571 if (aeb->ec < ai->min_ec) { in self_check_ai()
1573 ai->min_ec, aeb->ec); in self_check_ai()
1577 if (aeb->ec > ai->max_ec) { in self_check_ai()
1579 ai->max_ec, aeb->ec); in self_check_ai()
1583 if (aeb->pnum >= ubi->peb_count) { in self_check_ai()
1585 aeb->pnum, ubi->peb_count); in self_check_ai()
1590 if (aeb->lnum >= av->used_ebs) { in self_check_ai()
1601 if (aeb->lnum > av->highest_lnum) { in self_check_ai()
1616 aeb = last_aeb; in self_check_ai()
1618 if (aeb->lnum != av->highest_lnum) { in self_check_ai()
1633 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { in self_check_ai()
1638 last_aeb = aeb; in self_check_ai()
1640 err = ubi_io_read_vid_hdr(ubi, aeb->pnum, vidh, 1); in self_check_ai()
1656 if (aeb->sqnum != be64_to_cpu(vidh->sqnum)) { in self_check_ai()
1657 ubi_err(ubi, "bad sqnum %llu", aeb->sqnum); in self_check_ai()
1671 if (aeb->lnum != be32_to_cpu(vidh->lnum)) { in self_check_ai()
1672 ubi_err(ubi, "bad lnum %d", aeb->lnum); in self_check_ai()
1720 ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) in self_check_ai()
1721 buf[aeb->pnum] = 1; in self_check_ai()
1723 list_for_each_entry(aeb, &ai->free, u.list) in self_check_ai()
1724 buf[aeb->pnum] = 1; in self_check_ai()
1726 list_for_each_entry(aeb, &ai->corr, u.list) in self_check_ai()
1727 buf[aeb->pnum] = 1; in self_check_ai()
1729 list_for_each_entry(aeb, &ai->erase, u.list) in self_check_ai()
1730 buf[aeb->pnum] = 1; in self_check_ai()
1732 list_for_each_entry(aeb, &ai->alien, u.list) in self_check_ai()
1733 buf[aeb->pnum] = 1; in self_check_ai()
1748 ubi_err(ubi, "bad attaching information about LEB %d", aeb->lnum); in self_check_ai()
1749 ubi_dump_aeb(aeb, 0); in self_check_ai()