Lines Matching refs:vol

99  * @vol: volume description object
107 void ubi_eba_get_ldesc(struct ubi_volume *vol, int lnum,
111 ldesc->pnum = vol->eba_tbl->entries[lnum].pnum;
117 * @vol: volume containing the EBA table to copy
123 struct ubi_eba_table *ubi_eba_create_table(struct ubi_volume *vol,
167 * ubi_eba_copy_table - copy the EBA table attached to vol into another table
168 * @vol: volume containing the EBA table to copy
172 * Copy the EBA table stored in vol into the one pointed by dst.
174 void ubi_eba_copy_table(struct ubi_volume *vol, struct ubi_eba_table *dst,
180 ubi_assert(dst && vol && vol->eba_tbl);
182 src = vol->eba_tbl;
190 * @vol: volume containing the EBA table to copy
195 void ubi_eba_replace_table(struct ubi_volume *vol, struct ubi_eba_table *tbl)
197 ubi_eba_destroy_table(vol->eba_tbl);
198 vol->eba_tbl = tbl;
431 * @vol: volume description object
436 bool ubi_eba_is_mapped(struct ubi_volume *vol, int lnum)
438 return vol->eba_tbl->entries[lnum].pnum >= 0;
444 * @vol: volume description object
451 int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,
454 int err, pnum, vol_id = vol->vol_id;
463 pnum = vol->eba_tbl->entries[lnum].pnum;
471 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED;
484 * @vol: volume description object
498 static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
508 if (!vol->checkmap || test_bit(lnum, vol->checkmap))
533 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED;
535 ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture);
552 if (found_lnum != lnum || found_vol_id != vol->vol_id) {
554 *pnum, found_vol_id, found_lnum, vol->vol_id, lnum);
561 set_bit(lnum, vol->checkmap);
570 static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
580 * @vol: volume description object
596 int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
599 int err, pnum, scrub = 0, vol_id = vol->vol_id;
608 pnum = vol->eba_tbl->entries[lnum].pnum;
610 err = check_mapping(ubi, vol, lnum, &pnum);
624 ubi_assert(vol->vol_type != UBI_STATIC_VOLUME);
632 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
699 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
737 * @vol: volume description object
748 int ubi_eba_read_leb_sg(struct ubi_device *ubi, struct ubi_volume *vol,
764 ret = ubi_eba_read_leb(ubi, vol, lnum,
791 * @vol: volume description object
807 static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
811 struct ubi_device *ubi = vol->ubi;
813 int new_pnum, err, vol_id = vol->vol_id, data_size;
867 vol->eba_tbl->entries[lnum].pnum = new_pnum;
907 struct ubi_volume *vol = ubi->volumes[idx];
917 err = try_recover_peb(vol, pnum, lnum, buf, offset, len, vidb,
932 * @vol: volume description object
940 * eraseblock @lnum of volume @vol to a new physical eraseblock. Returns zero
945 static int try_write_vid_and_data(struct ubi_volume *vol, int lnum,
949 struct ubi_device *ubi = vol->ubi;
950 int pnum, opnum, err, err2, vol_id = vol->vol_id;
958 opnum = vol->eba_tbl->entries[lnum].pnum;
980 vol->eba_tbl->entries[lnum].pnum = pnum;
1005 * @vol: volume description object
1012 * @vol. Returns zero in case of success and a negative error code in case
1017 int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
1020 int err, pnum, tries, vol_id = vol->vol_id;
1031 pnum = vol->eba_tbl->entries[lnum].pnum;
1033 err = check_mapping(ubi, vol, lnum, &pnum);
1070 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1073 err = try_write_vid_and_data(vol, lnum, vidb, buf, offset, len);
1101 * @vol: volume description object
1108 * @vol. The @used_ebs argument should contain total number of logical
1120 int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol,
1123 int err, tries, data_size = len, vol_id = vol->vol_id;
1151 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1159 ubi_assert(vol->eba_tbl->entries[lnum].pnum < 0);
1162 err = try_write_vid_and_data(vol, lnum, vidb, buf, 0, len);
1184 * @vol: volume description object
1198 int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
1201 int err, tries, vol_id = vol->vol_id;
1214 err = ubi_eba_unmap_leb(ubi, vol, lnum);
1217 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
1235 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1246 err = try_write_vid_and_data(vol, lnum, vidb, buf, 0, len);
1316 struct ubi_volume *vol;
1341 vol = ubi->volumes[idx];
1343 if (!vol) {
1375 if (vol->eba_tbl->entries[lnum].pnum != from) {
1377 vol_id, lnum, from, vol->eba_tbl->entries[lnum].pnum);
1462 ubi_assert(vol->eba_tbl->entries[lnum].pnum == from);
1463 vol->eba_tbl->entries[lnum].pnum = to;
1529 struct ubi_volume *vol;
1546 vol = ubi->volumes[i];
1547 if (!vol)
1550 scan_eba[i] = kmalloc_array(vol->reserved_pebs,
1558 fm_eba[i] = kmalloc_array(vol->reserved_pebs,
1566 for (j = 0; j < vol->reserved_pebs; j++)
1583 for (j = 0; j < vol->reserved_pebs; j++) {
1590 vol->vol_id, j, fm_eba[i][j],
1623 struct ubi_volume *vol;
1639 vol = ubi->volumes[i];
1640 if (!vol)
1645 tbl = ubi_eba_create_table(vol, vol->reserved_pebs);
1651 ubi_eba_replace_table(vol, tbl);
1658 if (aeb->lnum >= vol->reserved_pebs) {
1667 entry = &vol->eba_tbl->entries[aeb->lnum];