diff options
author | Matias Bjørling <m@bjorling.me> | 2016-05-06 20:02:58 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-05-06 12:51:10 -0600 |
commit | 22e8c9766a669d49cf3749d397082a5cd93374a9 (patch) | |
tree | c24facba8321c5359bf6f111f2ca892cf894b62a /drivers/lightnvm/gennvm.c | |
parent | 4891d120b9cd419f4350b11e1231083745dcdc8b (diff) | |
download | linux-22e8c9766a669d49cf3749d397082a5cd93374a9.tar.bz2 |
lightnvm: move block fold outside of get_bb_tbl()
The get block table command returns a list of blocks and planes
with their associated state. Users, such as gennvm and sysblk,
manages all planes as a single virtual block.
It was therefore natural to fold the bad block list before it is
returned. However, to allow users, which manages on a per-plane
block level, to also use the interface, the get_bb_tbl interface is
changed to not fold by default and instead let the caller fold if
necessary.
Reviewed by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm/gennvm.c')
-rw-r--r-- | drivers/lightnvm/gennvm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c index 72e124a3927d..6096077c5dde 100644 --- a/drivers/lightnvm/gennvm.c +++ b/drivers/lightnvm/gennvm.c @@ -129,18 +129,21 @@ static int gennvm_luns_init(struct nvm_dev *dev, struct gen_nvm *gn) return 0; } -static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks, - void *private) +static int gennvm_block_bb(struct nvm_dev *dev, struct ppa_addr ppa, + u8 *blks, int nr_blks, void *private) { struct gen_nvm *gn = private; - struct nvm_dev *dev = gn->dev; struct gen_lun *lun; struct nvm_block *blk; int i; + nr_blks = nvm_bb_tbl_fold(dev, blks, nr_blks); + if (nr_blks < 0) + return nr_blks; + lun = &gn->luns[(dev->luns_per_chnl * ppa.g.ch) + ppa.g.lun]; - for (i = 0; i < nr_blocks; i++) { + for (i = 0; i < nr_blks; i++) { if (blks[i] == 0) continue; @@ -250,8 +253,7 @@ static int gennvm_blocks_init(struct nvm_dev *dev, struct gen_nvm *gn) ppa = generic_to_dev_addr(dev, ppa); ret = dev->ops->get_bb_tbl(dev, ppa, - dev->blks_per_lun, - gennvm_block_bb, gn); + gennvm_block_bb, gn); if (ret) pr_err("gennvm: could not read BB table\n"); } |