pandora-kernel.git
14 years agoUBI: add ioctl for unmap operation
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>
14 years agoUBI: add ioctl for map operation
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>
14 years agofix similar typos to successfull
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>
14 years agotrivial: fix then -> than typos in comments and documentation
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>
14 years agoUBI: fix checkpatch.pl warnings
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>
14 years agoUBI: simplify PEB protection code
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>
14 years agoUBI: prepare for protection tree improvements
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>
14 years agoUBI: return -ENOMEM upon failing vmalloc
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>
14 years agoUBI: handle write errors in WL worker
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>
14 years agoUBI: fix error path
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>
14 years agoUBI: some code re-structuring
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>
14 years agoUBI: fix deadlock
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>
14 years agoUBI: fix warnings when debugging is enabled
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>
14 years agoUBI: Don't exit from ubi_thread until kthread_should_stop() is true
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>
14 years agoUBI: fix EBADMSG handling
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>
14 years agoUBI: print reserved_peb when it is too large
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>
14 years agoUBI: fix IS_ERR test
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>
14 years agoPollux support + GPH wiz stuff dated 090105
GPH [Mon, 25 May 2009 14:54:11 +0000 (17:54 +0300)]
Pollux support + GPH wiz stuff dated 090105

14 years agoUBIFS: add mmap support for old kernels
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>
14 years agoUBIFS: minor tweaks in commit
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>
14 years agoUBIFS: reserve more space for index
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>
14 years agoUBIFS: print pid in dump function
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>
14 years agoUBI: always start the background thread
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>
14 years agoUBIFS: align inode data to eight
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>
14 years agoUBIFS: improve budgeting checks
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>
14 years agoUBIFS: correct orphan deletion order
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>
14 years agoUBIFS: fix typos in comments
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>
14 years agoUBIFS: do not union creat_sqnum and del_cmtno
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>
14 years agoUBIFS: compatibility fixes
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>
14 years agoUBIFS: add NFS support
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>
14 years agoUBIFS: optimize deletions
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>
14 years agoUBIFS: increment commit number earlier
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>
14 years agoUBIFS: remove another unneeded function parameter
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>
14 years agoUBIFS: remove unneeded function parameter
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>
14 years agoUBIFS: do not write orphans back
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>
14 years agoUBI: fix gcc warning
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>
14 years agoUBIFS: make ubifs_ro_mode() not inline
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>
14 years agoUBIFS: ensure UBIFS switches to read-only on error writing the log
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>
14 years agoUBIFS: fix error return in failure mode
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>
14 years agoUBIFS: free budget in delete_inode as well
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>
14 years agoUBIFS: fix budgeting calculations
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>
14 years agoUBI: remove pre-sqnum images support
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>
14 years agoUBI: fix kernel-doc errors and warnings
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>
14 years agoUBI: fix checkpatch.pl errors and warnings
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>
14 years agoUBI: bugfix - do not torture PEB needlessly
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>
14 years agoUBI: rework scrubbing messages
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>
14 years agoUBIFS: print volume name as well
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>
14 years agoDocumentation: fix typo in ubifs.txt
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>
14 years agoUBIFS: add the file-system
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>
14 years agodo_mounts: allow UBI root device name
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>
14 years agoVFS: export sync_sb_inodes
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>
14 years agoVFS: move inode_lock into sync_sb_inodes
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>
14 years agoUBI: implement multiple volumes rename
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>
14 years agoUBI: fix and re-work debugging stuff
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>
14 years agoUBI: amend commentaries
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>
14 years agoUBI: fix error message
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>
14 years agoUBI: improve mkvol request validation
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>
14 years agoUBI: add ubi_sync() interface
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>
14 years agoUBI: fix 64-bit calculations
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>
14 years agoUBI: fix LEB locking
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>
14 years agoUBI: fix memory leak on error path
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>
14 years agoUBI: do not forget to free internal volumes
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>
14 years agoUBI: fix memory leak
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>
14 years agoUBI: avoid unnecessary division operations
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>
14 years agoUBI: fix buffer padding
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>
14 years agoUBI: add a comment
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>
14 years agoUBI: print error code
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>
14 years agoUBI: add a message
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>
14 years agoUBI: print media information earlier
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>
14 years agoUBI: fix mean EC calculation
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>
14 years agoUBI: initialize static volumes with vol->used_bytes
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>
14 years agoUBI: improve Kconfig documentation
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>
14 years agoDocumentation: add UBI sysfs ABI docs
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>
14 years agoUBI: make ubi-header.h local
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>
14 years agoUBI: fix sparse errors in ubi.h
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>
14 years agoUBI: fix error printing
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>
14 years agoUBI: fix error message
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>
14 years agoUBI: silence warning
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>
14 years agoUBI: be verbose when debuggin is enabled
Artem Bityutskiy [Tue, 12 Feb 2008 11:26:31 +0000 (13:26 +0200)]
UBI: be verbose when debuggin is enabled

