07 May, 2016

13 commits

  • Now that device ops->get_bb_table no longer uses a callback, the
    struct factory_blks can be removed.

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

    Matias Bjørling
     
  • The device ops->get_bb_tbl() takes a callback, that allows the caller
    to use its own callback function to update its data structures in the
    returning function.

    This makes it difficult to send parameters to the callback, and usually
    is circumvented by small private structures, that both carry the callers
    state and any flags needed to fulfill the update.

    Refactor ops->get_bb_tbl() to fill a data buffer with the status of the
    blocks returned, and let the user call the callback function manually.
    That will provide the necessary flags and data structures and simplify
    the logic around ops->get_bb_tbl().

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

    Matias Bjørling
     
  • Users that wish to iterate all luns on a device. Must create a
    struct ppa_addr and separate iterators for channels and luns. To set the
    iterators, two loops are required, one to iterate channels, and another
    to iterate luns. This leads to decrease in readability.

    Introduce nvm_for_each_lun_ppa, which implements the nested loop and
    sets ppa, channel, and lun variable for each loop body, eliminating
    the boilerplate code.

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

    Matias Bjørling
     
  • A target name must be unique. However, a per-device registration of
    targets is maintained on a dev->online_targets list, with a per-device
    search for targets upon registration.

    This results in a name collision when two targets, with the same name,
    are created on two different targets, where the per-device list is not
    shared.

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

    Simon A. F. Lund
     
  • 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
     
  • A memory leak occurs if the lower page table is initialized and the
    following dev->lun_map fails on allocation.

    Rearrange the initialization of lower page table to allow dev->lun_map
    to fail gracefully without memory leak.

    Reviewed by: Johannes Thumshirn
    Move kfree of dev->lun_map to nvm_free()
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The get block table command returns a list of blocks and planes
    with their associated state. Users, such as gennvm and sysblk,
    manages all planes as a single virtual block.

    It was therefore natural to fold the bad block list before it is
    returned. However, to allow users, which manages on a per-plane
    block level, to also use the interface, the get_bb_tbl interface is
    changed to not fold by default and instead let the caller fold if
    necessary.

    Reviewed by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The flash page size (fpg) and size across planes (pfpg) are convenient
    to know when allocating buffer sizes. This has previously been a
    calculated in various places. Replace with the pre-calculated values.

    Reviewed by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The nvm_submit_ppa function assumes that users manage all plane
    blocks as a single block. Extend the API with nvm_submit_ppa_list
    to allow the user to send its own ppa list. If the user submits more
    than a single PPA, the user must take care to allocate and free
    the corresponding ppa list.

    Reviewed by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • The device ->submit_io() callback might fail to submit I/O to device.
    In that case, the nvm_submit_ppa function should not wait for
    completion. Instead return the ->submit_io() error.

    Reviewed by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Matias Bjørling
     
  • This fixes the following warnings:
    drivers/lightnvm/sysblk.c:125:9: warning: ‘ret’ may be used
    uninitialized in this function

    drivers/lightnvm/sysblk.c:275:15: warning: ‘ret’ may be used
    uninitialized in this function

    In both cases, ret is only set from within a loop that may not be entered.

    Signed-off-by: Jeff Mahoney
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Matias Bjørling
    Signed-off-by: Jens Axboe

    Jeff Mahoney
     

04 May, 2016

1 commit

  • This fixes a scenario where device is present and being reset, but a
    request to unbind the driver occurs.

    A previous patch series addressing a device failure removal scenario
    flushed reset_work after controller disable to unblock reset_work waiting
    on a completion that wouldn't occur. This isn't safe as-is. The broken
    scenario can potentially be induced with:

    modprobe nvme && modprobe -r nvme

    To fix, the reset work is flushed immediately after setting the controller
    removing flag, and any subsequent reset will not proceed with controller
    initialization if the flag is set.

    The controller status must be polled while active, so the watchdog timer
    is also left active until the controller is disabled to cleanup requests
    that may be stuck during namespace removal.

    [Fixes: ff23a2a15a2117245b4599c1352343c8b8fb4c43]
    Signed-off-by: Keith Busch
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Jens Axboe

    Keith Busch
     

02 May, 2016

