Lines Matching refs:vol

64  * @vol: volume description object
67 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
70 vi->vol_id = vol->vol_id;
72 vi->size = vol->reserved_pebs;
73 vi->used_bytes = vol->used_bytes;
74 vi->vol_type = vol->vol_type;
75 vi->corrupted = vol->corrupted;
76 vi->upd_marker = vol->upd_marker;
77 vi->alignment = vol->alignment;
78 vi->usable_leb_size = vol->usable_leb_size;
79 vi->name_len = vol->name_len;
80 vi->name = vol->name;
81 vi->cdev = vol->cdev.dev;
82 vi->dev = &vol->dev;
93 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi);
120 struct ubi_volume *vol;
154 vol = ubi->volumes[vol_id];
155 if (!vol || vol->is_dead)
161 if (vol->exclusive)
163 vol->readers += 1;
167 if (vol->exclusive || vol->writers > 0)
169 vol->writers += 1;
173 if (vol->exclusive || vol->writers || vol->readers ||
174 vol->metaonly)
176 vol->exclusive = 1;
180 if (vol->metaonly || vol->exclusive)
182 vol->metaonly = 1;
185 get_device(&vol->dev);
186 vol->ref_count += 1;
189 desc->vol = vol;
193 if (!vol->checked && !vol->skip_check) {
204 vol->corrupted = 1;
206 vol->checked = 1;
259 struct ubi_volume *vol = ubi->volumes[i];
261 if (vol && len == vol->name_len && !strcmp(name, vol->name)) {
348 struct ubi_volume *vol = desc->vol;
349 struct ubi_device *ubi = vol->ubi;
352 ubi->ubi_num, vol->vol_id, desc->mode);
357 vol->readers -= 1;
360 vol->writers -= 1;
363 vol->exclusive = 0;
366 vol->metaonly = 0;
369 vol->ref_count -= 1;
373 put_device(&vol->dev);
392 struct ubi_volume *vol = desc->vol;
393 struct ubi_device *ubi = vol->ubi;
394 int vol_id = vol->vol_id;
397 lnum >= vol->used_ebs || offset < 0 || len < 0 ||
398 offset + len > vol->usable_leb_size)
401 if (vol->vol_type == UBI_STATIC_VOLUME) {
402 if (vol->used_ebs == 0)
405 if (lnum == vol->used_ebs - 1 &&
406 offset + len > vol->last_eb_bytes)
410 if (vol->upd_marker)
446 struct ubi_volume *vol = desc->vol;
447 struct ubi_device *ubi = vol->ubi;
448 int err, vol_id = vol->vol_id;
459 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
460 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
462 vol->corrupted = 1;
486 struct ubi_volume *vol = desc->vol;
487 struct ubi_device *ubi = vol->ubi;
488 int err, vol_id = vol->vol_id;
499 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check);
500 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
502 vol->corrupted = 1;
537 struct ubi_volume *vol = desc->vol;
538 struct ubi_device *ubi = vol->ubi;
539 int vol_id = vol->vol_id;
546 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
549 if (!ubi_leb_valid(vol, lnum) || offset < 0 || len < 0 ||
550 offset + len > vol->usable_leb_size ||
554 if (vol->upd_marker)
560 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len);
582 struct ubi_volume *vol = desc->vol;
583 struct ubi_device *ubi = vol->ubi;
584 int vol_id = vol->vol_id;
591 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
594 if (!ubi_leb_valid(vol, lnum) || len < 0 ||
595 len > vol->usable_leb_size || len & (ubi->min_io_size - 1))
598 if (vol->upd_marker)
604 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len);
622 struct ubi_volume *vol = desc->vol;
623 struct ubi_device *ubi = vol->ubi;
626 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum);
628 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
631 if (!ubi_leb_valid(vol, lnum))
634 if (vol->upd_marker)
637 err = ubi_eba_unmap_leb(ubi, vol, lnum);
641 return ubi_wl_flush(ubi, vol->vol_id, lnum);
683 struct ubi_volume *vol = desc->vol;
684 struct ubi_device *ubi = vol->ubi;
686 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
688 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
691 if (!ubi_leb_valid(vol, lnum))
694 if (vol->upd_marker)
697 return ubi_eba_unmap_leb(ubi, vol, lnum);
719 struct ubi_volume *vol = desc->vol;
720 struct ubi_device *ubi = vol->ubi;
722 dbg_gen("map LEB %d:%d", vol->vol_id, lnum);
724 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
727 if (!ubi_leb_valid(vol, lnum))
730 if (vol->upd_marker)
733 if (ubi_eba_is_mapped(vol, lnum))
736 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
758 struct ubi_volume *vol = desc->vol;
760 dbg_gen("test LEB %d:%d", vol->vol_id, lnum);
762 if (!ubi_leb_valid(vol, lnum))
765 if (vol->upd_marker)
768 return ubi_eba_is_mapped(vol, lnum);