Re: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-31 Thread Wenwei Tao
Okay, I'll send a patch to cover that change.

2016-03-31 17:11 GMT+08:00 Matias Bjørling :
> On 03/30/2016 04:28 PM, Wenwei Tao wrote:
>>
>> Since every target now has their own logical address area,
>> we should deal trans_map and rev_trans_map with relative
>> logical address instead of the global one.
>>
>> Signed-off-by: Wenwei Tao 
>> ---
>>   drivers/lightnvm/rrpc.c | 12 
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
>> index 516a045..2279bd7 100644
>> --- a/drivers/lightnvm/rrpc.c
>> +++ b/drivers/lightnvm/rrpc.c
>> @@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64
>> *entries, void *private)
>>   {
>> struct rrpc *rrpc = (struct rrpc *)private;
>> struct nvm_dev *dev = rrpc->dev;
>> -   struct rrpc_addr *addr = rrpc->trans_map + slba;
>> -   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
>> -   u64 elba = slba + nlb;
>> -   u64 i;
>> +   struct rrpc_addr *addr;
>> +   struct rrpc_rev_addr *raddr;
>> +   u64 elba, i;
>> +
>> +   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
>> +   addr = rrpc->trans_map + slba;
>> +   raddr = rrpc->rev_trans_map;
>> +   elba = slba + nlb;
>>
>> if (unlikely(elba > dev->total_secs)) {
>> pr_err("nvm: L2P data from device is out of bounds!\n");
>>
>
> Hi Wenwei,
>
> How about storing the value of "rrpc->soffset >> (ilog2(dev->sec_size) - 9)"
> in rrpc->soffset. That let us only do the shifting for get/put area calls.


Re: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-31 Thread Wenwei Tao
Okay, I'll send a patch to cover that change.

2016-03-31 17:11 GMT+08:00 Matias Bjørling :
> On 03/30/2016 04:28 PM, Wenwei Tao wrote:
>>
>> Since every target now has their own logical address area,
>> we should deal trans_map and rev_trans_map with relative
>> logical address instead of the global one.
>>
>> Signed-off-by: Wenwei Tao 
>> ---
>>   drivers/lightnvm/rrpc.c | 12 
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
>> index 516a045..2279bd7 100644
>> --- a/drivers/lightnvm/rrpc.c
>> +++ b/drivers/lightnvm/rrpc.c
>> @@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64
>> *entries, void *private)
>>   {
>> struct rrpc *rrpc = (struct rrpc *)private;
>> struct nvm_dev *dev = rrpc->dev;
>> -   struct rrpc_addr *addr = rrpc->trans_map + slba;
>> -   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
>> -   u64 elba = slba + nlb;
>> -   u64 i;
>> +   struct rrpc_addr *addr;
>> +   struct rrpc_rev_addr *raddr;
>> +   u64 elba, i;
>> +
>> +   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
>> +   addr = rrpc->trans_map + slba;
>> +   raddr = rrpc->rev_trans_map;
>> +   elba = slba + nlb;
>>
>> if (unlikely(elba > dev->total_secs)) {
>> pr_err("nvm: L2P data from device is out of bounds!\n");
>>
>
> Hi Wenwei,
>
> How about storing the value of "rrpc->soffset >> (ilog2(dev->sec_size) - 9)"
> in rrpc->soffset. That let us only do the shifting for get/put area calls.


Re: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-31 Thread Matias Bjørling

On 03/30/2016 04:28 PM, Wenwei Tao wrote:

Since every target now has their own logical address area,
we should deal trans_map and rev_trans_map with relative
logical address instead of the global one.

Signed-off-by: Wenwei Tao 
---
  drivers/lightnvm/rrpc.c | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 516a045..2279bd7 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 
*entries, void *private)
  {
struct rrpc *rrpc = (struct rrpc *)private;
struct nvm_dev *dev = rrpc->dev;
-   struct rrpc_addr *addr = rrpc->trans_map + slba;
-   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
-   u64 elba = slba + nlb;
-   u64 i;
+   struct rrpc_addr *addr;
+   struct rrpc_rev_addr *raddr;
+   u64 elba, i;
+
+   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
+   addr = rrpc->trans_map + slba;
+   raddr = rrpc->rev_trans_map;
+   elba = slba + nlb;

if (unlikely(elba > dev->total_secs)) {
pr_err("nvm: L2P data from device is out of bounds!\n");



Hi Wenwei,

How about storing the value of "rrpc->soffset >> (ilog2(dev->sec_size) - 
9)" in rrpc->soffset. That let us only do the shifting for get/put area 
calls.


Re: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-31 Thread Matias Bjørling

On 03/30/2016 04:28 PM, Wenwei Tao wrote:

Since every target now has their own logical address area,
we should deal trans_map and rev_trans_map with relative
logical address instead of the global one.

Signed-off-by: Wenwei Tao 
---
  drivers/lightnvm/rrpc.c | 12 
  1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 516a045..2279bd7 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 
*entries, void *private)
  {
struct rrpc *rrpc = (struct rrpc *)private;
struct nvm_dev *dev = rrpc->dev;
-   struct rrpc_addr *addr = rrpc->trans_map + slba;
-   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
-   u64 elba = slba + nlb;
-   u64 i;
+   struct rrpc_addr *addr;
+   struct rrpc_rev_addr *raddr;
+   u64 elba, i;
+
+   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
+   addr = rrpc->trans_map + slba;
+   raddr = rrpc->rev_trans_map;
+   elba = slba + nlb;

if (unlikely(elba > dev->total_secs)) {
pr_err("nvm: L2P data from device is out of bounds!\n");



Hi Wenwei,

How about storing the value of "rrpc->soffset >> (ilog2(dev->sec_size) - 
9)" in rrpc->soffset. That let us only do the shifting for get/put area 
calls.


[PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-30 Thread Wenwei Tao
Since every target now has their own logical address area,
we should deal trans_map and rev_trans_map with relative
logical address instead of the global one.

Signed-off-by: Wenwei Tao 
---
 drivers/lightnvm/rrpc.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 516a045..2279bd7 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 
*entries, void *private)
 {
struct rrpc *rrpc = (struct rrpc *)private;
struct nvm_dev *dev = rrpc->dev;
-   struct rrpc_addr *addr = rrpc->trans_map + slba;
-   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
-   u64 elba = slba + nlb;
-   u64 i;
+   struct rrpc_addr *addr;
+   struct rrpc_rev_addr *raddr;
+   u64 elba, i;
+
+   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
+   addr = rrpc->trans_map + slba;
+   raddr = rrpc->rev_trans_map;
+   elba = slba + nlb;
 
if (unlikely(elba > dev->total_secs)) {
pr_err("nvm: L2P data from device is out of bounds!\n");
-- 
2.7.2.333.g70bd996



[PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update

2016-03-30 Thread Wenwei Tao
Since every target now has their own logical address area,
we should deal trans_map and rev_trans_map with relative
logical address instead of the global one.

Signed-off-by: Wenwei Tao 
---
 drivers/lightnvm/rrpc.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 516a045..2279bd7 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 
*entries, void *private)
 {
struct rrpc *rrpc = (struct rrpc *)private;
struct nvm_dev *dev = rrpc->dev;
-   struct rrpc_addr *addr = rrpc->trans_map + slba;
-   struct rrpc_rev_addr *raddr = rrpc->rev_trans_map;
-   u64 elba = slba + nlb;
-   u64 i;
+   struct rrpc_addr *addr;
+   struct rrpc_rev_addr *raddr;
+   u64 elba, i;
+
+   slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9);
+   addr = rrpc->trans_map + slba;
+   raddr = rrpc->rev_trans_map;
+   elba = slba + nlb;
 
if (unlikely(elba > dev->total_secs)) {
pr_err("nvm: L2P data from device is out of bounds!\n");
-- 
2.7.2.333.g70bd996