UBI header 位置 和 管理flash空间的开支
来源:互联网 发布:线程安全 java 编辑:程序博客网 时间:2024/04/28 05:57
UBI headers position
The EC header always resides at offset 0 and takes 64 bytes, the VID header resides at the next available min. I/O unit or sub-page, and also takes 64 bytes. For example:
- in case of NOR flash which has 1 byte min. I/O unit, the VID header resides at offset 64;
- in case of NAND flash which does not have sub-pages, the VID header resides at the second NAND page;
- in case of NAND flash which has sub-pages, the VID header resides at the second sub-page.
- 最小I/O单元为1个字节的 NOR flash, VID header 在偏移量64处
- 没有子页的NAND flash, VID header 在第二个NAND page处
- 有子页的NAND flash, VID header 在第二个NAND 子页处
UBI uses some amount of flash space for its own purposes, thus reducing the amount of flash space available for UBI users. Namely:
- 2 PEBs are used to store the volume table;
- 1 PEB is reserved for wear-leveling purposes;
- 1 PEB is reserved for the atomic LEB change operation;
- some amount of PEBs is reserved for bad PEB handling; this is applicable for NAND flash, but not for NOR flash; the amount of reserved PEBs is configurable and is equal to 20 blocks per 1024 blocks by default;
- UBI stores the EC and VID headers at the beginning of each PEB; the amount of bytes used for these purposes depends on the flash type and is explained below.
Flash 空间维护开支
UBI 使用一些flash空间作为自己的特殊用途, 这减少了留给用户的可用空间。 UBI 使用的空间如下:
- 2 个 PEB 用于存储 volume table
- 1 个 PEB 用于耗损均衡
- 1 个 PEB 用于对 LEB 的原子性更改
- 还有一定数量的 PEB 为 坏块管理 预留, 这仅在 NAND flash 上有, NOR flash没有; 预留的 PEB数量可配置, 缺省每 1024 个块有20个块预留。
- UBI 在每个PEB开始存储 EC header 和 VID header; 数量取决于flash类型, 下面会作解释。
Lets introduce symbols:
- W - total number of physical eraseblocks on the flash chip (NB: the entire chip, not the MTD partition);
- P - total number of physical eraseblocks on the MTD partition);
- SP - physical eraseblock size;
- SL - logical eraseblock size;
- BB - number of bad blocks on the MTD partition;
- BR - number of PEBs reserved for bad PEB handling. it is 20 * W/1024 for NAND by default, and 0 for NOR and other flash types which do not have bad PEBs;
- B - MAX(BR,BB);
- O - the overhead related to storing EC and VID headers in bytes, i.e. O = SP - SL.
先引入几个符号:
- W - flash 芯片上物理擦除块的总数量
- P - MTD 分区上物理擦除块的总数量
- SP - 物理擦除块size
- SL - 逻辑擦除块size
- BB - MTD 分区上坏块的数量
- BR - 为坏块管理预留的 PEB 数量; 如果是 NAND, 缺省为 20*W / 1024, NOR flash 为 0
- B - MAX(BB, BR)
- O - 存储 EC header 和 VID header 的开支, O = SP - SL
The UBI overhead is (B + 4) * SP + O * (P - B - 4) i.e., this amount of bytes will not be accessible for users. O is different for different flashes:
- in case of NOR flash which has 1 byte minimum input/output unit, O is 128 bytes;
- in case of NAND flash which does not have sub-pages (e.g., MLC NAND), O is 2 NAND pages, i.e. 4KiB in case of 2KiB NAND page and 1KiB in case of 512 bytes NAND page;
- in case of NAND flash which has sub-pages, UBI optimizes its on-flash layout and puts the EC and VID headers at the same NAND page, but different sub-pages; in this case O is only one NAND page;
- for other flashes the overhead should be 2 min. I/O units if the min. I/O unit size is greater or equivalent to 64 bytes, and 2 times 64 bytes aligned to the min. I/O unit size if the min. I/O unit size is less than 64 bytes.
N.B.: the formula above counts bad blocks as a UBI overhead. The real UBI overhead is: (B - BB + 4) * SP + O * (P - B - 4).
UBI 管理开支 是 (B+4)*SP + O*(P-B-4) . 也就是这些数量的字节用户将无法使用。 O 对于不同的flash是不一样的:
- 对于最小读写单元为字节的 NOR flash, O = 128 bytes
- 对于不支持子页的 NAND flash, O = 2 NAND page
- 对于支持子页的NAND flash, UBI 会优化其在flash上的布局, 把 EC 和 VID header 存在同一个 page上的不同子页; O = 1 NAND page
- 对于其它flash, 如果最小IO单元大于等于64字节,开支为 2 个最小IO单元;如果最小IO单元小于64字节, 则2倍的64字节以最小 IO单元对齐
Saving erase counters
When working with UBI, it is important to realize that UBI stores erase counters on the flash media. Namely, each physical eraseblock has so-called erase counter header which stores the amount of times this physical eraseblock has been erased (see here). And of course, it is important not to lose the erase counters, which means that the tools you use to erase the flash and to write UBI images have to be UBI-aware. The mtd-utils repository contains the ubiformat
utility which takes things right.
保存擦除计数
当使用UBI时, 知道 UBI 在 flash 上存储擦除计数是很重要的, 名义上, 每个物理擦除块有所谓的擦除计数头, 在头内存储有擦除块的擦除计数。 当然, 最重要的是不要丢失这些计数, 这意味着你用于擦除flash和写映像的工具必须能够识别 UBI 设备。 MTD 库中含有 ubiformat 这个工具, 它能够争取处理 UBI 设备。
- UBI header 位置 和 管理flash空间的开支
- UBI- 用户空间的工具
- nand ubi -2 ubi管理下的SLC nand
- 动态改变空间的位置和大小
- UBI 文件系统的支持和image制作
- ubi 的相关概念和解释
- ubi 的相关概念和解释
- 开支
- uboot对Flash和DDR的管理
- U-boot的启动和flash中的位置
- nand ubi - 5 kernel和ubi
- 管理oracle的表空间和数据文件
- oracle表空间和数据文件的管理!
- 表空间的管理和创建
- UNDO表空间的作用和管理
- 管理Oracle的undo表空间和temp表空间
- 一种新型FLASH文件系统UBI/UBIFS—-很不错的开源项目
- 【转】U-Boot中ubi和ubifs命令的使用
- 平衡二叉( AVL)
- Delphi COM编程技术一(COM编程基础知识)
- Gentoo Linux 2006.1(LiveCD)图形界面安装指南(菜鸟无图版)
- SQL server触发器实例讲解(如何实现两个表的关联)
- WPF 中RichTextBox控件用法细讲
- UBI header 位置 和 管理flash空间的开支
- Oracle多行函数
- Introduction to JSP Standard Tag Library (JSTL Basics)
- Vijos 10月月赛记录
- 网站解析的因素
- 经得起风雨,却经不起平凡
- Nask汇编编写操作系统,自制NaskCode开发环境
- 使用max函数转换rpgle中readpe操作码
- android 软键盘控制