Lines Matching defs:ubi

10 #include "ubi.h"
14 * @ubi: UBI device description object
22 int ubi_calc_data_len(const struct ubi_device *ubi, const void *buf,
27 ubi_assert(!(length & (ubi->min_io_size - 1)));
34 length = ALIGN(i + 1, ubi->min_io_size);
40 * @ubi: UBI device description object
48 int ubi_check_volume(struct ubi_device *ubi, int vol_id)
52 struct ubi_volume *vol = ubi->volumes[vol_id];
71 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1);
85 * @ubi: UBI device description object
90 * to availability. Should be called with ubi->volumes_lock held.
92 void ubi_update_reserved(struct ubi_device *ubi)
94 int need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs;
96 if (need <= 0 || ubi->avail_pebs == 0)
99 need = min_t(int, need, ubi->avail_pebs);
100 ubi->avail_pebs -= need;
101 ubi->rsvd_pebs += need;
102 ubi->beb_rsvd_pebs += need;
103 ubi_msg(ubi, "reserved more %d PEBs for bad PEB handling", need);
109 * @ubi: UBI device description object
111 void ubi_calculate_reserved(struct ubi_device *ubi)
117 ubi->beb_rsvd_level = ubi->bad_peb_limit - ubi->bad_peb_count;
118 if (ubi->beb_rsvd_level < 0) {
119 ubi->beb_rsvd_level = 0;
120 ubi_warn(ubi, "number of bad PEBs (%d) is above the expected limit (%d), not reserving any PEBs for bad PEB handling, will use available PEBs (if any)",
121 ubi->bad_peb_count, ubi->bad_peb_limit);
145 void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...)
155 pr_notice(UBI_NAME_STR "%d: %pV\n", ubi->ubi_num, &vaf);
161 void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...)
172 ubi->ubi_num, __builtin_return_address(0), &vaf);
178 void ubi_err(const struct ubi_device *ubi, const char *fmt, ...)
189 ubi->ubi_num, __builtin_return_address(0), &vaf);