^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef UBI_WL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define UBI_WL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #ifdef CONFIG_MTD_UBI_FASTMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) static void update_fastmap_work_fn(struct work_struct *wrk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) static void ubi_fastmap_close(struct ubi_device *ubi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* Reserve enough LEBs to store two fastmaps. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *count += (ubi->fm_size / ubi->leb_size) * 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct ubi_wl_entry *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct rb_root *root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #else /* !CONFIG_MTD_UBI_FASTMAP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static inline void ubi_fastmap_close(struct ubi_device *ubi) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct ubi_wl_entry *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct rb_root *root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) return e;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #endif /* CONFIG_MTD_UBI_FASTMAP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #endif /* UBI_WL_H */