aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/eba.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-16 08:44:24 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-25 09:41:24 -0500
commit4ccf8cffa963c7b5bdc6d455ea9417084ee49aa8 (patch)
treea7281874dc9298b3d7eca2d1e4cb22c326625382 /drivers/mtd/ubi/eba.c
parent896c0c06aa30147630e9a75949b6ae2014c841fc (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/eba.c')
-rw-r--r--drivers/mtd/ubi/eba.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 7c05c6e1abc7..1f951e39c535 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -341,9 +341,6 @@ int ubi_eba_unmap_leb(struct ubi_device *ubi, struct ubi_volume *vol,
341{ 341{
342 int err, pnum, vol_id = vol->vol_id; 342 int err, pnum, vol_id = vol->vol_id;
343 343
344 ubi_assert(ubi->ref_count > 0);
345 ubi_assert(vol->ref_count > 0);
346
347 if (ubi->ro_mode) 344 if (ubi->ro_mode)
348 return -EROFS; 345 return -EROFS;
349 346
@@ -392,9 +389,6 @@ int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
392 struct ubi_vid_hdr *vid_hdr; 389 struct ubi_vid_hdr *vid_hdr;
393 uint32_t uninitialized_var(crc); 390 uint32_t uninitialized_var(crc);
394 391
395 ubi_assert(ubi->ref_count > 0);
396 ubi_assert(vol->ref_count > 0);
397
398 err = leb_read_lock(ubi, vol_id, lnum); 392 err = leb_read_lock(ubi, vol_id, lnum);
399 if (err) 393 if (err)
400 return err; 394 return err;
@@ -618,9 +612,6 @@ int ubi_eba_write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
618 int err, pnum, tries = 0, vol_id = vol->vol_id; 612 int err, pnum, tries = 0, vol_id = vol->vol_id;
619 struct ubi_vid_hdr *vid_hdr; 613 struct ubi_vid_hdr *vid_hdr;
620 614
621 ubi_assert(ubi->ref_count > 0);
622 ubi_assert(vol->ref_count > 0);
623
624 if (ubi->ro_mode) 615 if (ubi->ro_mode)
625 return -EROFS; 616 return -EROFS;
626 617
@@ -754,9 +745,6 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, struct ubi_volume *vol,
754 struct ubi_vid_hdr *vid_hdr; 745 struct ubi_vid_hdr *vid_hdr;
755 uint32_t crc; 746 uint32_t crc;
756 747
757 ubi_assert(ubi->ref_count > 0);
758 ubi_assert(vol->ref_count > 0);
759
760 if (ubi->ro_mode) 748 if (ubi->ro_mode)
761 return -EROFS; 749 return -EROFS;
762 750
@@ -871,9 +859,6 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
871 struct ubi_vid_hdr *vid_hdr; 859 struct ubi_vid_hdr *vid_hdr;
872 uint32_t crc; 860 uint32_t crc;
873 861
874 ubi_assert(ubi->ref_count > 0);
875 ubi_assert(vol->ref_count > 0);
876
877 if (ubi->ro_mode) 862 if (ubi->ro_mode)
878 return -EROFS; 863 return -EROFS;
879 864