OSDN Git Service

nvme: introduce struct nvme_request
authorChristoph Hellwig <hch@lst.de>
Thu, 10 Nov 2016 15:32:33 +0000 (07:32 -0800)
committerJens Axboe <axboe@fb.com>
Thu, 10 Nov 2016 17:06:24 +0000 (10:06 -0700)
commitd49187e97e94e2eb613cb6fed810356972077cc3
treefcfb2353034857d86ded315e5ce139a0cd124c06
parent41c9499b221ebe102f776589085cde43d0dadc46
nvme: introduce struct nvme_request

This adds a shared per-request structure for all NVMe I/O.  This structure
is embedded as the first member in all NVMe transport drivers request
private data and allows to implement common functionality between the
drivers.

The first use is to replace the current abuse of the SCSI command
passthrough fields in struct request for the NVMe command passthrough,
but it will grow a field more fields to allow implementing things
like common abort handlers in the future.

The passthrough commands are handled by having a pointer to the SQE
(struct nvme_command) in struct nvme_request, and the union of the
possible result fields, which had to be turned from an anonymous
into a named union for that purpose.  This avoids having to pass
a reference to a full CQE around and thus makes checking the result
a lot more lightweight.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/core.c
drivers/nvme/host/fabrics.c
drivers/nvme/host/lightnvm.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd.c
drivers/nvme/target/loop.c
drivers/nvme/target/nvmet.h
include/linux/nvme.h