Skip to contentSkip to conversation

Limitation in the badblocks routines

DISCUSSION Verma, Vishal L 1 participant 1 message Nov 8, 2017 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Verma, Vishal L

author maintainer
#0 lore 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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm