@@ -470,6 +470,7 @@ static inline void nvme_clear_nvme_request(struct request *req)
if (!(req->rq_flags & RQF_DONTPREP)) {
nvme_req(req)->retries = 0;
nvme_req(req)->flags = 0;
+ nvme_req(req)->has_pi = false;
req->rq_flags |= RQF_DONTPREP;
}
}
@@ -703,6 +704,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
nvme_assign_write_stream(ctrl, req, &control, &dsmgmt);
if (ns->ms) {
+ nvme_req(req)->has_pi =
+ ns->features & NVME_NS_MD_CTRL_SUPPORTED;
/*
* If formated with metadata, the block layer always provides a
* metadata buffer if CONFIG_BLK_DEV_INTEGRITY is enabled. Else
@@ -710,8 +713,7 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
* namespace capacity to zero to prevent any I/O.
*/
if (!blk_integrity_rq(req)) {
- if (WARN_ON_ONCE(!(ns->features &
- NVME_NS_MD_CTRL_SUPPORTED)))
+ if (WARN_ON_ONCE(!nvme_req(req)->has_pi))
return BLK_STS_NOTSUPP;
control |= NVME_RW_PRINFO_PRACT;
}
@@ -139,6 +139,7 @@ struct nvme_request {
u8 flags;
u16 status;
struct nvme_ctrl *ctrl;
+ bool has_pi;
};
/*