]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/block/nvme-core.c
NVMe: Split non-mergeable bio requests
authorKeith Busch <keith.busch@intel.com>
Tue, 9 Apr 2013 17:59:32 +0000 (11:59 -0600)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Thu, 2 May 2013 18:38:59 +0000 (14:38 -0400)
commit427e97080196548557b288517537ab7eb48c309f
tree0c7456201d9315980182b9fc1d2d5bcd83a20a72
parentcbb6218fd4ae8f98ddf0d66f0826a7a3a9c88298
NVMe: Split non-mergeable bio requests

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: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme-core.c