19 Jun, 2017

1 commit

  • blk_queue_split() is always called with the last arg being q->bio_split,
    where 'q' is the first arg.

    Also blk_queue_split() sometimes uses the passed-in 'bs' and sometimes uses
    q->bio_split.

    This is inconsistent and unnecessary. Remove the last arg and always use
    q->bio_split inside blk_queue_split()

    Reviewed-by: Christoph Hellwig
    Reviewed-by: Ming Lei
    Credit-to: Javier González (Noticed that lightnvm was missed)
    Reviewed-by: Javier González
    Tested-by: Javier González
    Signed-off-by: NeilBrown
    Signed-off-by: Jens Axboe

    NeilBrown
     

09 Jun, 2017

1 commit

  • Replace bi_error with a new bi_status to allow for a clear conversion.
    Note that device mapper overloaded bi_error with a private value, which
    we'll have to keep arround at least for now and thus propagate to a
    proper blk_status_t value.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

17 Apr, 2017

5 commits

  • sector_t is always unsigned, therefore avoid < 0 checks on it.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Target initialization has two responsibilities: creating the target
    partition and instantiating the target. This patch enables to create a
    factory partition (e.g., do not trigger recovery on the given target).
    This is useful for target development and for being able to restore the
    device state at any moment in time without requiring a full-device
    erase.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • mempool_alloc() cannot fail if the gfp flags allow it to
    sleep, and both GFP_KERNEL and GFP_NOIO allows for sleeping.

    So rrpc_move_valid_pages() and rrpc_make_rq() don't need to
    test the return value.

    Signed-off-by: NeilBrown
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    NeilBrown
     
  • Until now erases have been submitted as synchronous commands through a
    dedicated erase function. In order to enable targets implementing
    asynchronous erases, refactor the erase path so that it uses the normal
    async I/O submission functions. If a target requires sync I/O, it can
    implement it internally. Also, adapt rrpc to use the new erase path.

    Signed-off-by: Javier González
    Fixed spelling error.
    Signed-off-by: Matias Bjørling

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • According to error handling in this function, it is likely that going to
    'out' was expected here.

    Signed-off-by: Christophe JAILLET
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Christophe JAILLET
     

31 Jan, 2017

1 commit

  • When the lightnvm core had the "gennvm" layer between the device and the
    target, there was a need for the core to be able to figure out which
    target it should send an end_io callback to. Leading to a "double"
    end_io, first for the media manager instance, and then for the target
    instance. Now that core and gennvm is merged, there is no longer a need
    for this, and a single end_io callback will do.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     

30 Nov, 2016

13 commits

  • Since targets are given a virtual target device, it is necessary to
    translate all communication between targets and the backend device.
    Implement the translation layer for get/set bad block table.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • On target-specific operations pass on nvm_tgt_dev instead of the generic
    nvm device.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Avoid calling media manager and device-specific operations directly from
    rrpc. Create helper functions on lightnvm's core instead.

    Signed-off-by: Javier González

    Made it work with null_blk as well.
    Signed-off-by: Matias Bjørling

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • In order to naturally support multi-target instances on an Open-Channel
    SSD, targets should own the LUNs they get blocks from and manage
    provisioning internally. This is done in several steps.

    Since targets own the LUNs the are instantiated on top of and manage the
    free block list internally, there is no need for a LUN abstraction in
    the media manager. LUNs are intrinsically managed as in the physical
    layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
    ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
    creation ioctl. This simplifies LUN management and clears the path for a
    partition manager to sit directly underneath LightNVM targets.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • In order to naturally support multi-target instances on an Open-Channel
    SSD, targets should own the LUNs they get blocks from and manage
    provisioning internally. This is done in several steps.

    A part of this transformation is that targets manage their blocks
    internally. This patch eliminates the nvm_block abstraction and moves
    block management to the target logic. The rrpc target is transformed.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Since LUNs are managed internally on the target, there is no need for
    the media manager to implement a get_lun operation.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • In order to naturally support multi-target instances on an Open-Channel
    SSD, targets should own the LUNs they get blocks from and manage
    provisioning internally. This is done in several steps.

    This patch moves the block provisioning inside of the target and removes
    the get/put block interface from the media manager.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • LUNs are exclusively owned by targets implementing a block device FTL.
    Doing this reservation requires at the moment a 2-way callback gennvm
    target. The reason behind this is that LUNs were not assumed to
    always be exclusively owned by targets. However, this design decision
    goes against I/O determinism QoS (two targets would mix I/O on the same
    parallel unit in the device).

    This patch makes LUN reservation as part of the target creation on the
    media manager. This makes that LUNs are always exclusively owned by the
    target instantiated on top of them. LUN stripping and/or sharing should
    be implemented on the target itself or the layers on top.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Before vectored I/Os were supported on rrpc, the physical address was
    stored as part of the nvm_rqd request. This variable become obsolete
    when the ppa_list was introduced. Cleanup this variable.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Targets are assumed to used the same generic ppa format, where the
    address is partitioned on ch:lun:block:pg:pl:sec. Thus, make the
    function in charge of transforming the ppa address from a linear format
    to the generic one available to all targets.

    This function will be needed by the media manager in order to do target
    mapping translations when targets are divided on different physical
    partitions.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • rrpc cannot handle bios of size > 256kb due to NVMe using a 64 bit
    bitmap to signal I/O completion. If a larger bio comes, split it
    explicitly.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Bad blocks should be managed by block owners. This would be either
    targets for data blocks or sysblk for system blocks.

    In order to support this, export two functions: One to mark a block as
    an specific type (e.g., bad block) and another to update the bad block
    table on the device.

    Move bad block management to rrpc.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • Erases might be subject to host hints. An example is multi-plane
    programming to erase blocks in parallel. Enable targets to specify this
    hint.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     

