diff options
author | Christoph Hellwig <hch@lst.de> | 2016-06-06 23:20:49 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-06-12 15:29:43 +0200 |
commit | 7a5abb4b48570c3552e33ff4c72ae1e8dac3ba15 (patch) | |
tree | 00d0e86f8fad328d1e788c060c8b9687bc5f898a /drivers/nvme | |
parent | nvme: allow for size limitations from transport drivers (diff) | |
download | linux-7a5abb4b48570c3552e33ff4c72ae1e8dac3ba15.tar.xz linux-7a5abb4b48570c3552e33ff4c72ae1e8dac3ba15.zip |
nvme: factor out a add nvme_is_write helper
Centralize the check if a given NVMe command reads or writes data.
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 7ded308fd67b..45fd6cca4a27 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -193,10 +193,9 @@ EXPORT_SYMBOL_GPL(nvme_requeue_req); struct request *nvme_alloc_request(struct request_queue *q, struct nvme_command *cmd, unsigned int flags) { - bool write = cmd->common.opcode & 1; struct request *req; - req = blk_mq_alloc_request(q, write, flags); + req = blk_mq_alloc_request(q, nvme_is_write(cmd), flags); if (IS_ERR(req)) return req; @@ -361,7 +360,7 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u32 *result, unsigned timeout) { - bool write = cmd->common.opcode & 1; + bool write = nvme_is_write(cmd); struct nvme_completion cqe; struct nvme_ns *ns = q->queuedata; struct gendisk *disk = ns ? ns->disk : NULL; |