Make I/O function to be always verbose when about CRC errors
and magic number errors when I/O debugging is enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: do not flush queue on each vtbl change
Artem Bityutskiy [Fri, 1 Feb 2008 11:48:49 +0000 (13:48 +0200)]
UBI: do not flush queue on each vtbl change

This is just not necessary. We re-write whole layout copy, so
the old contents cannot show up again sice scan process will
drop it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: implement atomic LEB change ioctl
Artem Bityutskiy [Thu, 24 Jan 2008 16:48:21 +0000 (18:48 +0200)]
UBI: implement atomic LEB change ioctl

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: introduce atomic LEB change ioctl
Artem Bityutskiy [Thu, 24 Jan 2008 14:15:14 +0000 (16:15 +0200)]
UBI: introduce atomic LEB change ioctl

We have to be able to change individual LEBs for utilities like
ubifsck, ubifstune. For example, ubifsck has to be able to fix
errors on the media, ubifstune has to be able to change the
the superblock, hence this ioctl.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: handle zero-length case
Artem Bityutskiy [Thu, 24 Jan 2008 15:56:14 +0000 (17:56 +0200)]
UBI: handle zero-length case

ubi_eba_atomic_leb_change() has to just map the LEB to a free PEB
if data length is zero.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: simplify internal interfaces
Artem Bityutskiy [Thu, 24 Jan 2008 15:04:01 +0000 (17:04 +0200)]
UBI: simplify internal interfaces

Instead of passing vol_id to all functions and then find
struct ubi_volume, pass struct ubi_volume pointer.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: do not change file pointer while updating
Artem Bityutskiy [Thu, 24 Jan 2008 14:45:57 +0000 (16:45 +0200)]
UBI: do not change file pointer while updating

Since we do not change semantics of seek(), changing the file
pointer while updating does not make much sense.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: add layout volume information
Artem Bityutskiy [Thu, 24 Jan 2008 09:23:23 +0000 (11:23 +0200)]
UBI: add layout volume information

Add more information about layout volume to make userspace tools
use the macros instead of constants. Also rename UBI_LAYOUT_VOL_ID
to make it consistent with other macros.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: fix warnings
Artem Bityutskiy [Thu, 24 Jan 2008 09:19:14 +0000 (11:19 +0200)]
UBI: fix warnings

Old gcc complains:

CC      drivers/mtd/ubi/wl.o
drivers/mtd/ubi/wl.c: In function 'wear_leveling_worker':
drivers/mtd/ubi/wl.c:746: warning: 'pe' may be used uninitialized in this function
CC      drivers/mtd/ubi/scan.o
drivers/mtd/ubi/scan.c: In function 'ubi_scan':
drivers/mtd/ubi/scan.c:772: warning: 'ec' may be used uninitialized in this function
drivers/mtd/ubi/scan.c:772: note: 'ec' was declared here

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: add sanity check
Artem Bityutskiy [Tue, 22 Jan 2008 10:38:15 +0000 (12:38 +0200)]
UBI: add sanity check

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: remove bogus assertion
Artem Bityutskiy [Tue, 22 Jan 2008 10:31:30 +0000 (12:31 +0200)]
UBI: remove bogus assertion

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: bugfix: calculate data offset properly
Artem Bityutskiy [Thu, 17 Jan 2008 13:41:14 +0000 (15:41 +0200)]
UBI: bugfix: calculate data offset properly

