UBI management overhead

What is administrative overhead? In order to manage Nand space and implement functions such as wear balancing, bad block management, etc., a part of the space must be occupied to store key data, just like the metadata of the file system. The space occupied by management will not be presented to user space for use. This space is the overhead of management.

For Nand, UBI management overhead mainly includes 5 parts:

  • Layer volume (volume table): occupies two physical blocks
  • Wear leveling: occupies a physical block
  • Logical block modification atomic operation: occupies a physical block
  • Bad block management: By default, 20 blocks are reserved for every 1024 blocks (kernel parameter configurable: CONFIG_MTD_UBI_BEB_LIMIT)
  • UBI header: (total number of physical blocks * 2) pages

The number of blocks reserved for bad block management can also be understood as the maximum number of bad blocks that can be accommodated. Considering the existence of bad blocks, the management overhead calculation formula is:

Total UBI management overhead = feature overhead + UBI header overhead

Among them:
Bad block reservation = MAX (number of bad blocks, number of bad block management reservations)
Feature overhead = (Bad block reservation + 1 wear-leveling overhead + 1 atomic operation overhead + 2 layer volume overhead) * Physical block Size
UBI header overhead = 2 * page size * (total number of blocks including bad blocks - bad block reservation - 1 wear leveling overhead + 1 atomic operation overhead + 2 layer volume overhead)

That is to say:
UBI management total overhead = (bad block reservation + 4) * physical block size + 2 * page size * (total number of blocks including bad blocks - bad block reservation - 4)

Taking the 128M Longsys FS35ND01G-S1F1 SPI Nand as an example, its specifications are:

Total size: 128M (1Gbit)
Page size: 2K bytes
Block size: 128K
Number of blocks: 1024

Assuming that the film is completely free of bad blocks, its management overhead is:

UBI management overhead = (20 + 4) * 128K + 2 * 2K * (1024 - 20 - 4) = 7072K ≈ 7M

Guess you like

Origin blog.csdn.net/qq_41483419/article/details/132500302