From: "Javier González" <jg@lightnvm.io>
To: Hans Holmberg <hans.ml.holmberg@owltronix.com>
Cc: "Matias Bjørling" <mb@lightnvm.io>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"Hans Holmberg" <hans.holmberg@cnexlabs.com>
Subject: Re: [PATCH 7/9] lightnvm: pblk: add l2p crc debug printouts
Date: Tue, 3 Oct 2017 12:39:46 +0200 [thread overview]
Message-ID: <28EFC5BD-92BF-404D-BEEB-3EE11DAE11FE@lightnvm.io> (raw)
In-Reply-To: <1507025113-13351-8-git-send-email-hans.ml.holmberg@owltronix.com>
[-- Attachment #1: Type: text/plain, Size: 2712 bytes --]
> On 3 Oct 2017, at 12.05, Hans Holmberg <hans.ml.holmberg@owltronix.com> wrote:
>
> From: Hans Holmberg <hans.holmberg@cnexlabs.com>
>
> Print the CRC of the logical-to-physical mapping during exit and
> after recovering the L2P table to facilitate detection of meta
> data corruption/recovery issues.
>
> The CRC printed after recovery should match the CRC printed during
> the previous exit - if it doesn't this indicates that either the meta
> data written to the disk is corrupt or recovery failed.
>
> Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
> ---
> drivers/lightnvm/pblk-init.c | 39 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
> index fb41182..c452478 100644
> --- a/drivers/lightnvm/pblk-init.c
> +++ b/drivers/lightnvm/pblk-init.c
> @@ -76,6 +76,28 @@ static blk_qc_t pblk_make_rq(struct request_queue *q, struct bio *bio)
> return BLK_QC_T_NONE;
> }
>
> +static size_t pblk_trans_map_size(struct pblk *pblk)
> +{
> + int entry_size = 8;
> +
> + if (pblk->ppaf_bitsize < 32)
> + entry_size = 4;
> +
> + return entry_size * pblk->rl.nr_secs;
> +}
> +
> +#ifdef CONFIG_NVM_DEBUG
> +static u32 pblk_l2p_crc(struct pblk *pblk)
> +{
> + size_t map_size;
> + u32 crc = ~(u32)0;
> +
> + map_size = pblk_trans_map_size(pblk);
> + crc = crc32_le(crc, pblk->trans_map, map_size);
> + return crc;
> +}
> +#endif
> +
> static void pblk_l2p_free(struct pblk *pblk)
> {
> vfree(pblk->trans_map);
> @@ -85,12 +107,10 @@ static int pblk_l2p_init(struct pblk *pblk)
> {
> sector_t i;
> struct ppa_addr ppa;
> - int entry_size = 8;
> -
> - if (pblk->ppaf_bitsize < 32)
> - entry_size = 4;
> + size_t map_size;
>
> - pblk->trans_map = vmalloc(entry_size * pblk->rl.nr_secs);
> + map_size = pblk_trans_map_size(pblk);
> + pblk->trans_map = vmalloc(map_size);
> if (!pblk->trans_map)
> return -ENOMEM;
>
> @@ -508,6 +528,10 @@ static int pblk_lines_configure(struct pblk *pblk, int flags)
> }
> }
>
> +#ifdef CONFIG_NVM_DEBUG
> + pr_info("pblk init: L2P CRC: %x\n", pblk_l2p_crc(pblk));
> +#endif
> +
> /* Free full lines directly as GC has not been started yet */
> pblk_gc_free_full_lines(pblk);
>
> @@ -898,6 +922,11 @@ static void pblk_exit(void *private)
> down_write(&pblk_lock);
> pblk_gc_exit(pblk);
> pblk_tear_down(pblk);
> +
> +#ifdef CONFIG_NVM_DEBUG
> + pr_info("pblk exit: L2P CRC: %x\n", pblk_l2p_crc(pblk));
> +#endif
> +
> pblk_free(pblk);
> up_write(&pblk_lock);
> }
> --
> 2.7.4
LGTM.
Reviewed-by: Javier González <javier@cnexlabs.com>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-10-03 10:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 10:05 [PATCH 0/9] recovery robustness improvements Hans Holmberg
2017-10-03 10:05 ` [PATCH 1/9] lightnvm: pblk: prevent gc kicks when gc is not operational Hans Holmberg
2017-10-03 10:27 ` Javier González
2017-10-03 10:05 ` [PATCH 2/9] lightnvm: pblk: recover partially written lines correctly Hans Holmberg
2017-10-03 10:28 ` Javier González
2017-10-03 10:05 ` [PATCH 3/9] lightnvm: pblk: free full lines during recovery Hans Holmberg
2017-10-03 10:36 ` Javier González
2017-10-03 10:05 ` [PATCH 4/9] lightnvm: pblk: start gc if needed during init Hans Holmberg
2017-10-03 10:36 ` Javier González
2017-10-03 10:05 ` [PATCH 5/9] lightnvm: pblk: consider bad sectors in emeta during recovery Hans Holmberg
2017-10-03 10:38 ` Javier González
2017-10-03 10:05 ` [PATCH 6/9] lightnvm: pblk: shut down gc gracefully during exit Hans Holmberg
2017-10-03 10:38 ` Javier González
2017-10-03 10:05 ` [PATCH 7/9] lightnvm: pblk: add l2p crc debug printouts Hans Holmberg
2017-10-03 10:39 ` Javier González [this message]
2017-10-03 10:05 ` [PATCH 8/9] lightnvm: pblk: gc all lines in the pipeline before exit Hans Holmberg
2017-10-03 10:40 ` Javier González
2017-10-03 10:05 ` [PATCH 9/9] lightnvm: pblk: correct valid lba count calculation Hans Holmberg
2017-10-03 10:41 ` Javier González
2017-10-03 10:51 ` [PATCH 0/9] recovery robustness improvements Javier González
2017-10-03 13:53 ` Hans Holmberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28EFC5BD-92BF-404D-BEEB-3EE11DAE11FE@lightnvm.io \
--to=jg@lightnvm.io \
--cc=hans.holmberg@cnexlabs.com \
--cc=hans.ml.holmberg@owltronix.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mb@lightnvm.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®