summaryrefslogtreecommitdiff
path: root/include/linux/nvme.h
diff options
context:
space:
mode:
authorMinwoo Im <minwoo.im.dev@gmail.com>2019-06-06 08:30:14 +0300
committerChristoph Hellwig <hch@lst.de>2019-06-21 12:08:38 +0300
commit7a1f46e3f75cff5042dfa1bb80c9929a0e412abc (patch)
tree0c6ca63c8514e435d59ff4cd2904e44c3f37ec26 /include/linux/nvme.h
parent1a87ee657c530bb2f3e39e4ac184d48f5f959cda (diff)
downloadlinux-7a1f46e3f75cff5042dfa1bb80c9929a0e412abc.tar.xz
nvme: introduce nvme_is_fabrics to check fabrics cmd
This patch introduces a nvme_is_fabrics() inline function to check whether or not the given command structure is for fabrics. Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/nvme.h')
-rw-r--r--include/linux/nvme.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 8028adacaff3..7080923e78d1 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1165,6 +1165,11 @@ struct nvme_command {
};
};
+static inline bool nvme_is_fabrics(struct nvme_command *cmd)
+{
+ return cmd->common.opcode == nvme_fabrics_command;
+}
+
struct nvme_error_slot {
__le64 error_count;
__le16 sqid;
@@ -1186,7 +1191,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd)
*
* Why can't we simply have a Fabrics In and Fabrics out command?
*/
- if (unlikely(cmd->common.opcode == nvme_fabrics_command))
+ if (unlikely(nvme_is_fabrics(cmd)))
return cmd->fabrics.fctype & 1;
return cmd->common.opcode & 1;
}