Skip to contentSkip to conversation

lightnvm: do not assume sequential lun alloc.

PATCH In review Javier González 2 participants 2 messages Apr 29, 2016 – May 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lightnvm: do not assume sequential lun alloc.

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.

---
 drivers/lightnvm/rrpc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/lightnvm/rrpc.c +2 -3
index ffcfee6..48862ead 100644
@@ -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);
Signature · 1 line
2.5.0
#1 lore raw
Quoted 28 lines · Javier González

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.

---
  drivers/lightnvm/rrpc.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/lightnvm/rrpc.c +1 -2
index ffcfee6..48862ead 100644
@@ -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);

drivers/lightnvm/rrpc.c static void rrpc_gc_queue(struct work_struct *work) · line 515

Quoted 10 lines
drivers/lightnvm/rrpc.c +1 -1
@@ -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);

Thanks Javier. Applied for 4.7.