Lines Matching refs:pnum
48 int pnum; member
111 ldesc->pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_get_ldesc()
140 tbl->entries[i].pnum = UBI_LEB_UNMAPPED; in ubi_eba_create_table()
184 dst->entries[i].pnum = src->entries[i].pnum; in ubi_eba_copy_table()
437 return vol->eba_tbl->entries[lnum].pnum >= 0; in ubi_eba_is_mapped()
453 int err, pnum, vol_id = vol->vol_id; in ubi_eba_unmap_leb() local
462 pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_unmap_leb()
463 if (pnum < 0) in ubi_eba_unmap_leb()
467 dbg_eba("erase LEB %d:%d, PEB %d", vol_id, lnum, pnum); in ubi_eba_unmap_leb()
470 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED; in ubi_eba_unmap_leb()
472 err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 0); in ubi_eba_unmap_leb()
498 int *pnum) in check_mapping() argument
514 err = ubi_io_read_vid_hdr(ubi, *pnum, vidb, 0); in check_mapping()
532 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED; in check_mapping()
534 ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture); in check_mapping()
536 *pnum = UBI_LEB_UNMAPPED; in check_mapping()
539 *pnum, err); in check_mapping()
553 *pnum, found_vol_id, found_lnum, vol->vol_id, lnum); in check_mapping()
570 int *pnum) in check_mapping() argument
598 int err, pnum, scrub = 0, vol_id = vol->vol_id; in ubi_eba_read_leb() local
607 pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_read_leb()
608 if (pnum >= 0) { in ubi_eba_read_leb()
609 err = check_mapping(ubi, vol, lnum, &pnum); in ubi_eba_read_leb()
614 if (pnum == UBI_LEB_UNMAPPED) { in ubi_eba_read_leb()
629 len, offset, vol_id, lnum, pnum); in ubi_eba_read_leb()
644 err = ubi_io_read_vid_hdr(ubi, pnum, vidb, 1); in ubi_eba_read_leb()
658 pnum, vol_id, lnum); in ubi_eba_read_leb()
693 err = ubi_io_read_data(ubi, buf, pnum, offset, len); in ubi_eba_read_leb()
721 err = ubi_wl_scrub_peb(ubi, pnum); in ubi_eba_read_leb()
806 static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum, in try_recover_peb() argument
824 pnum, new_pnum); in try_recover_peb()
826 err = ubi_io_read_vid_hdr(ubi, pnum, vidb, 1); in try_recover_peb()
841 err = ubi_io_read_data(ubi, ubi->peb_buf, pnum, 0, offset); in try_recover_peb()
866 vol->eba_tbl->entries[lnum].pnum = new_pnum; in try_recover_peb()
872 ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); in try_recover_peb()
902 static int recover_peb(struct ubi_device *ubi, int pnum, int vol_id, int lnum, in recover_peb() argument
916 err = try_recover_peb(vol, pnum, lnum, buf, offset, len, vidb, in recover_peb()
949 int pnum, opnum, err, vol_id = vol->vol_id; in try_write_vid_and_data() local
951 pnum = ubi_wl_get_peb(ubi); in try_write_vid_and_data()
952 if (pnum < 0) { in try_write_vid_and_data()
953 err = pnum; in try_write_vid_and_data()
957 opnum = vol->eba_tbl->entries[lnum].pnum; in try_write_vid_and_data()
960 len, offset, vol_id, lnum, pnum); in try_write_vid_and_data()
962 err = ubi_io_write_vid_hdr(ubi, pnum, vidb); in try_write_vid_and_data()
965 vol_id, lnum, pnum); in try_write_vid_and_data()
970 err = ubi_io_write_data(ubi, buf, pnum, offset, len); in try_write_vid_and_data()
974 len, offset, vol_id, lnum, pnum); in try_write_vid_and_data()
979 vol->eba_tbl->entries[lnum].pnum = pnum; in try_write_vid_and_data()
984 if (err && pnum >= 0) in try_write_vid_and_data()
985 err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); in try_write_vid_and_data()
1010 int err, pnum, tries, vol_id = vol->vol_id; in ubi_eba_write_leb() local
1021 pnum = vol->eba_tbl->entries[lnum].pnum; in ubi_eba_write_leb()
1022 if (pnum >= 0) { in ubi_eba_write_leb()
1023 err = check_mapping(ubi, vol, lnum, &pnum); in ubi_eba_write_leb()
1028 if (pnum >= 0) { in ubi_eba_write_leb()
1030 len, offset, vol_id, lnum, pnum); in ubi_eba_write_leb()
1032 err = ubi_io_write_data(ubi, buf, pnum, offset, len); in ubi_eba_write_leb()
1034 ubi_warn(ubi, "failed to write data to PEB %d", pnum); in ubi_eba_write_leb()
1036 err = recover_peb(ubi, pnum, vol_id, lnum, buf, in ubi_eba_write_leb()
1149 ubi_assert(vol->eba_tbl->entries[lnum].pnum < 0); in ubi_eba_write_leb_st()
1365 if (vol->eba_tbl->entries[lnum].pnum != from) { in ubi_eba_copy_leb()
1367 vol_id, lnum, from, vol->eba_tbl->entries[lnum].pnum); in ubi_eba_copy_leb()
1452 ubi_assert(vol->eba_tbl->entries[lnum].pnum == from); in ubi_eba_copy_leb()
1453 vol->eba_tbl->entries[lnum].pnum = to; in ubi_eba_copy_leb()
1565 scan_eba[i][aeb->lnum] = aeb->pnum; in self_check_eba()
1572 fm_eba[i][aeb->lnum] = aeb->pnum; in self_check_eba()
1659 entry->pnum = aeb->pnum; in ubi_eba_init()