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;
92 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi);
119 struct ubi_volume *vol;
153 vol = ubi->volumes[vol_id];
154 if (!vol)
160 if (vol->exclusive)
162 vol->readers += 1;
166 if (vol->exclusive || vol->writers > 0)
168 vol->writers += 1;
172 if (vol->exclusive || vol->writers || vol->readers ||
173 vol->metaonly)
175 vol->exclusive = 1;
179 if (vol->metaonly || vol->exclusive)
181 vol->metaonly = 1;
184 get_device(&vol->dev);
185 vol->ref_count += 1;
188 desc->vol = vol;
192 if (!vol->checked && !vol->skip_check) {
203 vol->corrupted = 1;
205 vol->checked = 1;
258 struct ubi_volume *vol = ubi->volumes[i];
260 if (vol && len == vol->name_len && !strcmp(name, vol->name)) {
327 struct ubi_volume *vol = desc->vol;
328 struct ubi_device *ubi = vol->ubi;
331 ubi->ubi_num, vol->vol_id, desc->mode);
336 vol->readers -= 1;
339 vol->writers -= 1;
342 vol->exclusive = 0;
345 vol->metaonly = 0;
348 vol->ref_count -= 1;
352 put_device(&vol->dev);
371 struct ubi_volume *vol = desc->vol;
372 struct ubi_device *ubi = vol->ubi;
373 int vol_id = vol->vol_id;
376 lnum >= vol->used_ebs || offset < 0 || len < 0 ||
377 offset + len > vol->usable_leb_size)
380 if (vol->vol_type == UBI_STATIC_VOLUME) {
381 if (vol->used_ebs == 0)
384 if (lnum == vol->used_ebs - 1 &&
385 offset + len > vol->last_eb_bytes)
389 if (vol->upd_marker)
425 struct ubi_volume *vol = desc->vol;
426 struct ubi_device *ubi = vol->ubi;
427 int err, vol_id = vol->vol_id;
438 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
439 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
441 vol->corrupted = 1;
465 struct ubi_volume *vol = desc->vol;
466 struct ubi_device *ubi = vol->ubi;
467 int err, vol_id = vol->vol_id;
478 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check);
479 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
481 vol->corrupted = 1;
516 struct ubi_volume *vol = desc->vol;
517 struct ubi_device *ubi = vol->ubi;
518 int vol_id = vol->vol_id;
525 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
528 if (!ubi_leb_valid(vol, lnum) || offset < 0 || len < 0 ||
529 offset + len > vol->usable_leb_size ||
533 if (vol->upd_marker)
539 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len);
561 struct ubi_volume *vol = desc->vol;
562 struct ubi_device *ubi = vol->ubi;
563 int vol_id = vol->vol_id;
570 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
573 if (!ubi_leb_valid(vol, lnum) || len < 0 ||
574 len > vol->usable_leb_size || len & (ubi->min_io_size - 1))
577 if (vol->upd_marker)
583 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len);
601 struct ubi_volume *vol = desc->vol;
602 struct ubi_device *ubi = vol->ubi;
605 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum);
607 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
610 if (!ubi_leb_valid(vol, lnum))
613 if (vol->upd_marker)
616 err = ubi_eba_unmap_leb(ubi, vol, lnum);
620 return ubi_wl_flush(ubi, vol->vol_id, lnum);
662 struct ubi_volume *vol = desc->vol;
663 struct ubi_device *ubi = vol->ubi;
665 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum);
667 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
670 if (!ubi_leb_valid(vol, lnum))
673 if (vol->upd_marker)
676 return ubi_eba_unmap_leb(ubi, vol, lnum);
698 struct ubi_volume *vol = desc->vol;
699 struct ubi_device *ubi = vol->ubi;
701 dbg_gen("map LEB %d:%d", vol->vol_id, lnum);
703 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME)
706 if (!ubi_leb_valid(vol, lnum))
709 if (vol->upd_marker)
712 if (ubi_eba_is_mapped(vol, lnum))
715 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0);
737 struct ubi_volume *vol = desc->vol;
739 dbg_gen("test LEB %d:%d", vol->vol_id, lnum);
741 if (!ubi_leb_valid(vol, lnum))
744 if (vol->upd_marker)
747 return ubi_eba_is_mapped(vol, lnum);