Lines Matching refs:vol

74 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,  in ubi_do_get_volume_info()  argument
77 vi->vol_id = vol->vol_id; in ubi_do_get_volume_info()
79 vi->size = vol->reserved_pebs; in ubi_do_get_volume_info()
80 vi->used_bytes = vol->used_bytes; in ubi_do_get_volume_info()
81 vi->vol_type = vol->vol_type; in ubi_do_get_volume_info()
82 vi->corrupted = vol->corrupted; in ubi_do_get_volume_info()
83 vi->upd_marker = vol->upd_marker; in ubi_do_get_volume_info()
84 vi->alignment = vol->alignment; in ubi_do_get_volume_info()
85 vi->usable_leb_size = vol->usable_leb_size; in ubi_do_get_volume_info()
86 vi->name_len = vol->name_len; in ubi_do_get_volume_info()
87 vi->name = vol->name; in ubi_do_get_volume_info()
88 vi->cdev = vol->cdev.dev; in ubi_do_get_volume_info()
99 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); in ubi_get_volume_info()
126 struct ubi_volume *vol; in ubi_open_volume() local
160 vol = ubi->volumes[vol_id]; in ubi_open_volume()
161 if (!vol) in ubi_open_volume()
167 if (vol->exclusive) in ubi_open_volume()
169 vol->readers += 1; in ubi_open_volume()
173 if (vol->exclusive || vol->writers > 0) in ubi_open_volume()
175 vol->writers += 1; in ubi_open_volume()
179 if (vol->exclusive || vol->writers || vol->readers || in ubi_open_volume()
180 vol->metaonly) in ubi_open_volume()
182 vol->exclusive = 1; in ubi_open_volume()
186 if (vol->metaonly || vol->exclusive) in ubi_open_volume()
188 vol->metaonly = 1; in ubi_open_volume()
191 get_device(&vol->dev); in ubi_open_volume()
192 vol->ref_count += 1; in ubi_open_volume()
195 desc->vol = vol; in ubi_open_volume()
199 if (!vol->checked) { in ubi_open_volume()
210 vol->corrupted = 1; in ubi_open_volume()
212 vol->checked = 1; in ubi_open_volume()
265 struct ubi_volume *vol = ubi->volumes[i]; in ubi_open_volume_nm() local
267 if (vol && len == vol->name_len && !strcmp(name, vol->name)) { in ubi_open_volume_nm()
333 struct ubi_volume *vol = desc->vol; in ubi_close_volume() local
334 struct ubi_device *ubi = vol->ubi; in ubi_close_volume()
337 ubi->ubi_num, vol->vol_id, desc->mode); in ubi_close_volume()
342 vol->readers -= 1; in ubi_close_volume()
345 vol->writers -= 1; in ubi_close_volume()
348 vol->exclusive = 0; in ubi_close_volume()
351 vol->metaonly = 0; in ubi_close_volume()
354 vol->ref_count -= 1; in ubi_close_volume()
358 put_device(&vol->dev); in ubi_close_volume()
377 struct ubi_volume *vol = desc->vol; in leb_read_sanity_check() local
378 struct ubi_device *ubi = vol->ubi; in leb_read_sanity_check()
379 int vol_id = vol->vol_id; in leb_read_sanity_check()
382 lnum >= vol->used_ebs || offset < 0 || len < 0 || in leb_read_sanity_check()
383 offset + len > vol->usable_leb_size) in leb_read_sanity_check()
386 if (vol->vol_type == UBI_STATIC_VOLUME) { in leb_read_sanity_check()
387 if (vol->used_ebs == 0) in leb_read_sanity_check()
390 if (lnum == vol->used_ebs - 1 && in leb_read_sanity_check()
391 offset + len > vol->last_eb_bytes) in leb_read_sanity_check()
395 if (vol->upd_marker) in leb_read_sanity_check()
431 struct ubi_volume *vol = desc->vol; in ubi_leb_read() local
432 struct ubi_device *ubi = vol->ubi; in ubi_leb_read()
433 int err, vol_id = vol->vol_id; in ubi_leb_read()
444 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
445 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { in ubi_leb_read()
447 vol->corrupted = 1; in ubi_leb_read()
471 struct ubi_volume *vol = desc->vol; in ubi_leb_read_sg() local
472 struct ubi_device *ubi = vol->ubi; in ubi_leb_read_sg()
473 int err, vol_id = vol->vol_id; in ubi_leb_read_sg()
484 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
485 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) { in ubi_leb_read_sg()
487 vol->corrupted = 1; in ubi_leb_read_sg()
523 struct ubi_volume *vol = desc->vol; in ubi_leb_write() local
524 struct ubi_device *ubi = vol->ubi; in ubi_leb_write()
525 int vol_id = vol->vol_id; in ubi_leb_write()
532 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_write()
535 if (lnum < 0 || lnum >= vol->reserved_pebs || offset < 0 || len < 0 || in ubi_leb_write()
536 offset + len > vol->usable_leb_size || in ubi_leb_write()
540 if (vol->upd_marker) in ubi_leb_write()
546 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
568 struct ubi_volume *vol = desc->vol; in ubi_leb_change() local
569 struct ubi_device *ubi = vol->ubi; in ubi_leb_change()
570 int vol_id = vol->vol_id; in ubi_leb_change()
577 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_change()
580 if (lnum < 0 || lnum >= vol->reserved_pebs || len < 0 || in ubi_leb_change()
581 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) in ubi_leb_change()
584 if (vol->upd_marker) in ubi_leb_change()
590 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
608 struct ubi_volume *vol = desc->vol; in ubi_leb_erase() local
609 struct ubi_device *ubi = vol->ubi; in ubi_leb_erase()
612 dbg_gen("erase LEB %d:%d", vol->vol_id, lnum); in ubi_leb_erase()
614 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_erase()
617 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_erase()
620 if (vol->upd_marker) in ubi_leb_erase()
623 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
627 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
669 struct ubi_volume *vol = desc->vol; in ubi_leb_unmap() local
670 struct ubi_device *ubi = vol->ubi; in ubi_leb_unmap()
672 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); in ubi_leb_unmap()
674 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_unmap()
677 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_unmap()
680 if (vol->upd_marker) in ubi_leb_unmap()
683 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
705 struct ubi_volume *vol = desc->vol; in ubi_leb_map() local
706 struct ubi_device *ubi = vol->ubi; in ubi_leb_map()
708 dbg_gen("unmap LEB %d:%d", vol->vol_id, lnum); in ubi_leb_map()
710 if (desc->mode == UBI_READONLY || vol->vol_type == UBI_STATIC_VOLUME) in ubi_leb_map()
713 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_leb_map()
716 if (vol->upd_marker) in ubi_leb_map()
719 if (vol->eba_tbl[lnum] >= 0) in ubi_leb_map()
722 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
744 struct ubi_volume *vol = desc->vol; in ubi_is_mapped() local
746 dbg_gen("test LEB %d:%d", vol->vol_id, lnum); in ubi_is_mapped()
748 if (lnum < 0 || lnum >= vol->reserved_pebs) in ubi_is_mapped()
751 if (vol->upd_marker) in ubi_is_mapped()
754 return vol->eba_tbl[lnum] >= 0; in ubi_is_mapped()