Lines Matching defs:pnum

43  * @pnum: The PEB to be makred as seen
46 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen)
51 set_bit(pnum, seen);
61 int pnum, ret = 0;
66 for (pnum = 0; pnum < ubi->peb_count; pnum++) {
67 if (!test_bit(pnum, seen) && ubi->lookuptbl[pnum]) {
68 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;
851 int i, used_blocks, pnum, fm_anchor, ret = 0;
860 /* Add fastmap blocks(pnum < UBI_FM_MAX_START) into attach structure. */
862 ret = add_aeb(ai, &ai->fastmap, aeb->pnum, aeb->ec, 0);
936 pnum = be32_to_cpu(fmsb->block_loc[i]);
938 if (ubi_io_is_bad(ubi, pnum)) {
943 if (i == 0 && pnum != fm_anchor) {
945 pnum, fm_anchor);
950 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
953 i, pnum);
975 ret = ubi_io_read_vid_hdr(ubi, pnum, vb, 0);
978 i, pnum);
1004 pnum, 0, ubi->leb_size);
1007 "err: %i)", i, pnum, ret);
1012 * Add left fastmap blocks (pnum >= UBI_FM_MAX_START) into
1015 if (pnum >= UBI_FM_MAX_START) {
1016 ret = add_aeb(ai, &ai->fastmap, pnum,
1061 e->pnum = be32_to_cpu(fmsb2->block_loc[i]);
1214 fec->pnum = cpu_to_be32(wl_e->pnum);
1215 set_seen(ubi, wl_e->pnum, seen_pebs);
1227 fec->pnum = cpu_to_be32(wl_e->pnum);
1228 set_seen(ubi, wl_e->pnum, seen_pebs);
1239 fec->pnum = cpu_to_be32(wl_e->pnum);
1240 set_seen(ubi, wl_e->pnum, seen_pebs);
1252 fec->pnum = cpu_to_be32(wl_e->pnum);
1253 set_seen(ubi, wl_e->pnum, seen_pebs);
1270 fec->pnum = cpu_to_be32(wl_e->pnum);
1271 set_seen(ubi, wl_e->pnum, seen_pebs);
1311 feba->pnum[j] = cpu_to_be32(ldesc.pnum);
1326 dbg_bld("writing fastmap SB to PEB %i", new_fm->e[0]->pnum);
1327 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[0]->pnum, avbuf);
1334 fmsb->block_loc[i] = cpu_to_be32(new_fm->e[i]->pnum);
1335 set_seen(ubi, new_fm->e[i]->pnum, seen_pebs);
1347 new_fm->e[i]->pnum, be64_to_cpu(dvhdr->sqnum));
1348 ret = ubi_io_write_vid_hdr(ubi, new_fm->e[i]->pnum, dvbuf);
1351 new_fm->e[i]->pnum);
1358 new_fm->e[i]->pnum, 0, ubi->leb_size);
1361 new_fm->e[i]->pnum);
1386 * @pnum: PEB to be erased
1390 static int erase_block(struct ubi_device *ubi, int pnum)
1400 ret = ubi_io_read_ec_hdr(ubi, pnum, ec_hdr, 0);
1408 ret = ubi_io_sync_erase(ubi, pnum, 0);
1420 ret = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr);
1476 ret = ubi_io_write_vid_hdr(ubi, e->pnum, vb);
1570 ret = erase_block(ubi, old_fm->e[i]->pnum);
1622 ret = erase_block(ubi, old_fm->e[0]->pnum);