• Keith Busch's avatar
    NVMe: Split non-mergeable bio requests · 427e9708
    Keith Busch authored
    It is possible a bio request can not be submitted as a single NVMe IO
    command if the bio_vec is not mergeable with the NVMe PRP alignement
    constraints. This condition was handled by submitting an IO for the
    mergeable portion then submitting a follow on IO for the remaining data
    after the previous IO completes. The remainder to be sent was tracked
    by manipulating the bio->bi_idx and bio->bi_sector. This patch splits
    the request as many times as necessary and submits the bios together.
    
    Since submitting the bio may cause it to be requeued on split,
    nvme_resubmit_bios had to be modified to remove the wait queue when
    the bio list is empty prior to submitting the bio since a split would
    have added the wait queue a second time, corrupting the wait queue head
    task list.
    
    There are a few other benefits from doing this: it fixes a potential
    issue with the previous handling of a non-mergeable bio as the requeuing
    method could would use an unlocked nvme_queue if the callback isn't
    invoked on the queue's associated cpu; it will be possible to retry a
    failed bio if desired at some later time since it does not manipulate
    the original bio; the bio integrity extensions require the bio to be in
    its original condition for the checks to work correctly if we implement
    the end-to-end data protection in the future.
    Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
    Signed-off-by: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
    427e9708
nvme-core.c 48.1 KB