Re: [RESEND PATCH] nvdimm: fix some compilation warnings

From: Qian Cai
Date: Wed Jun 26 2019 - 17:00:32 EST


On Thu, 2019-05-16 at 00:29 +0000, Verma, Vishal L wrote:
> On Wed, 2019-05-15 at 17:26 -0700, Dan Williams wrote:
> > On Wed, May 15, 2019 at 5:25 PM Verma, Vishal L
> > <vishal.l.verma@xxxxxxxxx> wrote:
> > > On Wed, 2019-05-15 at 16:25 -0700, Dan Williams wrote:
> > > > > diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> > > > > index 4671776f5623..9f02a99cfac0 100644
> > > > > --- a/drivers/nvdimm/btt.c
> > > > > +++ b/drivers/nvdimm/btt.c
> > > > > @@ -1269,11 +1269,9 @@ static int btt_read_pg(struct btt *btt,
> > > > > struct bio_integrity_payload *bip,
> > > > >
> > > > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂret = btt_data_read(arena, page, off, postmap,
> > > > > cur_len);
> > > > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (ret) {
> > > > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂint rc;
> > > > > -
> > > > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ/* Media error - set the e_flag */
> > > > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrc = btt_map_write(arena, premap,
> > > > > postmap, 0, 1,
> > > > > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂNVDIMM_IO_ATOMIC);
> > > > > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbtt_map_write(arena, premap, postmap, 0,
> > > > > 1,
> > > > > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂNVDIMM_IO_ATOMIC);
> > > > > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂgoto out_rtt;
> > > >
> > > > This doesn't look correct to me, shouldn't we at least be logging
> > > > that
> > > > the bad-block failed to be persistently tracked?
> > >
> > > Yes logging it sounds good to me. Qian, can you include this in your
> > > respin or shall I send a fix for it separately (since we were always
> > > ignoring the failure here regardless of this patch)?
> >
> > I think a separate fix for this makes more sense. Likely also needs to
> > be a ratelimited message in case a storm of errors is encountered.
>
> Yes good point on rate limiting - I was thinking WARN_ONCE but that
> might mask errors for distinct blocks, but a rate limited printk should
> work best. I'll prepare a patch.
>

Verma, are you still working on this? I can still see this warning in the latest
linux-next.

drivers/nvdimm/btt.c: In function 'btt_read_pg':
drivers/nvdimm/btt.c:1272:8: warning: variable 'rc' set but not used
[-Wunused-but-set-variable]