dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

400 Commits

Author SHA1 Message Date
Shmulik Ladkani 87e773c95e UBI: harmonize the update of ubi->beb_rsvd_pebs
Currently, there are several locations where an attempt to reserve more
PEBs for bad PEB handling is made, with the same code being duplicated.

Harmonize it by introducing 'ubi_update_reserved()'.

Also, improve the debug message issued, making it more descriptive.

Artem: amended the patch a little.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-07-18 14:30:34 +03:00
Shmulik Ladkani 5c669a5bd8 UBI: trivial: fix comment of ubi_calculate_reserved function
The function name within the comment was not aligned with the actual
function name.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-07-18 13:33:03 +03:00
Peter Meerwald 2ce7be1b77 UBI: fix spelling of detach in debug output
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-07-18 10:13:41 +03:00
Richard Genoud 54de1f1c44 UBI: Change the default percentage of reserved PEB
The actual value (1%) is too low for actual NAND devices, a huge
majority of device has 2% maximum bad blocks (SLC or MLC).
(Actually it's 20 blocks on a 1024 blocks device, 40/2048...)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
2012-07-18 10:13:41 +03:00
Brian Norris 903e0e4ef9 UBI: correct usage of IS_ENABLED()
Commit "e9b4cf2 UBI: fix debugfs-less systems support" fixed one
regression but introduced a different regression - the debugfs is now always
compiled out. Root cause: IS_ENABLED() arguments should be used with the
CONFIG_* prefix.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-06-27 14:22:15 +03:00
Artem Bityutskiy 12027f1b3f UBI: correct ubi_wl_flush locking
Commit "62f38455 UBI: modify ubi_wl_flush function to clear work queue for a lnum"
takes the 'work_sem' semaphore in write mode for the entire loop, which is not
very good because it will block other workers for potentially long time. We do
not need to have it in write mode - read mode is enough, and we do not need to
hole it over the entire loop. So this patch turns changes the locking: takes
'work_sem' in read mode and pushes it down to the loop.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-06-07 15:22:21 +03:00
Artem Bityutskiy e9b4cf2094 UBI: fix debugfs-less systems support
Commit "aa44d1d UBI: remove Kconfig debugging option" broke UBI and it
refuses to initialize if debugfs (CONFIG_DEBUG_FS) is disabled. I incorrectly
assumed that debugfs files creation function will return success if debugfs
is disabled, but they actually return -ENODEV. This patch fixes the issue.

Reported-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tested-by: Paul Parsons <lost.distance@yahoo.com>
2012-06-07 10:43:54 +03:00
Joel Reardon 62f384552b UBI: modify ubi_wl_flush function to clear work queue for a lnum
This patch modifies ubi_wl_flush to force the erasure of
particular volume id / logical eraseblock number pairs. Previous functionality
is preserved when passing UBI_ALL for both values. The locations where ubi_wl_flush
were called are appropriately changed: ubi_leb_erase only flushes for the
erased LEB, and ubi_create_volume forces only flushing for its volume id.
External code can call this new feature via the new function ubi_flush() added
to kapi.c, which simply passes through to ubi_wl_flush().

This was tested by disabling the call to do_work in ubi thread, which results
in the work queue remaining unless explicitly called to remove. UBIFS was
changed to call ubifs_leb_change 50 times for four different LEBs. Then the
new function was called to clear the queue: passing wrong volume ids / lnum,
correct ones, and finally UBI_ALL for both to ensure it was finally all
cleard. The work queue was dumped each time and the selective removal
of the particular LEB numbers was observed. Extra checks were enabled and
ubifs's integck was also run. Finally, the drive was repeatedly filled and
emptied to ensure that the queue was cleared normally.

Artem: amended the patch.

Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-21 11:34:41 +03:00
Artem Bityutskiy 05a3cb7dce UBI: introduce UBI_ALL constant
Joel will use it in his 'ubi_flush()' extention to specify all eraseblocks.
Also amend the comment for UBI_UNKNOWN - it is used beyond attaching info
structure now.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-21 11:34:41 +03:00
Joel Reardon d36e59e69b UBI: add lnum and vol_id to struct ubi_work
This is part of a multipart patch to allow UBI to force the erasure of
particular logical eraseblock numbers. In this patch, the volume id and LEB
number are added to ubi_work data structure, and both are also passed as a
parameter to schedule erase to set it appropriately. Whenever ubi_wl_put_peb
is called, the lnum is also passed to be forwarded to schedule erase. Later,
a new ubi_sync_lnum will be added to execute immediately all work related to
that lnum.

This was tested by outputting the vol_id and lnum during the schedule of
erasure. The ubi thread was disabled and two ubifs drives on separate
partitions repeated changed a small number of LEBs. The ubi module was readded,
and all the erased LEBs, corresponding to the volumes, were added to the
schedule erase queue.

Artem: minor tweaks

Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-21 11:34:41 +03:00
Joel Reardon 6dd3bc7e60 UBI: add volume id struct ubi_ainf_peb
This patch adds the volume id to struct ubi_ainf_peb when scanning the LEBs at
startup. PEBs now added to the erase queue will know their original LEB number
and volume id, if available, and will be -1 otherwise (for instance, if the VID
header is unreadable).

This was tested by creating an ubi device with 3 volumes and disabiling the
ubi_thread's do_work functionality. The different ubi volumes were formatted
to ubifs and had files created and erased.  The ubi modules was reloaded and
the list of LEB's added to the erased list was outputted, confirming the
volume ids and LEB numbers were appropriate.

Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-21 11:34:41 +03:00
Joel Reardon 5cc09420e2 UBI: add in hex the value for UBI_INTERNAL_VOL_START to comment
Explicitly provide the first internal volume ID value in the comment for
UBI_INTERNAL_VOL_START. This allows developers who, when adding features
related to volume ids and observe unexpected very large volume ids, to grep
for the observed value in the source code and find out immediately that it is
expected behaviour.

Signed-off-by: Joel Reardon <reardonj@inf.ethz.ch>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 21:30:45 +03:00
Artem Bityutskiy ae4a8104e3 UBI: rename scan.c to attach.c
Finally, rename the scan.c file. Now adding fastmap support won't look that
hacky anymore.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 21:01:28 +03:00
Artem Bityutskiy 0479ab48bb UBI: remove scan.h
This file is small and it does not make sense to have it separate from where
everything else lives, so merge it with ubi.h.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 21:01:28 +03:00
Artem Bityutskiy 9c47fb2fbe UBI: rename UBI_SCAN_UNKNOWN_EC
Rename the constant to UBI_UNKNOWN, for the same reason that we are going
to add nother attaching method and re-use the same data structures, so the
"SCAN" in the name becomes incorrect. I've also removed the "_EC" part because
Joel is going to use this constant for other fields in the attaching info data
structures.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 21:01:28 +03:00
Artem Bityutskiy 47e1ec70b2 UBI: move and rename attach_by_scanning
Rename the 'attach_by_scanning()' function to 'ubi_attach()' and move it to
scan.c. Richard will plug his fastmap stuff there.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:04 +03:00
Artem Bityutskiy 41e0cd9d4e UBI: rename _init_scan functions
We have a couple of initialization funcntionsn left which have "_scan" suffic -
rename them:

ubi_eba_init_scan() -> ubi_eba_init()
ubi_wl_init_scan() -> ubi_wl_init()

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:04 +03:00
Artem Bityutskiy fbd0107f4d UBI: amend comments after all the renamings
This patch amends commentaries in scan.[ch] to match the new logic. Reminder -
we did the restructuring to prepare the code for adding the fastmap. This patch
also renames a couple of functions - it was too difficult to separate out that
change and I decided that it is not too bad to have it in the same patch with
commentaries changes.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:04 +03:00
Artem Bityutskiy 1fc2e3e59d UBI: rename ubi_scan_leb_slab
The old name is not logical anymore - rename it to 'aeb_slab_cache'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy 0bae2887a7 UBI: rename ubi_scan_move_to_list
The old name is not logical anymore - rename it to 'ubi_move_aeb_to_list()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy 66a2af3824 UBI: rename ubi_scan_destroy_ai
The old name is not logical anymore - rename it to 'ubi_destroy_ai()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy c87fbd7deb UBI: rename ubi_scan_get_free_peb
The old name is not logical anymore - rename it to 'ubi_early_get_peb()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy d717dc2f85 UBI: rename ubi_scan_rm_volume
The old name is not logical anymore - rename it to 'ubi_remove_av()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy dcd85fdd10 UBI: rename ubi_scan_find_av
The old name is not logical anymore - rename it to 'ubi_find_av()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:03 +03:00
Artem Bityutskiy 3561188ac2 UBI: rename ubi_scan_add_used
The old name is not logical anymore - rename it to 'ubi_add_to_av()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy ee663d9292 UBI: remove unused function
The 'ubi_scan_find_aeb()' function is unused and thus can be removed.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy 13d33dad35 UBI: make ubi_scan_erase_peb static and rename
The 'ubi_scan_erase_peb()' is used only in scan.c so can be static. Also
re-name it to 'early_erase_peb()' because we tend to use "ubi_" prefix only for
non-static fuction and also because the new name is better.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy 517af48c05 UBI: rename sv to av
After re-naming the 'struct ubi_scan_volume' we should adjust all variables
named 'sv' to something else, because 'sv' stands for "scanning volume".
Let's rename it to 'av' which stands for "attaching volume" which is
a bit more consistent and has the same length, which makes re-naming easy.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy a4e6042f1d UBI: rename si to ai
After re-naming the 'struct ubi_scan_info' we should adjust all variables
named 'si' to something else, because 'si' stands for "scanning info".
Let's rename it to 'ai' which stands for "attaching info" which is
a bit more consistent and has the same length, which makes re-naming easy.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy 2c5ec5ce66 UBI: rename seb to aeb
After re-naming the 'struct ubi_scan_leb' we should adjust all variables
named 'seb' to something else, because 'seb' stands for "scanning eraseblock".
Let's rename it to 'aeb' which stands for "attaching eraseblock" which is
a bit more consistend and has the same length.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:02 +03:00
Artem Bityutskiy 55e93e55aa UBI: amend comments after renaming in scan.c
Now some commentaries are out-of-date, after we re-named the data
structures - amend them.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:01 +03:00
Artem Bityutskiy afc15a814b UBI: rename struct ubi_scan_info
Rename 'struct ubi_scan_info' to 'struct ubi_attach_info'. This is part
of the code re-structuring I am trying to do in order to add fastmap
in a more logical way. Fastmap can share a lot with scanning, including
the attach-time data structures, which all now have "scan" word in the
name. Let's get rid of this word.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:01 +03:00
Artem Bityutskiy cb28a9322d UBI: rename struct ubi_scan_volume
Rename 'struct ubi_scan_volume' to 'struct ubi_ainf_volume'. This is part
of the code re-structuring I am trying to do in order to add fastmap
in a more logical way. Fastmap can share a lot with scanning, including
the attach-time data structures, which all now have "scan" word in the
name. Let's get rid of this word and use "ainf" instead which stands
for "attach information". It has the same length as "scan" so re-naming
is trivial.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:01 +03:00
Artem Bityutskiy 227423d241 UBI: rename struct ubi_scan_leb
Rename 'struct ubi_scan_leb' to 'struct ubi_ainf_leb'. This is part
of the code re-structuring I am trying to do in order to add fastmap
in a more logical way. Fastmap can share a lot with scanning, including
the attach-time data structures, which all now have "scan" word in the
name. Let's get rid of this word and use "ainf" instead which stands
for "attach information". It has the same length as "scan" so re-naming
is trivial.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:26:01 +03:00
Artem Bityutskiy 97d6104bac UBI: rename few functions for consistency
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:01 +03:00
Artem Bityutskiy e2986827d5 UBI: get rid of dbg_err
This patch removes the 'dbg_err()' macro and we now use 'ubi_err' instead.
The idea of 'dbg_err()' was to compile out some error message to make the
binary a bit smaller - but I think it was a bad idea.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy 7bf523ae25 UBI: more of clean-up terminology for self-checks
We have the "sefl-check" feature in UBI, but for historical reasons many
corresponding functions and commentaries in the code use term "paranoid check"
instead. Let's clean this up and use "self-check" everywhere.

This patch renames functions, amends messages and kills several redundant
debugging messages.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy 8056eb4ac4 UBI: clean-up terminology for self-checks in io.c
We have the "sefl-check" feature in UBI, but for historical reasons many
corresponding functions and commentaries in the code use term "paranoid check"
instead. Let's clean this up and use "self-check" everywhere.

This patch renames functions, amends comments and messages. It touches only the
io.c file.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy aa44d1d35f UBI: remove Kconfig debugging option
This patch kills the UBI debugging Kconfig option completely and makes all the
debugging stuff to be always compiled-in. It was pain in the neck to maintain
this useless option because all users I am aware of have debugging enabled
anyway - how else will you diagnose errors otherwise?

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy 718c00bb8f UBI: rename ubi_dbg_dump_mkvol_req
I am going to remove the "UBI debugging" compilation option and make the
debugging stuff to be always compiled it. This patch is a preparation
which renames 'ubi_dbg_dump_mkvol_req()' to 'ubi_dump_mkvol_req()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy b989bd4c57 UBI: rename ubi_dbg_dump_seb
I am going to remove the "UBI debugging" compilation option and make the
debugging stuff to be always compiled it. This patch is a preparation
which renames 'ubi_dbg_dump_seb()' to 'ubi_dump_seb()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:26:00 +03:00
Artem Bityutskiy 614c74a75c UBI: rename ubi_dbg_dump_sv
I am going to remove the "UBI debugging" compilation option and make the
debugging stuff to be always compiled it. This patch is a preparation
which renames 'ubi_dbg_dump_sv()' to 'ubi_dump_sv()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:59 +03:00
Artem Bityutskiy 1f021e1de5 UBI: rename ubi_dbg_dump_vtbl_record
I am going to remove the "UBI debugging" compilation option and make the
debugging stuff to be always compiled it. This patch is a preparation
which renames 'ubi_dbg_dump_vtbl_record()' to 'ubi_dump_vtbl_record()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:59 +03:00
Artem Bityutskiy 766381f049 UBI: rename ubi_dbg_dump_vol_info
I am going to remove the "UBI debugging" compilation option and make the
debugging stuff to be always compiled it. This patch is a preparation
which renames 'ubi_dbg_dump_vol_info()' to 'ubi_dump_vol_info()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:59 +03:00
Artem Bityutskiy 4415626732 UBI: amend commentaries WRT dtype
Richard removed the "dtype" hint, but few commentaries were left and this patch
removes them. I've also added a better description about the "dtype" field in
the ubi-user.h for people who may ever wonder what was that dtype thing about.

This patch also adds an important note that it is better to use value "3" for
the "dtype" field.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:59 +03:00
Richard Weinberger b36a261e8c UBI: Kill data type hint
We do not need this feature and to our shame it even was not working
and there was a bug found very recently.
	-- Artem Bityutskiy

Without the data type hint UBI2 (fastmap) will be easier to implement.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:59 +03:00
Richard Weinberger 0964f6a27b UBI: remove superfluous "!!" operation
!!(x < y) and (x < y) are identical expressions.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:58 +03:00
Artem Bityutskiy f01e2d1654 UBI: always warn if case of I/O errors
Currently UBI silently retries I/O operation in case of errors. This patch
makes it emit a warning before retrying. This should allow users notice issues
earlier.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:58 +03:00
Artem Bityutskiy a904e3f1de UBI: always dump VID and EC headers in case of errors
UBI (and UBIFS) are a bit over-engineered WRT debugging. The idea was to
link as few as possible when debugging is disabled, but the downside is
that most people produce bug reports which are difficult to understand.

Always dump the VID and EC headers' contents in case of errors when it
is helpful.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-05-20 20:25:58 +03:00
Artem Bityutskiy ef7088e7f8 UBI: always dump flash contents in case of errors
UBI (and UBIFS) are a bit over-engineered WRT debugging. The idea was to
link as few as possible when debugging is disabled, but the downside is
that most people produce bug reports which are difficult to understand.

Always dump the flash contents in case of errors, not only when debugging is
enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
2012-05-20 20:25:58 +03:00