[dm-devel] Question about dm target size
Bryn M. Reeves
bmr at redhat.com
Wed Nov 12 12:28:03 UTC 2014
On Tue, Nov 11, 2014 at 07:37:44PM -0500, Josef Bacik wrote:
> Hello,
>
> I'm creating a dm target to better test power fail situations and I'm having
> trouble figuring out how to make the dm device appear as a different size.
> So for example you do the normal dm table
>
> offset size power-fail /dev/whatever args
Just make the size argument in your table be equal to dev_size / 2. This is
where ti->len comes from and it's the correct way to tell device-mapper how
big your mapped device should be.
Your ctr can then parse out /dev/whatever from its args, open it and do
whatever it likes with it. Access to that device by your target code is in
no way constrained by the offset/size params used in the table.
E.g.:
# dmsetup create pf0 --table="0 2048 power-fail /dev/whatever foo bar"
Would create a 1M device named pf0. The power-fail target could still access
the whole of /dev/whatever if it wants to.
within the
Regards,
Bryn.
More information about the dm-devel
mailing list