summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
Commit message (Collapse)AuthorAgeFilesLines
* UBI: Extend UBI layer debug/messaging capabilitiesTanya Brokhman2014-11-071-59/+67
| | | | | | | | | | | | | | If there is more then one UBI device mounted, there is no way to distinguish between messages from different UBI devices. Add device number to all ubi layer message types. The R/O block driver messages were replaced by pr_* since ubi_device structure is not used by it. Amended a bit by Artem. Signed-off-by: Tanya Brokhman <tlinder@codeaurora.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: R/O block driver on top of UBI volumesEzequiel Garcia2014-02-281-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces read-only block device emulation on top of UBI volumes. Given UBI takes care of wear leveling and bad block management it's possible to add a thin layer to enable block device access to UBI volumes. This allows to use a block-oriented filesystem on a flash device. The UBI block devices are meant to be used in conjunction with any regular, block-oriented file system (e.g. ext4), although it's primarily targeted at read-only file systems, such as squashfs. Block devices are created upon user request through new ioctls: UBI_IOCVOLATTBLK to attach and UBI_IOCVOLDETBLK to detach. Also, a new UBI module parameter is added 'ubi.block'. This parameter is needed in order to attach a block device on boot-up time, allowing to mount the rootfs on a ubiblock device. For instance, you could have these kernel parameters: ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0 Or, if you compile ubi as a module: $ modprobe ubi mtd=/dev/mtd5 block=/dev/ubi0_0 Artem: amend commentaries and massage the patch a little bit. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix error return codeJulia Lawall2014-01-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the return variable to an error code as done elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Richard Weinberger <richard@nod.at>
* mtd: Move major number definitions to major.hEzequiel Garcia2013-11-061-0/+1
| | | | | | | | | This patch moves the char and block major number definitions to major.h to be with the rest of the major numbers. While doing this, include major.h in the files that need it. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* Merge tag 'upstream-3.11-rc1' of git://git.infradead.org/linux-ubiLinus Torvalds2013-07-051-19/+40
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Pull ubi fixes from Artem Bityutskiy: "A couple of fixes and clean-ups, allow for assigning user-defined UBI device numbers when attaching MTD devices by using the "mtd=" module parameter" * tag 'upstream-3.11-rc1' of git://git.infradead.org/linux-ubi: UBI: support ubi_num on mtd.ubi command line UBI: fastmap break out of used PEB search UBI: document UBI_IOCVOLUP better in user header UBI: do not abort init when ubi.mtd devices cannot be found UBI: drop redundant "UBI error" string
| * UBI: support ubi_num on mtd.ubi command lineMike Frysinger2013-07-011-11/+28
| | | | | | | | | | | | | | | | | | | | | | I want to be able to add UBI volumes with specific numbers, but the command line API doesn't have that atm. Add an additional token to support it. Artem: amended the patch a little bit. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: do not abort init when ubi.mtd devices cannot be foundMike Frysinger2013-05-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current ubi.mtd parsing logic will warn & continue on when attaching the specified mtd device fails (for any reason). It doesn't however skip things when the specified mtd device can't be opened. This scenario can be hit in a couple of different ways such as: - build NAND controller driver as a module - build UBI into the kernel - include ubi.mtd on the kernel command line - boot the system - MTD devices don't exist, so UBI init fails This is problematic because failing init means the entire UBI layer is unavailable until you reboot and modify the kernel command line. If we just warn and continue on, /dev/ubi_ctrl is available for userland to add UBI volumes on the fly once it loads the NAND driver. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * UBI: drop redundant "UBI error" stringMike Frysinger2013-05-161-7/+7
| | | | | | | | | | | | | | | | | | The ubi_err() macro automatically prefixes "UBI error" before the message. By also using it here, we get a log like so: UBI error: ubi_init: UBI error: cannot initialize UBI, error -19 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* | drivers: avoid parsing names as kthread_run() format stringsKees Cook2013-07-031-1/+1
|/ | | | | | | | | | Calling kthread_run with a single name parameter causes it to be handled as a format string. Many callers are passing potentially dynamic string content, so use "%s" in those cases to avoid any potential accidents. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* UBI: embed ubi_debug_info field in ubi_device structEzequiel Garcia2012-12-101-8/+1
| | | | | | | | | | ubi_debug_info struct was dynamically allocated which is always suboptimal, for it tends to fragment memory and make the code error-prone. Fix this by embedding it in ubi_device struct. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: replace memcpy with struct assignmentEzequiel Garcia2012-12-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This kind of memcpy() is error-prone. Its replacement with a struct assignment is prefered because it's type-safe and much easier to read. Found by coccinelle. Hand patched and reviewed. Tested by compilation only. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier struct_name; struct struct_name to; struct struct_name from; expression E; @@ -memcpy(&(to), &(from), E); +to = from; // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: Add fastmap stuff to attach.cRichard Weinberger2012-10-031-1/+1
| | | | | | | | - Export compare_lebs() as fastmap needs this function. - Implement fastmap scan logic. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: Add fastmap bits to build.cRichard Weinberger2012-10-031-3/+65
| | | | | Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: load after mtd device driversJiang Lu2012-09-261-1/+1
| | | | | | | Use 'late_initcall()' in UBI to make sure it initializes after MTD drivers. Signed-off-by: Jiang Lu <lu.jiang@windriver.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: print lessArtem Bityutskiy2012-09-041-41/+32
| | | | | | | | | | | UBI currently prints a lot of information when it mounts a volume, which bothers some people. Make it less chatty - print only important information by default. Get rid of 'dbg_msg()' macro completely. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: use pr_ helper instead of printkArtem Bityutskiy2012-09-041-13/+10
| | | | | | Use 'pr_err()' instead of 'printk(KERN_ERR', etc. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: comply with coding styleArtem Bityutskiy2012-09-041-12/+10
| | | | | | Join all the split printk lines in order to stop checkpatch complaining. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: fix autoresize handling in R/O modeArtem Bityutskiy2012-09-041-0/+5
| | | | | | | | | | Currently UBI fails in autoresize when it is in R/O mode (e.g., because the underlying MTD device is R/O). This patch fixes the issue - we just skip autoresize and print a warning. Reported-by: Pali Rohár <pali.rohar@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: allow specifying bad PEBs limit using module parameterRichard Genoud2012-09-041-15/+25
| | | | | | | | | | | | | This patch provides the possibility to adjust the "maximum expected number of bad blocks per 1024 blocks" (max_beb_per1024) for each mtd device. The majority of NAND devices have their max_beb_per1024 equal to 20, but sometimes it's more. Now, we can adjust that via a kernel parameter: ubi.mtd=<name|num|path>[,<vid_hdr_offs>[,max_beb_per1024]] Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: check max_beb_per1024 value in ubi_attach_mtd_devRichard Genoud2012-09-041-0/+9
| | | | | | | | max_beb_per1024 shouldn't be negative, and a 0 value will be treated as the default value. For the upper bound, 768/1024 should be enough. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: prepare for max_beb_per1024 module parameter additionRichard Genoud2012-09-041-6/+8
| | | | | | | | | This patch prepare the way for the addition of max_beb_per1024 module parameter. There's no functional change. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: introduce MTD_PARAM_MAX_COUNTRichard Genoud2012-09-041-2/+5
| | | | | Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: separate bad_peb_limit in a functionRichard Genoud2012-09-041-23/+31
| | | | | | | No functional changes here, just to prepare for next patch. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: use the whole MTD device size to get bad_peb_limitRichard Genoud2012-09-041-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On NAND flash devices, UBI reserves some physical erase blocks (PEB) for bad block handling. Today, the number of reserved PEB can only be set as a percentage of the total number of PEB in each MTD partition. For example, for a NAND flash with 128KiB PEB, 2 MTD partition of 20MiB (mtd0) and 100MiB (mtd1) and 2% reserved PEB: - the UBI device on mtd0 will have 2 PEB reserved - the UBI device on mtd1 will have 16 PEB reserved The problem with this behaviour is that NAND flash manufacturers give a minimum number of valid block (NVB) during the endurance life of the device, e.g.: Parameter Symbol Min Max Unit Notes -------------------------------------------------------------- Valid block number NVB 1004 1024 Blocks 1 From this number we can deduce the maximum number of bad PEB that a device will contain during its endurance life: a 128MiB NAND flash (1024 PEB) will not have less than 20 bad blocks during the flash endurance life. But the manufacturer doesn't tell where those bad block will appear. He doesn't say either if they will be equally disposed on the whole device (and I'm pretty sure they won't). So, according to the datasheets, we should reserve the maximum number of bad PEB for each UBI device (worst case scenario: 20 bad blocks appears on the smallest MTD partition). So this patch make UBI use the whole MTD device size to calculate the maximum bad expected eraseblocks. The Kconfig option is in per1024 blocks, thus it can have a default value of 20 which is *very* common for NAND devices. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: introduce new bad PEB limitShmulik Ladkani2012-09-041-1/+11
| | | | | | | | | | | | | | Introduce 'ubi->bad_peb_limit', which specifies an upper limit of PEBs UBI expects to go bad. Currently, it is initialized to a fixed percentage of total PEBs in the UBI device (configurable via CONFIG_MTD_UBI_BEB_LIMIT). The 'bad_peb_limit' is intended to be used for calculating the amount of PEBs UBI needs to reserve for bad eraseblock handling. Artem: minor amendments. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
* UBI: print image sequence number as unsigned integerArtem Bityutskiy2012-09-041-1/+1
| | | | Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: move and rename attach_by_scanningArtem Bityutskiy2012-05-201-59/+6
| | | | | | | Rename the 'attach_by_scanning()' function to 'ubi_attach()' and move it to scan.c. Richard will plug his fastmap stuff there. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: rename _init_scan functionsArtem Bityutskiy2012-05-201-2/+2
| | | | | | | | | | We have a couple of initialization funcntionsn left which have "_scan" suffic - rename them: ubi_eba_init_scan() -> ubi_eba_init() ubi_wl_init_scan() -> ubi_wl_init() Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: amend comments after all the renamingsArtem Bityutskiy2012-05-201-8/+4
| | | | | | | | | | This patch amends commentaries in scan.[ch] to match the new logic. Reminder - we did the restructuring to prepare the code for adding the fastmap. This patch also renames a couple of functions - it was too difficult to separate out that change and I decided that it is not too bad to have it in the same patch with commentaries changes. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: rename ubi_scan_destroy_aiArtem Bityutskiy2012-05-201-2/+2
| | | | | | The old name is not logical anymore - rename it to 'ubi_destroy_ai()'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: rename si to aiArtem Bityutskiy2012-05-201-16/+16
| | | | | | | | | After re-naming the 'struct ubi_scan_info' we should adjust all variables named 'si' to something else, because 'si' stands for "scanning info". Let's rename it to 'ai' which stands for "attaching info" which is a bit more consistent and has the same length, which makes re-naming easy. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
* UBI: rename struct ubi_scan_infoArtem Bityutskiy2012-05-201-1/+1
| | | | | | | | | | Rename 'struct ubi_scan_info' to 'struct ubi_attach_info'. This is part of the code re-structuring I am trying to do in order to add fastmap in a more logical way. Fastmap can share a lot with scanning, including the attach-time data structures, which all now have "scan" word in the name. Let's get rid of this word. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
* UBI: rename struct ubi_scan_lebArtem Bityutskiy2012-05-201-1/+1
| | | | | | | | | | | | Rename 'struct ubi_scan_leb' to 'struct ubi_ainf_leb'. This is part of the code re-structuring I am trying to do in order to add fastmap in a more logical way. Fastmap can share a lot with scanning, including the attach-time data structures, which all now have "scan" word in the name. Let's get rid of this word and use "ainf" instead which stands for "attach information". It has the same length as "scan" so re-naming is trivial. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
* UBI: get rid of dbg_errArtem Bityutskiy2012-05-201-4/+4
| | | | | | | | This patch removes the 'dbg_err()' macro and we now use 'ubi_err' instead. The idea of 'dbg_err()' was to compile out some error message to make the binary a bit smaller - but I think it was a bad idea. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: rename peb_buf1 to peb_bufArtem Bityutskiy2012-03-091-4/+4
| | | | | | Now we have only one buffer so let's rename it to just 'peb_buf1'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* UBI: reduce memory consumptionJosselin Costanzi2012-03-091-6/+0
| | | | | | | | | | | | Remove the pre-allocated 'peb_buf2' buffer because we do not really need it. The only reason UBI has it is to check that the data were written correctly. But we do not have to have 2 buffers for this and waste RAM - we can just compare CRC checksums instead. This reduces UBI memory consumption. Artem bityutskiy: massaged the patch and commit message Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* mtd: introduce mtd_can_have_bb helperArtem Bityutskiy2012-01-091-1/+1
| | | | | | | | | This patch introduces new 'mtd_can_have_bb()' helper function which checks whether the flash can have bad eraseblocks. Then it changes all the direct 'mtd->block_isbad' use cases with 'mtd_can_have_bb()'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* UBI: fix oops in error pathArtem Bityutskiy2011-06-011-0/+2
| | | | | | | | | | | | | | | This patch fixes an oops in the error path of 'ubi_attach_mtd_dev()'. If anything after 'uif_init()' fails, we get an oops in 'cancel_pending()'. The reason is that 'uif_close()' drops the last reference count for 'ubi->dev' and whole 'struct ubi_device' is freed. And then 'ubi_wl_close()'->'cancel_pending()' tries to access the 'ubi' pointer and problems begin. Note, in 'ubi_detach_mtd_dev()' function we get a device reference to work-around this issue. Do the same in the error path of 'ubi_attach_mtd_dev()'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: use debugfs for the extra checks knobsArtem Bityutskiy2011-06-011-2/+24
| | | | | | | | | | This patch introduces debugfs support to UBI. All the UBI stuff is kept in the "ubi" debugfs directory, which contains per-UBI device "ubi/ubiX" sub-directories, containing debugging files. This file also creates "ubi/ubiX/chk_gen" and "ubi/ubiX/chk_io" knobs for switching general and I/O extra checks on and off. And it removes the 'debug_chks' UBI module parameters. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6Linus Torvalds2011-03-181-0/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'linux-next' of git://git.infradead.org/ubifs-2.6: (25 commits) UBIFS: clean-up commentaries UBIFS: save 128KiB or more RAM UBIFS: allocate orphans scan buffer on demand UBIFS: allocate lpt dump buffer on demand UBIFS: allocate ltab checking buffer on demand UBIFS: allocate scanning buffer on demand UBIFS: allocate dump buffer on demand UBIFS: do not check data crc by default UBIFS: simplify UBIFS Kconfig menu UBIFS: print max. index node size UBIFS: handle allocation failures in UBIFS write path UBIFS: use max_write_size during recovery UBIFS: use max_write_size for write-buffers UBIFS: introduce write-buffer size field UBI: incorporate LEB offset information UBIFS: incorporate maximum write size UBI: provide LEB offset information UBI: incorporate maximum write size UBIFS: fix LEB number in printk UBIFS: restrict world-writable debugfs files ...
| * UBI: incorporate maximum write sizeArtem Bityutskiy2011-03-081-0/+14
| | | | | | | | | | | | | | | | Incorporate MTD write buffer size into UBI device information because UBIFS needs this field. UBI does not use it ATM, just provides to upper layers in 'struct ubi_device_info'. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* | UBI: make tests modes dynamicArtem Bityutskiy2011-03-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Similarly to the debugging checks and message, make the test modes be dynamically selected via the "debug_tsts" module parameter or via the "/sys/module/ubi/parameters/debug_tsts" sysfs file. This is consistent with UBIFS as well. And now, since all the Kconfig knobs became dynamic, we can remove the Kconfig.debug file completely. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* | UBI: kill debugging bufferArtem Bityutskiy2011-03-161-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch kills the 'ubi->dbg_peb_buf' debugging buffer and the associated mutex, because all users of this buffer are now gone. We are killing this buffer because we are going to switch to dynamic debugging control, just like in UBIFS, which means that CONFIG_MTD_UBI_DEBUG_PARANOID will be removed. In this case we'd end up always allocating 'ubi->dbg_peb_buf', which is rather large (128KiB or more), and this would be wasteful. Thus, we are just killing it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* | UBI: add slab cache for ubi_scan_leb objectsArtem Bityutskiy2011-02-061-0/+2
| | | | | | | | | | | | | | | | | | During scanning UBI allocates one struct ubi_scan_leb object for each PEB, so it can end up allocating thousands of them. Use slab cache to reduce memory consumption for these 48-byte objects, because currently used 'kmalloc()' ends up allocating 64 bytes per object, instead of 48. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* | UBI: cleanup LEB start calculationsJohn Ogness2011-01-261-1/+1
|/ | | | | | | | | | | | | | Wrong macro was used in calculating the data offset: UBI_EC_HDR_SIZE instead of UBI_VID_HDR_SIZE. The data offset should be VID header offset + VID header size (aligned to the minimum I/O unit). This was not a bug only because currently UBI_EC_HDR_SIZE and UBI_VID_HDR_SIZE have the same value of 64 bytes. Commit message was amended by Artem. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: preserve corrupted PEBsArtem Bityutskiy2010-10-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently UBI erases all corrupted eraseblocks, irrespectively of the nature of corruption: corruption due to power cuts and non-power cut corruption. The former case is OK, but the latter is not, because UBI may destroy potentially important data. With this patch, during scanning, when UBI hits a PEB with corrupted VID header, it checks whether this PEB contains only 0xFF data. If yes, it is safe to erase this PEB and it is put to the 'erase' list. If not, this may be important data and it is better to avoid erasing this PEB. Instead, UBI puts it to the corr list and moves out of the pool of available PEB. IOW, UBI preserves this PEB. Such corrupted PEB lessen the amount of available PEBs. So the more of them we accumulate, the less PEBs are available. The maximum amount of non-power cut corrupted PEBs is 8. This patch is a response to UBIFS problem where reporter (Matthew L. Creech <mlcreech@gmail.com>) observes that UBIFS index points to an unmapped LEB. The theory is that corresponding PEB somehow got corrupted and UBI wiped it. This patch (actually a series of patches) tries to make sure such PEBs are preserved - this would make it is easier to analyze the corruption. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: fix small 80 characters limit style issueArtem Bityutskiy2010-10-191-2/+2
| | | | | | One line was longer than 80 lines, make it shorter. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: do not warn unnecessarilyArtem Bityutskiy2010-08-021-1/+2
| | | | | | | | | | | | | | | Currently, when UBI attaches an MTD device and cannot reserve all 1% (by default) of PEBs for bad eraseblocks handling, it prints a warning. However, Matthew L. Creech <mlcreech@gmail.com> is not very happy to see this warning, because he did reserve enough of PEB at the beginning, but with time some PEBs became bad. The warning is not necessary in this case. This patch makes UBI print the warning o if this is a new image o of this is used image and the amount of reserved PEBs is only 10% (or less) of the size of the reserved PEB pool. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: init even if MTD device cannot be attached, if built into kernelMarc Kleine-Budde2010-05-061-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UBI can be built into the kernel or be compiled as a kernel module. Further on the command line one can specify MTD devices to be attach to UBI while loading. In the current implementation the UBI driver refuses to load if one of the MTD devices cannot be attached. Consider: 1) UBI compiled into the kernel and 2) a MTD device specified on the command line and 3) this MTD device contains bogus data (for whatever reason). During init UBI tries to attach the MTD device is this fails the whole UBI subsystem isn't initialized. Later the userspace cannot attach any MTD to UBI because UBI isn't loaded. This patch keeps the current behaviour: if UBI is compiled as a module and a MTD device cannot be attached the UBI module cannot be loaded, but changes it for the UBI-is-built-into-the-kernel usecase. If UBI is builtin, a not attachable MTD device doen't stop UBI from initializing. This slightly modifies the behaviour if multiple MTD devices are specified on the command line. Now every MTD device is probed and, if possible, attached, i.e. a faulty MTD device doesn't stop the others from being attached. Artem: tweaked the patch Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* UBI: remove reboot notifierKevin Cernekee2010-05-031-35/+0
| | | | | | | | The UBI reboot notifier causes problems with hibernation. Move this functionality into the low-level MTD driver instead. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>