Data offset is VID header offset + VID header size aligned to
the min. I/O unit size up.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: amend array size
Artem Bityutskiy [Thu, 17 Jan 2008 13:35:57 +0000 (15:35 +0200)]
UBI: amend array size

Since the data offset parameter was removed, the size of
the parameters array is now 2, not 3.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: add auto-resize feature
Artem Bityutskiy [Wed, 16 Jan 2008 13:44:24 +0000 (15:44 +0200)]
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>
14 years agoUBI: use bit-fields
Artem Bityutskiy [Wed, 16 Jan 2008 12:24:14 +0000 (14:24 +0200)]
UBI: use bit-fields

Save 12 bytes of RAM per volume by using bit-fields instead of integers.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: fix warnings
Artem Bityutskiy [Wed, 16 Jan 2008 10:15:47 +0000 (12:15 +0200)]
UBI: fix warnings

drivers/mtd/ubi/cdev.c: In function ‘vol_cdev_read’:
drivers/mtd/ubi/cdev.c:187: warning: unused variable ‘vol_id’
CC [M]  drivers/mtd/ubi/kapi.o
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_erase’:
drivers/mtd/ubi/kapi.c:483: warning: unused variable ‘vol_id’
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_unmap’:
drivers/mtd/ubi/kapi.c:544: warning: unused variable ‘vol_id’
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_map’:
drivers/mtd/ubi/kapi.c:582: warning: unused variable ‘vol_id’

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: get rid of ubi_ltree_slab
Artem Bityutskiy [Wed, 16 Jan 2008 10:11:54 +0000 (12:11 +0200)]
UBI: get rid of ubi_ltree_slab

This slab cache is not really needed since the number of objects
is low and the constructor does not make much sense because we
allocate oblects when doint I/O, which is way slower then allocation.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: bugfix: do not forget to increment vol_count
Artem Bityutskiy [Wed, 26 Dec 2007 13:59:39 +0000 (15:59 +0200)]
UBI: bugfix: do not forget to increment vol_count

When creating a new volume, do not forget to increment the
vol_count variable.

Also, users are not interested in internal volumes, so do not show
them in the volumes_count sysfs file.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: do not support kiB
Artem Bityutskiy [Wed, 26 Dec 2007 12:25:58 +0000 (14:25 +0200)]
UBI: do not support kiB

Be strict and accept only KiB, MiB and GiB, not Kib, not kib, etc.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: add mtd_num sysfs attribute
Artem Bityutskiy [Wed, 26 Dec 2007 11:46:46 +0000 (13:46 +0200)]
UBI: add mtd_num sysfs attribute

Expose number or the underlying MTD device in sysfs.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: fix mtd device string parsing
Artem Bityutskiy [Tue, 25 Dec 2007 17:17:00 +0000 (19:17 +0200)]
UBI: fix mtd device string parsing

UBI allows to specify MTD device name or number when the module is being
loaded. When parsing MTD device identity string, it first tries to treat
it as device NAME, and if that fails, it treats it as device number.

Make it vice-versa as this is more logical and makes less troubles when
you have an MTD device named "1" and try to load mtd1 which has different
name. This is especially easy to hit when gluebi is enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
14 years agoUBI: use separate mutex for volumes checking
Artem Bityutskiy [Tue, 25 Dec 2007 16:13:33 +0000 (18:13 +0200)]
UBI: use separate mutex for volumes checking

Introduce a separate mutex which serializes volumes checking,
because we cammot really use volumes_mutex - it cases reverse
locking problems with mtd_tbl_mutex when gluebi is used -
thanks to lockdep.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>