Lines Matching refs:pnum

42  * @pnum: The PEB to be makred as seen
45 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen)
50 set_bit(pnum, seen);
60 int pnum, ret = 0;
65 for (pnum = 0; pnum < ubi->peb_count; pnum++) {
66 if (!test_bit(pnum, seen) && ubi->lookuptbl[pnum]) {
67 ubi_err(ubi, "self-check failed for PEB %d, fastmap didn't see it", pnum);
130 * @pnum: PEB number of the new attach erase block
137 int pnum, int ec, int scrub)
141 aeb = ubi_alloc_aeb(ai, pnum, ec);
267 if (aeb->pnum == new_aeb->pnum) {
274 cmp_res = ubi_compare_lebs(ubi, aeb, new_aeb->pnum, new_vh);
280 victim = ubi_alloc_aeb(ai, aeb->pnum, aeb->ec);
291 av->vol_id, aeb->lnum, new_aeb->pnum);
294 aeb->pnum = new_aeb->pnum;
303 av->vol_id, aeb->lnum, new_aeb->pnum);
368 * @pnum: The PEB to be unmapped
370 static void unmap_peb(struct ubi_attach_info *ai, int pnum)
378 if (aeb->pnum == pnum) {
408 int i, pnum, err, ret = 0;
432 pnum = be32_to_cpu(pebs[i]);
434 if (ubi_io_is_bad(ubi, pnum)) {
440 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
443 pnum, err);
462 err = ubi_io_read_vid_hdr(ubi, pnum, vb, 0);
465 unmap_peb(ai, pnum);
466 dbg_bld("Adding PEB to free: %i", pnum);
471 ret = add_aeb(ai, free, pnum, ec, scrub);
476 dbg_bld("Found non empty PEB:%i in pool", pnum);
481 new_aeb = ubi_alloc_aeb(ai, pnum, be64_to_cpu(ech->ec));
643 ret = add_aeb(ai, &ai->free, be32_to_cpu(fmec->pnum),
656 ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum),
669 ret = add_aeb(ai, &used, be32_to_cpu(fmec->pnum),
682 ret = add_aeb(ai, &ai->erase, be32_to_cpu(fmec->pnum),
735 int pnum = be32_to_cpu(fm_eba->pnum[j]);
737 if (pnum < 0)
742 if (tmp_aeb->pnum == pnum) {
749 ubi_err(ubi, "PEB %i is in EBA but not in used list", pnum);
761 aeb->pnum, aeb->lnum, av->vol_id);
824 ret = aeb->pnum;
836 new = ubi_alloc_aeb(ai, old->pnum, old->ec);
869 int i, used_blocks, pnum, fm_anchor, ret = 0;
958 pnum = be32_to_cpu(fmsb->block_loc[i]);
960 if (ubi_io_is_bad(ubi, pnum)) {
965 if (i == 0 && pnum != fm_anchor) {
967 pnum, fm_anchor);
972 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
975 i, pnum);
997 ret = ubi_io_read_vid_hdr(ubi, pnum, vb, 0);
1000 i, pnum);
1026 pnum, 0, ubi->leb_size);
1029 "err: %i)", i, pnum, ret);
1072 e->pnum = be32_to_cpu(fmsb2->block_loc[i]);
1224 fec->pnum = cpu_to_be32(wl_e->pnum);
1225 set_seen(ubi, wl_e->pnum, seen_pebs);
1237 fec->pnum = cpu_to_be32(wl_e->pnum);
1238 set_seen(ubi, wl_e->pnum, seen_pebs);
1249 fec->pnum = cpu_to_be32(wl_e->pnum);
1250 set_seen(ubi, wl_e->pnum, seen_pebs);
1262 fec->pnum = cpu_to_be32(wl_e->pnum);
1263 set_seen(ubi, wl_e->pnum, seen_pebs);
1280 fec->pnum = cpu_to_be32(wl_e->pnum);
1281 set_seen(ubi, wl_e->pnum, seen_pebs);
1321 feba->pnum[j] = cpu_to_be32(ldesc.pnum);
1336 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum);
1337 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avbuf);
1344 fmsb->block_loc[i] = cpu_to_be32(new_fm->e[i]->pnum);
1345 set_seen(ubi, new_fm->e[i]->pnum, seen_pebs);
1357 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum));
1358 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvbuf);
1361 new_fm->e[i]->pnum);
1368 new_fm->e[i]->pnum, 0, ubi->leb_size);
1371 new_fm->e[i]->pnum);
1396 * @pnum: PEB to be erased
1400 static int erase_block(struct ubi_device *ubi, int pnum)
1410 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0);
1418 ret = ubi_io_sync_erase(ubi, pnum, 0);
1430 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr);
1486 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vb);
1580 ret = erase_block(ubi, old_fm->e[i]->pnum);
1632 ret = erase_block(ubi, old_fm->e[0]->pnum);