Cryptsetup development
 help / color / mirror / Atom feed
* dm-integrity: estimate the size needed for separate integrity device
@ 2026-06-01  7:50 Max Gautier
  2026-06-07 13:08 ` Milan Broz
  0 siblings, 1 reply; 3+ messages in thread
From: Max Gautier @ 2026-06-01  7:50 UTC (permalink / raw)
  To: cryptsetup

Hello,

I'm building a media server where I intend to use RAID10 on top of
dm-integrity (and cryptsetup on top of that, but that's not really
relevant, AFAIK). I plan to put the integrity tags of dm-integrity on my
NVME, to avoid some of the performance penalty. 

But I'm not sure what size each "integrity tags" partition should be,
depending on the data device.

I'm using this blog [1] as the base for the calculation, but I couldn't
find a reference for the calculation in the dm-integrity kernel
documentation, in cryptsetup wiki or in the integritysetup man page.

Is there a reference for calculating that size ? I'm fine looking at
some code, and it looks like the dm-integrity source[2] has some functions names
which could be helpful, but any pointers would help :)

Thanks !

[1]: https://blog.tty8.org/posts/2025-04-02-moving-dm-integrity-tags-off-the-hdd-to-speed-up-raid.html
[2]: https://codebrowser.dev/linux/linux/drivers/md/dm-integrity.c.html

-- 
Max Gautier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dm-integrity: estimate the size needed for separate integrity device
  2026-06-01  7:50 dm-integrity: estimate the size needed for separate integrity device Max Gautier
@ 2026-06-07 13:08 ` Milan Broz
  2026-06-08  7:05   ` Max Gautier
  0 siblings, 1 reply; 3+ messages in thread
From: Milan Broz @ 2026-06-07 13:08 UTC (permalink / raw)
  To: Max Gautier, cryptsetup; +Cc: Mikulas Patocka

Hi,

On 6/1/26 9:50 AM, Max Gautier wrote:
> I'm building a media server where I intend to use RAID10 on top of
> dm-integrity (and cryptsetup on top of that, but that's not really
> relevant, AFAIK). I plan to put the integrity tags of dm-integrity on my
> NVME, to avoid some of the performance penalty.
> 
> But I'm not sure what size each "integrity tags" partition should be,
> depending on the data device.

Interesting, while we can print information about data size,
there is actually no calculation of size in the case of an independent
data device. (And even this is post-format, we cannot calculate it
in userspace in advance.)

The only place for this is actually kernel dm-integrity,
but the code is tricky.

CC to Mikulas - is there a simple way to calculate this size?

Or at least provide userspace with information about the existing
meta device size (we send only the meta_device option as part
of the mapping table).
Actually, integritysetup should check device size before activation...

(We have such a calculation for dm-verity for hash and FEC device,
but not for dm-integrity.)

Milan


> 
> I'm using this blog [1] as the base for the calculation, but I couldn't
> find a reference for the calculation in the dm-integrity kernel
> documentation, in cryptsetup wiki or in the integritysetup man page.
> 
> Is there a reference for calculating that size ? I'm fine looking at
> some code, and it looks like the dm-integrity source[2] has some functions names
> which could be helpful, but any pointers would help :)
> 
> Thanks !
> 
> [1]: https://blog.tty8.org/posts/2025-04-02-moving-dm-integrity-tags-off-the-hdd-to-speed-up-raid.html
> [2]: https://codebrowser.dev/linux/linux/drivers/md/dm-integrity.c.html
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dm-integrity: estimate the size needed for separate integrity device
  2026-06-07 13:08 ` Milan Broz
@ 2026-06-08  7:05   ` Max Gautier
  0 siblings, 0 replies; 3+ messages in thread
From: Max Gautier @ 2026-06-08  7:05 UTC (permalink / raw)
  To: Milan Broz; +Cc: cryptsetup, Mikulas Patocka

On Sun, Jun 07, 2026 at 03:08:41PM +0200, Milan Broz wrote:

> ...
> Actually, integritysetup should check device size before activation...

I don't know about activation, but at least format does some kind of
check (delegated to the kernel, maybe ?): I used trial and errors to
confirm the calculation (running `integritysetup format` resizing the
metadata device between each attempts) and by resizing below a certain
threshold, I obtained every time a error.

I did not write it down (the error message) but it didn't hint to the
size of the metadata device at all, it was only clear because I only
changed the size between two attempts.

-- 
Max Gautier

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-08  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01  7:50 dm-integrity: estimate the size needed for separate integrity device Max Gautier
2026-06-07 13:08 ` Milan Broz
2026-06-08  7:05   ` Max Gautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox