UBI - Unsorted Block Images
Total Page:16
File Type:pdf, Size:1020Kb
UBI - Unsorted Block Images Thomas Gleixner Frank Haverkamp Artem Bityutskiy UBI - Unsorted Block Images by Thomas Gleixner, Frank Haverkamp, and Artem Bityutskiy Copyright © 2006 International Business Machines Corp. Revision History Revision v1.0.0 2006-06-09 Revised by: haver Release Version. Table of Contents 1. Document conventions...........................................................................................................................1 2. Introduction............................................................................................................................................2 UBI Volumes......................................................................................................................................2 Static Volumes ..........................................................................................................................2 Dynamic Volumes.....................................................................................................................3 3. MTD integration ....................................................................................................................................4 Simple partitioning.............................................................................................................................4 Complex partitioning .........................................................................................................................5 4. UBI design ..............................................................................................................................................6 Eraseblock assignement .....................................................................................................................6 Enhancements...........................................................................................................................6 Eraseblock headers.............................................................................................................................7 General Header format .............................................................................................................8 Erase counter format.................................................................................................................8 Volume identifier format...........................................................................................................9 Erase counter update atomicity ..............................................................................................10 Volumes............................................................................................................................................10 The layout volume..................................................................................................................11 Robustness ....................................................................................................................11 FLASH space requirements .............................................................................................................12 Spare erase blocks ..................................................................................................................12 Bad block parameter .....................................................................................................12 Robustness ....................................................................................................................12 Space calculation....................................................................................................................13 Volume management........................................................................................................................13 Volume creation......................................................................................................................14 Volume deletion......................................................................................................................14 Volume resizing ......................................................................................................................14 Logical blocks ..................................................................................................................................14 Block management...........................................................................................................................15 Block allocation......................................................................................................................15 Block erasure..........................................................................................................................15 Block content movement........................................................................................................15 Static volumes...............................................................................................................16 Dynamic volumes .........................................................................................................16 Scrubbing ......................................................................................................................17 UBI Initialization .............................................................................................................................18 Future enhancements..............................................................................................................18 Background operation ......................................................................................................................18 Wear leveling....................................................................................................................................18 Enhancements.........................................................................................................................19 Volume update..................................................................................................................................19 Volume readout ................................................................................................................................20 iii 5. Programming Interfaces .....................................................................................................................21 Kernel Space ....................................................................................................................................21 read .........................................................................................................................................21 write........................................................................................................................................22 erase........................................................................................................................................22 get_volume .............................................................................................................................23 put_volume .............................................................................................................................23 Enhanced: move_update.........................................................................................................23 Userspace Interface UBI ..................................................................................................................24 sysfs interface .........................................................................................................................24 Deviceinfo (sysfs) .........................................................................................................24 Volumeinfo (sysfs) ........................................................................................................25 Examples.......................................................................................................................25 UBI device I/O functions........................................................................................................25 create_volume ...............................................................................................................26 delete_volume ...............................................................................................................26 resize_volume ...............................................................................................................26 UBI volume I/O functions ......................................................................................................27 start_update ioctl...........................................................................................................27 open...............................................................................................................................28 llseek .............................................................................................................................28 read................................................................................................................................28 write ..............................................................................................................................28 Volume update write mode..................................................................................28 Enhancement: Dynamic volume write mode ......................................................29