/linux-6.12.1/drivers/mtd/ubi/ |
D | build.c | 11 * This file includes UBI initialization and building of UBI devices. 13 * When UBI is initialized, it attaches all the MTD devices specified as the 15 * specified, UBI does not attach any MTD device, but it is possible to do 16 * later using the "UBI control device". 33 #include "ubi.h" 54 * @ubi_num: UBI number 75 /* UBI module parameter to enable fastmap automatically on non-fastmap images */ 83 /* UBI control character device */ 90 /* All UBI devices in system */ 93 /* Serializes UBI devices creations and removals */ [all …]
|
D | fastmap-wl.c | 14 struct ubi_device *ubi = container_of(wrk, struct ubi_device, fm_work); in update_fastmap_work_fn() local 16 ubi_update_fastmap(ubi); in update_fastmap_work_fn() 17 spin_lock(&ubi->wl_lock); in update_fastmap_work_fn() 18 ubi->fm_work_scheduled = 0; in update_fastmap_work_fn() 19 spin_unlock(&ubi->wl_lock); in update_fastmap_work_fn() 42 static inline void return_unused_peb(struct ubi_device *ubi, in return_unused_peb() argument 45 wl_tree_add(e, &ubi->free); in return_unused_peb() 46 ubi->free_count++; in return_unused_peb() 51 * @ubi: UBI device description object 54 static void return_unused_pool_pebs(struct ubi_device *ubi, in return_unused_pool_pebs() argument [all …]
|
D | wl.c | 9 * UBI wear-leveling sub-system. 23 * done asynchronously in context of the per-UBI device background thread, 37 * As it was said, for the UBI sub-system all physical eraseblocks are either 92 #include "ubi.h" 125 static int self_check_ec(struct ubi_device *ubi, int pnum, int ec); 126 static int self_check_in_wl_tree(const struct ubi_device *ubi, 128 static int self_check_in_pq(const struct ubi_device *ubi, 137 * the @ubi->used and @ubi->free RB-trees. 169 * @ubi: UBI device description object 175 static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) in wl_entry_destroy() argument [all …]
|
D | vmt.c | 17 #include "ubi.h" 19 static int self_check_volumes(struct ubi_device *ubi); 24 /* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */ 43 * "Show" method for files in '/<sysfs>/class/ubi/ubiX_Y/'. 47 * /<sysfs>/class/ubi/ubiX_Y/reserved_ebs; 49 * C. process 1 starts reading the /<sysfs>/class/ubi/ubiX_Y/reserved_ebs file; 52 * out that the volume was removed from the @ubi->volumes array. 59 struct ubi_device *ubi = vol->ubi; in vol_attribute_show() local 61 spin_lock(&ubi->volumes_lock); in vol_attribute_show() 62 if (!ubi->volumes[vol->vol_id] || ubi->volumes[vol->vol_id]->is_dead) { in vol_attribute_show() [all …]
|
D | io.c | 10 * UBI input/output sub-system. 14 * writing UBI headers. 26 * changed. For example, for different reasons (e.g., optimization) UBI may be 28 * offset. Of course, if the offset of the VID header is unaligned, UBI adds 32 * About minimal I/O units. In general, UBI assumes flash device model where 35 * @ubi->mtd->writesize field. But as an exception, UBI admits use of another 40 * write operations to one NAND page. In this case UBI can fit EC and VID 41 * headers at one NAND page. Thus, UBI may use "sub-page" size as the minimal 42 * I/O unit for the headers (the @ubi->hdrs_min_io_size field). But it still 43 * reports NAND page size (@ubi->min_io_size) as a minimal I/O unit for the UBI [all …]
|
D | debug.h | 11 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); 19 pr_crit("UBI assert failed in %s at %u (pid %d)\n", \ 29 pr_debug("UBI DBG " type " (pid %d): " fmt "\n", current->pid, \ 48 int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, 52 int ubi_debugfs_init_dev(struct ubi_device *ubi); 53 void ubi_debugfs_exit_dev(struct ubi_device *ubi); 56 * The following function is a legacy implementation of UBI fault-injection 60 int ubi_dbg_power_cut(struct ubi_device *ubi, int caller); 62 static inline int ubi_dbg_bitflip(const struct ubi_device *ubi) in ubi_dbg_bitflip() argument 64 if (ubi->dbg.emulate_bitflips) in ubi_dbg_bitflip() [all …]
|
D | vtbl.c | 29 * In this UBI implementation the on-flash volume table does not contain any 52 #include "ubi.h" 54 static void self_vtbl_check(const struct ubi_device *ubi); 61 * @ubi: UBI device description object 63 static int ubi_update_layout_vol(struct ubi_device *ubi) in ubi_update_layout_vol() argument 68 layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)]; in ubi_update_layout_vol() 70 err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl, in ubi_update_layout_vol() 71 ubi->vtbl_size); in ubi_update_layout_vol() 81 * @ubi: UBI device description object 90 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, in ubi_change_vtbl_record() argument [all …]
|
D | fastmap.c | 10 #include "ubi.h" 14 * @ubi: UBI device description object 16 static inline unsigned long *init_seen(struct ubi_device *ubi) in init_seen() argument 20 if (!ubi_dbg_chk_fastmap(ubi)) in init_seen() 23 ret = bitmap_zalloc(ubi->peb_count, GFP_NOFS); in init_seen() 32 * @seen: integer array of @ubi->peb_count size 41 * @ubi: UBI device description object 43 * @seen: integer array of @ubi->peb_count size 45 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen) in set_seen() argument 47 if (!ubi_dbg_chk_fastmap(ubi) || !seen) in set_seen() [all …]
|
D | eba.c | 9 * The UBI Eraseblock Association (EBA) sub-system. 34 #include "ubi.h" 62 * @ubi: UBI device description object 68 unsigned long long ubi_next_sqnum(struct ubi_device *ubi) in ubi_next_sqnum() argument 72 spin_lock(&ubi->ltree_lock); in ubi_next_sqnum() 73 sqnum = ubi->global_sqnum++; in ubi_next_sqnum() 74 spin_unlock(&ubi->ltree_lock); in ubi_next_sqnum() 81 * @ubi: UBI device description object 87 static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) in ubi_get_compat() argument 199 * @ubi: UBI device description object [all …]
|
D | misc.c | 8 /* Here we keep miscellaneous functions which are used all over the UBI code */ 10 #include "ubi.h" 14 * @ubi: UBI device description object 22 int ubi_calc_data_len(const struct ubi_device *ubi, const void *buf, in ubi_calc_data_len() argument 27 ubi_assert(!(length & (ubi->min_io_size - 1))); in ubi_calc_data_len() 34 length = ALIGN(i + 1, ubi->min_io_size); in ubi_calc_data_len() 40 * @ubi: UBI device description object 48 int ubi_check_volume(struct ubi_device *ubi, int vol_id) in ubi_check_volume() argument 52 struct ubi_volume *vol = ubi->volumes[vol_id]; in ubi_check_volume() 71 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); in ubi_check_volume() [all …]
|
D | kapi.c | 8 /* This file mostly implements UBI kernel API functions */ 16 #include "ubi.h" 19 * ubi_do_get_device_info - get information about UBI device. 20 * @ubi: UBI device description object 23 * This function is the same as 'ubi_get_device_info()', but it assumes the UBI 26 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument 28 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info() 29 di->leb_size = ubi->leb_size; in ubi_do_get_device_info() 30 di->leb_start = ubi->leb_start; in ubi_do_get_device_info() 31 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info() [all …]
|
D | ubi.h | 28 #include <linux/mtd/ubi.h> 31 #include "ubi-media.h" 33 /* Maximum number of supported UBI devices */ 36 /* UBI name used for character devices, sysfs, etc */ 37 #define UBI_NAME_STR "ubi" 41 /* Normal UBI messages */ 43 void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...); 45 /* UBI warning messages */ 47 void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...); 49 /* UBI error messages */ [all …]
|
D | Kconfig | 3 tristate "Enable UBI - Unsorted block images" 6 UBI is a software layer above MTD layer which admits use of LVM-like 15 int "UBI wear-leveling threshold" 21 of UBI devices. When this threshold is exceeded, UBI starts performing 36 This option specifies the maximum bad physical eraseblocks UBI 47 To put it differently, if this value is 20, UBI will try to reserve 50 partition UBI attaches. This means that if you have, say, a NAND 52 MTD partitions of the same size, UBI will reserve 40 eraseblocks when 55 This option can be overridden by the "mtd=" UBI module parameter or 61 bool "UBI Fastmap (Experimental feature)" [all …]
|
D | attach.c | 9 * UBI attaching sub-system. 32 * UBI protects EC and VID headers with CRC-32 checksums, so it can detect 33 * whether the headers are corrupted or not. Sometimes UBI also protects the 37 * UBI tries to distinguish between 2 types of corruptions. 39 * 1. Corruptions caused by power cuts. These are expected corruptions and UBI 46 * When UBI detects a corruption (CRC-32 mismatch) in a PEB, and it looks like 47 * the reason is a power cut, UBI puts this PEB to the @erase list, and all 51 * attaching, such PEBs are put to the @corr list and UBI preserves them. 53 * UBI runs out of free PEBs, it switches to R/O mode. UBI also loudly informs 57 * corruptions and UBI's strategy is as follows (in case of attaching by [all …]
|
D | cdev.c | 9 * This file includes implementation of UBI character device operations. 11 * There are two kinds of character devices in UBI: UBI character devices and 12 * UBI volume character devices. UBI character devices allow users to 16 * Major and minor numbers are assigned dynamically to both UBI and volume 19 * Well, there is the third kind of character devices - the UBI control 20 * character device, which allows to manipulate by UBI devices - create and 33 #include <mtd/ubi-user.h> 34 #include "ubi.h" 37 * get_exclusive - get exclusive access to an UBI volume. 40 * This function changes UBI volume open mode to "exclusive". Returns previous [all …]
|
D | upd.c | 19 * marker stays on the flash media and UBI finds it when it attaches the MTD 31 #include "ubi.h" 35 * @ubi: UBI device description object 41 static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) in set_update_marker() argument 49 ubi_assert(ubi->vtbl[vol->vol_id].upd_marker); in set_update_marker() 54 vtbl_rec = ubi->vtbl[vol->vol_id]; in set_update_marker() 57 mutex_lock(&ubi->device_mutex); in set_update_marker() 58 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); in set_update_marker() 60 mutex_unlock(&ubi->device_mutex); in set_update_marker() 66 * @ubi: UBI device description object [all …]
|
D | debug.c | 8 #include "ubi.h" 47 * @ubi: UBI device description object in FAIL_ACTION() 52 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len) in FAIL_ACTION() 57 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; in FAIL_ACTION() 62 err = mtd_read(ubi->mtd, addr, len, &read, buf); in FAIL_ACTION() 64 ubi_err(ubi, "err %d while reading %d bytes from PEB %d:%d, read %zd bytes", in FAIL_ACTION() 69 ubi_msg(ubi, "dumping %d bytes of data from PEB %d, offset %d", in FAIL_ACTION() 123 * @vol: UBI volume description object 240 * Root directory for UBI stuff in debugfs. Contains sub-directories which 241 * contain the stuff specific to particular UBI devices. [all …]
|
D | wl.h | 7 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi); 8 static struct ubi_wl_entry *next_peb_for_wl(struct ubi_device *ubi); 9 static bool need_wear_leveling(struct ubi_device *ubi); 10 static void ubi_fastmap_close(struct ubi_device *ubi); 11 static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) in ubi_fastmap_init() argument 13 if (ubi->fm_disabled) in ubi_fastmap_init() 14 ubi->fm_pool_rsv_cnt = 0; in ubi_fastmap_init() 16 *count += (ubi->fm_size / ubi->leb_size) * 2 + ubi->fm_pool_rsv_cnt; in ubi_fastmap_init() 17 INIT_WORK(&ubi->fm_work, update_fastmap_work_fn); in ubi_fastmap_init() 19 static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi, [all …]
|
D | ubi-media.h | 10 * This file defines the layout of UBI headers and all the other UBI on-flash 19 /* The version of UBI images supported by this implementation */ 28 /* Erase counter header magic number (ASCII "UBI#") */ 30 /* Volume identifier header magic number (ASCII "UBI!") */ 55 * table. UBI automatically re-sizes the volume which has this flag and makes 57 * initialization UBI finds out that there are available physical eraseblocks 62 * eraseblocks will be zero after UBI is loaded, because all of them will be 70 * exceed certain percent, e.g. 2%. When one creates an UBI image which will be 74 * table of the UBI image. In this case, one of the volumes (e.g., the one 76 * UBI will adjust its size on the first boot if needed. [all …]
|
D | gluebi.c | 9 * This is a small driver which implements fake MTD devices on top of UBI 12 * UBI. 15 * size (@mtd->writesize) is equivalent to the UBI minimal I/O unit. The 26 #include <linux/mtd/ubi.h> 28 #include "ubi-media.h" 38 * @desc: UBI volume descriptor 39 * @ubi_num: UBI device number this gluebi device works on 40 * @vol_id: ID of UBI volume this gluebi device works on 58 * @ubi_num: UBI device number 61 * This function seraches for gluebi device corresponding to UBI device [all …]
|
/linux-6.12.1/Documentation/ABI/stable/ |
D | sysfs-class-ubi | 1 What: /sys/class/ubi/ 6 The ubi/ class sub-directory belongs to the UBI subsystem and 7 provides general UBI information, per-UBI device information 8 and per-UBI volume information. 10 What: /sys/class/ubi/version 15 This file contains version of the latest supported UBI on-media 17 However, if in the future UBI needs on-flash format changes 29 UBI devices (UBI device 0, 1, etc). They contain general UBI 30 device information and per UBI volume information (each UBI 31 device may have many UBI volumes) [all …]
|
/linux-6.12.1/include/uapi/mtd/ |
D | ubi-user.h | 28 * UBI device creation (the same as MTD device attachment) 31 * MTD devices may be attached using %UBI_IOCATT ioctl command of the UBI 33 * &struct ubi_attach_req object - UBI will attach the MTD device specified in 34 * the request and return the newly created UBI device number as the ioctl 37 * UBI device deletion (the same as MTD device detachment) 40 * An UBI device maybe deleted with %UBI_IOCDET ioctl command of the UBI 43 * UBI volume creation 46 * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character 50 * UBI volume deletion 53 * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character [all …]
|
/linux-6.12.1/Documentation/filesystems/ |
D | ubifs.rst | 4 UBI File System 10 UBIFS file-system stands for UBI File System. UBI stands for "Unsorted 41 UBIFS works on top of UBI. UBI is a separate software layer which may be 42 found in drivers/mtd/ubi. UBI is basically a volume management and 43 wear-leveling layer. It provides so called UBI volumes which is a higher 44 level abstraction than a MTD device. The programming model of UBI devices 46 they have read/write/erase operations, but UBI devices are devoid of 53 * JFFS2 works on top of MTD devices, UBIFS depends on UBI and works on 54 top of UBI volumes. 74 UBI, which scales linearly. So overall UBI/UBIFS stack scales linearly. [all …]
|
/linux-6.12.1/include/linux/mtd/ |
D | ubi.h | 14 #include <mtd/ubi-user.h> 26 * enum ubi_open_mode - UBI volume open mode constants. 42 * struct ubi_volume_info - UBI volume description data structure. 44 * @ubi_num: UBI device number this volume belongs to 57 * @cdev: UBI volume character device major and minor numbers 60 * for dynamic ones. This is because UBI does not care about dynamic volume 64 * Before touching the volume data during the update operation, UBI first sets 85 * In general, logical eraseblock size is a property of the UBI device, not 86 * of the UBI volume. Indeed, the logical eraseblock size depends on the 87 * physical eraseblock size and on how much bytes UBI headers consume. But [all …]
|
/linux-6.12.1/Documentation/devicetree/bindings/mtd/partitions/ |
D | linux,ubi.yaml | 4 $id: http://devicetree.org/schemas/mtd/partitions/linux,ubi.yaml# 10 UBI ("Unsorted Block Images") is a volume management system for raw 23 const: linux,ubi 27 description: UBI Volumes 30 "^ubi-volume-.*$": 31 $ref: /schemas/mtd/partitions/ubi-volume.yaml# 55 label = "ubi"; 56 compatible = "linux,ubi"; 59 ubi-volume-caldata {
|