24 Mar, 2017

1 commit


03 Oct, 2016

1 commit

  • Currently, all VID headers are allocated and freed using the
    ubi_zalloc_vid_hdr() and ubi_free_vid_hdr() function. These functions
    make sure to align allocation on ubi->vid_hdr_alsize and adjust the
    vid_hdr pointer to match the ubi->vid_hdr_shift requirements.
    This works fine, but is a bit convoluted.
    Moreover, the future introduction of LEB consolidation (needed to support
    MLC/TLC NANDs) will allows a VID buffer to contain more than one VID
    header.

    Hence the creation of a ubi_vid_io_buf struct to attach extra information
    to the VID header.

    We currently only store the actual pointer of the underlying buffer, but
    will soon add the number of VID headers contained in the buffer.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     

30 Jul, 2016

1 commit

  • When reading the vid hdr from the device UBI always reads a whole
    page. Instead, read only the data we actually need and speed up
    attachment of UBI devices by potentially making use of reading
    subpages if the NAND driver supports it.

    Since the VID header may be at offset vid_hdr_shift in the page and
    we can only read from the beginning of a page we have to add that
    offset to the read size.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Richard Weinberger

    Sascha Hauer
     

17 Dec, 2015

1 commit

  • Looks like a typo, using UBI_EC_HDR_SIZE_CRC (note the "EC") to compute
    the CRC for the VID header.

    This shouldn't cause any functional change, as both structures are 64
    bytes. Verified with:

    BUILD_BUG_ON(UBI_VID_HDR_SIZE_CRC != UBI_EC_HDR_SIZE_CRC);

    Reported here:
    http://lists.infradead.org/pipermail/linux-mtd/2013-September/048570.html

    Reported by: Bill Pringlemeir
    Signed-off-by: Brian Norris
    Signed-off-by: Richard Weinberger

    Brian Norris
     

29 Sep, 2015

1 commit

  • Make sure that data_size is less than LEB size.
    Otherwise a handcrafted UBI image is able to trigger
    an out of bounds memory access in ubi_compare_lebs().

    Cc: stable@vger.kernel.org
    Signed-off-by: Richard Weinberger
    Reviewed-by: David Gstir

    Richard Weinberger
     

14 Apr, 2015

1 commit

  • Emulate random power cuts by switching device to ro after a number of
    writes to allow simple power cut testing with nand-sim.

    Maximum and minimum number of successful writes before power cut and
    what kind of writes (EC header, VID header or none) to interrupt
    configurable via debugfs.

    Signed-off-by: David Oberhollenzer
    Signed-off-by: Richard Weinberger

    david.oberhollenzer@sigma-star.at
     

28 Jan, 2015

1 commit


07 Nov, 2014

1 commit

  • If there is more then one UBI device mounted, there is no way to
    distinguish between messages from different UBI devices.
    Add device number to all ubi layer message types.

    The R/O block driver messages were replaced by pr_* since
    ubi_device structure is not used by it.

    Amended a bit by Artem.

    Signed-off-by: Tanya Brokhman
    Signed-off-by: Artem Bityutskiy

    Tanya Brokhman
     

10 Jan, 2014

1 commit

  • nor_erase_prepare() will be called before erase a NOR flash, it will program '0'
    into a block to mark this block. But program data into a erasure interrupted block
    can cause program timtout(several minutes at most) error, could impact other
    operation on NOR flash. So UBIFS can read this block first to avoid unneeded
    program operation.

    This patch try to put read operation at head of write operation in
    nor_erase_prepare(), read out the data.
    If the data is already corrupt, then no need to program any data into this block,
    just go to erase this block.

    This patch is validated on Micron NOR flash, part number is:JS28F512M29EWHA

    Signed-off-by: Qi Wang
    Signed-off-by: Artem Bityutskiy

    Qi Wang 王起 (qiwang)
     

10 Dec, 2012

1 commit

  • With this patch code is a bit more readable and there's no
    generated code or functionality impact.
    Furthermore, this abstracts implementation details and
    will allow to change ubi_debug_info in a less invasive way.

    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Artem Bityutskiy

    Ezequiel Garcia
     

04 Sep, 2012

2 commits


21 May, 2012