21 Jul, 2016

1 commit

  • These two are confusing leftover of the old world order, combining
    values of the REQ_OP_ and REQ_ namespaces. For callers that don't
    special case we mostly just replace bi_rw with bio_data_dir or
    op_is_write, except for the few cases where a switch over the REQ_OP_
    values makes more sense. Any check for READA is replaced with an
    explicit check for REQ_RAHEAD. Also remove the READA alias for
    REQ_RAHEAD.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: Mike Christie
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

07 Jul, 2016

6 commits

  • The nvm_get_blk() function is called with rlun->lock held. This is ok
    when the media manager implementation doesn't go out of its atomic
    context. However, if a media manager persists its metadata, and
    guarantees that the block is given to the target, this is no longer
    a viable approach. Therefore, clean up the flow of rrpc_map_page,
    and make sure that nvm_get_blk() is called without any locks acquired.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The [get/put]_blk API enables targets to get ownership of blocks at
    runtime. This information is currently not recorded on disk, and the
    information is therefore lost on power failure. To restore the
    metadata, the [get/put]_blk must persist its metadata. In that case,
    we need to control the outer lock, so that we can disable them while
    updating the on-disk metadata. Fortunately, the _unlocked versions can
    be removed, which allows us to move the lock into the [get/put]_blk
    functions.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The ->list, ->open_list, and ->closed_list lists were previously used
    for statistics. However, their usage have been removed, and thus these
    can safely be removed.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The responsibility of the media manager is not to keep track of
    open/closed blocks. This is better maintained within a target,
    that already manages this information on writes.

    Remove the statistics and merge the states NVM_BLK_ST_OPEN and
    NVM_BLK_ST_CLOSED.

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • Checkpatch found two incidents where the type was preferred to be
    written out in full.

    ./drivers/lightnvm/rrpc.h:184: WARNING: Prefer 'unsigned int' to bare
    use of 'unsigned'
    ./drivers/lightnvm/rrpc.h:209: WARNING: Prefer 'unsigned int' to bare
    use of 'unsigned'
    ./drivers/lightnvm/rrpc.c:51: WARNING: Prefer 'unsigned int' to bare use
    of 'unsigned'

    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • Break the loop when rqd is not null to reduce
    an unnecessary schedule.

    Signed-off-by: Wenwei Tao
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Wenwei Tao
     

08 Jun, 2016

1 commit

  • This patch converts the simple bi_rw use cases in the block,
    drivers, mm and fs code to set/get the bio operation using
    bio_set_op_attrs/bio_op

    These should be simple one or two liner cases, so I just did them
    in one patch. The next patches handle the more complicated
    cases in a module per patch.

    Signed-off-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe

    Mike Christie
     

07 May, 2016

