Artem Bityutskiy [Sun, 28 Dec 2008 08:17:23 +0000 (10:17 +0200)]
UBIFS: improve lprops dump
Improve 'dbg_dump_lprop()' and print dark and dead space there,
decode flags, and journal heads.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 15 Sep 2009 14:09:24 +0000 (17:09 +0300)]
UBIFS: various minor commentary fixes
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 15 Sep 2009 12:03:51 +0000 (15:03 +0300)]
UBIFS: improve journal head debugging prints
Convert the journal head integer into the head name when printing
debugging information.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 15 Sep 2009 11:44:06 +0000 (14:44 +0300)]
UBIFS: define journal head numbers in ubifs-media.h
The journal head names and numbers are part of the UBIFS format, so
they should be in the ubifs-media.h.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 1 Sep 2009 14:06:43 +0000 (17:06 +0300)]
UBIFS: amend commentaries
This patch amends and nicifies commentaries in file.c, as well as
fixes some spelling problems.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 25 Aug 2009 13:22:53 +0000 (16:22 +0300)]
UBIFS: check ubifs_scan error codes better
The 'ubifs_scan()' function returns -EUCLEAN if something is corrupted
and recovery is needed, otherwise it returns other error codes. However,
in few places UBIFS does not check the error codes and runs recovery.
This patch changes this behavior and makes UBIFS start recovery only
on -EUCLEAN errors.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Tue, 25 Aug 2009 12:00:55 +0000 (15:00 +0300)]
UBIFS: do not print scary error messages needlessly
At the moment UBIFS print large and scary error messages and
flash dumps in case of nearly any corruption, even if it is
a recoverable corruption. For example, if the master node is
corrupted, ubifs_scan() prints error dumps, then UBIFS recovers
just fine and goes on.
This patch makes UBIFS print scary error messages only in
real cases, which are not recoverable. It adds 'quiet' argument
to the 'ubifs_scan()' function, so the caller may ask 'ubi_scan()'
not to print error messages if the caller is able to do recovery.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Thu, 27 Aug 2009 13:34:19 +0000 (16:34 +0300)]
UBIFS: add inode size debugging check
Add one more check to UBIFS - a check that makes sure that there
are no data nodes beyond inode size. And few commantaries fixes
along the line.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Sat, 15 Aug 2009 10:57:48 +0000 (13:57 +0300)]
UBIFS: constify file and inode operations
This patch adds 'const' qualifier to UBIFS xattr inode and file
operations.
Pointed-out-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Justin P. Mattock [Sat, 7 Mar 2009 12:31:29 +0000 (13:31 +0100)]
kbuild: fix C libary confusion in unifdef.c due to getline()
This fixes an error when compiling the kernel.
CHK include/linux/version.h
HOSTCC scripts/unifdef
scripts/unifdef.c:209: error: conflicting types for 'getline'
/usr/include/stdio.h:651: note: previous declaration of 'getline' was here
make[1]: *** [scripts/unifdef] Error 1
make: *** [__headers] Error 2
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Subrata Modak [Fri, 17 Jul 2009 15:28:12 +0000 (18:28 +0300)]
UBIFS: remove unused functions
Remove 'xent_key_init_hash()' and 'data_key_init_flash()' functions,
as they are unot used anywhere.
Signed-off-by: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subrata Modak [Wed, 15 Jul 2009 02:19:03 +0000 (07:49 +0530)]
UBIFS: suppress compilation warning
Fix "using uninitialized variable" compilation warning by using
the "unititialized_var()" helper.
Signed-off-by: Subrata Modak<subrata@linux.vnet.ibm.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 24 Jul 2009 13:18:04 +0000 (16:18 +0300)]
UBI: improve NOR flash erasure quirk
More testing of NOR flash against power cuts showed that sometimes
eraseblocks may be unwritable, and we cannot really invalidate
them before erasure. But in this case the eraseblock probably
contains garbage anyway, and we do not have to invalidate the
headers. This assumption might be not true, but this is at least
what I have observed. So if we cannot invalidate the headers,
we make sure that the PEB does not contain valid VID header.
If this is true, everything is fine, otherwise we panic.
Artem Bityutskiy [Fri, 24 Jul 2009 12:31:33 +0000 (15:31 +0300)]
UBI: introduce flash dump helper
Useful for debugging problems, compiled in only if UBI debugging
is enabled. This patch also makes the UBI writing function dump
the flash if it fails to write.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Fri, 24 Jul 2009 16:16:04 +0000 (19:16 +0300)]
UBI: compatible fallback in absense of sequence numbers
Fall back onto thinking everything's OK if either of the sequence
numbers we are asked to compare is zero, which is what was used
before sequence numbers were introduced.
[ Artem: modified the patch to be applicable to upstream UBI, added
big comment ]
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Fri, 24 Jul 2009 14:05:00 +0000 (17:05 +0300)]
UBI: fix double free on error path
If we fail in 'ubi_eba_init_scan()', we free
'ubi->volumes[i]->eba_tbl' in there, but also later free it
in 'free_internal_volumes()'. Fix this by assigning NULL
to 'ubi->volumes[i]->eba_tbl' after it is freed.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Phil Carmody [Thu, 23 Jul 2009 13:29:10 +0000 (15:29 +0200)]
UBI: eliminate possible undefined behaviour
The assignment to pos when rb is finally NULL is undefined behaviour.
Upon seeing that assignment, GCC may assume that rb is not NULL, and
the loop condition ``rb'' may be optimised away.
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 19 Jul 2009 11:33:14 +0000 (14:33 +0300)]
UBI: print a warning if too many PEBs are corrupted
There was a bug report recently where UBI prints:
UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22
error messages and refuses to attach a PEB. It turned out to be a
buggy flash driver which returned garbage to almost every UBI read.
This patch makes UBI print a better message in such cases. Namely,
if UBI finds 8 or more corrupted PEBs, it prints a warning and
lists the corrupted PEBs.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 19 Jul 2009 11:09:46 +0000 (14:09 +0300)]
UBI: amend NOR flash pre-erase quirk
In case of NOR flash, UBI zeroes EC and VID headers' magic,
in order to detect interrupted erasures. It first zeroes out
the EC magic, then VID magic. However, if a power cut happens
in between, we'll end up with a corrupted EC header and a valid
VID header, in which case UBI accepts the PEB, but prints a
warning. This patch makes sure we first zero out the VID
magic, then the EC magic, not vice versa. This is just a
small amendment to prevent warning messages.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 19 Jul 2009 11:03:16 +0000 (14:03 +0300)]
UBI: print a message if ECH is corrupted and VIDH is ok
If the EC header is corrupted, but the VID header is OK, UBI accepts the
PEB and treats it as "used". However, generally this should not happen.
Print a warning if this happens.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Holger Brunck [Mon, 13 Jul 2009 14:47:57 +0000 (16:47 +0200)]
UBI: fix bug in image sequence number handling
This patch fixes a bug in the image seq. number handling in the
scanning level. The assignment of the image_seq was incorrect.
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 10 Jul 2009 14:02:17 +0000 (17:02 +0300)]
mtd: blkdevs: do not for get to get MTD devices
Nowadays MTD devices have to be "get" before they can be
used. This has to be done with 'put_mtd_device()'. The
'blktrans_open()' function did not do this and instead
used 'try_module_get()'. Fixe this.
Since 'put_mtd_device()' already gets the module, extra
'try_module_get()' is not needed.
This fixes oops when one tries to use mtdbloc on tope of
gluebi.
Reported-by: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 10 Jul 2009 13:59:36 +0000 (16:59 +0300)]
UBI: gluebi: initialize ubi_num field
Do not forget to initialize 'gluebi->ubi_num' because otherwise
it will stay 0 even for ubi1 device, and gluebi will open
wrong UBI device when 'gluebi_get_device()' is called.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 8 Jul 2009 07:15:41 +0000 (10:15 +0300)]
UBI: fix compilation warnings
The recent "UBI: fix NOR flash recovery" introduced compilation
warnings which were immediately spotted by our linux-next keeper.
This patch fixes them.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 6 Jul 2009 05:57:53 +0000 (08:57 +0300)]
UBI: fix NOR flash recovery
This commit fixes NOR flash recovery issues observed with Spansion
S29GL512N NOR.
When NOR erases, it first fills PEBs with zeroes, then sets all bytes
to 0xFF. Filling with zeroes starts from the end of the PEB. And when
power is cut, this results in PEBs containing correct EC and VID headers
but corrupted with zeros at the end. This confuses UBI and it mistakinly
accepts these PEBs and associate them with LEBs.
Fis this issue by zeroing EC and VID magics before erasing PEBs, to
make UBI later refuse zem.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 30 Jun 2009 13:11:59 +0000 (16:11 +0300)]
UBI: nicify image sequence number handling
Move the image seq. number handling from I/O level to the scanning
lever, where it really belongs to. Move the @image_seq_set variable
to the @struct ubi_scan_info structure, which exists only during
scanning.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Fri, 26 Jun 2009 11:58:01 +0000 (14:58 +0300)]
UBI: add image sequence number to EC header
An image sequence number is added to the UBI erase-counter header
to be able determine if the root file system contains a mixture
of old and new images (because the flashing failed to complete).
A change to nolo is also needed for this to take effect.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 29 Jun 2009 12:58:36 +0000 (15:58 +0300)]
UBI: remove bogus debugging checks
The 'paranoid_check_empty()' is bogus because, which is easilly
seen on NOR flash, which has long erase cycles, and which may
easilly end-up with half-erased eraseblocks. In this case the
paranoid check fails. I is just wrong to assume that PEBs which
do not have EC headers always contain all 0xFF. Such assumption
should not be made on the I/O level, which is quite low.
Thus, just kill the check.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 28 Jun 2009 16:16:55 +0000 (19:16 +0300)]
UBI: add empty eraseblocks verification
This patch adds code which makes sure eraseblocks contain all 0xFF
bytes before starting using them. The verification is done only when
debugging checks are enabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 29 Jun 2009 16:27:14 +0000 (19:27 +0300)]
UBIFS: fix corruption dump
In the 'ubifs_recover_leb()' function, when we find corrupted
empty space, we dump 8K starting from the offset where the last
node ends. This is OK if the corrupted empty space is somewhere
near that offset. But if the corruption is far at the end of the
LEB, we will dump all 0xFF bytes and complitely ignore the
interesting data. This is observed on a PPC ("kilauea") with
NOR flash.
This patch changes the behavior and teaches UBIFS to print only
interesting data. I.e., now we find where corruption starts and
start dumping from that offset.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Mon, 29 Jun 2009 15:58:34 +0000 (18:58 +0300)]
UBIFS: clean up free space checking
recovery.c has 'is_empty()' helper and it is better to use
this helper instead of re-implementing it in several places.
This patch does this and removes some amount of unneeded code.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Mon, 29 Jun 2009 14:59:23 +0000 (17:59 +0300)]
UBIFS: small amendments in the LEB scanning code
This patch fixes few minor things I've spotted while going through
code:
1. Better document return codes
2. If 'ubifs_scan_a_node()' returns some thing we do not expect,
treat this as an error.
3. Try to do recovery only when 'ubifs_scan()' returns %-EUCLEAN,
not on any error.
4. If empty space starts at a non-aligned address, print a message.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Artem Bityutskiy [Mon, 29 Jun 2009 13:25:33 +0000 (16:25 +0300)]
UBIFS: dump a little more in case of corruptions
In case of corruptions, dump 8192 bytes instead of 4096. The
largest node is 4096+ bytes, so it is better to see a node
boundary, which is not always possible when only 4096 bytes
are printed.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Reviewed-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Daniel Mack [Thu, 2 Jul 2009 15:15:47 +0000 (17:15 +0200)]
UBIFS: allow more than one volume to be mounted
UBIFS uses a bdi device per volume, but does not care to hand out unique
names to each of them. This causes an error when trying to mount more
than one volumes. Append the UBI volume and device ID to avoid that.
[Amended a bit by Artem Bityutskiy]
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Artem Bityutskiy <dedekind@infradead.org>
Cc: Adrian Hunter <ext-adrian.hunter@nokia.com>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 3 Jul 2009 08:21:54 +0000 (11:21 +0300)]
MAINTAINERS: update ahunter's e-mail address
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 28 Jun 2009 15:31:58 +0000 (18:31 +0300)]
UBIFS: fix assertion warning
When debugging is enabled and an unclean file-system is mounter,
the following assertion is triggered:
UBIFS assert failed in ubifs_tnc_start_commit at 805 (pid 1081)
Call Trace:
[
cfaffbd0] [
c0006cf8] show_stack+0x44/0x16c (unreliable)
[
cfaffc10] [
c011b738] ubifs_tnc_start_commit+0xbb8/0xd18
[
cfaffc90] [
c0112670] do_commit+0x150/0xa44
[
cfaffd10] [
c0125234] ubifs_rcvry_gc_commit+0xd8/0x544
[
cfaffd60] [
c0100e9c] ubifs_fill_super+0xe78/0x15f8
[
cfaffdf0] [
c0102118] ubifs_get_sb+0x20c/0x320
[
cfaffe70] [
c007f764] vfs_kern_mount+0x58/0xe0
[
cfaffe90] [
c007f83c] do_kern_mount+0x40/0xf8
[
cfaffeb0] [
c0095c24] do_mount+0x550/0x758
[
cfafff10] [
c0095ebc] sys_mount+0x90/0xe0
[
cfafff40] [
c000ed4c] ret_from_syscall+0x0/0x3c
The reason is that we initialize 'c->min_leb_idx' early, and do
not re-calculate it after journal replay.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Wed, 24 Jun 2009 06:59:38 +0000 (09:59 +0300)]
UBIFS: minor spelling and grammar fixes
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Adrian Hunter [Wed, 24 Jun 2009 07:15:12 +0000 (10:15 +0300)]
UBIFS: fix 64-bit divisions in debug print
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Artem Bityutskiy [Tue, 23 Jun 2009 17:30:32 +0000 (20:30 +0300)]
UBIFS: few spelling fixes
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 23 Jun 2009 17:26:33 +0000 (20:26 +0300)]
UBIFS: set write-buffer timout to 3-5 seconds
This patch cleans up write-buffer timeout initialization and
sets it to 3-5 interval.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 23 Jun 2009 09:30:43 +0000 (12:30 +0300)]
UBIFS: slightly optimize write-buffer timer usage
This patch adds the following minor optimization:
1. If write-buffer does not use the timer, indicate it with the
wbuf->no_timer variable, instead of using the wbuf->softlimit
variable. This is better because wbuf->softlimit is of ktime_t
type, and the ktime_to_ns function contains 64-bit multiplication.
2. Do not call the 'hrtimer_cancel()' function for write-buffers
which do not use timers.
3. Do not cancel the timer in 'ubifs_put_super()' because the
synchronization function does this.
This patch also removes a confusing comment.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 18 Jun 2009 10:37:15 +0000 (13:37 +0300)]
UBIFS: improve debugging messaged
1. Make the I/O debugging message print the journal head number.
2. Add prints to timer functions.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 29 May 2009 17:16:27 +0000 (20:16 +0300)]
UBIFS: do not forget to register BDI device
Reviewed-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 28 May 2009 13:24:15 +0000 (16:24 +0300)]
UBIFS: start using hrtimers
UBIFS uses timers for write-buffer write-back. It is not
crucial for us to write-back exactly on time. We are fine
to write-back a little earlier or later. And this means
we may optimize UBIFS timer so that it could be groped
with a close timer event, so that the CPU would not be
waken up just to do the write back. This is optimization
to lessen power consumption, which is important in
embedded devices UBIFS is used for.
hrtimers have a nice feature: they are effectively range
timers, and we may defind the soft and hard limits for
it. Standard timers do not have these feature. They may
only be made deferrable, but this means there is effectively
no hard limit. So, we will better use hrtimers.
[This patch was re-worked to make it apply to this ancient
kernel. There is no soft limit here, becasue hrtimers
do not support this yet]
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 29 May 2009 09:34:52 +0000 (12:34 +0300)]
UBIFS: allow sync option in rootflags
When passing UBIFS parameters via kernel command line, the
sync option will be passed to UBIFS as a string, not as an
MS_SYNCHRONOUS flag. Teach UBIFS interpreting this flag.
Reported-by: Aurélien GÉRÔME <ag@debian.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 25 May 2009 13:59:28 +0000 (16:59 +0300)]
UBIFS: remove dead code
UBIFS assumes that @c->min_io_size is 8 in case of NOR flash. This
is because UBIFS alignes all nodes to 8-byte boundary, and maintaining
@c->min_io_size introduced unnecessary complications.
This patch removes senseless constructs like:
if (c->min_io_size == 1)
NOR-specific code
Also, few commentaries amendments.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Kevin Cernekee [Tue, 9 Jun 2009 17:59:19 +0000 (10:59 -0700)]
UBI: add reboot notifier
Terminate the UBI background thread prior to restarting the system.
[Artem: amended comments a little]
Signed-off-by: Kevin Cernekee <kpc.mtd@gmail.com>
Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Wed, 10 Jun 2009 08:32:05 +0000 (11:32 +0300)]
UBI: handle more error codes
The UBIFS WL worker may encounter read errors and there is logic
which makes a decision whether we should do one of:
1. cancel the operation and move the PEB with the read errors to
the 'erroneous' list;
2. switch to R/O mode.
ATM, only -EIO errors trigger 1., other errors trigger 2. The idea
is that if we know we encountered an I/O error, do 1. Otherwise,
we do not know how to react, and do 2., just in case. E.g., if
the underlying driver became crazy because of a bug, we do not
want to harm any data, and switch to R/O mode.
This patch does 2 things:
1. Makes sure reads from the source PEB always cause 1. This is
more consistent with other reads which come from the upper
layers and never cause R/O.
2. Teaches UBI to do 1. also on -EBADMSG, UBI_IO_BAD_VID_HDR,
-ENOMEM, and -ETIMEOUT. But this is only when reading the
target PEB.
This preblems were hunted by Adrian Hunter.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 8 Jun 2009 16:28:18 +0000 (19:28 +0300)]
UBI: fix multiple spelling typos
Some of the typos were indicated by Adrian Hunter,
some by 'aspell'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 8 Jun 2009 16:28:18 +0000 (19:28 +0300)]
UBI: fix kmem_cache_free on error patch
'kmem_cache_free()' oopeses if NULL is passed, and there is
one error-path place where UBI may call it with NULL object.
This problem was pointed to by Adrian Hunter.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 8 Jun 2009 13:52:48 +0000 (16:52 +0300)]
UBI: print amount of reserved PEBs
When marking a PEB as bad, print how many PEBs are left reserved.
This is very useful information.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 8 Jun 2009 09:49:08 +0000 (12:49 +0300)]
UBI: improve messages in the WL worker
Print not only the PEB number, but also the LEB number and volume id,
which is very useful for bug hunting.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Dmitry Pervushin [Sun, 31 May 2009 14:32:59 +0000 (18:32 +0400)]
UBI: make gluebi a separate module
[Artem: re-worked the patch: made it release resources when the
module is unloaded, made it do module referencing, made it really
independent on UBI, tested it with the UBI test-suite which can
be found in ubi-2.6.git/tests/ubi-tests, re-named most of the
funcs/variables to get rid of the "ubi" word and make names
consistent.]
Signed-off-by: Dmitry Pervushin <dpervushin@embeddedalley.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Dmitry Pervushin [Wed, 29 Apr 2009 15:29:44 +0000 (19:29 +0400)]
UBI: remove built-in gluebi
Remove built-in gluebi support. This is a preparation for a
standalone glubi module support
Signed-off-by: Dmitry Pervushin <dpervushin@embeddedalley.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Dmitry Pervushin [Wed, 29 Apr 2009 15:29:38 +0000 (19:29 +0400)]
UBI: add notification API
UBI volume notifications are intended to create the API to get clients
notified about volume creation/deletion, renaming and re-sizing. A
client can subscribe to these notifications using 'ubi_volume_register()'
and cancel the subscription using 'ubi_volume_unregister()'. When UBI
volumes change, a blocking notifier is called. Clients also can request
"added" events on all volumes that existed before client subscribed
to the notifications.
If we use notifications instead of calling functions like 'ubi_gluebi_xxx()',
we can make the MTD emulation layer to be more flexible: build it as a
separate module and load/unload it on demand.
[Artem: many cleanups, rework locking, add "updated" event, provide
device/volume info in notifiers]
Signed-off-by: Dmitry Pervushin <dpervushin@embeddedalley.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 24 May 2009 11:13:34 +0000 (14:13 +0300)]
UBI: do not switch to R/O mode on read errors
This patch improves UBI errors handling. ATM UBI switches to
R/O mode when the WL worker fails to read the source PEB.
This means that the upper layers (e.g., UBIFS) has no
chances to unmap the erroneous PEB and fix the error.
This patch changes this behaviour and makes UBI put PEBs
like this into a separate RB-tree, thus preventing the
WL worker from hitting the same read errors again and
again.
But there is a 10% limit on a maximum amount of PEBs like this.
If there are too much of them, UBI switches to R/O mode.
Additionally, this patch teaches UBI not to panic and
switch to R/O mode if after a PEB has been copied, the
target LEB cannot be read back. Instead, now UBI cancels
the operation and schedules the target PEB for torturing.
The error paths has been tested by ingecting errors
into 'ubi_eba_copy_leb()'.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 24 May 2009 08:58:58 +0000 (11:58 +0300)]
UBI: fix and clean-up error paths in WL worker
This patch fixes the error path in the WL worker - in same cases
UBI oopses when 'goto out_error' happens and e1 or e2 are NULL.
This patch also cleans up the error paths a little. And I have
tested nearly all error paths in the WL worker.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 23 May 2009 13:04:17 +0000 (16:04 +0300)]
UBI: introduce new constants
This patch is a clean-up and a preparation for the following
patches. It introduece constants for the return values of the
'ubi_eba_copy_leb()' function.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Wed, 12 Nov 2008 14:06:40 +0000 (16:06 +0200)]
MTD: nandsim: suppress unnecessary warning
nand_base sometimes reads only 2 bytes of a 4 byte id.
It is OK. Do not print a warning in that case.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Artem Bityutskiy [Sat, 23 May 2009 10:44:09 +0000 (13:44 +0300)]
UBI: fix race condition
This patch fixes a minor problem where we may fail to wake
upe the UBI background thread. This is not fatal at all,
it may just result at sligtly worse performace for a short
period of time, just because the thread will be woken up
when real I/O on the UBI starts.
Anywey, the issue is the race condition between
'ubi_attach_mtd_dev()' and 'ubi_thread()'. If we do not
serialize them, the 'wake_up_process()' call may be done
before 'ubi_thread()' went seep, but after it checked
'ubi->thread_enabled'.
This issue was spotted by Shin Hong <hongshin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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>
Artem Bityutskiy [Mon, 25 May 2009 16:23:04 +0000 (19:23 +0300)]
UBIFS: use anonymous device
UBIFS has erroneuosly set 'sb->s_dev' to the UBI volume
character device major/minor. This may lead to clashes
if there is another FS mounted to a block device with
the same major/minor numbers. User-space programs which
use 'stat->st_dev' may get confused because of this.
This problem was found by Al Viro. He also pointed the
way to fix the problem - use 'set_anon_super()' and
'kill_anon_super()' VFS helpers.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Corentin Chary [Mon, 25 May 2009 06:49:10 +0000 (08:49 +0200)]
UBIFS: return proper error code if the compr is not present
If the compressor is not present, mount_ubifs need
to return an error code. This way ubifs_fill_super
will stop and handle the error.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Hunter Adrian [Thu, 14 May 2009 04:32:30 +0000 (06:32 +0200)]
UBIFS: return error if link and unlink race
Consider a scenario when 'vfs_link(dirA/fileA)' and
'vfs_unlink(dirA/fileA, dirB/fileB)' race. 'vfs_link()' does not
lock 'dirA->i_mutex', so this is possible. Both of the functions
lock 'fileA->i_mutex' though. Suppose 'vfs_unlink()' wins, and takes
'fileA->i_mutex' mutex first. Suppose 'fileA->i_nlink' is 1. In this
case 'ubifs_unlink()' will drop the last reference, and put 'inodeA'
to the list of orphans. After this, 'vfs_link()' will link
'dirB/fileB' to 'inodeA'. Thir is a problem because, for example,
the subsequent 'vfs_unlink(dirB/fileB)' will add the same inode
to the list of orphans.
This problem was reported by J. R. Okajima <hooanon05@yahoo.co.jp>
[Artem: add more comments, amended commit message]
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Wed, 8 Apr 2009 12:07:57 +0000 (14:07 +0200)]
UBIFS: reset no_space flag after inode deletion
When UBIFS runs out of space it spends a lot of time trying to
find more space before returning ENOSPC. As there is no point
repeating that unless something has changed, UBIFS has an
optimization to record that the file system is 100% full and not
try to find space. That flag was not being reset when a pending
deletion was finally done.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Reviewed-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Fri, 20 Mar 2009 10:09:04 +0000 (11:09 +0100)]
UBIFS: fix recovery bug
UBIFS did not recovery in a situation in which it could
have. The relevant function assumed there could not be
more nodes in an eraseblock after a corrupted node, but
in fact the last (NAND) page written might contain anything.
The correct approach is to check for empty space (0xFF bytes)
from then on.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Artem Bityutskiy [Thu, 26 Mar 2009 10:51:21 +0000 (12:51 +0200)]
UBIFS: add R/O compatibility
Now UBIFS is supported by u-boot. If we ever decide to change the
media format, then people will have to upgrade their u-boots to
mount new format images. However, very often it is possible to
preserve R/O forward-compatibility, even though the write
forward-compatibility is not preserved.
This patch introduces a new super-block field which stores the
R/O compatibility version.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Adrian Hunter <Adrian.Hunter@nokia.com>
Hunter Adrian [Wed, 18 Mar 2009 11:29:39 +0000 (12:29 +0100)]
UBIFS: fix compiler warnings
fs/ubifs/super.c: In function ‘ubifs_show_options’:
fs/ubifs/super.c:425: warning: format not a string literal and no format arguments
fs/ubifs/super.c: In function ‘mount_ubifs’:
fs/ubifs/super.c:1204: warning: format not a string literal and no format arguments
fs/ubifs/super.c: In function ‘ubifs_remount_rw’:
fs/ubifs/super.c:1557: warning: format not a string literal and no format arguments
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 8 Mar 2009 13:13:00 +0000 (15:13 +0200)]
UBIFS: fully sort GCed nodes
The 'joinup()' function cannot deal with situations when nodes
go in reverse order - it just leaves them in this order. This
patch implement full nodes sorting using n*log(n) algorithm.
It sorts data nodes for bulk-read, and direntry nodes for
readdir().
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 20 Mar 2009 17:11:12 +0000 (19:11 +0200)]
UBIFS: fix commentaries
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 16 Mar 2009 07:56:57 +0000 (09:56 +0200)]
UBIFS: introduce a helpful variable
This patch introduces a helpful @c->idx_leb_size variable.
The patch also fixes some spelling issues and makes comments
use "LEB" instead of "eraseblock", which is more correct.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 16 Mar 2009 07:42:03 +0000 (09:42 +0200)]
UBIFS: use KERN_CONT
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 14 Mar 2009 14:35:27 +0000 (16:35 +0200)]
UBIFS: fix lprops committing bug
When writing lprop nodes, do not forget to set @from to 0 when
switching the LEB. This fixes the following bug:
UBIFS error (pid 27768): ubifs_leb_write: writing -15456 bytes at 16:15880, error -22
UBIFS error (pid 27768): do_commit: commit failed, error -22
UBIFS warning (pid 27768): ubifs_ro_mode: switched to read-only mode, error -22
Pid: 27768, comm: freespace Not tainted 2.6.29-rc4-ubifs-2.6 #43
Call Trace:
[<
ffffffffa00c46d6>] ubifs_ro_mode+0x54/0x56 [ubifs]
[<
ffffffffa00cfa16>] do_commit+0x4f5/0x50a [ubifs]
[<
ffffffffa00cfae7>] ubifs_run_commit+0xbc/0xdb [ubifs]
[<
ffffffffa00d42b9>] ubifs_budget_space+0x742/0x9ed [ubifs]
[<
ffffffff812daf45>] ? __mutex_lock_common+0x361/0x3ae
[<
ffffffffa00bc437>] ? ubifs_write_begin+0x18d/0x44c [ubifs]
[<
ffffffffa00bc5cb>] ubifs_write_begin+0x321/0x44c [ubifs]
[<
ffffffff8106222b>] ? trace_hardirqs_on_caller+0x1f/0x14d
[<
ffffffff81097ce2>] generic_file_buffered_write+0x12f/0x2d9
[<
ffffffff8109828d>] __generic_file_aio_write_nolock+0x261/0x295
[<
ffffffff81098aff>] generic_file_aio_write+0x69/0xc5
[<
ffffffffa00bb914>] ubifs_aio_write+0x14c/0x19e [ubifs]
[<
ffffffff810c8f42>] do_sync_write+0xe7/0x12d
[<
ffffffff81055378>] ? autoremove_wake_function+0x0/0x38
[<
ffffffff81149edc>] ? security_file_permission+0x11/0x13
[<
ffffffff810c9827>] vfs_write+0xab/0x105
[<
ffffffff810c9945>] sys_write+0x47/0x6f
[<
ffffffff8100c35b>] system_call_fastpath+0x16/0x1b
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sun, 15 Mar 2009 15:20:22 +0000 (17:20 +0200)]
UBIFS: fix bogus assertion
Empty journal head LEBs are accounted as taken empty as well, so
the GC LEB does not have to be the only taken empty LEB when
nounting/remounting.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Mon, 23 Feb 2009 10:47:25 +0000 (12:47 +0200)]
UBIFS: fix bug where page is marked uptodate when out of space
UBIFS fast path in write_begin may mark a page up to date
and then discover that there may not be enough space to do
the write, and so fall back to a slow path. The slow path
tries harder, but may still find no space - leaving the page
marked up to date, when it is not. This patch ensures that
the page is marked not up to date in that case.
The bug that this patch fixes becomes evident when the write
is into a hole (sparse file) or is at the end of the file
and a subsequent read is off the end of the file. In both
cases, the file system should return zeros but was instead
returning the page that had not been written because the
file system was out of space.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Sat, 7 Mar 2009 18:53:41 +0000 (20:53 +0200)]
UBIFS: amend key_hash return value
... which should be uint32_t, not int.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 3 Mar 2009 17:22:53 +0000 (19:22 +0200)]
UBIFS: improve find function interface
Make 'ubifs_find_free_space()' return offset where free space starts,
rather than the amount of free space. This is just more appropriat
for its caller.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Eric Sesterhenn [Fri, 13 Feb 2009 08:13:11 +0000 (09:13 +0100)]
UBIFS: list usage cleanup
Trivial cleanup, list_del(); list_add{,_tail}() is equivalent
to list_move{,_tail}(). Semantic patch for coccinelle can be
found at www.cccmz.de/~snakebyte/list_move_tail.spatch
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Thu, 5 Feb 2009 11:08:11 +0000 (13:08 +0200)]
UBIFS: fix dbg_chk_lpt_sz()
The debugging function dbg_chk_lpt_sz() was not working
correctly for small min_io_unit size e.g. NOR flash.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
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 [Thu, 29 Jan 2009 14:34:30 +0000 (16:34 +0200)]
UBIFS: remove fast unmounting
This UBIFS feature has never worked properly, and it was a mistake
to add it because we simply have no use-cases. So, lets still accept
the fast_unmount mount option, but ignore it. This does not change
much, because UBIFS commit in sync_fs anyway, and sync_fs is called
while unmounting.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Thu, 29 Jan 2009 14:22:54 +0000 (16:22 +0200)]
UBIFS: return sensible error codes
When mounting/re-mounting, UBIFS returns EINVAL even if the ENOSPC
or EROFS codes are are much better, just because we have not found
references to ENOSPC/EROFS in mount (2) man pages. This patch
changes this behaviour and makes UBIFS return real error code,
because:
1. It is just less confusing and more logical
2. mount is not described in SuSv3, so it seems to be not really
well-standartized
3. we do not cover all cases, and any random undocumented in man
pages error code may be returned anyway
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Thu, 29 Jan 2009 10:59:33 +0000 (12:59 +0200)]
UBIFS: remount ro fixes
- preserve the idx_gc list - it will be needed in the same
state, should UBIFS be remounted rw again
- prevent remounting ro if we have switched to read only
mode (due to a fatal error)
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Thu, 29 Jan 2009 09:53:51 +0000 (11:53 +0200)]
UBIFS: spelling fix 'date' -> 'data'
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Thu, 29 Jan 2009 09:17:24 +0000 (11:17 +0200)]
UBIFS: sync wbufs after syncing inodes and pages
All writes go through wbufs so they must be sync'd
after syncing inodes and pages.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Tue, 27 Jan 2009 13:22:54 +0000 (15:22 +0200)]
UBIFS: fix LPT out-of-space bug (again)
The function to traverse and dirty the LPT was still not
dirtying all nodes, with the result that the LPT could
run out of space.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Tue, 27 Jan 2009 14:12:31 +0000 (16:12 +0200)]
UBIFS: fix no_chk_data_crc
When data CRC checking is disabled, UBIFS returns incorrect return
code from the 'try_read_node()' function (0 instead of 1, which means
CRC error), which make the caller re-read the data node again, but using
a different code patch, so the second read is fine. Thus, we read the
same node twice. And the result of this is that UBIFS is slower
with no_chk_data_crc option than it is with chk_data_crc option.
This patches fixes the problem.
Reported-by: Reuben Dowle <Reuben.Dowle@navico.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 26 Jan 2009 14:12:20 +0000 (16:12 +0200)]
UBIFS: fix assertions
I introduce wrong assertions in one of the previous commits, this
patch fixes them.
Also, initialize debugfs after the debugging check. This is a little
nicer because we want the FS data to be accessible to external users
after everything has been initialized.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Mon, 26 Jan 2009 11:20:32 +0000 (13:20 +0200)]
UBI: remove lock_kernel
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Adrian Hunter [Mon, 26 Jan 2009 08:55:40 +0000 (10:55 +0200)]
UBIFS: ensure orphan area head is initialized
When mounting read-only the orphan area head is
not initialized. It must be initialized when
remounting read/write, but it was not. This patch
fixes that.
[Artem: sorry, added comment tweaking noise]
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 23 Jan 2009 16:23:03 +0000 (18:23 +0200)]
UBIFS: always clean up GC LEB space
When we mount UBIFS, GC LEB may contain out-of-date information,
and UBIFS should update lprops and set free space for thei LEB.
Currently UBIFS does this only if mounted R/W. But for R/O mount
we have to do the same, because otherwise we will have incorrect
FS free space reported to user-space.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy [Fri, 23 Jan 2009 12:54:59 +0000 (14:54 +0200)]
UBIFS: add re-mount debugging checks
We observe space corrupted accounting when re-mounting. So add some
debbugging checks to catch problems like this.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>