Lines Matching +full:many +full:- +full:to +full:- +full:one
1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
10 * This file defines the layout of UBI headers and all the other UBI on-flash
47 * @UBI_VTBL_AUTORESIZE_FLG: auto-resize this volume
51 * check. Main use-case for this flag is
52 * boot-time reduction
54 * %UBI_VTBL_AUTORESIZE_FLG flag can be set only for one volume in the volume
55 * table. UBI automatically re-sizes the volume which has this flag and makes
56 * the volume to be of largest possible size. This means that if after the
58 * present on the device, it automatically appends all of them to the volume
66 * The auto-resize feature is useful for device production purposes. For
70 * exceed certain percent, e.g. 2%. When one creates an UBI image which will be
71 * flashed to the end devices in production, he does not know the exact amount
73 * number is required to calculate the volume sized and put them to the volume
74 * table of the UBI image. In this case, one of the volumes (e.g., the one
75 * which will store the root file system) is marked as "auto-resizable", and
79 * eraseblock handling, and then re-sizes the volume, not vice-versa. This
91 * to the flash
92 * @UBI_COMPAT_RO: attach this device in read-only mode
93 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
94 * physical eraseblocks, don't allow the wear-leveling
95 * sub-system to move them
110 #define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(__be32))
111 #define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(__be32))
114 * struct ubi_ec_hdr - UBI erase counter header.
116 * @version: version of UBI implementation which is supposed to accept this
127 * future usage. The unused fields are zeroed. The @version field is used to
128 * indicate the version of UBI implementation which is supposed to be able to
135 * volume identifier header and user data, relative to the beginning of the
136 * physical eraseblock. These values have to be the same for all physical
139 * The @image_seq field is used to validate a UBI image that has been prepared
143 * One way to make use of @image_seq is to increase its value by one every time
151 __be64 ec; /* Warning: the current limit is 31-bit anyway! */
160 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
162 * @version: UBI implementation version which is supposed to accept this UBI
166 * eraseblock (for wear-leveling reasons)
172 * @data_size: how many bytes of data this logical eraseblock contains
174 * @data_pad: how many bytes at the end of this physical eraseblock are not
184 * UBI writes a new VID header to the flash, i.e. when it maps a logical
185 * eraseblock to a new physical eraseblock. The global sequence counter is an
186 * unsigned 64-bit integer and we assume it never overflows. The @sqnum
187 * (sequence number) is used to distinguish between older and newer versions of
190 * There are 2 situations when there may be more than one physical eraseblock
191 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
193 * eraseblock L and it is mapped to the physical eraseblock P.
197 * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
198 * so P1 is written to, then an unclean reboot happens. Result - there are 2
199 * physical eraseblocks P and P1 corresponding to the same logical eraseblock
203 * 2. From time to time UBI moves logical eraseblocks to other physical
204 * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
205 * to P1, and an unclean reboot happens before P is physically erased, there
206 * are two physical eraseblocks P and P1 corresponding to L and UBI has to
207 * select one of them when the flash is attached. The @sqnum field says which
209 * it is not enough to select the physical eraseblock with the higher sequence
211 * copying process, so the data in P is corrupted. It is also not enough to
213 * data there may be old (consider a case if more data was added to P1 after
218 * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
220 * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
221 * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
222 * examined. If it is cleared, the situation is simple and the newer one is
225 * the older one (P) is selected.
229 * UBI purposes. In this implementation there is only one internal volume - the
231 * For example, in future one may introduce a journal internal volume. Internal
236 * provides a mechanism to introduce UBI extensions and to be still compatible
241 * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
242 * - it just ignores the Ext3fs journal.
247 * data of the physical eraseblock was moved by the wear-leveling sub-system,
248 * then the wear-leveling sub-system calculates the data CRC and stores it in
251 * The @data_size field is used only for static volumes because UBI has to know
252 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
254 * physical eraseblock was moved to another physical eraseblock for
255 * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
259 * The @used_ebs field is used only for static volumes and indicates how many
265 * eraseblocks of this volume. This is very handy when one uses block-oriented
294 #define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
305 /* The maximum number of volumes per one UBI device */
315 #define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
318 * struct ubi_vtbl_record - a record in the volume table.
319 * @reserved_pebs: how many physical eraseblocks are reserved for this volume
321 * @data_pad: how many bytes are unused at the end of the each physical
322 * eraseblock to satisfy the requested alignment
337 * If the size of the logical eraseblock is large enough to fit
339 * records. Otherwise, it contains as many records as it can fit (i.e., size of
342 * The @upd_marker flag is used to implement volume update. It is set to %1
343 * before update and set to %0 after the update. So if the update operation was
347 * later changed. It may be useful, for example, when a block-oriented file
349 * logical eraseblock size and @alignment. The alignment must be multiple to the
368 /* UBI fastmap on-flash data structures */
373 /* fastmap on-flash data structure format version */
386 /* A fastmap can use up to UBI_FM_MAX_BLOCKS PEBs */
389 /* 5% of the total number of PEBs have to be scanned while attaching
391 * But the size of this pool is limited to be between UBI_FM_MIN_POOL_SIZE and
397 * struct ubi_fm_sb - UBI fastmap super block
420 * struct ubi_fm_hdr - header of the fastmap data set
424 * @scrub_peb_count: number of to be scrubbed PEBs known by this fastmap
426 * @erase_peb_count: number of bad PEBs which have to be erased
443 * struct ubi_fm_scan_pool - Fastmap pool PEBs to be scanned while attaching
460 * struct ubi_fm_ec - stores the erase counter of a PEB
470 * struct ubi_fm_volhdr - Fastmap volume header
490 /* struct ubi_fm_volhdr is followed by one struct ubi_fm_eba records */
493 * struct ubi_fm_eba - denotes an association between a PEB and LEB