xref: /kernel/linux/linux-5.10/drivers/mtd/ubi/wl.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef UBI_WL_H
38c2ecf20Sopenharmony_ci#define UBI_WL_H
48c2ecf20Sopenharmony_ci#ifdef CONFIG_MTD_UBI_FASTMAP
58c2ecf20Sopenharmony_cistatic void update_fastmap_work_fn(struct work_struct *wrk);
68c2ecf20Sopenharmony_cistatic struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
78c2ecf20Sopenharmony_cistatic struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
88c2ecf20Sopenharmony_cistatic void ubi_fastmap_close(struct ubi_device *ubi);
98c2ecf20Sopenharmony_cistatic inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
108c2ecf20Sopenharmony_ci{
118c2ecf20Sopenharmony_ci	/* Reserve enough LEBs to store two fastmaps. */
128c2ecf20Sopenharmony_ci	*count += (ubi->fm_size / ubi->leb_size) * 2;
138c2ecf20Sopenharmony_ci	INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
148c2ecf20Sopenharmony_ci}
158c2ecf20Sopenharmony_cistatic struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
168c2ecf20Sopenharmony_ci					       struct ubi_wl_entry *e,
178c2ecf20Sopenharmony_ci					       struct rb_root *root);
188c2ecf20Sopenharmony_ci#else /* !CONFIG_MTD_UBI_FASTMAP */
198c2ecf20Sopenharmony_cistatic struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
208c2ecf20Sopenharmony_cistatic inline void ubi_fastmap_close(struct ubi_device *ubi) { }
218c2ecf20Sopenharmony_cistatic inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
228c2ecf20Sopenharmony_cistatic struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
238c2ecf20Sopenharmony_ci					       struct ubi_wl_entry *e,
248c2ecf20Sopenharmony_ci					       struct rb_root *root) {
258c2ecf20Sopenharmony_ci	return e;
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci#endif /* CONFIG_MTD_UBI_FASTMAP */
288c2ecf20Sopenharmony_ci#endif /* UBI_WL_H */
29