Richard Weinberger | 78d6d49 | 2014-11-10 18:21:51 +0100 | [diff] [blame] | 1 | #ifndef UBI_WL_H |
| 2 | #define UBI_WL_H |
| 3 | #ifdef CONFIG_MTD_UBI_FASTMAP |
Richard Weinberger | 78d6d49 | 2014-11-10 18:21:51 +0100 | [diff] [blame] | 4 | static int anchor_pebs_avalible(struct rb_root *root); |
| 5 | static void update_fastmap_work_fn(struct work_struct *wrk); |
| 6 | static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root); |
| 7 | static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi); |
| 8 | static void ubi_fastmap_close(struct ubi_device *ubi); |
Richard Weinberger | acfda79 | 2014-10-28 17:07:06 +0100 | [diff] [blame] | 9 | static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) |
| 10 | { |
| 11 | /* Reserve enough LEBs to store two fastmaps. */ |
| 12 | *count += (ubi->fm_size / ubi->leb_size) * 2; |
| 13 | INIT_WORK(&ubi->fm_work, update_fastmap_work_fn); |
| 14 | } |
Richard Weinberger | 2f84c246 | 2014-10-29 10:31:41 +0100 | [diff] [blame] | 15 | static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi, |
| 16 | struct ubi_wl_entry *e, |
| 17 | struct rb_root *root); |
Richard Weinberger | 78d6d49 | 2014-11-10 18:21:51 +0100 | [diff] [blame] | 18 | #else /* !CONFIG_MTD_UBI_FASTMAP */ |
| 19 | static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi); |
Richard Weinberger | 78d6d49 | 2014-11-10 18:21:51 +0100 | [diff] [blame] | 20 | static inline void ubi_fastmap_close(struct ubi_device *ubi) { } |
Richard Weinberger | acfda79 | 2014-10-28 17:07:06 +0100 | [diff] [blame] | 21 | static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { } |
Richard Weinberger | 2f84c246 | 2014-10-29 10:31:41 +0100 | [diff] [blame] | 22 | static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi, |
| 23 | struct ubi_wl_entry *e, |
| 24 | struct rb_root *root) { |
| 25 | return e; |
| 26 | } |
Richard Weinberger | 78d6d49 | 2014-11-10 18:21:51 +0100 | [diff] [blame] | 27 | #endif /* CONFIG_MTD_UBI_FASTMAP */ |
| 28 | #endif /* UBI_WL_H */ |