[dm-devel] [PATCH 0/2] introduce interface to list all badblocks

Bryn M. Reeves bmr at redhat.com
Tue Jun 16 12:28:03 UTC 2020


On Mon, Jun 15, 2020 at 06:03:31PM +0100, Alasdair G Kergon wrote:
> On Mon, Jun 08, 2020 at 04:45:11PM +0800, yangerkun wrote:
> >     $ sudo dmsetup message dust1 0 listbadblocks
> > The following message will appear, listing one bad block number per
> 
> Did you consider returning the data directly to the caller so it
> can be accessed directly?
> 
> (e.g. like @stats_list handled in dm-stats.c)

Having this returned in the message response would certainly be more
natural and would simplify parsing the data: sending it to the log seems
like it would allow log lines from distinct devices to become
interleaved when the lists are long and the message is sent to two or
more devices near simultaneously. Without something to identify the
devices in each message you can't distinguish them.

Even with large numbers of bad blocks userspace libdevmapper will
automatically handle re-trying with a larger buffer if the list is too
big for the default.

We use (sometimes very large) message replies heavily in libdm-stats.

device-mapper.h provides the DMEMIT macro to output message replies.
See dm_stats_print() or various target status() functions for
examples.

Regards,
Bryn.




More information about the dm-devel mailing list