On 4/21/2020 6:33 PM, Christoph Hellwig wrote:
On Fri, Mar 27, 2020 at 08:15:43PM +0300, Max Gurtovoy wrote:
- if (!nvmet_check_transfer_len(req, nvmet_rw_data_len(req)))
+ if (!nvmet_check_transfer_len(req,
+ nvmet_rw_data_len(req) + req->md_len))
Shouldn't we also calculate the actual metadata length on the fly here?
we calculate it during nvmet_init_req.
blk_start_plug(&plug);
+ if (req->use_md)
Can't we use a non-NULL req->md_sg or non-null req->md_sg_cnt as a
metadata supported indicator and remove the use_md flag? Maybe wrap
them in a helper function that also checks for blk integrity support
using IS_ENABLED and we can skip the stubs as well.
I'll replace it with:
static inline bool nvmet_req_has_pi(struct nvmet_req *req)
{
return req->sq->ctrl->pi_support && nvmet_ns_has_pi(req->ns);
}