Skip to content

Commit 7bca889

Browse files
committed
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
2 parents dd08a8d + a536b49 commit 7bca889

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

drivers/nvme/host/multipath.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,12 @@ static inline bool nvme_state_is_live(enum nvme_ana_state state)
404404
static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
405405
struct nvme_ns *ns)
406406
{
407-
enum nvme_ana_state old;
408-
409407
mutex_lock(&ns->head->lock);
410-
old = ns->ana_state;
411408
ns->ana_grpid = le32_to_cpu(desc->grpid);
412409
ns->ana_state = desc->state;
413410
clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
414411

415-
if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old))
412+
if (nvme_state_is_live(ns->ana_state))
416413
nvme_mpath_set_live(ns);
417414
mutex_unlock(&ns->head->lock);
418415
}

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static int nvme_tcp_recv_pdu(struct nvme_tcp_queue *queue, struct sk_buff *skb,
627627
return ret;
628628
}
629629

630-
static inline void nvme_tcp_end_request(struct request *rq, __le16 status)
630+
static inline void nvme_tcp_end_request(struct request *rq, u16 status)
631631
{
632632
union nvme_result res = {};
633633

drivers/nvme/target/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
509509

510510
ret = nvmet_p2pmem_ns_enable(ns);
511511
if (ret)
512-
goto out_unlock;
512+
goto out_dev_disable;
513513

514514
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
515515
nvmet_p2pmem_ns_add_p2p(ctrl, ns);
@@ -550,7 +550,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
550550
out_dev_put:
551551
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
552552
pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid));
553-
553+
out_dev_disable:
554554
nvmet_ns_dev_disable(ns);
555555
goto out_unlock;
556556
}

drivers/nvme/target/io-cmd-file.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
7575
return ret;
7676
}
7777

78-
static void nvmet_file_init_bvec(struct bio_vec *bv, struct sg_page_iter *iter)
78+
static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg)
7979
{
80-
bv->bv_page = sg_page_iter_page(iter);
81-
bv->bv_offset = iter->sg->offset;
82-
bv->bv_len = PAGE_SIZE - iter->sg->offset;
80+
bv->bv_page = sg_page(sg);
81+
bv->bv_offset = sg->offset;
82+
bv->bv_len = sg->length;
8383
}
8484

8585
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)
128128

129129
static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
130130
{
131-
ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE);
132-
struct sg_page_iter sg_pg_iter;
131+
ssize_t nr_bvec = req->sg_cnt;
133132
unsigned long bv_cnt = 0;
134133
bool is_sync = false;
135134
size_t len = 0, total_len = 0;
136135
ssize_t ret = 0;
137136
loff_t pos;
138-
137+
int i;
138+
struct scatterlist *sg;
139139

140140
if (req->f.mpool_alloc && nr_bvec > NVMET_MAX_MPOOL_BVEC)
141141
is_sync = true;
@@ -147,8 +147,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
147147
}
148148

149149
memset(&req->f.iocb, 0, sizeof(struct kiocb));
150-
for_each_sg_page(req->sg, &sg_pg_iter, req->sg_cnt, 0) {
151-
nvmet_file_init_bvec(&req->f.bvec[bv_cnt], &sg_pg_iter);
150+
for_each_sg(req->sg, sg, req->sg_cnt, i) {
151+
nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg);
152152
len += req->f.bvec[bv_cnt].bv_len;
153153
total_len += req->f.bvec[bv_cnt].bv_len;
154154
bv_cnt++;
@@ -225,7 +225,7 @@ static void nvmet_file_submit_buffered_io(struct nvmet_req *req)
225225

226226
static void nvmet_file_execute_rw(struct nvmet_req *req)
227227
{
228-
ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE);
228+
ssize_t nr_bvec = req->sg_cnt;
229229

230230
if (!req->sg_cnt || !nr_bvec) {
231231
nvmet_req_complete(req, 0);

0 commit comments

Comments
 (0)