Lines Matching refs:pnum
55 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen) in set_seen() argument
60 set_bit(pnum, seen); in set_seen()
70 int pnum, ret = 0; in self_check_seen() local
75 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in self_check_seen()
76 if (test_bit(pnum, seen) && ubi->lookuptbl[pnum]) { in self_check_seen()
77 ubi_err(ubi, "self-check failed for PEB %d, fastmap didn't see it", pnum); in self_check_seen()
146 int pnum, int ec, int scrub) in add_aeb() argument
150 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_aeb()
277 if (aeb->pnum == new_aeb->pnum) { in update_vol()
284 cmp_res = ubi_compare_lebs(ubi, aeb, new_aeb->pnum, new_vh); in update_vol()
290 victim = ubi_alloc_aeb(ai, aeb->pnum, aeb->ec); in update_vol()
301 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
304 aeb->pnum = new_aeb->pnum; in update_vol()
313 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
380 static void unmap_peb(struct ubi_attach_info *ai, int pnum) in unmap_peb() argument
388 if (aeb->pnum == pnum) { in unmap_peb()
418 int i, pnum, err, ret = 0; in scan_pool() local
442 pnum = be32_to_cpu(pebs[i]); in scan_pool()
444 if (ubi_io_is_bad(ubi, pnum)) { in scan_pool()
450 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in scan_pool()
453 pnum, err); in scan_pool()
472 err = ubi_io_read_vid_hdr(ubi, pnum, vb, 0); in scan_pool()
475 unmap_peb(ai, pnum); in scan_pool()
476 dbg_bld("Adding PEB to free: %i", pnum); in scan_pool()
481 add_aeb(ai, free, pnum, ec, scrub); in scan_pool()
484 dbg_bld("Found non empty PEB:%i in pool", pnum); in scan_pool()
489 new_aeb = ubi_alloc_aeb(ai, pnum, be64_to_cpu(ech->ec)); in scan_pool()
651 add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
662 add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
673 add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
684 add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
735 int pnum = be32_to_cpu(fm_eba->pnum[j]); in ubi_attach_fastmap() local
737 if (pnum < 0) in ubi_attach_fastmap()
742 if (tmp_aeb->pnum == pnum) { in ubi_attach_fastmap()
749 ubi_err(ubi, "PEB %i is in EBA but not in used list", pnum); in ubi_attach_fastmap()
761 aeb->pnum, aeb->lnum, av->vol_id); in ubi_attach_fastmap()
824 ret = aeb->pnum; in find_fm_anchor()
836 new = ubi_alloc_aeb(ai, old->pnum, old->ec); in clone_aeb()
869 int i, used_blocks, pnum, fm_anchor, ret = 0; in ubi_scan_fastmap() local
958 pnum = be32_to_cpu(fmsb->block_loc[i]); in ubi_scan_fastmap()
960 if (ubi_io_is_bad(ubi, pnum)) { in ubi_scan_fastmap()
965 if (i == 0 && pnum != fm_anchor) { in ubi_scan_fastmap()
967 pnum, fm_anchor); in ubi_scan_fastmap()
972 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in ubi_scan_fastmap()
975 i, pnum); in ubi_scan_fastmap()
997 ret = ubi_io_read_vid_hdr(ubi, pnum, vb, 0); in ubi_scan_fastmap()
1000 i, pnum); in ubi_scan_fastmap()
1026 pnum, 0, ubi->leb_size); in ubi_scan_fastmap()
1029 "err: %i)", i, pnum, ret); in ubi_scan_fastmap()
1072 e->pnum = be32_to_cpu(fmsb2->block_loc[i]); in ubi_scan_fastmap()
1205 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1206 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1218 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1219 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1230 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1231 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1243 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1244 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1261 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1262 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1302 feba->pnum[j] = cpu_to_be32(ldesc.pnum); in ubi_write_fastmap()
1317 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum); in ubi_write_fastmap()
1318 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avbuf); in ubi_write_fastmap()
1325 fmsb->block_loc[i] = cpu_to_be32(new_fm->e[i]->pnum); in ubi_write_fastmap()
1326 set_seen(ubi, new_fm->e[i]->pnum, seen_pebs); in ubi_write_fastmap()
1338 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum)); in ubi_write_fastmap()
1339 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvbuf); in ubi_write_fastmap()
1342 new_fm->e[i]->pnum); in ubi_write_fastmap()
1349 new_fm->e[i]->pnum, 0, ubi->leb_size); in ubi_write_fastmap()
1352 new_fm->e[i]->pnum); in ubi_write_fastmap()
1378 static int erase_block(struct ubi_device *ubi, int pnum) in erase_block() argument
1388 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0); in erase_block()
1396 ret = ubi_io_sync_erase(ubi, pnum, 0); in erase_block()
1408 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr); in erase_block()
1464 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vb); in invalidate_fastmap()
1566 ret = erase_block(ubi, old_fm->e[i]->pnum); in ubi_update_fastmap()
1617 ret = erase_block(ubi, old_fm->e[0]->pnum); in ubi_update_fastmap()