blob: 662dbe3765469765f05e9fa577ef63b3bd0fd739 [file] [log] [blame]
Heiko Schocher0195a7b2015-10-22 06:19:21 +02001#ifndef UBI_WL_H
2#define UBI_WL_H
3#ifdef CONFIG_MTD_UBI_FASTMAP
4static int anchor_pebs_avalible(struct rb_root *root);
5#ifndef __UBOOT__
6static void update_fastmap_work_fn(struct work_struct *wrk);
7#else
8void update_fastmap_work_fn(struct ubi_device *ubi);
9#endif
10static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
11static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
12static void ubi_fastmap_close(struct ubi_device *ubi);
13static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
14{
15 /* Reserve enough LEBs to store two fastmaps. */
16 *count += (ubi->fm_size / ubi->leb_size) * 2;
17#ifndef __UBOOT__
18 INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
19#endif
20}
21static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
22 struct ubi_wl_entry *e,
23 struct rb_root *root);
24#else /* !CONFIG_MTD_UBI_FASTMAP */
25static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
26static inline void ubi_fastmap_close(struct ubi_device *ubi) { }
27static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
28static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
29 struct ubi_wl_entry *e,
30 struct rb_root *root) {
31 return e;
32}
33#endif /* CONFIG_MTD_UBI_FASTMAP */
34#endif /* UBI_WL_H */