9 commits

  • 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
     
  • Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • 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
     
  • 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
     
  • 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
     
  • 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
     
  • 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
     
  • 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
     
  • 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.

    This patch weeds out the 'ubi_dbg_dump_stack()' function and turns it
    into 'dump_stack()' - it is always useful to have stack dump in case of
    an error.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

09 Mar, 2012

1 commit


10 Jan, 2012

5 commits


21 Sep, 2011

1 commit


01 Jun, 2011

2 commits

  • We'll need the 'struct ubi_device *ubi' pointer in every debugging function (to
    access the ->dbg field), so add this pointer to all the functions implementing
    UBI debugging test modes like 'ubi_dbg_is_bitflip()' etc.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • This patch introduces debugfs support to UBI. All the UBI stuff is kept in the
    "ubi" debugfs directory, which contains per-UBI device "ubi/ubiX"
    sub-directories, containing debugging files. This file also creates
    "ubi/ubiX/chk_gen" and "ubi/ubiX/chk_io" knobs for switching general and I/O
    extra checks on and off. And it removes the 'debug_chks' UBI module parameters.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

14 Apr, 2011

2 commits


05 Apr, 2011

1 commit

  • 'do_sync_erase()' has to check whether we are in R/O mode before
    erasing the PEB. This patch adds the check and while on it, adds an
    assertion which validates the 'pnum' argument, as well as removes
    a check which is always true because it has already been done
    few lines before.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

24 Mar, 2011

1 commit

  • This patch fixes a brown-paperbag bug which was introduced by me:
    I used incorrect "GFP_KERNEL | GFP_NOFS" allocation flags to make
    sure my allocations do not cause write-back. But the correct form
    is "GFP_NOFS".

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

16 Mar, 2011

4 commits

  • This patch adds a possibility to dynamically switch UBI self-checks
    on and off, instead of toggling them compile-time from the configuration
    menu. This is much more flexible, and consistent with UBIFS, and this
    also simplifies UBI Kconfig menu and the code.

    This patch introduces two levels of self-checks - general, which
    includes all self-checks which are relatively fast, and I/O, which
    includes write-verify checks and erase-verify checks, which are
    relatively slow and involve flash I/O.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • This additional little macro is used to print a bit more messages
    while scanning the media. However, we have the 'dbg_bld()' macro
    for this, so we better us 'dbg_bld()' and kill UBI_IO_DEBUG. This
    simplifies the code a tiny bit.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • Instead of using pre-allocated 'ubi->dbg_peb_buf' buffer in
    'ubi_dbg_check_all_ff()', dynamically allocate it when needed. The
    intend is to get rid of the pre-allocated 'ubi->dbg_peb_buf' buffer
    completely. And the need for this arises because we want to change
    to dynamic debugging control instead of compile-time control, i.e.,
    we are going to kill the CONFIG_MTD_UBI_DEBUG_PARANOID Kconfig
    option, which would mean that 'ubi->dbg_peb_buf' is always allocated,
    which would be wasteful.

    Thus, we are getting rid of 'ubi->dbg_peb_buf', and this is a
    preparation for that.

    signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • Instead of using pre-allocated 'ubi->dbg_peb_buf' buffer in
    'ubi_dbg_check_write()', dynamically allocate it when needed. The
    intend is to get rid of the pre-allocated 'ubi->dbg_peb_buf' buffer
    completely. And the need for this arises because we want to change
    to dynamic debugging control instead of compile-time control, i.e.,
    we are going to kill the CONFIG_MTD_UBI_DEBUG_PARANOID Kconfig
    option, which would mean that 'ubi->dbg_peb_buf' is always allocated,
    which would be wasteful.

    Thus, we are getting rid of 'ubi->dbg_peb_buf', and this is a
    preparation for that.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

07 Feb, 2011

2 commits

  • When the read operation fails, UBI tries to re-read several times in
    a hope that one of the subsequent reads may succeed. However, currently
    UBI re-reads only if MTD failed to read all data, but does not re-reads
    if all the data were read, but with an integrity error (-EBADMSB). This
    patch makes UBI to always re-try reading.

    This should be useful for reading NAND pages with unstable bits -
    re-reading may help to get correct data.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • This change affects only the debugging code. Namely, use mtd->read()
    function instead of ubi_io_read() to avoid bit-flips injection
    (ubi_dbg_is_bitflip()) which we do not want on the debugging path.

    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy