Lines Matching +full:use +full:- +full:minimum +full:- +full:ecc

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
86 * Error codes returned by the I/O sub-system.
91 * (uncorrectable ECC error in case of NAND)
95 * (uncorrectable ECC error in case of NAND)
96 * UBI_IO_BITFLIPS: bit-flips were detected and corrected
98 * Note, it is probably better to have bit-flip and ebadmsg as flags which can
121 * MOVE_TARGET_BITFLIPS: canceled because a bit-flip was detected in the
135 * Return codes of the fastmap sub-system
157 * struct ubi_vid_io_buf - VID buffer used to read/write VID info to/from the
168 * struct ubi_wl_entry - wear-leveling entry.
169 * @u.rb: link in the corresponding (free/used) RB-tree
174 * This data structure is used in the WL sub-system. Each physical eraseblock
176 * RB-trees. See WL sub-system for details.
188 * struct ubi_ltree_entry - an entry in the lock tree.
189 * @rb: links RB-tree nodes
196 * This data structure is used in the EBA sub-system to implement per-LEB
197 * locking. When a logical eraseblock is being locked - corresponding
198 * &struct ubi_ltree_entry object is inserted to the lock tree (@ubi->ltree).
199 * See EBA sub-system for details.
210 * struct ubi_rename_entry - volume re-name description data structure.
213 * @remove: if not zero, this volume should be removed, not re-named
215 * @list: links re-name entries into a list
217 * This data structure is utilized in the multiple volume re-name code. Namely,
233 * struct ubi_fastmap_layout - in-memory fastmap data structure.
235 * @to_be_tortured: if non-zero tortured this PEB
238 * @max_wl_pool_size: maximal size of the pool used by the WL sub-system
249 * struct ubi_fm_pool - in-memory fastmap pool
268 * struct ubi_eba_leb_desc - EBA logical eraseblock descriptor
283 * struct ubi_volume - UBI volume description data structure.
284 * @dev: device object to make use of the the Linux device model
289 * @readers: number of users holding this volume in read-only mode
290 * @writers: number of users holding this volume in read-write mode
316 * @eba_tbl: EBA table of this volume (LEB->PEB mapping)
327 * @checkmap: bitmap to remember which PEB->LEB mappings got checked,
332 * dynamic volumes - it is user's responsibility to assure their data
381 * struct ubi_volume_desc - UBI volume descriptor returned when it is opened.
392 * struct ubi_debug_info - debugging information for an UBI device.
398 * @emulate_bitflips: emulate bit-flips for testing purposes
402 * @power_cut_min: minimum number of writes before emulating a power cut
410 * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips
413 * @dfs_power_cut_min: debugfs knob for minimum writes before power cut
441 * struct ubi_device - UBI device description structure
442 * @dev: UBI device object to use the the Linux device model
450 * @vol->readers, @vol->writers, @vol->exclusive,
451 * @vol->metaonly, @vol->ref_count, @vol->mapping and
452 * @vol->eba_tbl.
462 * @autoresize_vol_id: ID of the volume which has to be auto-resized at the end
466 * @vtbl: in-RAM volume table copy
467 * @device_mutex: protects on-flash volume table and serializes volume
468 * creation, deletion, update, re-size, re-name and set
479 * @fm_disabled: non-zero if fastmap is disabled (default)
480 * @fm: in-memory data structure of the currently used fastmap
481 * @fm_pool: in-memory data structure of the fastmap pool
482 * @fm_wl_pool: in-memory data structure of the fastmap pool used by the WL
483 * sub-system
490 * @fm_work_scheduled: non-zero if fastmap work was scheduled
491 * @fast_attach: non-zero if UBI was attached by fastmap
496 * @used: RB-tree of used physical eraseblocks
497 * @erroneous: RB-tree of erroneous used physical eraseblocks
498 * @free: RB-tree of free physical eraseblocks
500 * @scrub: RB-tree of physical eraseblocks which need scrubbing
502 * protected from the wear-leveling worker)
511 * @wl_scheduled: non-zero if the wear-leveling was scheduled
535 * @ro_mode: if the UBI device is in read-only mode
545 * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset
547 * @nor_flash: non-zero if working on top of NOR flash
582 /* Note, mean_ec is not updated run-time - should be fixed */
585 /* EBA sub-system's stuff */
607 /* Wear-leveling sub-system's stuff */
629 /* I/O sub-system's stuff */
661 * struct ubi_ainf_peb - attach information about a physical eraseblock.
669 * @u: unions RB-tree or @list links
670 * @u.rb: link in the per-volume RB-tree of &struct ubi_ainf_peb objects
692 * struct ubi_ainf_volume - attaching information about a volume.
705 * @rb: link in the volume RB-tree
706 * @root: root of the RB-tree containing all the eraseblock belonging to this
726 * struct ubi_attach_info - MTD device attaching information.
727 * @volumes: root of the volume RB-tree
732 * those belonging to "preserve"-compatible internal volumes)
758 * be used by other UBI sub-systems to build final UBI data structures, further
759 * error-recovery and so on.
789 * struct ubi_work - UBI work description data structure.
799 * WL sub-system is shutting down.
873 return lnum >= 0 && lnum < vol->reserved_pebs; in ubi_leb_valid()
989 return -ENOSYS; in ubiblock_create()
993 return -ENOSYS; in ubiblock_remove()
998 * ubi_for_each_free_peb - walk the UBI free RB tree.
1000 * @e: a pointer to a ubi_wl_entry to use as cursor
1001 * @pos: a pointer to RB-tree entry type to use as a loop counter
1004 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->free, u.rb)
1007 * ubi_for_each_used_peb - walk the UBI used RB tree.
1009 * @e: a pointer to a ubi_wl_entry to use as cursor
1010 * @pos: a pointer to RB-tree entry type to use as a loop counter
1013 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->used, u.rb)
1016 * ubi_for_each_scub_peb - walk the UBI scub RB tree.
1018 * @e: a pointer to a ubi_wl_entry to use as cursor
1019 * @pos: a pointer to RB-tree entry type to use as a loop counter
1022 ubi_rb_for_each_entry((tmp_rb), (e), &(ubi)->scrub, u.rb)
1025 * ubi_for_each_protected_peb - walk the UBI protection queue.
1028 * @e: a pointer to a ubi_wl_entry to use as cursor
1032 list_for_each_entry((e), &(ubi->pq[(i)]), u.list)
1035 * ubi_rb_for_each_entry - walk an RB-tree.
1036 * @rb: a pointer to type 'struct rb_node' to use as a loop counter
1037 * @pos: a pointer to RB-tree entry type to use as a loop counter
1038 * @root: RB-tree's root
1039 * @member: the name of the 'struct rb_node' within the RB-tree entry
1049 * ubi_move_aeb_to_list - move a PEB from the volume tree to a list.
1059 rb_erase(&aeb->u.rb, &av->root); in ubi_move_aeb_to_list()
1060 list_add_tail(&aeb->u.list, list); in ubi_move_aeb_to_list()
1064 * ubi_init_vid_buf - Initialize a VID buffer
1074 memset(buf, 0, ubi->vid_hdr_alsize); in ubi_init_vid_buf()
1076 vidb->buffer = buf; in ubi_init_vid_buf()
1077 vidb->hdr = buf + ubi->vid_hdr_shift; in ubi_init_vid_buf()
1081 * ubi_init_vid_buf - Allocate a VID buffer
1083 * @gfp_flags: GFP flags to use for the allocation
1095 buf = kmalloc(ubi->vid_hdr_alsize, gfp_flags); in ubi_alloc_vid_buf()
1107 * ubi_free_vid_buf - Free a VID buffer
1115 kfree(vidb->buffer); in ubi_free_vid_buf()
1120 * ubi_get_vid_hdr - Get the VID header attached to a VID buffer
1125 return vidb->hdr; in ubi_get_vid_hdr()
1137 return ubi_io_read(ubi, buf, pnum, offset + ubi->leb_start, len); in ubi_io_read_data()
1149 return ubi_io_write(ubi, buf, pnum, offset + ubi->leb_start, len); in ubi_io_write_data()
1153 * ubi_ro_mode - switch to read-only mode.
1158 if (!ubi->ro_mode) { in ubi_ro_mode()
1159 ubi->ro_mode = 1; in ubi_ro_mode()
1160 ubi_warn(ubi, "switch to read-only mode"); in ubi_ro_mode()
1166 * vol_id2idx - get table index by volume ID.
1173 return vol_id - UBI_INTERNAL_VOL_START + ubi->vtbl_slots; in vol_id2idx()
1179 * idx2vol_id - get volume ID by table index.
1185 if (idx >= ubi->vtbl_slots) in idx2vol_id()
1186 return idx - ubi->vtbl_slots + UBI_INTERNAL_VOL_START; in idx2vol_id()
1192 * ubi_is_fm_vol - check whether a volume ID is a Fastmap volume.
1207 * ubi_find_fm_block - check whether a PEB is part of the current Fastmap.
1219 if (ubi->fm) { in ubi_find_fm_block()
1220 for (i = 0; i < ubi->fm->used_blocks; i++) { in ubi_find_fm_block()
1221 if (ubi->fm->e[i]->pnum == pnum) in ubi_find_fm_block()
1222 return ubi->fm->e[i]; in ubi_find_fm_block()