summaryrefslogtreecommitdiff
path: root/drivers/nvme/host
diff options
context:
space:
mode:
authorMatias Bjørling <m@bjorling.me>2016-05-06 21:03:05 +0300
committerJens Axboe <axboe@fb.com>2016-05-06 21:51:10 +0300
commite11903f5dfeb4f59fe93316d47f2ee5982e91e60 (patch)
treecff5ac80004af7b45bf3785889bb4ea04780943a /drivers/nvme/host
parent5136061ce705210b501ed9ecd673a67b74ebe017 (diff)
downloadlinux-e11903f5dfeb4f59fe93316d47f2ee5982e91e60.tar.xz
lightnvm: refactor device ops->get_bb_tbl()
The device ops->get_bb_tbl() takes a callback, that allows the caller to use its own callback function to update its data structures in the returning function. This makes it difficult to send parameters to the callback, and usually is circumvented by small private structures, that both carry the callers state and any flags needed to fulfill the update. Refactor ops->get_bb_tbl() to fill a data buffer with the status of the blocks returned, and let the user call the callback function manually. That will provide the necessary flags and data structures and simplify the logic around ops->get_bb_tbl(). Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r--drivers/nvme/host/lightnvm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index d289980d2bc8..45e3511d5d3d 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -388,7 +388,7 @@ out:
}
static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa,
- nvm_bb_update_fn *update_bbtbl, void *priv)
+ u8 *blks)
{
struct request_queue *q = nvmdev->q;
struct nvme_ns *ns = q->queuedata;
@@ -435,9 +435,7 @@ static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa,
goto out;
}
- ppa = dev_to_generic_addr(nvmdev, ppa);
- ret = update_bbtbl(nvmdev, ppa, bb_tbl->blk, nr_blks, priv);
-
+ memcpy(blks, bb_tbl->blk, nvmdev->blks_per_lun * nvmdev->plane_mode);
out:
kfree(bb_tbl);
return ret;