Lines Matching refs:vol
80 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, in ubi_do_get_volume_info() argument
83 vi->vol_id = vol->vol_id; in ubi_do_get_volume_info()
85 vi->size = vol->reserved_pebs; in ubi_do_get_volume_info()
86 vi->used_bytes = vol->used_bytes; in ubi_do_get_volume_info()
87 vi->vol_type = vol->vol_type; in ubi_do_get_volume_info()
88 vi->corrupted = vol->corrupted; in ubi_do_get_volume_info()
89 vi->upd_marker = vol->upd_marker; in ubi_do_get_volume_info()
90 vi->alignment = vol->alignment; in ubi_do_get_volume_info()
91 vi->usable_leb_size = vol->usable_leb_size; in ubi_do_get_volume_info()
92 vi->name_len = vol->name_len; in ubi_do_get_volume_info()
93 vi->name = vol->name; in ubi_do_get_volume_info()
94 vi->cdev = vol->cdev.dev; in ubi_do_get_volume_info()
105 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); in ubi_get_volume_info()
132 struct ubi_volume *vol; in ubi_open_volume() local
166 vol = ubi->volumes[vol_id]; in ubi_open_volume()
167 if (!vol) in ubi_open_volume()
173 if (vol->exclusive) in ubi_open_volume()
175 vol->readers += 1; in ubi_open_volume()
179 if (vol->exclusive || vol->writers > 0) in ubi_open_volume()
181 vol->writers += 1; in ubi_open_volume()
185 if (vol->exclusive || vol->writers || vol->readers || in ubi_open_volume()
186 vol->metaonly) in ubi_open_volume()
188 vol->exclusive = 1; in ubi_open_volume()
192 if (vol->metaonly || vol->exclusive) in ubi_open_volume()
194 vol->metaonly = 1; in ubi_open_volume()
197 get_device(&vol->dev); in ubi_open_volume()
198 vol->ref_count += 1; in ubi_open_volume()
201 desc->vol = vol; in ubi_open_volume()
205 if (!vol->checked) { in ubi_open_volume()
216 vol->corrupted = 1; in ubi_open_volume()
218 vol->checked = 1; in ubi_open_volume()
271 struct ubi_volume *vol = ubi->volumes[i]; in ubi_open_volume_nm() local
273 if (vol && len == vol->name_len && !strcmp(name, vol->name)) { in ubi_open_volume_nm()
337 struct ubi_volume *vol = desc->vol; in ubi_close_volume() local
338 struct ubi_device *ubi = vol->ubi; in ubi_close_volume()
341 ubi->ubi_num, vol->vol_id, desc->mode); in ubi_close_volume()
346 vol->readers -= 1; in ubi_close_volume()
349 vol->writers -= 1; in ubi_close_volume()
352 vol->exclusive = 0; in ubi_close_volume()
355 vol->metaonly = 0; in ubi_close_volume()
358 vol->ref_count -= 1; in ubi_close_volume()
362 put_device(&vol->dev); in ubi_close_volume()
381 struct ubi_volume *vol = desc->vol; in leb_read_sanity_check() local
382 struct ubi_device *ubi = vol->ubi; in leb_read_sanity_check()
383 int vol_id = vol->vol_id; in leb_read_sanity_check()
386 lnum >= vol->used_ebs || offset < 0 || len < 0 || in leb_read_sanity_check()
387 offset + len > vol->usable_leb_size) in leb_read_sanity_check()
390 if (vol->vol_type == UBI_STATIC_VOLUME) { in leb_read_sanity_check()
391 if (vol->used_ebs == 0) in leb_read_sanity_check()
394 if (lnum == vol->used_ebs - 1 && in leb_read_sanity_check()
395 offset + len > vol->last_eb_bytes) in leb_read_sanity_check()
399 if (vol->upd_marker) in leb_read_sanity_check()
435 struct ubi_volume *vol = desc->vol; in ubi_leb_read() local
436 struct ubi_device *ubi = vol->ubi; in ubi_leb_read()
437 int err, vol_id = vol->vol_id; in ubi_leb_read()
448 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
449 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { in ubi_leb_read()
451 vol->corrupted = 1; in ubi_leb_read()
475 struct ubi_volume *vol = desc->vol; in ubi_leb_read_sg() local
476 struct ubi_device *ubi = vol->ubi; in ubi_leb_read_sg()
477 int err, vol_id = vol->vol_id; in ubi_leb_read_sg()
488 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
489 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { in ubi_leb_read_sg()
491 vol->corrupted = 1; in ubi_leb_read_sg()
526 struct ubi_volume *vol = desc->vol; in ubi_leb_write() local
527 struct ubi_device *ubi = vol->ubi; in ubi_leb_write()
528 int vol_id = vol->vol_id; in ubi_leb_write()
535 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_write()
538 if (lnum < 0 || lnum >= vol->reserved_pebs || offset < 0 || len < 0 || in ubi_leb_write()
539 offset + len > vol->usable_leb_size || in ubi_leb_write()
543 if (vol->upd_marker) in ubi_leb_write()
549 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
571 struct ubi_volume *vol = desc->vol; in ubi_leb_change() local
572 struct ubi_device *ubi = vol->ubi; in ubi_leb_change()
573 int vol_id = vol->vol_id; in ubi_leb_change()
580 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_change()
583 if (lnum < 0 || lnum >= vol->reserved_pebs || len < 0 || in ubi_leb_change()
584 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) in ubi_leb_change()
587 if (vol->upd_marker) in ubi_leb_change()
593 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
611 struct ubi_volume *vol = desc->vol; in ubi_leb_erase() local
612 struct ubi_device *ubi = vol->ubi; in ubi_leb_erase()
615 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); in ubi_leb_erase()
617 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_erase()
620 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_erase()
623 if (vol->upd_marker) in ubi_leb_erase()
626 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
630 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
672 struct ubi_volume *vol = desc->vol; in ubi_leb_unmap() local
673 struct ubi_device *ubi = vol->ubi; in ubi_leb_unmap()
675 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); in ubi_leb_unmap()
677 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_unmap()
680 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_unmap()
683 if (vol->upd_marker) in ubi_leb_unmap()
686 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
708 struct ubi_volume *vol = desc->vol; in ubi_leb_map() local
709 struct ubi_device *ubi = vol->ubi; in ubi_leb_map()
711 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); in ubi_leb_map()
713 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_map()
716 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_map()
719 if (vol->upd_marker) in ubi_leb_map()
722 if (vol->eba_tbl[lnum] >= 0) in ubi_leb_map()
725 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
747 struct ubi_volume *vol = desc->vol; in ubi_is_mapped() local
749 dbg_gen("test LEB %d:%d", vol->vol_id, lnum); in ubi_is_mapped()
751 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_is_mapped()
754 if (vol->upd_marker) in ubi_is_mapped()
757 return vol->eba_tbl[lnum] >= 0; in ubi_is_mapped()