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,
166 * ubi_eba_copy_table - copy the EBA table attached to vol into another table
167 * @vol: volume containing the EBA table to copy
171 * Copy the EBA table stored in vol into the one pointed by dst.
173 void ubi_eba_copy_table(struct ubi_volume *vol, struct ubi_eba_table *dst,
179 ubi_assert(dst && vol && vol->eba_tbl);
181 src = vol->eba_tbl;
189 * @vol: volume containing the EBA table to copy
194 void ubi_eba_replace_table(struct ubi_volume *vol, struct ubi_eba_table *tbl)
196 ubi_eba_destroy_table(vol->eba_tbl);
197 vol->eba_tbl = tbl;
430 * @vol: volume description object
435 bool ubi_eba_is_mapped(struct ubi_volume *vol, int lnum)
437 return vol->eba_tbl->entries[lnum].pnum >= 0;
443 * @vol: volume description object
450 int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,
453 int err, pnum, vol_id = vol->vol_id;
462 pnum = vol->eba_tbl->entries[lnum].pnum;
470 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED;
483 * @vol: volume description object
497 static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
507 if (!vol->checkmap || test_bit(lnum, vol->checkmap))
532 vol->eba_tbl->entries[lnum].pnum = UBI_LEB_UNMAPPED;
534 ubi_wl_put_peb(ubi, vol->vol_id, lnum, *pnum, torture);
551 if (found_lnum != lnum || found_vol_id != vol->vol_id) {
553 *pnum, found_vol_id, found_lnum, vol->vol_id, lnum);
560 set_bit(lnum, vol->checkmap);
569 static int check_mapping(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
579 * @vol: volume description object
595 int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
598 int err, pnum, scrub = 0, vol_id = vol->vol_id;
607 pnum = vol->eba_tbl->entries[lnum].pnum;
609 err = check_mapping(ubi, vol, lnum, &pnum);
623 ubi_assert(vol->vol_type != UBI_STATIC_VOLUME);
631 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
698 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
736 * @vol: volume description object
747 int ubi_eba_read_leb_sg(struct ubi_device *ubi, struct ubi_volume *vol,
763 ret = ubi_eba_read_leb(ubi, vol, lnum,
790 * @vol: volume description object
806 static int try_recover_peb(struct ubi_volume *vol, int pnum, int lnum,
810 struct ubi_device *ubi = vol->ubi;
812 int new_pnum, err, vol_id = vol->vol_id, data_size;
866 vol->eba_tbl->entries[lnum].pnum = new_pnum;
906 struct ubi_volume *vol = ubi->volumes[idx];
916 err = try_recover_peb(vol, pnum, lnum, buf, offset, len, vidb,
931 * @vol: volume description object
939 * eraseblock @lnum of volume @vol to a new physical eraseblock. Returns zero
944 static int try_write_vid_and_data(struct ubi_volume *vol, int lnum,
948 struct ubi_device *ubi = vol->ubi;
949 int pnum, opnum, err, err2, vol_id = vol->vol_id;
957 opnum = vol->eba_tbl->entries[lnum].pnum;
979 vol->eba_tbl->entries[lnum].pnum = pnum;
1004 * @vol: volume description object
1011 * @vol. Returns zero in case of success and a negative error code in case
1016 int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
1019 int err, pnum, tries, vol_id = vol->vol_id;
1030 pnum = vol->eba_tbl->entries[lnum].pnum;
1032 err = check_mapping(ubi, vol, lnum, &pnum);
1069 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1072 err = try_write_vid_and_data(vol, lnum, vidb, buf, offset, len);
1100 * @vol: volume description object
1107 * @vol. The @used_ebs argument should contain total number of logical
1119 int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol,
1122 int err, tries, data_size = len, vol_id = vol->vol_id;
1150 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1158 ubi_assert(vol->eba_tbl->entries[lnum].pnum < 0);
1161 err = try_write_vid_and_data(vol, lnum, vidb, buf, 0, len);
1183 * @vol: volume description object
1197 int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
1200 int err, tries, vol_id = vol->vol_id;
1213 err = ubi_eba_unmap_leb(ubi, vol, lnum);
1216 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
1234 vid_hdr->data_pad = cpu_to_be32(vol->data_pad);
1245 err = try_write_vid_and_data(vol, lnum, vidb, buf, 0, len);
1315 struct ubi_volume *vol;
1340 vol = ubi->volumes[idx];
1342 if (!vol) {
1374 if (vol->eba_tbl->entries[lnum].pnum != from) {
1376 vol_id, lnum, from, vol->eba_tbl->entries[lnum].pnum);
1461 ubi_assert(vol->eba_tbl->entries[lnum].pnum == from);
1462 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];