diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-16 08:44:24 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-25 09:41:24 -0500 |
commit | 4ccf8cffa963c7b5bdc6d455ea9417084ee49aa8 (patch) | |
tree | a7281874dc9298b3d7eca2d1e4cb22c326625382 /drivers/mtd/ubi/ubi.h | |
parent | 896c0c06aa30147630e9a75949b6ae2014c841fc (diff) |
UBI: add auto-resize feature
The problem: NAND flashes have different amount of initial bad physical
eraseblocks (marked as bad by the manufacturer). For example, for 256MiB
Samsung OneNAND flash there might be from 0 to 40 bad initial eraseblocks,
which is about 2%. When UBI is used as the base system, one needs to know
the exact amount of good physical eraseblocks, because this number is
needed to create the UBI image which is put to the devices during
production. But this number is not know, which forces us to use the
minimum number of good physical eraseblocks. And UBI additionally
reserves some percentage of physical eraseblocks for bad block handling
(default is 1%), so we have 1-3% of PEBs reserved at the end, depending
on the amount of initial bad PEBs. But it is desired to always have
1% (or more, depending on the configuration).
Solution: this patch adds an "auto-resize" flag to the volume table.
The volume which has the "auto-resize" flag will automatically be re-sized
(enlarged) on the first UBI initialization. UBI clears the flag when
the volume is re-sized. Only one volume may have the "auto-resize" flag.
So, the production UBI image may have one volume with "auto-resize"
flag set, and its size is automatically adjusted on the first boot
of the device.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 90cdcad83cbb..a8cdbd0364fb 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -250,9 +250,11 @@ struct ubi_wl_entry; | |||
250 | * @rsvd_pebs: count of reserved physical eraseblocks | 250 | * @rsvd_pebs: count of reserved physical eraseblocks |
251 | * @avail_pebs: count of available physical eraseblocks | 251 | * @avail_pebs: count of available physical eraseblocks |
252 | * @beb_rsvd_pebs: how many physical eraseblocks are reserved for bad PEB | 252 | * @beb_rsvd_pebs: how many physical eraseblocks are reserved for bad PEB |
253 | * handling | 253 | * handling |
254 | * @beb_rsvd_level: normal level of PEBs reserved for bad PEB handling | 254 | * @beb_rsvd_level: normal level of PEBs reserved for bad PEB handling |
255 | * | 255 | * |
256 | * @autoresize_vol_id: ID of the volume which has to be auto-resized at the end | ||
257 | * of UBI ititializetion | ||
256 | * @vtbl_slots: how many slots are available in the volume table | 258 | * @vtbl_slots: how many slots are available in the volume table |
257 | * @vtbl_size: size of the volume table in bytes | 259 | * @vtbl_size: size of the volume table in bytes |
258 | * @vtbl: in-RAM volume table copy | 260 | * @vtbl: in-RAM volume table copy |
@@ -333,12 +335,14 @@ struct ubi_device { | |||
333 | int beb_rsvd_pebs; | 335 | int beb_rsvd_pebs; |
334 | int beb_rsvd_level; | 336 | int beb_rsvd_level; |
335 | 337 | ||
338 | int autoresize_vol_id; | ||
336 | int vtbl_slots; | 339 | int vtbl_slots; |
337 | int vtbl_size; | 340 | int vtbl_size; |
338 | struct ubi_vtbl_record *vtbl; | 341 | struct ubi_vtbl_record *vtbl; |
339 | struct mutex volumes_mutex; | 342 | struct mutex volumes_mutex; |
340 | 343 | ||
341 | int max_ec; | 344 | int max_ec; |
345 | /* TODO: mean_ec is not updated run-time, fix */ | ||
342 | int mean_ec; | 346 | int mean_ec; |
343 | 347 | ||
344 | /* EBA unit's stuff */ | 348 | /* EBA unit's stuff */ |