Commit 7bca889e authored by Jens Axboe's avatar Jens Axboe

Merge branch 'nvme-5.1' of git://git.infradead.org/nvme into for-linus

Pull NVMe fixes from Christoph:

"A few accumulated small fixes:

 - fix an endianess misannotation that sneaked in this merge window in
   nvme-tcp (me)
 - fix nvme-loop to handle multi-page segments (Ming)
 - fix error handling in the nvmet configfs code (Max)
 - add a missing requeue point in the multipath code (Martin George)"

* 'nvme-5.1' of git://git.infradead.org/nvme:
  nvmet: fix error flow during ns enable
  nvmet: fix building bvec from sg list
  nvme-multipath: relax ANA state check
  nvme-tcp: fix an endianess miss-annotation
parents dd08a8d9 a536b497
...@@ -404,15 +404,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state) ...@@ -404,15 +404,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state)
static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc, static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
struct nvme_ns *ns) struct nvme_ns *ns)
{ {
enum nvme_ana_state old;
mutex_lock(&ns->head->lock); mutex_lock(&ns->head->lock);
old = ns->ana_state;
ns->ana_grpid = le32_to_cpu(desc->grpid); ns->ana_grpid = le32_to_cpu(desc->grpid);
ns->ana_state = desc->state; ns->ana_state = desc->state;
clear_bit(NVME_NS_ANA_PENDING, &ns->flags); clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old)) if (nvme_state_is_live(ns->ana_state))
nvme_mpath_set_live(ns); nvme_mpath_set_live(ns);
mutex_unlock(&ns->head->lock); mutex_unlock(&ns->head->lock);
} }
......
...@@ -627,7 +627,7 @@ static int nvme_tcp_recv_pdu(struct nvme_tcp_queue *queue, struct sk_buff *skb, ...@@ -627,7 +627,7 @@ static int nvme_tcp_recv_pdu(struct nvme_tcp_queue *queue, struct sk_buff *skb,
return ret; return ret;
} }
static inline void nvme_tcp_end_request(struct request *rq, __le16 status) static inline void nvme_tcp_end_request(struct request *rq, u16 status)
{ {
union nvme_result res = {}; union nvme_result res = {};
......
...@@ -509,7 +509,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns) ...@@ -509,7 +509,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
ret = nvmet_p2pmem_ns_enable(ns); ret = nvmet_p2pmem_ns_enable(ns);
if (ret) if (ret)
goto out_unlock; goto out_dev_disable;
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
nvmet_p2pmem_ns_add_p2p(ctrl, ns); nvmet_p2pmem_ns_add_p2p(ctrl, ns);
...@@ -550,7 +550,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns) ...@@ -550,7 +550,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
out_dev_put: out_dev_put:
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid));
out_dev_disable:
nvmet_ns_dev_disable(ns); nvmet_ns_dev_disable(ns);
goto out_unlock; goto out_unlock;
} }
......
...@@ -75,11 +75,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) ...@@ -75,11 +75,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
return ret; return ret;
} }
static void nvmet_file_init_bvec(struct bio_vec *bv, struct sg_page_iter *iter) static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg)
{ {
bv->bv_page = sg_page_iter_page(iter); bv->bv_page = sg_page(sg);
bv->bv_offset = iter->sg->offset; bv->bv_offset = sg->offset;
bv->bv_len = PAGE_SIZE - iter->sg->offset; bv->bv_len = sg->length;
} }
static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos, static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos,
...@@ -128,14 +128,14 @@ static void nvmet_file_io_done(struct kiocb *iocb, long ret, long ret2) ...@@ -128,14 +128,14 @@ static void nvmet_file_io_done(struct kiocb *iocb, long ret, long ret2)
static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags) static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
{ {
ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE); ssize_t nr_bvec = req->sg_cnt;
struct sg_page_iter sg_pg_iter;
unsigned long bv_cnt = 0; unsigned long bv_cnt = 0;
bool is_sync = false; bool is_sync = false;
size_t len = 0, total_len = 0; size_t len = 0, total_len = 0;
ssize_t ret = 0; ssize_t ret = 0;
loff_t pos; loff_t pos;
int i;
struct scatterlist *sg;
if (req->f.mpool_alloc && nr_bvec > NVMET_MAX_MPOOL_BVEC) if (req->f.mpool_alloc && nr_bvec > NVMET_MAX_MPOOL_BVEC)
is_sync = true; is_sync = true;
...@@ -147,8 +147,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags) ...@@ -147,8 +147,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
} }
memset(&req->f.iocb, 0, sizeof(struct kiocb)); memset(&req->f.iocb, 0, sizeof(struct kiocb));
for_each_sg_page(req->sg, &sg_pg_iter, req->sg_cnt, 0) { for_each_sg(req->sg, sg, req->sg_cnt, i) {
nvmet_file_init_bvec(&req->f.bvec[bv_cnt], &sg_pg_iter); nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg);
len += req->f.bvec[bv_cnt].bv_len; len += req->f.bvec[bv_cnt].bv_len;
total_len += req->f.bvec[bv_cnt].bv_len; total_len += req->f.bvec[bv_cnt].bv_len;
bv_cnt++; bv_cnt++;
...@@ -225,7 +225,7 @@ static void nvmet_file_submit_buffered_io(struct nvmet_req *req) ...@@ -225,7 +225,7 @@ static void nvmet_file_submit_buffered_io(struct nvmet_req *req)
static void nvmet_file_execute_rw(struct nvmet_req *req) static void nvmet_file_execute_rw(struct nvmet_req *req)
{ {
ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE); ssize_t nr_bvec = req->sg_cnt;
if (!req->sg_cnt || !nr_bvec) { if (!req->sg_cnt || !nr_bvec) {
nvmet_req_complete(req, 0); nvmet_req_complete(req, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment