All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "neilb@suse.com" <neilb@suse.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Limitation in the badblocks routines
Date: Wed, 8 Nov 2017 00:27:03 +0000	[thread overview]
Message-ID: <1510100688.6296.17.camel@intel.com> (raw)

I think I've found a limitation in the badblocks implementation
(block/badblocks.c), which we now also use for nvdimm badblocks. 

Consider the following operations:

badblocks_set(bb, 32, 1);
badblocks_set(bb, 34, 1);
badblocks_set(bb, 36, 1);

badblocks_show will now correctly report:
32 1
34 1
36 1

Now if I do:
badblocks_set(bb, 32, 12);

Ideally, this should collapse all ranges into a single (32, 12).. But
looks like badblocks_set only merges one set of adjacent mergeable
ranges, and then returns, resulting in:

32 3
36 1

Now if I add the same (32, 12) range again, I get:

32 5

as one more set is merged. And finally after adding (32, 12) one final
time, I get the expected

32 12.

Neil - do you think it will be relatively straightforward to extend
badblocks_set to be aware of multi-overlap ranges like above? I haven't
really looked at the internals of it (I'll take a look tomorrow), but I
wanted to get this out in the meantime.

Thanks,
	-Vishal
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

                 reply	other threads:[~2017-11-08  0:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1510100688.6296.17.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=neilb@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.