loop.c (fa41d6ee904266fa8739cafa6ec038c3a8e435b7) loop.c (5812d04c4c7455627d8722e04ab99a737cfe9713)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVMe over Fabrics loopback device.
4 * Copyright (c) 2015-2016 HGST, a Western Digital Company.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/scatterlist.h>
8#include <linux/blk-mq.h>

--- 143 unchanged lines hidden (view full) ---

152 if (!nvmet_req_init(&iod->req, &queue->nvme_cq,
153 &queue->nvme_sq, &nvme_loop_ops))
154 return BLK_STS_OK;
155
156 if (blk_rq_nr_phys_segments(req)) {
157 iod->sg_table.sgl = iod->first_sgl;
158 if (sg_alloc_table_chained(&iod->sg_table,
159 blk_rq_nr_phys_segments(req),
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * NVMe over Fabrics loopback device.
4 * Copyright (c) 2015-2016 HGST, a Western Digital Company.
5 */
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7#include <linux/scatterlist.h>
8#include <linux/blk-mq.h>

--- 143 unchanged lines hidden (view full) ---

152 if (!nvmet_req_init(&iod->req, &queue->nvme_cq,
153 &queue->nvme_sq, &nvme_loop_ops))
154 return BLK_STS_OK;
155
156 if (blk_rq_nr_phys_segments(req)) {
157 iod->sg_table.sgl = iod->first_sgl;
158 if (sg_alloc_table_chained(&iod->sg_table,
159 blk_rq_nr_phys_segments(req),
160 iod->sg_table.sgl, SG_CHUNK_SIZE))
160 iod->sg_table.sgl, SG_CHUNK_SIZE)) {
161 nvme_cleanup_cmd(req);
161 return BLK_STS_RESOURCE;
162 return BLK_STS_RESOURCE;
163 }
162
163 iod->req.sg = iod->sg_table.sgl;
164 iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl);
165 iod->req.transfer_len = blk_rq_payload_bytes(req);
166 }
167
168 schedule_work(&iod->work);
169 return BLK_STS_OK;

--- 550 unchanged lines hidden ---
164
165 iod->req.sg = iod->sg_table.sgl;
166 iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl);
167 iod->req.transfer_len = blk_rq_payload_bytes(req);
168 }
169
170 schedule_work(&iod->work);
171 return BLK_STS_OK;

--- 550 unchanged lines hidden ---