]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
lightnvm: do not assume sequential lun alloc.
authorJavier González <jg@lightnvm.io>
Fri, 6 May 2016 18:03:15 +0000 (20:03 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 6 May 2016 18:51:10 +0000 (12:51 -0600)
When doing GC, rrpc calculates the physical LUN to which the rrpc block
belongs too. This calculation is based on the assumption that LUNs are
assigned sequentially to the LUN list. Use the reference to the LUN
instead. This saves us the calculation and allows us to align LUNs in a
different manner to, for example, take advantage of devide parallelism.

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>
drivers/lightnvm/rrpc.c

index ffcfee6684ba21bb51940661a5f972b42492f19a..48862ead7c99dfb65d2bbd7145c879b16e0911d5 100644 (file)
@@ -405,9 +405,8 @@ static void rrpc_block_gc(struct work_struct *work)
                                                                        ws_gc);
        struct rrpc *rrpc = gcb->rrpc;
        struct rrpc_block *rblk = gcb->rblk;
+       struct rrpc_lun *rlun = rblk->rlun;
        struct nvm_dev *dev = rrpc->dev;
-       struct nvm_lun *lun = rblk->parent->lun;
-       struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset];
 
        mempool_free(gcb, rrpc->gcb_pool);
        pr_debug("nvm: block '%lu' being reclaimed\n", rblk->parent->id);
@@ -508,9 +507,9 @@ static void rrpc_gc_queue(struct work_struct *work)
                                                                        ws_gc);
        struct rrpc *rrpc = gcb->rrpc;
        struct rrpc_block *rblk = gcb->rblk;
+       struct rrpc_lun *rlun = rblk->rlun;
        struct nvm_lun *lun = rblk->parent->lun;
        struct nvm_block *blk = rblk->parent;
-       struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset];
 
        spin_lock(&rlun->lock);
        list_add_tail(&rblk->prio, &rlun->prio_list);