Skip to content

Commit 08236c6

Browse files
MatiasBjorlingaxboe
authored andcommitted
lightnvm: unconverted ppa returned in get_bb_tbl
The get_bb_tbl function takes ppa as a generic address, which is converted to the ppa device address within the device driver. When the update_bbtbl callback is called from get_bb_tbl, the device specific ppa is used, instead of the generic ppa. Make sure to pass the generic ppa. Signed-off-by: Matias Bjørling <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 09f2e71 commit 08236c6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

drivers/lightnvm/gennvm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,
7575
struct nvm_block *blk;
7676
int i;
7777

78-
ppa = dev_to_generic_addr(gn->dev, ppa);
7978
lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun];
8079

8180
for (i = 0; i < nr_blocks; i++) {
@@ -187,7 +186,7 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn)
187186
ppa.g.lun = lun->vlun.id;
188187
ppa = generic_to_dev_addr(dev, ppa);
189188

190-
ret = dev->ops->get_bb_tbl(dev->q, ppa,
189+
ret = dev->ops->get_bb_tbl(dev, ppa,
191190
dev->blks_per_lun,
192191
gennvm_block_bb, gn);
193192
if (ret)

drivers/nvme/host/lightnvm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,11 @@ static int nvme_nvm_get_l2p_tbl(struct request_queue *q, u64 slba, u32 nlb,
355355
return ret;
356356
}
357357

358-
static int nvme_nvm_get_bb_tbl(struct request_queue *q, struct ppa_addr ppa,
358+
static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa,
359359
int nr_blocks, nvm_bb_update_fn *update_bbtbl,
360360
void *priv)
361361
{
362+
struct request_queue *q = nvmdev->q;
362363
struct nvme_ns *ns = q->queuedata;
363364
struct nvme_dev *dev = ns->dev;
364365
struct nvme_nvm_command c = {};
@@ -402,6 +403,7 @@ static int nvme_nvm_get_bb_tbl(struct request_queue *q, struct ppa_addr ppa,
402403
goto out;
403404
}
404405

406+
ppa = dev_to_generic_addr(nvmdev, ppa);
405407
ret = update_bbtbl(ppa, nr_blocks, bb_tbl->blk, priv);
406408
if (ret) {
407409
ret = -EINTR;

include/linux/lightnvm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ typedef int (nvm_bb_update_fn)(struct ppa_addr, int, u8 *, void *);
179179
typedef int (nvm_id_fn)(struct request_queue *, struct nvm_id *);
180180
typedef int (nvm_get_l2p_tbl_fn)(struct request_queue *, u64, u32,
181181
nvm_l2p_update_fn *, void *);
182-
typedef int (nvm_op_bb_tbl_fn)(struct request_queue *, struct ppa_addr, int,
182+
typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, int,
183183
nvm_bb_update_fn *, void *);
184184
typedef int (nvm_op_set_bb_fn)(struct request_queue *, struct nvm_rq *, int);
185185
typedef int (nvm_submit_io_fn)(struct request_queue *, struct nvm_rq *);

0 commit comments

Comments
 (0)