Lines Matching refs:pnum
45 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen) in set_seen() argument
50 set_bit(pnum, seen); in set_seen()
60 int pnum, ret = 0; in self_check_seen() local
65 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in self_check_seen()
66 if (!test_bit(pnum, seen) && ubi->lookuptbl[pnum]) { in self_check_seen()
67 ubi_err(ubi, "self-check failed for PEB %d, fastmap didn't see it", pnum); in self_check_seen()
136 int pnum, int ec, int scrub) in add_aeb() argument
140 aeb = ubi_alloc_aeb(ai, pnum, ec); in add_aeb()
266 if (aeb->pnum == new_aeb->pnum) { in update_vol()
273 cmp_res = ubi_compare_lebs(ubi, aeb, new_aeb->pnum, new_vh); in update_vol()
279 victim = ubi_alloc_aeb(ai, aeb->pnum, aeb->ec); in update_vol()
290 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
293 aeb->pnum = new_aeb->pnum; in update_vol()
302 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
369 static void unmap_peb(struct ubi_attach_info *ai, int pnum) in unmap_peb() argument
377 if (aeb->pnum == pnum) { in unmap_peb()
407 int i, pnum, err, ret = 0; in scan_pool() local
431 pnum = be32_to_cpu(pebs[i]); in scan_pool()
433 if (ubi_io_is_bad(ubi, pnum)) { in scan_pool()
439 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in scan_pool()
442 pnum, err); in scan_pool()
461 err = ubi_io_read_vid_hdr(ubi, pnum, vb, 0); in scan_pool()
464 unmap_peb(ai, pnum); in scan_pool()
465 dbg_bld("Adding PEB to free: %i", pnum); in scan_pool()
470 ret = add_aeb(ai, free, pnum, ec, scrub); in scan_pool()
475 dbg_bld("Found non empty PEB:%i in pool", pnum); in scan_pool()
480 new_aeb = ubi_alloc_aeb(ai, pnum, be64_to_cpu(ech->ec)); in scan_pool()
642 ret = add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
655 ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
668 ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
681 ret = add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
734 int pnum = be32_to_cpu(fm_eba->pnum[j]); in ubi_attach_fastmap() local
736 if (pnum < 0) in ubi_attach_fastmap()
741 if (tmp_aeb->pnum == pnum) { in ubi_attach_fastmap()
748 ubi_err(ubi, "PEB %i is in EBA but not in used list", pnum); in ubi_attach_fastmap()
760 aeb->pnum, aeb->lnum, av->vol_id); in ubi_attach_fastmap()
823 ret = aeb->pnum; in find_fm_anchor()
835 new = ubi_alloc_aeb(ai, old->pnum, old->ec); in clone_aeb()
868 int i, used_blocks, pnum, fm_anchor, ret = 0; in ubi_scan_fastmap() local
957 pnum = be32_to_cpu(fmsb->block_loc[i]); in ubi_scan_fastmap()
959 if (ubi_io_is_bad(ubi, pnum)) { in ubi_scan_fastmap()
964 if (i == 0 && pnum != fm_anchor) { in ubi_scan_fastmap()
966 pnum, fm_anchor); in ubi_scan_fastmap()
971 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in ubi_scan_fastmap()
974 i, pnum); in ubi_scan_fastmap()
996 ret = ubi_io_read_vid_hdr(ubi, pnum, vb, 0); in ubi_scan_fastmap()
999 i, pnum); in ubi_scan_fastmap()
1025 pnum, 0, ubi->leb_size); in ubi_scan_fastmap()
1028 "err: %i)", i, pnum, ret); in ubi_scan_fastmap()
1071 e->pnum = be32_to_cpu(fmsb2->block_loc[i]); in ubi_scan_fastmap()
1223 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1224 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1236 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1237 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1248 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1249 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()
1279 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1280 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1320 feba->pnum[j] = cpu_to_be32(ldesc.pnum); in ubi_write_fastmap()
1335 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum); in ubi_write_fastmap()
1336 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avbuf); in ubi_write_fastmap()
1343 fmsb->block_loc[i] = cpu_to_be32(new_fm->e[i]->pnum); in ubi_write_fastmap()
1344 set_seen(ubi, new_fm->e[i]->pnum, seen_pebs); in ubi_write_fastmap()
1356 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum)); in ubi_write_fastmap()
1357 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvbuf); in ubi_write_fastmap()
1360 new_fm->e[i]->pnum); in ubi_write_fastmap()
1367 new_fm->e[i]->pnum, 0, ubi->leb_size); in ubi_write_fastmap()
1370 new_fm->e[i]->pnum); in ubi_write_fastmap()
1399 static int erase_block(struct ubi_device *ubi, int pnum) in erase_block() argument
1409 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0); in erase_block()
1417 ret = ubi_io_sync_erase(ubi, pnum, 0); in erase_block()
1429 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr); in erase_block()
1485 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vb); in invalidate_fastmap()
1579 ret = erase_block(ubi, old_fm->e[i]->pnum); in ubi_update_fastmap()
1631 ret = erase_block(ubi, old_fm->e[0]->pnum); in ubi_update_fastmap()