This hides command cleanup into nvme.h and fabrics drivers will
also use it.
Signed-off-by: Ming Lin <ming.l@ssi.samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
return blk_rq_bytes(rq);
}
+static inline void nvme_cleanup_cmd(struct request *req)
+{
+ if (req->cmd_flags & REQ_DISCARD)
+ kfree(req->completion_data);
+}
+
static inline int nvme_error_status(u16 status)
{
switch (status & 0x7ff) {
__le64 **list = iod_list(req);
dma_addr_t prp_dma = iod->first_dma;
- if (req->cmd_flags & REQ_DISCARD)
- kfree(req->completion_data);
+ nvme_cleanup_cmd(req);
if (iod->npages == 0)
dma_pool_free(dev->prp_small_pool, list[0], prp_dma);