1. 17 9月, 2014 2 次提交
    • E
      UBI: block: Fix block device size setting · 978d6496
      Ezequiel Garcia 提交于
      We are currently taking the block device size from the ubi_volume_info.size
      field. However, this is not the amount of data in the volume, but the
      number of reserved physical eraseblocks, and hence leads to an incorrect
      representation of the volume.
      
      In particular, this produces I/O errors on static volumes as the block
      interface may attempt to read unmapped PEBs:
      
      $ cat /dev/ubiblock0_0 > /dev/null
      UBI error: ubiblock_read_to_buf: ubiblock0_0 ubi_read error -22
      end_request: I/O error, dev ubiblock0_0, sector 9536
      Buffer I/O error on device ubiblock0_0, logical block 2384
      [snip]
      
      Fix this by using the ubi_volume_info.used_bytes field which is set to the
      actual number of data bytes for both static and dynamic volumes.
      
      While here, improve the error message to be less stupid and more useful:
      UBI error: ubiblock_read_to_buf: ubiblock0_1 ubi_read error -9 on LEB=0, off=15872, len=512
      
      It's worth noticing that the 512-byte sector representation of the volume
      is only correct if the volume size is multiple of 512-bytes. This is true for
      virtually any NAND device, given eraseblocks and pages are 512-byte multiple
      and hence so is the LEB size.
      
      Artem: tweak the error message and make it look more like other UBI error
      messages.
      
      Fixes: 9d54c8a3 ("UBI: R/O block driver on top of UBI volumes")
      Signed-off-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Cc: stable@vger.kernel.org # v3.15+
      978d6496
    • C
      UBI: block: fix dereference on uninitialized dev · 3df77072
      Colin Ian King 提交于
      commit 4df38926 ("UBI: block: Avoid disk size integer overflow")
      introduced a dereference on dev (which is not initialized at that
      point) when printing a warning message.  Re-order disk_capacity check
      after the dev is found.
      
      Found by cppcheck:
       [drivers/mtd/ubi/block.c:509]: (error) Uninitialized variable: dev
      
      Artem: tweak the error message a bit
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Acked-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      3df77072
  2. 28 7月, 2014 3 次提交
  3. 27 5月, 2014 1 次提交
  4. 05 5月, 2014 1 次提交
  5. 16 4月, 2014 1 次提交
    • J
      block: remove struct request buffer member · b4f42e28
      Jens Axboe 提交于
      This was used in the olden days, back when onions were proper
      yellow. Basically it mapped to the current buffer to be
      transferred. With highmem being added more than a decade ago,
      most drivers map pages out of a bio, and rq->buffer isn't
      pointing at anything valid.
      
      Convert old style drivers to just use bio_data().
      
      For the discard payload use case, just reference the page
      in the bio.
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b4f42e28
  6. 22 3月, 2014 1 次提交
  7. 05 3月, 2014 1 次提交
  8. 04 3月, 2014 3 次提交
  9. 28 2月, 2014 1 次提交
    • E
      UBI: R/O block driver on top of UBI volumes · 9d54c8a3
      Ezequiel Garcia 提交于
      This commit introduces read-only block device emulation on top of UBI volumes.
      
      Given UBI takes care of wear leveling and bad block management it's possible
      to add a thin layer to enable block device access to UBI volumes.
      This allows to use a block-oriented filesystem on a flash device.
      
      The UBI block devices are meant to be used in conjunction with any
      regular, block-oriented file system (e.g. ext4), although it's primarily
      targeted at read-only file systems, such as squashfs.
      
      Block devices are created upon user request through new ioctls:
      UBI_IOCVOLATTBLK to attach and UBI_IOCVOLDETBLK to detach.
      Also, a new UBI module parameter is added 'ubi.block'. This parameter is
      needed in order to attach a block device on boot-up time, allowing to
      mount the rootfs on a ubiblock device.
      For instance, you could have these kernel parameters:
      
        ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0
      
      Or, if you compile ubi as a module:
      
        $ modprobe ubi mtd=/dev/mtd5 block=/dev/ubi0_0
      
      Artem: amend commentaries and massage the patch a little bit.
      Signed-off-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      9d54c8a3