On Tue, 12 May 2026, Matthew Sakai wrote:
>
>
> On 5/12/26 9:36 AM, Mikulas Patocka wrote:
> > The VDO code needs to perform some calculations before creating a device.
> > The calculations should be performed in the kernel, so that the same logic
> > is not duplicated in the kernel and in the userspace.
> >
> > However, currently it is not possible to call a device mapper target
> > when no device exists.
> >
> > This commit solves the problem by adding "deviceless" messages. If the
> > message starts with '%', the name is a name of a target, not a name of a
> > device. The message will be directed to the target by calling the
> > "deviceless_message" method. The target can perform the requested
> > calculations in this method and return the result back to userspace.
> >
> > Signed-off-by: Mikulas Patocka <[email protected]>
>
> I do wish that we could clean up the message interface. The sector number
> argument is completely meaningless for a deviceless message, so in theory we
> could distinguish this case by omitting the argument, e.g. "dmsetup message
> <target_type> <command>" and not require the special '%' notation, either. But
> that looks like it would require a lot more rearrangement of the message
> handling code.
I wanted to design it in such a way that we don't have to update the
libdevmapper library or the dmsetup tool to send deviceless messages -
that's why there is the unused sector number.
In the past, dm_stats was glueued to messages in a similar way (the
dm_stats messages start with '@'), the sector number is also unused in
this case.
Perhaps we could introduce a new ioctl DM_DEVICELESS_MSG_CMD and send
deviceless messages with it, but that would need coordination with the
libdevmapper+dmsetup maintainers. I think it would create maintenance
burden (you couldn't use deviceless messages unless you update
libdevmapper, you couldn't update libdevmapper unless you update libc, you
couldn't update libc unless you update the whole distribution ... etc.).
> I agree this does what we need, so...
>
> Reviewed-by: Matthew Sakai <[email protected]>
When you make a patch that needs deviceless messages, let me know and I
will commit it. I will not commit deviceless messages now, because I want
to have someone using it when committing it.
Mikulas