Lines Matching +full:wear +full:- +full:leveling

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
31 #include "ubi-media.h"
57 * This marker in the EBA table means that the LEB is um-mapped.
60 #define UBI_LEB_UNMAPPED -1
64 * returning error. The below constant defines how many times UBI re-tries.
70 * number of (global) erase cycles PEBs are protected from the wear-leveling
76 #define UBI_UNKNOWN -1
89 * Error codes returned by the I/O sub-system.
99 * UBI_IO_BITFLIPS: bit-flips were detected and corrected
101 * Note, it is probably better to have bit-flip and ebadmsg as flags which can
124 * MOVE_TARGET_BITFLIPS: canceled because a bit-flip was detected in the
138 * Return codes of the fastmap sub-system
149 * struct ubi_vid_io_buf - VID buffer used to read/write VID info to/from the
160 * struct ubi_wl_entry - wear-leveling entry.
161 * @u.rb: link in the corresponding (free/used) RB-tree
166 * This data structure is used in the WL sub-system. Each physical eraseblock
168 * RB-trees. See WL sub-system for details.
180 * struct ubi_ltree_entry - an entry in the lock tree.
181 * @rb: links RB-tree nodes
188 * This data structure is used in the EBA sub-system to implement per-LEB
189 * locking. When a logical eraseblock is being locked - corresponding
190 * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree).
191 * See EBA sub-system for details.
202 * struct ubi_rename_entry - volume re-name description data structure.
205 * @remove: if not zero, this volume should be removed, not re-named
207 * @list: links re-name entries into a list
209 * This data structure is utilized in the multiple volume re-name code. Namely,
225 * struct ubi_fastmap_layout - in-memory fastmap data structure.
227 * @to_be_tortured: if non-zero tortured this PEB
230 * @max_wl_pool_size: maximal size of the pool used by the WL sub-system
241 * struct ubi_fm_pool - in-memory fastmap pool
260 * struct ubi_eba_leb_desc - EBA logical eraseblock descriptor
275 * struct ubi_volume - UBI volume description data structure.
281 * @readers: number of users holding this volume in read-only mode
282 * @writers: number of users holding this volume in read-write mode
308 * @eba_tbl: EBA table of this volume (LEB->PEB mapping)
319 * @checkmap: bitmap to remember which PEB->LEB mappings got checked,
324 * dynamic volumes - it is user's responsibility to assure their data
374 * struct ubi_volume_desc - UBI volume descriptor returned when it is opened.
385 * struct ubi_debug_info - debugging information for an UBI device.
391 * @emulate_bitflips: emulate bit-flips for testing purposes
404 * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips
438 * struct ubi_device - UBI device description structure
447 * @vol->readers, @vol->writers, @vol->exclusive,
448 * @vol->metaonly, @vol->ref_count, @vol->mapping and
449 * @vol->eba_tbl.
459 * @autoresize_vol_id: ID of the volume which has to be auto-resized at the end
463 * @vtbl: in-RAM volume table copy
464 * @device_mutex: protects on-flash volume table and serializes volume
465 * creation, deletion, update, re-size, re-name and set
476 * @fm_disabled: non-zero if fastmap is disabled (default)
477 * @fm: in-memory data structure of the currently used fastmap
478 * @fm_pool: in-memory data structure of the fastmap pool
479 * @fm_wl_pool: in-memory data structure of the fastmap pool used by the WL
480 * sub-system
487 * @fm_work_scheduled: non-zero if fastmap work was scheduled
488 * @fast_attach: non-zero if UBI was attached by fastmap
493 * @used: RB-tree of used physical eraseblocks
494 * @erroneous: RB-tree of erroneous used physical eraseblocks
495 * @free: RB-tree of free physical eraseblocks
497 * @scrub: RB-tree of physical eraseblocks which need scrubbing
499 * protected from the wear-leveling worker)
508 * @wl_scheduled: non-zero if the wear-leveling was scheduled
532 * @ro_mode: if the UBI device is in read-only mode
542 * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset
544 * @nor_flash: non-zero if working on top of NOR flash
580 /* Note, mean_ec is not updated run-time - should be fixed */
583 /* EBA sub-system's stuff */
605 /* Wear-leveling sub-system's stuff */
627 /* I/O sub-system's stuff */
659 * struct ubi_ainf_peb - attach information about a physical eraseblock.
667 * @u: unions RB-tree or @list links
668 * @u.rb: link in the per-volume RB-tree of &struct ubi_ainf_peb objects
690 * struct ubi_ainf_volume - attaching information about a volume.
703 * @rb: link in the volume RB-tree
704 * @root: root of the RB-tree containing all the eraseblock belonging to this
724 * struct ubi_attach_info - MTD device attaching information.
725 * @volumes: root of the volume RB-tree
730 * those belonging to "preserve"-compatible internal volumes)
756 * be used by other UBI sub-systems to build final UBI data structures, further
757 * error-recovery and so on.
787 * struct ubi_work - UBI work description data structure.
797 * WL sub-system is shutting down.
871 return lnum >= 0 && lnum < vol->reserved_pebs; in ubi_leb_valid()
990 return -ENOSYS; in ubiblock_create()
994 return -ENOSYS; in ubiblock_remove()
999 * ubi_for_each_free_peb - walk the UBI free RB tree.
1002 * @pos: a pointer to RB-tree entry type to use as a loop counter
1005 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb)
1008 * ubi_for_each_used_peb - walk the UBI used RB tree.
1011 * @pos: a pointer to RB-tree entry type to use as a loop counter
1014 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->used, u.rb)
1017 * ubi_for_each_scub_peb - walk the UBI scub RB tree.
1020 * @pos: a pointer to RB-tree entry type to use as a loop counter
1023 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->scrub, u.rb)
1026 * ubi_for_each_protected_peb - walk the UBI protection queue.
1033 list_for_each_entry((e), &(ubi->pq[(i)]), u.list)
1036 * ubi_rb_for_each_entry - walk an RB-tree.
1038 * @pos: a pointer to RB-tree entry type to use as a loop counter
1039 * @root: RB-tree's root
1040 * @member: the name of the 'struct rb_node' within the RB-tree entry
1050 * ubi_move_aeb_to_list - move a PEB from the volume tree to a list.
1060 rb_erase(&aeb->u.rb, &av->root); in ubi_move_aeb_to_list()
1061 list_add_tail(&aeb->u.list, list); in ubi_move_aeb_to_list()
1065 * ubi_init_vid_buf - Initialize a VID buffer
1075 memset(buf, 0, ubi->vid_hdr_alsize); in ubi_init_vid_buf()
1077 vidb->buffer = buf; in ubi_init_vid_buf()
1078 vidb->hdr = buf + ubi->vid_hdr_shift; in ubi_init_vid_buf()
1082 * ubi_init_vid_buf - Allocate a VID buffer
1096 buf = kmalloc(ubi->vid_hdr_alsize, gfp_flags); in ubi_alloc_vid_buf()
1108 * ubi_free_vid_buf - Free a VID buffer
1116 kfree(vidb->buffer); in ubi_free_vid_buf()
1121 * ubi_get_vid_hdr - Get the VID header attached to a VID buffer
1126 return vidb->hdr; in ubi_get_vid_hdr()
1130 * ubi_ro_mode - switch to read-only mode.
1135 if (!ubi->ro_mode) { in ubi_ro_mode()
1136 ubi->ro_mode = 1; in ubi_ro_mode()
1137 ubi_warn(ubi, "switch to read-only mode"); in ubi_ro_mode()
1151 return ubi_io_read(ubi, buf, pnum, offset + ubi->leb_start, len); in ubi_io_read_data()
1167 return -EROFS; in ubi_io_write_data()
1169 return ubi_io_write(ubi, buf, pnum, offset + ubi->leb_start, len); in ubi_io_write_data()
1173 * vol_id2idx - get table index by volume ID.
1180 return vol_id - UBI_INTERNAL_VOL_START + ubi->vtbl_slots; in vol_id2idx()
1186 * idx2vol_id - get volume ID by table index.
1192 if (idx >= ubi->vtbl_slots) in idx2vol_id()
1193 return idx - ubi->vtbl_slots + UBI_INTERNAL_VOL_START; in idx2vol_id()
1199 * ubi_is_fm_vol - check whether a volume ID is a Fastmap volume.
1214 * ubi_find_fm_block - check whether a PEB is part of the current Fastmap.
1218 * This function returns a wear leveling object if @pnum relates to the current
1226 if (ubi->fm) { in ubi_find_fm_block()
1227 for (i = 0; i < ubi->fm->used_blocks; i++) { in ubi_find_fm_block()
1228 if (ubi->fm->e[i]->pnum == pnum) in ubi_find_fm_block()
1229 return ubi->fm->e[i]; in ubi_find_fm_block()