Lines Matching refs:pnum
54 static inline void set_seen(struct ubi_device *ubi, int pnum, int *seen) in set_seen() argument
59 seen[pnum] = 1; in set_seen()
69 int pnum, ret = 0; in self_check_seen() local
74 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in self_check_seen()
75 if (!seen[pnum] && ubi->lookuptbl[pnum]) { in self_check_seen()
76 ubi_err(ubi, "self-check failed for PEB %d, fastmap didn't see it", pnum); in self_check_seen()
143 int pnum, int ec, int scrub) in add_aeb() argument
151 aeb->pnum = pnum; in add_aeb()
297 if (aeb->pnum == new_aeb->pnum) { in update_vol()
304 cmp_res = ubi_compare_lebs(ubi, aeb, new_aeb->pnum, new_vh); in update_vol()
316 victim->pnum = aeb->pnum; in update_vol()
324 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
327 aeb->pnum = new_aeb->pnum; in update_vol()
335 av->vol_id, aeb->lnum, new_aeb->pnum); in update_vol()
419 static void unmap_peb(struct ubi_attach_info *ai, int pnum) in unmap_peb() argument
431 if (aeb->pnum == pnum) { in unmap_peb()
466 int i, pnum, err, ret = 0; in scan_pool() local
488 pnum = be32_to_cpu(pebs[i]); in scan_pool()
490 if (ubi_io_is_bad(ubi, pnum)) { in scan_pool()
496 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in scan_pool()
499 pnum, err); in scan_pool()
518 err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in scan_pool()
521 unmap_peb(ai, pnum); in scan_pool()
522 dbg_bld("Adding PEB to free: %i", pnum); in scan_pool()
524 add_aeb(ai, free, pnum, ec, 1); in scan_pool()
526 add_aeb(ai, free, pnum, ec, 0); in scan_pool()
529 dbg_bld("Found non empty PEB:%i in pool", pnum); in scan_pool()
542 new_aeb->pnum = pnum; in scan_pool()
699 add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
710 add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
721 add_aeb(ai, &used, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
732 add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum), in ubi_attach_fastmap()
783 int pnum = be32_to_cpu(fm_eba->pnum[j]); in ubi_attach_fastmap() local
785 if ((int)be32_to_cpu(fm_eba->pnum[j]) < 0) in ubi_attach_fastmap()
790 if (tmp_aeb->pnum == pnum) { in ubi_attach_fastmap()
797 ubi_err(ubi, "PEB %i is in EBA but not in used list", pnum); in ubi_attach_fastmap()
809 aeb->pnum, aeb->lnum, av->vol_id); in ubi_attach_fastmap()
884 int i, used_blocks, pnum, ret = 0; in ubi_scan_fastmap() local
956 pnum = be32_to_cpu(fmsb->block_loc[i]); in ubi_scan_fastmap()
958 if (ubi_io_is_bad(ubi, pnum)) { in ubi_scan_fastmap()
963 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in ubi_scan_fastmap()
966 i, pnum); in ubi_scan_fastmap()
988 ret = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in ubi_scan_fastmap()
991 i, pnum); in ubi_scan_fastmap()
1016 ret = ubi_io_read(ubi, ubi->fm_buf + (ubi->leb_size * i), pnum, in ubi_scan_fastmap()
1020 "err: %i)", i, pnum, ret); in ubi_scan_fastmap()
1063 e->pnum = be32_to_cpu(fmsb2->block_loc[i]); in ubi_scan_fastmap()
1191 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1192 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1204 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1205 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1216 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1217 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1229 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1230 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1247 fec->pnum = cpu_to_be32(wl_e->pnum); in ubi_write_fastmap()
1248 set_seen(ubi, wl_e->pnum, seen_pebs); in ubi_write_fastmap()
1285 feba->pnum[j] = cpu_to_be32(vol->eba_tbl[j]); in ubi_write_fastmap()
1299 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum); in ubi_write_fastmap()
1300 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avhdr); in ubi_write_fastmap()
1307 fmsb->block_loc[i] = cpu_to_be32(new_fm->e[i]->pnum); in ubi_write_fastmap()
1308 set_seen(ubi, new_fm->e[i]->pnum, seen_pebs); in ubi_write_fastmap()
1320 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum)); in ubi_write_fastmap()
1321 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvhdr); in ubi_write_fastmap()
1324 new_fm->e[i]->pnum); in ubi_write_fastmap()
1331 new_fm->e[i]->pnum, ubi->leb_start, ubi->leb_size); in ubi_write_fastmap()
1334 new_fm->e[i]->pnum); in ubi_write_fastmap()
1360 static int erase_block(struct ubi_device *ubi, int pnum) in erase_block() argument
1370 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0); in erase_block()
1378 ret = ubi_io_sync_erase(ubi, pnum, 0); in erase_block()
1390 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr); in erase_block()
1443 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vh); in invalidate_fastmap()
1537 ret = erase_block(ubi, old_fm->e[i]->pnum); in ubi_update_fastmap()
1588 ret = erase_block(ubi, old_fm->e[0]->pnum); in ubi_update_fastmap()