11 commits

  • On receipt of a namespace attribute changed AER, we acquire the
    namespace mutex lock before proceeding to scan and validate the
    namespace list. In case of namespace detach/delete command,
    nvme_ns_remove function deadlocks trying to acquire the already held
    lock.

    All callers, except nvme_remove_namespaces(), of nvme_ns_remove()
    already held namespaces_mutex. So we can simply fix the deadlock by
    not acquiring the mutex in nvme_ns_remove() and acquiring it in
    nvme_remove_namespaces().

    Reported-by: Sunad Bhandary S
    Signed-off-by: Ming Lin
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Keith Busch
    Reviewed-by: Sagi Grimerg
    Signed-off-by: Jens Axboe

    Ming Lin
     
  • Switch to RCU freeing the namespace structure so that
    nvme_start_queues, nvme_stop_queues and nvme_kill_queues would
    be able to get away with only a RCU read side critical section.

    Suggested-by: Christoph Hellwig
    Signed-off-by: Ming Lin
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Keith Busch
    Reviewed-by: Sagi Grimerg
    Signed-off-by: Jens Axboe

    Ming Lin
     
  • Section 3.1 gives the comment for the offset of controller registers
    in the specification 1.2a.

    Some are mis-copied in the header file nvme.h. Correct them.

    Signed-off-by: Wang Sheng-Hui
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Jens Axboe

    Wang Sheng-Hui
     
  • This hides command cleanup into nvme.h and fabrics drivers will
    also use it.

    Signed-off-by: Ming Lin
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Ming Lin
     
  • The transport driver still needs to do the actual submission, but all the
    higher level code can be shared.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Move the scan work item and surrounding code to the common code. For now
    we need a new finish_scan method to allow the PCI driver to set the
    irq affinity hints, but I have plans in the works to obsolete this as well.

    Note that this moves the namespace scanning from nvme_wq to the system
    workqueue, but as we don't rely on namespace scanning to finish from reset
    or I/O this should be fine.

    Signed-off-by: Christoph Hellwig
    Acked-by Jon Derrick:
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • We only should be scanning namespaces if the controller is live. Currently
    we call the function just before setting it live, so fix the code up to
    move the call to nvme_queue_scan to just below the state change.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Acked-by Jon Derrick:
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Replace the adhoc flags in the PCI driver with a state machine in the
    core code. Based on code from Sagi Grimberg for the Fabrics driver.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Sagi Grimberg
    Acked-by Jon Derrick:
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • It's unused since "NVMe: Move error handling to failed reset handler".

    Signed-off-by: Christoph Hellwig
    Acked-by: Jon Derrick
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • nvme_core_init does:
    1) register_blkdev
    2) __register_chrdev
    3) class_create

    nvme_core_exit should do cleanup in the reverse order.

    Signed-off-by: Wang Sheng-Hui
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Wang Sheng-Hui
     
  • If the controller fails and is degraded after a reset, we need to kill
    off all requests queues before removing the inaccessble namespaces. This
    will prevent del_gendisk from syncing dirty data, which we can't due
    from a WQ_MEM_RECLAIM work queue.

    Signed-off-by: Keith Busch
    Reviewed-by: Sagi Grimberg
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Keith Busch
     

26 Apr, 2016

3 commits

  • "as well as " is miss typed "as well a " in section
    "config BLK_DEV_NVME_SCSI"

    Signed-off-by: Wang Sheng-Hui
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Wang Sheng-Hui
     
  • Controller IDs in NVMe are unsigned 16-bit types. In the Fabrics driver we
    actually pass ctrl->id by reference, so we need it to have the correct type.

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

    Christoph Hellwig
     
  • Simply creating a file system on an skd device, followed by mount and
    fstrim will result in errors in the logs and then a BUG(). Let's remove
    discard support from that driver. As far as I can tell, it hasn't
    worked right since it was merged. This patch also has a side-effect of
    cleaning up an unintentional shadowed declaration inside of
    skd_end_request.

    I tested to ensure that I can still do I/O to the device using xfstests
    ./check -g quick. I didn't do anything more extensive than that,
    though.

    Signed-off-by: Jeff Moyer
    Signed-off-by: Jens Axboe

    Jeff Moyer
     

14 Apr, 2016

1 commit


13 Apr, 2016

11 commits