7 commits

  • The nvm_dev->max_pages_per_blk variable was removed in favor of the new
    nvm->sec_per_blk variable. The ->max_pages_per_blk variable was still
    used in rrpc_capacity, reporting the reserved capacity to zero. Replace
    with ->sec_per_blk to calculate the reserved area again.

    Signed-off-by: Javier González
    Updated patch description. Was "lightnvm: eliminate redundant variable"
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • The number of ppas contained on a request is not necessarily the number
    of pages that it maps to neither on the target nor on the device side.
    In order to avoid confusion, rename nr_pages to nr_ppas since it is what
    the variable actually contains.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • When doing GC, rrpc calculates the physical LUN to which the rrpc block
    belongs too. This calculation is based on the assumption that LUNs are
    assigned sequentially to the LUN list. Use the reference to the LUN
    instead. This saves us the calculation and allows us to align LUNs in a
    different manner to, for example, take advantage of devide parallelism.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • rrpc does not save any metadata on a given request. Thus, do not attempt
    to free the metadata dma region.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González
     
  • The functions nvm_register_target(), nvm_unregister_target() and
    associated list refers to a target type that is being registered by a
    target type module. Rename nvm_*_targets() to nvm_*_tgt_type(), so that
    the intension is clear.

    This enables target instances to use the _nvm_*_targets() naming.

    Signed-off-by: Simon A. F. Lund
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Simon A. F. Lund
     
  • Since we mainly use soffset in device sector size, we therefore store
    this value in rrpc->soffset, instead of the offset in 512byte sector
    size. This eliminates the "(ilog2(dev->sec_size) - 9)" calculation on
    each I/O.

    Signed-off-by: Wenwei Tao
    Updated patch description.
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Wenwei Tao
     
  • Calculate rrpc total blocks and sectors up front, make sense
    to use them. For example, we use rrpc->nr_sects to calculate rrpc
    area size, but it makes no sense if we don't initialize it up front,
    since it would be zero until we finish rrpc luns init.

    Signed-off-by: Wenwei Tao
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Wenwei Tao
     

19 Mar, 2016

3 commits

  • Add a bitmap of luns to indicate the status
    of luns: inuse/available. When create targets
    do the necessary check to avoid allocating luns
    that are already allocated.

    Signed-off-by: Wenwei Tao
    Freed dev->lun_map if nvm_core_init later failed in the init process.
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Wenwei Tao
     
  • We can create more than one target on a lightnvm
    device by specifying its begin lun and end lun.

    But only specify the physical address area is not
    enough, we need to get the corresponding non-
    intersection logical address area division from
    the backend device's logcial address space.
    Otherwise the targets on the device might use
    the same logical addresses cause incorrect
    information in the device's l2p table.

    Signed-off-by: Wenwei Tao
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Wenwei Tao
     
  • Pull block driver updates from Jens Axboe:
    "This is the block driver pull request for this merge window. It sits
    on top of for-4.6/core, that was just sent out.

    This contains:

    - A set of fixes for lightnvm. One from Alan, fixing an overflow,
    and the rest from the usual suspects, Javier and Matias.

    - A set of fixes for nbd from Markus and Dan, and a fixup from Arnd
    for correct usage of the signed 64-bit divider.

    - A set of bug fixes for the Micron mtip32xx, from Asai.

    - A fix for the brd discard handling from Bart.

    - Update the maintainers entry for cciss, since that hardware has
    transferred ownership.

    - Three bug fixes for bcache from Eric Wheeler.

    - Set of fixes for xen-blk{back,front} from Jan and Konrad.

    - Removal of the cpqarray driver. It has been disabled in Kconfig
    since 2013, and we were initially scheduled to remove it in 3.15.

    - Various updates and fixes for NVMe, with the most important being:

    - Removal of the per-device NVMe thread, replacing that with a
    watchdog timer instead. From Christoph.

    - Exposing the namespace WWID through sysfs, from Keith.

    - Set of cleanups from Ming Lin.

    - Logging the controller device name instead of the underlying
    PCI device name, from Sagi.

    - And a bunch of fixes and optimizations from the usual suspects
    in this area"

    * 'for-4.6/drivers' of git://git.kernel.dk/linux-block: (49 commits)
    NVMe: Expose ns wwid through single sysfs entry
    drivers:block: cpqarray clean up
    brd: Fix discard request processing
    cpqarray: remove it from the kernel
    cciss: update MAINTAINERS
    NVMe: Remove unused sq_head read in completion path
    bcache: fix cache_set_flush() NULL pointer dereference on OOM
    bcache: cleaned up error handling around register_cache()
    bcache: fix race of writeback thread starting before complete initialization
    NVMe: Create discard zero quirk white list
    nbd: use correct div_s64 helper
    mtip32xx: remove unneeded variable in mtip_cmd_timeout()
    lightnvm: generalize rrpc ppa calculations
    lightnvm: remove struct nvm_dev->total_blocks
    lightnvm: rename ->nr_pages to ->nr_sects
    lightnvm: update closed list outside of intr context
    xen/blback: Fit the important information of the thread in 17 characters
    lightnvm: fold get bb tbl when using dual/quad plane mode
    lightnvm: fix up nonsensical configure overrun checking
    xen-blkback: advertise indirect segment support earlier
    ...

    Linus Torvalds
     

04 Mar, 2016

1 commit

  • In rrpc, some calculations assume a certain configuration (e.g., 1 LUN,
    1 sector per page). The reason behind this was that LightNVM used a
    simple configuration with QEMU to test core features in the beginning.
    This patch relaxes these assumptions and generalizes calculation,
    allowing multiple luns to be used.

    Signed-off-by: Javier González
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Javier González