diff options
author | Javier González <jg@lightnvm.io> | 2016-11-29 00:39:07 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-11-29 22:12:51 +0300 |
commit | 0ac4072eb10c9627415eb1ca511121156e20012c (patch) | |
tree | a2581ae27e54d08e0f95bdff8712fd5daade109e /drivers/lightnvm/rrpc.c | |
parent | 8e79b5cb1d3b8eceaf6862995952dd4de431dd99 (diff) | |
download | linux-0ac4072eb10c9627415eb1ca511121156e20012c.tar.xz |
lightnvm: remove get_lun operation on gennvm
Since LUNs are managed internally on the target, there is no need for
the media manager to implement a get_lun operation.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm/rrpc.c')
-rw-r--r-- | drivers/lightnvm/rrpc.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 5377c7a987aa..165b9d396493 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -1199,10 +1199,11 @@ static void rrpc_luns_free(struct rrpc *rrpc) kfree(rrpc->luns); } -static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end) +static int rrpc_luns_init(struct rrpc *rrpc, struct list_head *lun_list) { struct nvm_tgt_dev *dev = rrpc->dev; struct nvm_geo *geo = &dev->geo; + struct nvm_lun *lun; struct rrpc_lun *rlun; int i, j, ret = -EINVAL; @@ -1218,16 +1219,11 @@ static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end) if (!rrpc->luns) return -ENOMEM; - /* 1:1 mapping */ - for (i = 0; i < rrpc->nr_luns; i++) { - int lunid = lun_begin + i; - struct nvm_lun *lun; + i = 0; - lun = dev->mt->get_lun(dev->parent, lunid); - if (!lun) - goto err; - - rlun = &rrpc->luns[i]; + /* 1:1 mapping */ + list_for_each_entry(lun, lun_list, list) { + rlun = &rrpc->luns[i++]; rlun->parent = lun; rlun->blocks = vzalloc(sizeof(struct rrpc_block) * geo->blks_per_lun); @@ -1256,6 +1252,8 @@ static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end) spin_lock_init(&rlun->lock); } + WARN_ON(i != rrpc->nr_luns); + return 0; err: return ret; @@ -1410,12 +1408,13 @@ err: static struct nvm_tgt_type tt_rrpc; static void *rrpc_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, - int lun_begin, int lun_end) + struct list_head *lun_list) { struct request_queue *bqueue = dev->q; struct request_queue *tqueue = tdisk->queue; struct nvm_geo *geo = &dev->geo; struct rrpc *rrpc; + int lun_begin = (list_first_entry(lun_list, struct nvm_lun, list))->id; sector_t soffset; int ret; @@ -1450,7 +1449,7 @@ static void *rrpc_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk, } rrpc->soffset = soffset; - ret = rrpc_luns_init(rrpc, lun_begin, lun_end); + ret = rrpc_luns_init(rrpc, lun_list); if (ret) { pr_err("nvm: rrpc: could not initialize luns\n"); goto err; |