Markus Rathgeb [Sun, 11 Apr 2010 17:11:39 +0000 (19:11 +0200)]
USB: gadget: ether: LF1000 should use simple cdc subset
Patch to support ethernet over USB for the LF1000 (used by
e.g. gp2x wiz handheld).
Taken from:
http://www.gp32x.com/board/index.php?/topic/50468-howto-wiz-usb-ethernet-with-stock-usb-cable/
Signed-off-by: Markus Rathgeb <maggu2810@web.de>
Grazvydas Ignotas [Wed, 27 May 2009 13:38:22 +0000 (16:38 +0300)]
hacks for uImage and GPH compatible modules
GPH [Fri, 17 Jul 2009 12:52:52 +0000 (15:52 +0300)]
GPH r245 release
Artem Bityutskiy [Wed, 13 May 2009 14:05:11 +0000 (17:05 +0300)]
UBI: minor serialization fix
The @vol->upd_marker should be protected by the @ubi->device_mutex,
otherwise 'paranoid_check_volume()' complains sometimes because
vol->upd_marker is 1 while vtbl_rec->upd_marker is 0.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 13 May 2009 11:05:24 +0000 (14:05 +0300)]
UBI: do not panic if volume check fails
If a volume paranoid check fails, do not return an error
code to the caller, but just print error messages and go
forward. The primary reason for this is that it is difficult
to recover and cancel the operation at that stage.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 12 May 2009 17:29:15 +0000 (20:29 +0300)]
UBI: add dump_stack in checking code
I am experiencing an error in 'paranoid_check_volume()'. Add
dump_stack() there to make it easier to identify the reasons
of the error.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 12 May 2009 12:43:44 +0000 (15:43 +0300)]
UBI: fix races in I/O debugging checks
When paranoid checs are enabled, the 'io_paral' test from the
'mtd-utils' package fails. The symptoms are:
UBI error: paranoid_check_all_ff: flash region at PEB 3973:512, length 15872 does not contain all 0xFF bytes
UBI error: paranoid_check_all_ff: paranoid check failed for PEB 3973
UBI: hex dump of the 512-16384 region
It turned out to be a bug in the checking function. Suppose there
are 2 tasks - A and B. Task A is the wear-levelling working
('wear_leveling_worker()'). It is reading the VID header to find
which LEB this PEB belongs to. Say, task A is reading header
of PEB X. Suppose PEB X is unmapped, and has no VID header.
Task B is trying to write to PEB X.
Task A: in 'ubi_io_read_vid_hdr()': reads the VID header from PEB X.
The read data contain all 0xFF bytes.
Task B: writes VID header and some data to PEB X
Task A: assumes PEB X is empty, calls 'paranoid_check_all_ff()', which
fails.
The solution for this problem is to make 'paranoid_check_all_ff()'
re-read the VID header, re-check it, and only if it is not there,
check the rest. This now implemented by the 'paranoid_check_empty()'
function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 12 May 2009 12:10:03 +0000 (15:10 +0300)]
UBI: small debugging code optimization
The @ubi->dbg_peb_buf is needed only when paranoid checks are
enabled, not when debugging in general is enabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 7 May 2009 15:24:14 +0000 (18:24 +0300)]
UBI: improve debugging messages
Various minor improvements to the debugging messages which
I found useful while hunting problems.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 7 May 2009 08:46:49 +0000 (11:46 +0300)]
UBI: re-name volumes_mutex to device_mutex
The mutex essencially protects the entire UBI device, so the
old @volumes_mutex name is a little misleading.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 7 May 2009 08:25:54 +0000 (11:25 +0300)]
UBI: remove redundant mutex
The @mult_mutex does not serve any purpose. We already have
@volumes_mutex and it is enough. The @volume mutex is pushed
down to the 'ubi_rename_volumes()', because we want first
to open all volumes in the exclusive mode, and then lock the
mutex, just like all other ioctl's (remove, re-size, etc) do.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Arnd Bergmann [Wed, 25 Feb 2009 23:51:41 +0000 (00:51 +0100)]
make MTD headers use strict integer types
The MTD headers traditionally use stdint types rather than
the kernel integer types. This converts them to do the
same as all the others.
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Corentin Chary [Thu, 5 Feb 2009 21:25:52 +0000 (22:25 +0100)]
UBI: add fsync capability
Now, we can call fsync() on an UBI volume.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sidney Amani [Tue, 27 Jan 2009 09:11:46 +0000 (10:11 +0100)]
UBI: allow direct user-space I/O
Introduce a new ioctl UBI_IOCSETPROP to set properties
on a volume. Also add the first property:
UBI_PROP_DIRECT_WRITE, this property is used to set the
ability to use direct writes in userspace
Signed-off-by: Sidney Amani <seed@uffs.org>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 20 Jan 2009 16:04:09 +0000 (18:04 +0200)]
UBI: fix resource de-allocation
GregKH asked to fix UBI which has fake device release method. Indeed,
we have to free UBI device description object from the release method,
because otherwise we'll oops is someone opens a UBI device sysfs file,
then the device is removed, and he reads the file. With this fix, he
will get -ENODEV instead of an oops.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 20 Jan 2009 15:48:02 +0000 (17:48 +0200)]
UBI: remove unused variable
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 16 Jan 2009 17:08:43 +0000 (19:08 +0200)]
UBI: use nicer 64-bit math
Get rid of 'do_div()' and use more user-friendly primitives from
'linux/math64.h'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 16 Jan 2009 16:06:55 +0000 (18:06 +0200)]
UBI: add ioctl compatibility
UBI ioctl's do not work when running 64-bit kernel and 32-bit
user-land. Fix this by adding the compat_ioctl method.
Also, UBI serializes all ioctls, so more than one ioctl at a time
is not a problem. Amd UBI does not seem to depend on anything else,
so use unlocked_ioctl instead of ioctl (no BKL needed).
Reported-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Jan Engelhardt [Sun, 11 Jan 2009 22:55:39 +0000 (23:55 +0100)]
UBI: constify file operations
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 16 Jan 2009 16:03:22 +0000 (18:03 +0200)]
UBI: allow all ioctls
Some ioctl's in UBI are enabled only when debugging is switched
on. There is not particular reason for this, just noone needed
them. However, some people need the now for their user-space
development. Thus, allow these ioctl's even if UBI debugging
is disabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 7 Jan 2009 14:10:58 +0000 (16:10 +0200)]
UBI: improve ioctl commentaries
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Corentin Chary [Mon, 5 Jan 2009 13:48:59 +0000 (14:48 +0100)]
UBI: add ioctl for is_mapped operation
This patch adds ioctl to check if an LEB is mapped or not (as a
debugging option so far).
[Re-named ioctl to make it look the same as the other one and made
some minor stylistic changes. Artem Bityutskiy.]
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Corentin Chary [Mon, 5 Jan 2009 13:46:19 +0000 (14:46 +0100)]
UBI: add ioctl for unmap operation
This patch adds ioctl for the LEB unmap operation (as a debugging
option so far).
[Re-named ioctl to make it look the same as the other one and made
some minor stylistic changes. Artem Bityutskiy.]
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Corentin Chary [Mon, 5 Jan 2009 13:44:11 +0000 (14:44 +0100)]
UBI: add ioctl for map operation
This patch adds ioctl for the LEB map operation (as a debugging
option so far).
[Re-named ioctl to make it look the same as the other one and made
some minor stylistic changes. Artem Bityutskiy.]
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Coly Li [Thu, 8 Jan 2009 02:09:16 +0000 (18:09 -0800)]
fix similar typos to successfull
When I review ocfs2 code, find there are 2 typos to "successfull". After
doing grep "successfull " in kernel tree, 22 typos found totally -- great
minds always think alike :)
This patch fixes all the similar typos. Thanks for Randy's ack and comments.
Signed-off-by: Coly Li <coyli@suse.de>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Frederik Schwarzer [Thu, 16 Oct 2008 17:02:37 +0000 (19:02 +0200)]
trivial: fix then -> than typos in comments and documentation
- (better, more, bigger ...) then -> (...) than
Signed-off-by: Frederik Schwarzer <schwarzerf@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Artem Bityutskiy [Sun, 28 Dec 2008 10:20:51 +0000 (12:20 +0200)]
UBI: fix checkpatch.pl warnings
Just minor indentation and "over 80 characters" fixes.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Xiaochuan-Xu [Mon, 15 Dec 2008 13:07:41 +0000 (21:07 +0800)]
UBI: simplify PEB protection code
UBI has 2 RB-trees to implement PEB protection, which is too
much for simply prevent PEB from being moved for some time.
This patch implements this using lists. The benefits:
1. No need to allocate protection entry on each PEB get.
2. No need to maintain balanced trees and walk them.
Signed-off-by: Xiaochuan-Xu <xiaochuan-xu@cqu.edu.cn>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Xiaochuan-Xu [Tue, 9 Dec 2008 11:44:12 +0000 (19:44 +0800)]
UBI: prepare for protection tree improvements
This patch modifies @struct ubi_wl_entry and adds union which
contains only one element so far. This is just a preparation
for further changes which will kill the protection tree and
make UBI use a list instead.
Signed-off-by: Xiaochuan-Xu <xiaochuan-xu@cqu.edu.cn>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Stefan Roese [Wed, 10 Dec 2008 09:42:54 +0000 (10:42 +0100)]
UBI: return -ENOMEM upon failing vmalloc
Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon
failing vmalloc().
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 5 Dec 2008 11:37:02 +0000 (13:37 +0200)]
UBI: handle write errors in WL worker
When a PEB is moved and a write error happens, UBI switches
to R/O mode, which is wrong, because we just copy the data
and may select a different PEB and re-try this. This patch
fixes WL worker's behavior.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 5 Dec 2008 10:42:45 +0000 (12:42 +0200)]
UBI: fix error path
Make sure the resources had not already been freed before
freeing them in the error path of the WL worker function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 5 Dec 2008 10:23:48 +0000 (12:23 +0200)]
UBI: some code re-structuring
Minor code re-structuring and commentaries fixes to improve readability.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 4 Dec 2008 18:52:44 +0000 (20:52 +0200)]
UBI: fix deadlock
We cannot call 'ubi_wl_get_peb()' with @ubi->buf_mutex locked,
because 'ubi_wl_get_peb()' may force erasure, which, in turn,
may call 'torture_peb()' which also locks the @ubi->buf_mutex
and deadlocks.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 12 Nov 2008 08:14:10 +0000 (10:14 +0200)]
UBI: fix warnings when debugging is enabled
The 'ubi_io_read_vid_hdr()' and 'ubi_io_read_ec_hdr()' function
have the 'verbose' argument which controls whether they should
print a warning if the VID/EC header was not found or was corrupted.
Some callers require the headers to be OK, and pass 1. Some allow
a corrupted/not present header, and pass 0.
if (UBI_IO_DEBUG)
verbose = 1;
And UBI_IO_DEBUG is 1 if CONFIG_MTD_UBI_DEBUG_MSG_BLD is true. So in
this case the warning is printed all the time. This confuses people.
Thus, do not print the messages as warnings if UBI_IO_DEBUG is true,
but print them as debugging messages instead.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Vitaliy Gusev [Wed, 5 Nov 2008 15:27:18 +0000 (18:27 +0300)]
UBI: Don't exit from ubi_thread until kthread_should_stop() is true
If ubi_thread() exits but kthread_should_stop() is not true
then kthread_stop() will never return and cleanup thread
will forever stay in "D" state.
Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Zoltan Sogor [Wed, 29 Oct 2008 08:50:02 +0000 (09:50 +0100)]
UBI: fix EBADMSG handling
'ubi_io_read_data()' may return EBADMSG in case of an ECC error,
and we should not panic because of this. We have CRC32 checksum
and may check the data. So just ignore the EBADMSG error.
This patch also fixes a minor spelling error at the same time.
Signed-off-by: Zoltan Sogor <weth@inf.u-szeged.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Deepak Saxena [Wed, 8 Oct 2008 19:56:24 +0000 (12:56 -0700)]
UBI: print reserved_peb when it is too large
This patch makes debugging a missconfigured UBI a bit easier
by providing the needed information in the boot log.
Signed-off-by: Deepak Saxena <dsaxena@laptop.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Julien Brunel [Fri, 26 Sep 2008 13:27:25 +0000 (15:27 +0200)]
UBI: fix IS_ERR test
In case of error, the function add_volume returns an ERR pointer. The
result of IS_ERR, which is supposed to be used in a test as it is, is
here checked to be less than zero, which seems odd. We suggest to
replace this test by a simple IS_ERR test.
A simplified version of the semantic match that finds this problem is
as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@def0@
expression x;
position p0;
@@
x@p0 = add_volume(...)
@protected@
expression def0.x,E;
position def0.p0;
position p;
statement S;
@@
x@p0
... when != x = E
if (!IS_ERR(x) && ...) {<... x@p ...>} else S
@unprotected@
expression def0.x,E;
identifier fld;
position def0.p0;
position p != protected.p;
@@
x@p0
... when != x = E
* x@p->fld
// </smpl>
Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
GPH [Mon, 25 May 2009 14:54:11 +0000 (17:54 +0300)]
Pollux support + GPH wiz stuff dated 090105
Artem Bityutskiy [Wed, 30 Jul 2008 07:14:59 +0000 (10:14 +0300)]
UBIFS: add mmap support for old kernels
There is no reason not to support mmap in 2.6.21.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 25 Jul 2008 13:39:44 +0000 (16:39 +0300)]
UBIFS: minor tweaks in commit
No functional changes, just lessen the amount of indentations.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 25 Jul 2008 11:38:51 +0000 (14:38 +0300)]
UBIFS: reserve more space for index
At the moment UBIFS reserves twice old index size space for the
index. But this is not enough in some cases, because if the indexing
node are very fragmented and there are many small gaps, while the
dirty index has big znodes - in-the-gaps method would fail.
Thus, reserve trise as more, in which case we are guaranteed that
we can commit in any case.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 25 Jul 2008 09:58:38 +0000 (12:58 +0300)]
UBIFS: print pid in dump function
Useful when something fails and there are many processes
racing.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 24 Jul 2008 15:28:11 +0000 (18:28 +0300)]
UBI: always start the background thread
This fix only affects UBI debugging.
If the the background thread is disabled for debugging purposes,
start it anyway, because otherwise we see tonns of kernel debugging
complaints like this:
INFO: task ubi_bgt0d:26857 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
ubi_bgt0d D
dd37bf94 0 26857 2
dd37bfcc 00000086 f8e17cea dd37bf94 00000046 00000000 00000000 f5c62430
f5c62430 f5c62590 c2a09c80 f6cbd498 dd8e9cbc 00000296 dd37bfb0 00000296
dd8e9cb8 dd8e9cbc dd37bfcc c0119774 00000000 00000000 c0132e89 f6961560
Call Trace:
[<
f8e17cea>] ? ubi_thread+0x0/0x127 [ubi]
[<
c0119774>] ? complete+0x43/0x4b
[<
c0132e89>] ? kthread+0x0/0x5b
[<
f8e17cea>] ? ubi_thread+0x0/0x127 [ubi]
[<
c0132eae>] kthread+0x25/0x5b
[<
c0132e89>] ? kthread+0x0/0x5b
[<
c0104953>] kernel_thread_helper+0x7/0x14
=======================
So start it, and go sleep inside it, instead of creating it and never
start.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 24 Jul 2008 11:52:45 +0000 (14:52 +0300)]
UBIFS: align inode data to eight
UBIFS aligns node lengths to 8, so budgeting has to do the
same. Well, direntry, inode, and page budgets are already
aligned, but not inode data budget (e.g., data in special
devices or symlinks). Do this for inode data as well.
Also, add corresponding debugging checks.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 24 Jul 2008 11:42:05 +0000 (14:42 +0300)]
UBIFS: improve budgeting checks
Budgeting is a crucial UBIFS subsystem - add more assertions
to improve requests checking. This is not compiled in when
UBIFS debugging is disabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Wed, 23 Jul 2008 13:55:55 +0000 (16:55 +0300)]
UBIFS: correct orphan deletion order
The debug function that checks orphans, does so using the
TNC mutex. That means it will not see a correct picture
if the inode is removed from the orphan tree before it is
removed from TNC.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Adrian Hunter [Wed, 23 Jul 2008 12:48:39 +0000 (15:48 +0300)]
UBIFS: fix typos in comments
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Adrian Hunter [Wed, 23 Jul 2008 12:23:11 +0000 (15:23 +0300)]
UBIFS: do not union creat_sqnum and del_cmtno
The values in these two fields need to be preserved independently
and so a union cannot be used.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Artem Bityutskiy [Fri, 25 Jul 2008 14:34:19 +0000 (17:34 +0300)]
UBIFS: compatibility fixes
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 22 Jul 2008 13:49:31 +0000 (16:49 +0300)]
UBIFS: add NFS support
Implement minimal set of FS export operations to support NFS.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 22 Jul 2008 10:06:20 +0000 (13:06 +0300)]
UBIFS: optimize deletions
Every time anything is deleted, UBIFS writes the deletion inode
node twice - once in 'ubifs_jnl_update()' and the second time in
'ubifs_jnl_write_inode()'. However, the second write is not needed
if no commit happened after 'ubifs_jnl_update()'. This patch
checke that condition and avoids writing the deletion inode for
the second time.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 21 Jul 2008 14:14:29 +0000 (17:14 +0300)]
UBIFS: increment commit number earlier
Increment the commit number at the beginnig of the commit, instead
of doing this after the commit. This is needed for further
optimizations.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 22 Jul 2008 09:19:09 +0000 (12:19 +0300)]
UBIFS: remove another unneeded function parameter
The 'last_reference' parameter of 'pack_inode()' is not really
needed because 'inode->i_nlink' may be tested instead. Zap it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 22 Jul 2008 09:06:13 +0000 (12:06 +0300)]
UBIFS: remove unneeded function parameter
Simplify 'ubifs_jnl_write_inode()' by removing the 'deletion'
parameter which is not really needed because we may test
inode->i_nlink and check whether this is a deletion or not.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 22 Jul 2008 08:52:52 +0000 (11:52 +0300)]
UBIFS: do not write orphans back
Orphan inodes are deleted inodes which will disappear after FS
re-mount. There is not need to write orphan inodes back, because
they are not needed on the flash media.
So optimize orphans a little by not writing them back. Just mark
them as clean, free the budget, and report success to VFS.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 23 Jul 2008 12:51:46 +0000 (15:51 +0300)]
UBI: fix gcc warning
Fix the following warning:
drivers/mtd/ubi/vmt.c: In function 'ubi_rename_volumes':
drivers/mtd/ubi/vmt.c:642: warning: statement with no effect
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Mon, 21 Jul 2008 12:39:05 +0000 (15:39 +0300)]
UBIFS: make ubifs_ro_mode() not inline
We use ubifs_ro_mode() quite a lot, and not in fast-path, so
there is no reason to blow the code up by having it inlined.
Also, we usually want R/O mode change to be seen to other
CPUs as soon as possible, so when we make this a function
call, we will automatically have a memory barrier.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Fri, 18 Jul 2008 14:56:37 +0000 (17:56 +0300)]
UBIFS: ensure UBIFS switches to read-only on error writing the log
UBI transparently handles write errors by automatically copying
and remapping the affected eraseblock. If UBI is unable to do
that, for example its pool of eraseblocks reserved for bad block
handling is empty, then the error is propagated to UBIFS. UBIFS
must protect the media from falling into an inconsistent state
by immediately switching to read-only mode. In the case of log
updates, this was not being done.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Adrian Hunter [Fri, 18 Jul 2008 13:47:41 +0000 (16:47 +0300)]
UBIFS: fix error return in failure mode
UBIFS recovery testing debug facility simulates media failures.
When simulating an IO error, the error code returned must be
-EIO but it was not always if the user switched off the
debug recovery testing option at the same time.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Artem Bityutskiy [Mon, 21 Jul 2008 07:59:53 +0000 (10:59 +0300)]
UBIFS: free budget in delete_inode as well
Although the inode is marked as clean when it is being deleted,
it might stay and be used as orphan, and be marked as dirty.
So we have to free the budget when we delete it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 15:54:29 +0000 (18:54 +0300)]
UBIFS: fix budgeting calculations
The 'ubifs_release_dirty_inode_budget()' was buggy and incorrectly
freed the budget, which led to not freeing all dirty data budget.
This patch fixes that.
Also, this patch fixes ubifs_mkdir() which passed 1 in dirty_ino_d,
which makes no sense. Well, it is harmless though.
Also, add few more useful assertions. And improve few debugging
messages.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 10:53:39 +0000 (13:53 +0300)]
UBI: remove pre-sqnum images support
Before UBI got into mainline, there was a slight flash format
change - we did not have sequence number support, then added it.
We have carried full support of those ancient images till this
moment. Now the support is removed, well, not fully removed.
Now UBI will support only _clean_ old images, which were cleanly
detached last time (just before kernel upgrade). This is most
likely the case.
But we will not support unclean ancient images. Surprisingly,
this allows us to remove a big chunk of legacy code.
And the same should be true for downgrading: clean images should
downgrade fine, but unclean ones will not.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 10:34:32 +0000 (13:34 +0300)]
UBI: fix kernel-doc errors and warnings
No functional changes, just tweak comments to make kernel-doc
work fine and stop complaining.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 10:19:52 +0000 (13:19 +0300)]
UBI: fix checkpatch.pl errors and warnings
Just out or curiousity ran checkpatch.pl for whole UBI,
and discovered there are quite a few of stylistic issues.
Fix them.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 09:42:14 +0000 (12:42 +0300)]
UBI: bugfix - do not torture PEB needlessly
This is probably a copy-paste bug - we torture the old PEB
in the atomic LEB change function, but we should not do this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 09:20:23 +0000 (12:20 +0300)]
UBI: rework scrubbing messages
If bit-flips happen often, UBI prints to many messages. Lessen
the amount by only printing the messages when the PEB has been
scrubbed. Also, print torturing messages.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 18 Jul 2008 09:54:21 +0000 (12:54 +0300)]
UBIFS: print volume name as well
We encouredge people to mount using volume name, not device
numbers. So print the name of the mounted UBI volume, not just
IDs.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sebastian Siewior [Thu, 17 Jul 2008 12:16:09 +0000 (14:16 +0200)]
Documentation: fix typo in ubifs.txt
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 17 Jul 2008 09:21:55 +0000 (12:21 +0300)]
UBIFS: add the file-system
This commit adds full UBIFS at the same state as it was pulled
by Linus on "Wed Jul 16 15:02:57 2008 -0700", commit number
9c1be0c4712fe760d8969427ef91107e9c062d91
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Thu, 31 Jan 2008 15:25:00 +0000 (17:25 +0200)]
do_mounts: allow UBI root device name
Similarly to MTD devices, allow UBI devices.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Artem Bityutskiy [Wed, 7 May 2008 18:01:30 +0000 (21:01 +0300)]
VFS: export sync_sb_inodes
This patch exports the 'sync_sb_inodes()' which is needed for
UBIFS because it have to force write-back from time to time.
Namely, the UBIFS budgeting subsystem forces write-back when
its pessimistic callculations show that there is not free
space on the media.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Hans Reiser [Wed, 7 May 2008 12:48:57 +0000 (15:48 +0300)]
VFS: move inode_lock into sync_sb_inodes
This patch makes 'sync_sb_inodes()' lock 'inode_lock', rather
than expect that the caller will do this.
This change was previously done by Hans Reiser <reiser@namesys.com>
and sat in the -mm tree.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 13 Jul 2008 18:47:47 +0000 (21:47 +0300)]
UBI: implement multiple volumes rename
Quite useful ioctl which allows to make atomic system upgrades.
The idea belongs to Richard Titmuss <richard_titmuss@logitech.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 16 Jul 2008 14:40:22 +0000 (17:40 +0300)]
UBI: fix and re-work debugging stuff
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 16 Jul 2008 07:25:56 +0000 (10:25 +0300)]
UBI: amend commentaries
Hch asked not to use "unit" for sub-systems, let it be so.
Also some other commentaries modifications.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 14 Jul 2008 09:57:27 +0000 (12:57 +0300)]
UBI: fix error message
The ubi_err() macro will add \n.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 13 Jul 2008 18:46:24 +0000 (21:46 +0300)]
UBI: improve mkvol request validation
Check that volume name is not shorter than 'name_len'.
No need to copy the trailing zero byte because whole array
was zeroed earlier.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 10 Jul 2008 15:38:33 +0000 (18:38 +0300)]
UBI: add ubi_sync() interface
To flush MTD device caches.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Bruce Leonard [Thu, 3 Jul 2008 07:35:49 +0000 (10:35 +0300)]
UBI: fix 64-bit calculations
Signed-off-by: Bruce Leonard <brucle@selinc.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 16 Jun 2008 10:35:23 +0000 (13:35 +0300)]
UBI: fix LEB locking
leb_read_unlock() may be called simultaniously by several tasks.
The would race at the following code:
up_read(&le->mutex);
if (free)
kfree(le);
And it is possible that one task frees 'le' before the other tasks
do 'up_read()'. Fix this by doing up_read and free inside the
'ubi->ltree' lock. Below it the oops we had because of this:
BUG: spinlock bad magic on CPU#0, integck/7504
BUG: unable to handle kernel paging request at
6b6b6c4f
IP: [<
c0211221>] spin_bug+0x5c/0xdb
*pde =
00000000 Oops: 0000 [#1] PREEMPT SMP Modules linked in: ubifs ubi nandsim nand nand_ids nand_ecc video output
Pid: 7504, comm: integck Not tainted (2.6.26-rc3ubifs26 #8)
EIP: 0060:[<
c0211221>] EFLAGS:
00010002 CPU: 0
EIP is at spin_bug+0x5c/0xdb
EAX:
00000032 EBX:
6b6b6b6b ECX:
6b6b6b6b EDX:
f7f7ce30
ESI:
f76491dc EDI:
c044f51f EBP:
e8a736cc ESP:
e8a736a8
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process integck (pid: 7504, ti=
e8a72000 task=
f7f7ce30 task.ti=
e8a72000)
Stack:
c044f754 c044f51f 00000000 f7f7d024 00001d50 00000001 f76491dc 00000296 f6df50e0 e8a736d8 c02112f0 f76491dc e8a736e8 c039157a f7d9e830 f76491d8 e8a7370c c020b975 f76491dc 00000296 f76491f8 00000000 f76491d8 00000000 Call Trace:
[<
c02112f0>] ? _raw_spin_unlock+0x50/0x7c
[<
c039157a>] ? _spin_unlock_irqrestore+0x20/0x58
[<
c020b975>] ? rwsem_wake+0x4b/0x122
[<
c0390e0a>] ? call_rwsem_wake+0xa/0xc
[<
c0139ee7>] ? up_read+0x28/0x31
[<
f8873b3c>] ? leb_read_unlock+0x73/0x7b [ubi]
[<
f88742a3>] ? ubi_eba_read_leb+0x195/0x2b0 [ubi]
[<
f8872a04>] ? ubi_leb_read+0xaf/0xf8 [ubi]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 4 Jun 2008 14:58:37 +0000 (17:58 +0300)]
UBI: fix memory leak on error path
Normally UBI volumes are freed in the release function of
the struct device object. However, on error path they may
have to be freed before the struct device objects have been
initialized.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 4 Jun 2008 14:00:35 +0000 (17:00 +0300)]
UBI: do not forget to free internal volumes
UBI forgets to free internal volumes when detaching MTD device.
Fix this.
Pointed-out-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 4 Jun 2008 13:48:12 +0000 (16:48 +0300)]
UBI: fix memory leak
ubi_free_volume() function sets ubi->volumes[] to NULL, so
ubi_eba_close() is useless, it does not free what has to be freed.
So zap it and free vol->eba_tbl at the volume release function.
Pointed-out-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Kyungmin Park [Thu, 22 May 2008 01:32:18 +0000 (10:32 +0900)]
UBI: avoid unnecessary division operations
UBI already checks that @min io size is the power of 2 at io_init.
It is save to use bit operations then.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Kyungmin Park [Wed, 21 May 2008 11:34:56 +0000 (14:34 +0300)]
UBI: fix buffer padding
Instead of correctly pad the buffer wich we are writing to the
eraseblock during update, we used weird construct:
memset(buf + len, 0xFF, len - len);
Fix this.
Signed-off-by: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 20 May 2008 06:54:02 +0000 (09:54 +0300)]
UBI: add a comment
It is not clear why we schedule PEB for scrubbing in case of
-EBADMSG. Elaborate.
Requested-by: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 14 May 2008 13:10:33 +0000 (16:10 +0300)]
UBI: print error code
Print error code if checking failed which is very useful
to identify problems.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 23 Apr 2008 10:43:21 +0000 (13:43 +0300)]
UBI: add a message
UBI scan takes quite a time on some systems, so it is nice
to print a message that we started attaching an MTD device.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 20 Apr 2008 15:00:33 +0000 (18:00 +0300)]
UBI: print media information earlier
Print information about logicale eraseblock size, sub-page
size and so on at early stage, befor an attempt to attach
the MTD device was made. This is more convenient to do so
because the attempt to attach may fail, and the information
is never printed then.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 19 Apr 2008 17:44:31 +0000 (20:44 +0300)]
UBI: fix mean EC calculation
(a + b) / (c + d) != a / c + b / d. The old code errornously
assumed this incorrect formuld. Instead, just sum all erase
counters in a 64-bit variable and divide to the number of EBs
at the end.
Thanks to Adrian Hunter for pointing this out.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Jan Altenberg [Fri, 28 Mar 2008 15:13:53 +0000 (16:13 +0100)]
UBI: initialize static volumes with vol->used_bytes
I came across a problem which seems to be present since:
commit
941dfb07ed91451b1c58626a0d258dfdf468b593
UBI: set correct gluebi device size
ubi_create_gluebi() leaves mtd->size = 0 for static volumes. So even
existing static volumes are initialized with a size of 0.
Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 27 Mar 2008 15:18:45 +0000 (17:18 +0200)]
UBI: improve Kconfig documentation
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 8 Feb 2008 10:13:08 +0000 (12:13 +0200)]
Documentation: add UBI sysfs ABI docs
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Greg KH <greg@kroah.com>
Artem Bityutskiy [Sat, 16 Feb 2008 13:42:52 +0000 (15:42 +0200)]
UBI: make ubi-header.h local
The new trend in linux is not to store headers which define
on-media format in the include/ directory, but instead, store
them locally. This is because these headers "do not define any
kernel<->userspace interface".
Do so for UBI as well.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Harvey Harrison [Fri, 15 Feb 2008 08:47:51 +0000 (10:47 +0200)]
UBI: fix sparse errors in ubi.h
In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1
are ever assigned in current code. Make them unsigned bitfields.
Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 12 Feb 2008 14:36:41 +0000 (16:36 +0200)]
UBI: fix error printing
Use existing ubi_err() as the rest of the code does.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 12 Feb 2008 14:32:35 +0000 (16:32 +0200)]
UBI: fix error message
Make it print "UBI error: cannot attach mtd4"
instead of "UBI error: cannot attach 4"
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
S.Çağlar Onur [Tue, 12 Feb 2008 11:25:06 +0000 (13:25 +0200)]
UBI: silence warning
drivers/mtd/ubi/vmt.c: In function `ubi_create_volume':
drivers/mtd/ubi/vmt.c:379: warning: statement with no effect
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>