14 Oct, 2007
12 commits
-
Fix the following warning:
drivers/mtd/ubi/eba.c: In function 'ubi_eba_init_scan':
drivers/mtd/ubi/eba.c:1116: warning: 'err' may be used uninitialized in this functionPointed-to-by: Andrew Morton
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Artem Bityutskiy
-
When the UBI device is nearly full, i.e. all LEBs are mapped, we have
only one spare LEB left - the one we reserved for WL purposes. Well,
I do not count the LEBs which were reserved for bad PEB handling -
suppose NOR flash for simplicity. If an "atomic LEB change operation"
is run, and the WL unit is moving a LEB, we have no spare LEBs to
finish the operation and fail, which is not good. Moreover, if there
are 2 or more simultanious "atomic LEB change" requests, only one of
them has chances to succeed, the other will fail with -ENOSPC. Not
good either.This patch does 2 things:
1. Reserves one PEB for the "atomic LEB change" operation.
2. Serealize the operations so that only on of them may run
at a time (by means of a mutex).Pointed-to-by: Brijesh Singh
Signed-off-by: Artem Bityutskiy -
More handy since word hexdump prints in host endian.
Signed-off-by: Artem Bityutskiy
-
Similar reason as in case of the previous patch: it causes
deadlocks if a filesystem with writeback support works on top
of UBI. So pre-allocate needed buffers when attaching MTD device.
We also need mutexes to protect the buffers, but they do not
cause much contantion because they are used in recovery, torture,
and WL copy routines, which are called seldom.Signed-off-by: Artem Bityutskiy
-
Use GFP_NOFS flag when allocating memory on I/O path, because otherwise
we may deadlock the filesystem which works on top of us. We observed
the deadlocks with UBIFS. Example:VFS->FS lock a lock->UBI->kmalloc()->VFS writeback->FS locks the same
lock again.Signed-off-by: Artem Bityutskiy
-
Signed-off-by: Artem Bityutskiy
-
I can't find anything guaranteeing that 'ubi_num' cannot be
Signed-off-by: Artem Bityutskiy -
I hit those situations and found out lack of print messages. Add more prints
when erase problems occur.Signed-off-by: Artem Bityutskiy
-
Fix "symbol shadows an earlier one" warnings. Although they are harmless
but it does not hurt to fix them and make sparse happy.Signed-off-by: Artem Bityutskiy
-
Coverity (1769) found the following problem: if the erase counter
overflow check triggers, ec_hdr is leaked.Moving the allocation after the overflow check should take care of it.
Signed-off-by: Florin Malita
Signed-off-by: Artem Bityutskiy
01 Aug, 2007
1 commit
-
To be able to convert kmalloc + memset(..., 1, ...) to kzalloc this patch
reverses the logic around 'buf'.Signed-off-by: Mariusz Kozlowski
Signed-off-by: David Woodhouse
20 Jul, 2007
1 commit
-
Slab destructors were no longer supported after Christoph's
c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
BUGs for both slab and slub, and slob never supported them
either.This rips out support for the dtor pointer from kmem_cache_create()
completely and fixes up every single callsite in the kernel (there were
about 224, not including the slab allocator definitions themselves,
or the documentation references).Signed-off-by: Paul Mundt
18 Jul, 2007
26 commits
-
cdev.c whines in current git:
drivers/mtd/ubi/cdev.c: In function `major_to_device':
drivers/mtd/ubi/cdev.c:67: warning: control reaches end of non-void functionShut it up.
Signed-off-by: Paul Mundt
Signed-off-by: Artem Bityutskiy -
Do not switch to read-only mode in case of -EINTR and some
other obvious cases. Switch to RO mode only when we do not
know what is the error.Reported-by: Vinit Agnihotri
Signed-off-by: Artem Bityutskiy -
Signed-off-by: Artem Bityutskiy
-
Pointed to by viro.
Signed-off-by: Artem Bityutskiy
-
The use of try_module_get(THIS_MODULE) in ubi_get_device_info does not
offer real protection against unexpected driver unloads, since we could
be preempted before try_modules_get gets executed. It is the caller who
should manipulate the refcounts. Besides, ubi_get_device_info is an
exported symbol which guarantees protection when accessed through
symbol_get.Signed-off-by: Fernando Luis Vazquez Cao
Signed-off-by: Artem Bityutskiy -
I was experiencing overflows in multiplications for
volume->used_bytes in vmt.c & vtbl.c, while creating & resizing large volumes.vol->used_bytes is long long however its 2 operands vol->used_ebs &
vol->usable_leb_size
are int. So their multiplication for larger values causes integer overflows.
Typecasting them solves the problem.My machine & flash details:
64Bit dual-core AMD opteron, 1 GB RAM, linux 2.6.18.3.
mtd size = 6GB, volume size= 5GB, peb_size = 4MB.heres patch which does the fix.
Signed-off-by: Vinit Agnihotri
Signed-off-by: Artem Bityutskiy -
Do not zero max_sqnum after a new volume has been found.
Signed-off-by: Artem Bityutskiy
-
Hi,I came across problem of having two leb with same sequence no.This
happens when we continuously write one block again and again and reboot
machine before background thread erases those blocks.
The problem here was,when we find two blocks with same sequence no,we take
the higher one,but we were not updating max seq no,so next block may have
the same seqnum.
This patch solves this problem.Signed-off-by: Brijesh Singh
Signed-off-by: Artem Bityutskiy -
There is signed multiplication assigned to unsigned ei.addr in io.c.
This causes wrong addresses for big multiplication.This patch solves the
problem.Signed-off-by: Brijesh Singh
Signed-off-by: Artem Bityutskiy -
atomic_leb_change() is only allowed for dynamic volumes, so set
the volume type correctly.Signed-off-by: Artem Bityutskiy
-
Increase UBI devices couter after the message, not before.
Signed-off-by: Vinit Agnihotri
Signed-off-by: Artem Bityutskiy -
Do not check volumes which are currently in use because thay may be
in inconsistent state.Signed-off-by: Artem Bityutskiy
-
When volume creation fails, we have to set ubi->volumes[vol_id]
back to NULL.This patch also tweaks some debugging stuff.
Signed-off-by: Artem Bityutskiy
-
Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2Signed-off-by: Vignesh Babu
Signed-off-by: Artem Bityutskiy -
ubi->vtbl is allocated using vmalloc() in vtbl.c empty_create_lvol(),
but it is freed in build.c with kfree()Signed-off-by: Vinit Agnihotri
Signed-off-by: Artem Bityutskiy -
Do not call 'ubi_wl_put_peb()' if the LEB was unmapped.
Reported-by: Gabor Loki
Signed-off-by: Artem Bityutskiy -
Kill UBI's homegrown endianess handling and replace it with
the standard kernel endianess handling.Signed-off-by: Christoph Hellwig
Signed-off-by: Artem Bityutskiy -
- don't do access_ok + get/put user but use the proper macro
- remove useless checksSigned-off-by: Christoph Hellwig
Signed-off-by: Artem Bityutskiy -
No need to unlock the lock, this will be done at out_unlock.
Signed-off-by: Artem Bityutskiy
-
Use coma at the the last elements of structure initializer.
Daniel Stone's explanation:
Because it turns:
- .attr = foo
+ .attr = foo,
+ .bar = bazinto:
+ .bar = baz,i.e., far less likely to screw up a merge.
Signed-off-by: Artem Bityutskiy
-
UBI allocates temporary buffers of PEB size, which may be 256KiB.
Use vmalloc instead of kmalloc for such big temporary buffers.Signed-off-by: Artem Bityutskiy
-
Add few comments above ubi_scan_add_used() to explain why it is so
complex. Requested by Satyam Sharma .Signed-off-by: Artem Bityutskiy
-
In case of static volumes, make emulated MTD device size to
be equivalent to data size, rather then volume size.Reported-by: John Smith
Signed-off-by: Artem Bityutskiy -
In case of static volumes it is prohibited to read more data
then available.Signed-off-by: Artem Bityutskiy
-
There were several bugs in volume table creation error path. Thanks to
Satyam Sharma and Florin Malita
for finding and analysing them: http://lkml.org/lkml/2007/5/3/274This patch makes ubi_scan_add_to_list() static and renames it to
add_to_list(), just because it is not needed outside scan.c anymore.Signed-off-by: Artem Bityutskiy
-
Coverity (CID 1614) spotted new_seb being dereferenced after kfree() in
create_vtbl's write_error path.Signed-off-by: Florin Malita
Signed-off-by: Artem Bityutskiy