Lines Matching refs:ubi
35 int ubi_calc_data_len(const struct ubi_device *ubi, const void *buf, in ubi_calc_data_len() argument
40 ubi_assert(!(length & (ubi->min_io_size - 1))); in ubi_calc_data_len()
47 length = ALIGN(i + 1, ubi->min_io_size); in ubi_calc_data_len()
61 int ubi_check_volume(struct ubi_device *ubi, int vol_id) in ubi_check_volume() argument
65 struct ubi_volume *vol = ubi->volumes[vol_id]; in ubi_check_volume()
82 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); in ubi_check_volume()
103 void ubi_update_reserved(struct ubi_device *ubi) in ubi_update_reserved() argument
105 int need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs; in ubi_update_reserved()
107 if (need <= 0 || ubi->avail_pebs == 0) in ubi_update_reserved()
110 need = min_t(int, need, ubi->avail_pebs); in ubi_update_reserved()
111 ubi->avail_pebs -= need; in ubi_update_reserved()
112 ubi->rsvd_pebs += need; in ubi_update_reserved()
113 ubi->beb_rsvd_pebs += need; in ubi_update_reserved()
122 void ubi_calculate_reserved(struct ubi_device *ubi) in ubi_calculate_reserved() argument
128 ubi->beb_rsvd_level = ubi->bad_peb_limit - ubi->bad_peb_count; in ubi_calculate_reserved()
129 if (ubi->beb_rsvd_level < 0) { in ubi_calculate_reserved()
130 ubi->beb_rsvd_level = 0; in ubi_calculate_reserved()
132 ubi->bad_peb_count, ubi->bad_peb_limit); in ubi_calculate_reserved()