2018-08-29 09:04:16

by Javier González

[permalink] [raw]
Subject: [PATCH 0/4] lightnvm: pblk: collection of small fixes

Collection of small helper function fixes, removal of unused variables
and comment typos.

Javier González (4):
lightnvm: pblk: calculate line pad distance in helper
lightnvm: pblk: fix comment typo
lightnvm: pblk: remove unused variable.
lightnvm: pblk: guarantee emeta on line close

drivers/lightnvm/pblk-core.c | 13 +++++++++++--
drivers/lightnvm/pblk-recovery.c | 2 --
drivers/lightnvm/pblk-write.c | 2 +-
drivers/lightnvm/pblk.h | 6 +++---
4 files changed, 15 insertions(+), 8 deletions(-)

--
2.7.4



2018-08-29 09:03:26

by Javier González

[permalink] [raw]
Subject: [PATCH 3/4] lightnvm: pblk: remove unused variable.

Removed unused struct ppa_addr variable.

Signed-off-by: Javier González <[email protected]>
---
drivers/lightnvm/pblk.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 994a081994fb..22cc9bfbbb10 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -1398,7 +1398,6 @@ static inline int pblk_check_io(struct pblk *pblk, struct nvm_rq *rqd)

if (rqd->opcode == NVM_OP_PWRITE) {
struct pblk_line *line;
- struct ppa_addr ppa;
int i;

for (i = 0; i < rqd->nr_ppas; i++) {
--
2.7.4


2018-08-29 09:03:32

by Javier González

[permalink] [raw]
Subject: [PATCH 4/4] lightnvm: pblk: guarantee emeta on line close

If a line is recovered from open chunks, the memory structures for
emeta have not necessarily been properly set on line initialization.
When closing a line, make sure that emeta is consistent so that the line
can be recovered on the fast path on next reboot.

Also, remove a couple of empty lines at the end of the function.

Signed-off-by: Javier González <[email protected]>
---
drivers/lightnvm/pblk-core.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 1e4dc0c1ed88..fdcbeb920c9e 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1857,6 +1857,17 @@ void pblk_line_close_meta(struct pblk *pblk, struct pblk_line *line)
wa->pad = cpu_to_le64(atomic64_read(&pblk->pad_wa));
wa->gc = cpu_to_le64(atomic64_read(&pblk->gc_wa));

+ if (le32_to_cpu(emeta_buf->header.identifier) != PBLK_MAGIC) {
+ emeta_buf->header.identifier = cpu_to_le32(PBLK_MAGIC);
+ memcpy(emeta_buf->header.uuid, pblk->instance_uuid, 16);
+ emeta_buf->header.id = cpu_to_le32(line->id);
+ emeta_buf->header.type = cpu_to_le16(line->type);
+ emeta_buf->header.version_major = EMETA_VERSION_MAJOR;
+ emeta_buf->header.version_minor = EMETA_VERSION_MINOR;
+ emeta_buf->header.crc = cpu_to_le32(
+ pblk_calc_meta_header_crc(pblk, &emeta_buf->header));
+ }
+
emeta_buf->nr_valid_lbas = cpu_to_le64(line->nr_valid_lbas);
emeta_buf->crc = cpu_to_le32(pblk_calc_emeta_crc(pblk, emeta_buf));

@@ -1874,8 +1885,6 @@ void pblk_line_close_meta(struct pblk *pblk, struct pblk_line *line)
spin_unlock(&l_mg->close_lock);

pblk_line_should_sync_meta(pblk);
-
-
}

static void pblk_save_lba_list(struct pblk *pblk, struct pblk_line *line)
--
2.7.4


2018-08-29 09:03:49

by Javier González

[permalink] [raw]
Subject: [PATCH 2/4] lightnvm: pblk: fix comment typo

Fix comment typo Decrese -> Decrease

Signed-off-by: Javier González <[email protected]>
---
drivers/lightnvm/pblk-write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c
index 767618eba4c2..617572717065 100644
--- a/drivers/lightnvm/pblk-write.c
+++ b/drivers/lightnvm/pblk-write.c
@@ -195,7 +195,7 @@ static void pblk_prepare_resubmit(struct pblk *pblk, unsigned int sentry,
/* Release flags on write context. Protect from writes */
smp_store_release(&w_ctx->flags, flags);

- /* Decrese the reference count to the line as we will
+ /* Decrease the reference count to the line as we will
* re-map these entries
*/
line = pblk_ppa_to_line(pblk, w_ctx->ppa);
--
2.7.4


2018-08-29 09:04:06

by Javier González

[permalink] [raw]
Subject: [PATCH 1/4] lightnvm: pblk: calculate line pad distance in helper

If a line is padded, calculate the pad distance directly on the helper
being used for this purpose.

Signed-off-by: Javier González <[email protected]>
---
drivers/lightnvm/pblk-recovery.c | 2 --
drivers/lightnvm/pblk.h | 5 +++--
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index fdc770f2545f..188c89819a40 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -487,8 +487,6 @@ static int pblk_recov_scan_all_oob(struct pblk *pblk, struct pblk_line *line,
bitmap_clear(line->map_bitmap, line->cur_sec, nr_error_bits);

pad_secs = pblk_pad_distance(pblk);
- if (pad_secs > line->left_msecs)
- pad_secs = line->left_msecs;

ret = pblk_recov_pad_oob(pblk, line, pad_secs);
if (ret)
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 54f937c1fb62..994a081994fb 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -990,12 +990,13 @@ static inline int pblk_line_vsc(struct pblk_line *line)
return le32_to_cpu(*line->vsc);
}

-static inline int pblk_pad_distance(struct pblk *pblk)
+static inline int pblk_pad_distance(struct pblk *pblk, struct pblk_line *line)
{
struct nvm_tgt_dev *dev = pblk->dev;
struct nvm_geo *geo = &dev->geo;
+ int distance = geo->mw_cunits * geo->all_luns * geo->ws_opt;

- return geo->mw_cunits * geo->all_luns * geo->ws_opt;
+ return (distance > line->left_msecs) ? line->left_msecs : distance;
}

static inline int pblk_ppa_to_line_id(struct ppa_addr p)
--
2.7.4


2018-08-29 13:15:56

by Matias Bjørling

[permalink] [raw]
Subject: Re: [PATCH 0/4] lightnvm: pblk: collection of small fixes

On 08/29/2018 11:01 AM, Javier González wrote:
> Collection of small helper function fixes, removal of unused variables
> and comment typos.
>
> Javier González (4):
> lightnvm: pblk: calculate line pad distance in helper
> lightnvm: pblk: fix comment typo
> lightnvm: pblk: remove unused variable.
> lightnvm: pblk: guarantee emeta on line close
>
> drivers/lightnvm/pblk-core.c | 13 +++++++++++--
> drivers/lightnvm/pblk-recovery.c | 2 --
> drivers/lightnvm/pblk-write.c | 2 +-
> drivers/lightnvm/pblk.h | 6 +++---
> 4 files changed, 15 insertions(+), 8 deletions(-)
>

Thanks. Applied 2-4. The pad distance does not compile due to missing
update to pblk_pad_distance call from pblk-recovery.c.

Also, it looks like pblk-recovery.c is the only user. Please consider
moving it the function from pblk.h to pblk-recovery.c

2018-08-29 13:31:05

by Javier Gonzalez

[permalink] [raw]
Subject: Re: [PATCH 0/4] lightnvm: pblk: collection of small fixes


> On 29 Aug 2018, at 15.14, Matias Bjørling <[email protected]> wrote:
>
> On 08/29/2018 11:01 AM, Javier González wrote:
>> Collection of small helper function fixes, removal of unused variables
>> and comment typos.
>> Javier González (4):
>> lightnvm: pblk: calculate line pad distance in helper
>> lightnvm: pblk: fix comment typo
>> lightnvm: pblk: remove unused variable.
>> lightnvm: pblk: guarantee emeta on line close
>> drivers/lightnvm/pblk-core.c | 13 +++++++++++--
>> drivers/lightnvm/pblk-recovery.c | 2 --
>> drivers/lightnvm/pblk-write.c | 2 +-
>> drivers/lightnvm/pblk.h | 6 +++---
>> 4 files changed, 15 insertions(+), 8 deletions(-)
>
> Thanks. Applied 2-4. The pad distance does not compile due to missing
> update to pblk_pad_distance call from pblk-recovery.c.
>
> Also, it looks like pblk-recovery.c is the only user. Please consider
> moving it the function from pblk.h to pblk-recovery.c

I reordered to send the helpers, but you can see that all these are made
to support.

lightnvm: pblk: recover open lines on 2.0 devices

Can you fix this directly and apply 1 too? I'm fine with moving it to
pblk-recovery.c. The patch above will use it.

Thanks,
Javier


Attachments:
signature.asc (849.00 B)
Message signed with OpenPGP

2018-08-29 18:13:32

by Matias Bjørling

[permalink] [raw]
Subject: Re: [PATCH 0/4] lightnvm: pblk: collection of small fixes

On 08/29/2018 03:27 PM, Javier Gonzalez wrote:
>
>> On 29 Aug 2018, at 15.14, Matias Bjørling <[email protected]> wrote:
>>
>> On 08/29/2018 11:01 AM, Javier González wrote:
>>> Collection of small helper function fixes, removal of unused variables
>>> and comment typos.
>>> Javier González (4):
>>> lightnvm: pblk: calculate line pad distance in helper
>>> lightnvm: pblk: fix comment typo
>>> lightnvm: pblk: remove unused variable.
>>> lightnvm: pblk: guarantee emeta on line close
>>> drivers/lightnvm/pblk-core.c | 13 +++++++++++--
>>> drivers/lightnvm/pblk-recovery.c | 2 --
>>> drivers/lightnvm/pblk-write.c | 2 +-
>>> drivers/lightnvm/pblk.h | 6 +++---
>>> 4 files changed, 15 insertions(+), 8 deletions(-)
>>
>> Thanks. Applied 2-4. The pad distance does not compile due to missing
>> update to pblk_pad_distance call from pblk-recovery.c.
>>
>> Also, it looks like pblk-recovery.c is the only user. Please consider
>> moving it the function from pblk.h to pblk-recovery.c
>
> I reordered to send the helpers, but you can see that all these are made
> to support.
>
> lightnvm: pblk: recover open lines on 2.0 devices
>
> Can you fix this directly and apply 1 too? I'm fine with moving it to
> pblk-recovery.c. The patch above will use it.
>

Yes. I've fixed it up in pblk-recovery.c, and also moved the function to
pblk-recovery.c. Applied for 4.20.


2018-08-29 19:15:41

by Javier Gonzalez

[permalink] [raw]
Subject: Re: [PATCH 0/4] lightnvm: pblk: collection of small fixes


> On 29 Aug 2018, at 20.11, Matias Bjørling <[email protected]> wrote:
>
> On 08/29/2018 03:27 PM, Javier Gonzalez wrote:
>>> On 29 Aug 2018, at 15.14, Matias Bjørling <[email protected]> wrote:
>>>
>>>> On 08/29/2018 11:01 AM, Javier González wrote:
>>>> Collection of small helper function fixes, removal of unused variables
>>>> and comment typos.
>>>> Javier González (4):
>>>> lightnvm: pblk: calculate line pad distance in helper
>>>> lightnvm: pblk: fix comment typo
>>>> lightnvm: pblk: remove unused variable.
>>>> lightnvm: pblk: guarantee emeta on line close
>>>> drivers/lightnvm/pblk-core.c | 13 +++++++++++--
>>>> drivers/lightnvm/pblk-recovery.c | 2 --
>>>> drivers/lightnvm/pblk-write.c | 2 +-
>>>> drivers/lightnvm/pblk.h | 6 +++---
>>>> 4 files changed, 15 insertions(+), 8 deletions(-)
>>>
>>> Thanks. Applied 2-4. The pad distance does not compile due to missing
>>> update to pblk_pad_distance call from pblk-recovery.c.
>>>
>>> Also, it looks like pblk-recovery.c is the only user. Please consider
>>> moving it the function from pblk.h to pblk-recovery.c
>> I reordered to send the helpers, but you can see that all these are made
>> to support.
>> lightnvm: pblk: recover open lines on 2.0 devices
>> Can you fix this directly and apply 1 too? I'm fine with moving it to
>> pblk-recovery.c. The patch above will use it.
>
> Yes. I've fixed it up in pblk-recovery.c, and also moved the function to pblk-recovery.c. Applied for 4.20.

Thanks!