blob: fbc2d8e312df3843900f9ef048fa168c55a79839 [file] [log] [blame]
Richard Weinberger78d6d492014-11-10 18:21:51 +01001#ifndef UBI_WL_H
2#define UBI_WL_H
3#ifdef CONFIG_MTD_UBI_FASTMAP
4static int is_fm_block(struct ubi_device *ubi, int pnum);
5static int anchor_pebs_avalible(struct rb_root *root);
6static void update_fastmap_work_fn(struct work_struct *wrk);
7static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
8static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
9static void ubi_fastmap_close(struct ubi_device *ubi);
Richard Weinbergeracfda792014-10-28 17:07:06 +010010static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
11{
12 /* Reserve enough LEBs to store two fastmaps. */
13 *count += (ubi->fm_size / ubi->leb_size) * 2;
14 INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
15}
Richard Weinberger2f84c2462014-10-29 10:31:41 +010016static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
17 struct ubi_wl_entry *e,
18 struct rb_root *root);
Richard Weinberger78d6d492014-11-10 18:21:51 +010019#else /* !CONFIG_MTD_UBI_FASTMAP */
20static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
21static inline int is_fm_block(struct ubi_device *ubi, int pnum)
22{
23 return 0;
24}
25static inline void ubi_fastmap_close(struct ubi_device *ubi) { }
Richard Weinbergeracfda792014-10-28 17:07:06 +010026static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
Richard Weinberger2f84c2462014-10-29 10:31:41 +010027static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
28 struct ubi_wl_entry *e,
29 struct rb_root *root) {
30 return e;
31}
Richard Weinberger78d6d492014-11-10 18:21:51 +010032#endif /* CONFIG_MTD_UBI_FASTMAP */
33#endif /* UBI_WL_H */