- 14 4月, 2015 1 次提交
-
-
Emulate random power cuts by switching device to ro after a number of writes to allow simple power cut testing with nand-sim. Maximum and minimum number of successful writes before power cut and what kind of writes (EC header, VID header or none) to interrupt configurable via debugfs. Signed-off-by: NDavid Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: NRichard Weinberger <richard@nod.at>
-
- 13 4月, 2015 1 次提交
-
-
由 Sheng Yong 提交于
The INUM_WATERMARK is a unsigned 32bit value, `%d' prints it as negatave: [ 103.682255] UBIFS warning (ubi0:0 pid 691): ubifs_new_inode: running out of inode numbers (current 122763, max -256) Fix it as: [ 154.422940] UBIFS warning (ubi0:0 pid 688): ubifs_new_inode: running out of inode numbers (current 122765, max 4294967040) Signed-off-by: NSheng Yong <shengyong1@huawei.com> Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
-
- 27 3月, 2015 38 次提交
-
-
由 Richard Weinberger 提交于
If we encounter an uncorrectable ECC error while scanning for the fastmap UBI must not fail hard. Instead fall back to scanning mode. Reported-by: NAlexander Block <Alexander.Block@continental-corporation.com> Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
This function was added to fastmap in a very early stage to have paranoid assertions. With the current fastmap implementation this assert will never trigger as fastmap PEBs are not seen by the WL sub-system. Remove it to save us some CPU cycles. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Another checkpatch complaint: WARNING: Missing a blank line after declarations Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
checkpatch.pl complains: WARNING: else is not generally useful after a break or return Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
...and kill another #ifdef. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
...and kill another #ifdef in wl.c. :-) Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Use the new WL accessor functions in fastmap. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Fastmap need access to various WL data structures as fastmap tightly depends on WL. To make the access less invasive add accessor functions. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Fastmap is tightly connected to the WL sub-system, many fastmap-specific functionslive in wl.c. To get rid of most #ifdefs in wl.c move this functions into a new file and include it into wl.c Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
If fm_debug is set fastmap debugging is enabled by default. This is useful if one wants to debug fastmap on an UBI device with serves the rootfs. The the UBI attach mechanism runs long before debugfs can be mounted and chk_fastmap set. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
...instead of generic self checking. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
This self check allows Fastmap to detect absent PEBs while writing a new fastmap to the MTD device. It will help to find implementation issues in Fastmap. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
In some error paths the WL sub-system gives up on a PEB and frees it's ubi_wl_entry struct but does not set the entry in ubi->lookuptbl to NULL. Fastmap can stumble over such a stale pointer as it uses ubi->lookuptbl to find all PEBs. Fix this by introducing a new helper function which free()s a WL entry and removes the reference from the lookup table. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Don't update the fastmap upon detach if fastmap checking is enabled. This is poor men's power cut testing feature. :-) Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Using this debugfs knob fastmap self checks can be controlled. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NTanya Brokhman <tlinder@codeaurora.org>
-
由 Richard Weinberger 提交于
If UBI is unable to write the fastmap to the device we have make sure that upon next attach UBI will fall back to scanning mode. In case we cannot ensure that they only thing we can do is falling back to read-only mode. The current error handling code is not powercut proof. It could happen that a powercut while invalidating would lead to a state where an too old fastmap could be used upon attach. This patch addresses the issue by writing a fake fastmap super block to a fresh PEB instead of reerasing the existing one. The fake fastmap super block will UBI case to do a full scan. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
The current code assumes that each fastmap has the same amount of PEBs. So far this is true but will change soon. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
a) Rename ubi->fm_sem to ubi->fm_eba_sem as this semaphore protects EBA changes. b) Turn ubi->fm_mutex into a rw semaphore. It will still serialize fastmap writes but also ensures that ubi_wl_put_peb() is not interrupted by a fastmap write. We use a rw semaphore to allow ubi_wl_put_peb() still to be executed in parallel if no fastmap write is happening. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
If we set it for dynamic ones we might confuse various self checks. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
ubi_wl_get_peb() returns a fresh PEB which can be used by user of UBI. Due to the pool logic fastmap will correctly map this PEB upon attach time because it will be scanned. If a new fastmap is written (due to heavy parallel io) while the before the fresh PEB is assigned to the EBA table it will not be scanned as it is no longer in the pool. So, the race window exists between ubi_wl_get_peb() and the EBA table assignment. We have to make sure that no new fastmap can be written while that. To ensure that ubi_wl_get_peb() will grab ubi->fm_sem in read mode and the user of ubi_wl_get_peb() has to release it after the PEB got assigned. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
If a LEB is unmapped we have to decrement leb_count as well. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Don't use a fixed size for the WL pool. Make it instead 50% of the user pool. We don't make it 100% as it is not as heavily used as the user pool. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
We have to switch to ro mode to guarantee that upon next UBI attach all data is consistent. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
This logic is in vain as we treat protected PEBs also as used, so this case must not happen. If a PEB is found which is in the EBA table but not known as used has to be issued as fatal error. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
It is legal to have PEBs left in the used list. This can happen if UBI copies a PEB and a powercut happens between writing a new fastmap and adding this PEB into the EBA table. In this case the old PEB will be used. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
This function a) requests a new PEB, b) writes data to it, c) returns the old PEB and d) registers the new PEB in the EBA table. For the non-fastmap case this works perfectly fine and is powercut safe. Is fastmap enabled this can lead to issues. If a new fastmap is written between a) and c) the freshly requested PEB is no longer in a pool and will not be scanned upon attaching. If now a powercut happens between c) and d) the freshly requested PEB will not be scanned and the old one got already scheduled for erase. After attaching the EBA table will point to a erased PEB. Fix this issue by swapping steps c) and d). Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
There is always exactly one ubi_attach_info object allocated, therefore we don't have to care about the name. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Currently we leak a few ubi_ainf_pebs while attaching. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
There is no need to switch to ro mode if ubi_update_fastmap() fails. Also get rid of the ifdef. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NTanya Brokhman <tlinder@codeaurora.org>
-
由 Richard Weinberger 提交于
...such that we can implement NOP variants of some functions. This will help to reduce fastmap specific ifdefs in other c files. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NTanya Brokhman <tlinder@codeaurora.org>
-
由 Richard Weinberger 提交于
If ubi_update_fastmap() fails notify the user. This is not a hard error as ubi_update_fastmap() makes sure that upon failure the current on-flash fastmap will no be used upon next UBI attach. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
Add a ubi_fastmap_close() to free all resources used by fastmap at WL shutdown. Signed-off-by: NRichard Weinberger <richard@nod.at> Tested-by: NGuido Martínez <guido@vanguardiasur.com.ar> Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
-
由 Richard Weinberger 提交于
There is no need to allocate new ones every time, we can reuse the existing ones. This makes the code cleaner and more easy to follow. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NTanya Brokhman <tlinder@codeaurora.org> Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
-
由 Richard Weinberger 提交于
Currently ubi_refill_pools() first fills the first and then the second one. If only very few free PEBs are available the second pool can get zero PEBs. Change ubi_refill_pools() to distribute free PEBs fair between all pools. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
-
由 Richard Weinberger 提交于
Make it two functions, wl_get_wle() and wl_get_peb(). wl_get_peb() works exactly like __wl_get_peb() but wl_get_wle() does not call produce_free_peb(). While refilling the fastmap user pool we cannot release ubi->wl_lock as produce_free_peb() does. Hence the fastmap logic uses now wl_get_wle(). Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
ubi_wl_get_peb() has two problems, it reads the pool size and usage counters without any protection. While reading one value would be perfectly fine it reads multiple values and compares them. This is racy and can lead to incorrect pool handling. Furthermore ubi_update_fastmap() is called without wl_lock held, before incrementing the used counter it needs to be checked again. It could happen that another thread consumed all PEBs from the pool and the counter goes beyond ->size. Signed-off-by: NRichard Weinberger <richard@nod.at>
-
由 Richard Weinberger 提交于
...otherwise the deferred work might run after datastructures got freed and corrupt memory. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
-
由 Richard Weinberger 提交于
If the WL pool runs out of PEBs we schedule a fastmap write to refill it as soon as possible. Ensure that only one at a time is scheduled otherwise we might end in a fastmap write storm because writing the fastmap can schedule another write if bitflips are detected. Signed-off-by: NRichard Weinberger <richard@nod.at> Reviewed-by: NTanya Brokhman <tlinder@codeaurora.org> Reviewed-by: NGuido Martínez <guido@vanguardiasur.com.ar>
-