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)
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)) {
328 struct ubi_volume *vol = desc->vol;
329 struct ubi_device *ubi = vol->ubi;
332 ubi->ubi_num, vol->vol_id, desc->mode);
337 vol->readers -= 1;
340 vol->writers -= 1;
343 vol->exclusive = 0;
346 vol->metaonly = 0;
349 vol->ref_count -= 1;
353 put_device(&vol->dev);
372 struct ubi_volume *vol = desc->vol;
373 struct ubi_device *ubi = vol->ubi;
374 int vol_id = vol->vol_id;
377 lnum >= vol->used_ebs || offset < 0 || len < 0 ||
378 offset + len > vol->usable_leb_size)
381 if (vol->vol_type == UBI_STATIC_VOLUME) {
382 if (vol->used_ebs == 0)
385 if (lnum == vol->used_ebs - 1 &&
386 offset + len > vol->last_eb_bytes)
390 if (vol->upd_marker)
426 struct ubi_volume *vol = desc->vol;
427 struct ubi_device *ubi = vol->ubi;
428 int err, vol_id = vol->vol_id;
439 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
440 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
442 vol->corrupted = 1;
466 struct ubi_volume *vol = desc->vol;
467 struct ubi_device *ubi = vol->ubi;
468 int err, vol_id = vol->vol_id;
479 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check);
480 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
482 vol->corrupted = 1;
517 struct ubi_volume *vol = desc->vol;
518 struct ubi_device *ubi = vol->ubi;
519 int vol_id = vol->vol_id;
526 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
529 if (!ubi_leb_valid(vol, lnum) || offset < 0 || len < 0 ||
530 offset + len > vol->usable_leb_size ||
534 if (vol->upd_marker)
540 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len);
562 struct ubi_volume *vol = desc->vol;
563 struct ubi_device *ubi = vol->ubi;
564 int vol_id = vol->vol_id;
571 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
574 if (!ubi_leb_valid(vol, lnum) || len < 0 ||
575 len > vol->usable_leb_size || len & (ubi->min_io_size - 1))
578 if (vol->upd_marker)
584 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len);
602 struct ubi_volume *vol = desc->vol;
603 struct ubi_device *ubi = vol->ubi;
606 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum);
608 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
611 if (!ubi_leb_valid(vol, lnum))
614 if (vol->upd_marker)
617 err = ubi_eba_unmap_leb(ubi, vol, lnum);
621 return ubi_wl_flush(ubi, vol->vol_id, lnum);
663 struct ubi_volume *vol = desc->vol;
664 struct ubi_device *ubi = vol->ubi;
666 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
668 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
671 if (!ubi_leb_valid(vol, lnum))
674 if (vol->upd_marker)
677 return ubi_eba_unmap_leb(ubi, vol, lnum);
699 struct ubi_volume *vol = desc->vol;
700 struct ubi_device *ubi = vol->ubi;
702 dbg_gen("map LEB %d:%d", vol->vol_id, lnum);
704 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
707 if (!ubi_leb_valid(vol, lnum))
710 if (vol->upd_marker)
713 if (ubi_eba_is_mapped(vol, lnum))
716 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
738 struct ubi_volume *vol = desc->vol;
740 dbg_gen("test LEB %d:%d", vol->vol_id, lnum);
742 if (!ubi_leb_valid(vol, lnum))
745 if (vol->upd_marker)
748 return ubi_eba_is_mapped(vol, lnum);