[dm-crypt] En/decrypting in multi-sector batches?

Milan Broz mbroz at redhat.com
Sun May 1 10:13:58 CEST 2011

On 04/29/2011 07:33 PM, Mandeep Singh Baines wrote:
> But isn't this what should happen? You're trying to do 512B direct I/O
> on a block device with a 4096B logical block size. The same error would
> happen if you tried to do 512B direct I/O on a disk with a 4096B
> logical block size. A portable user-space application should not
> assume a logical block size when using direct I/O.

Sure. But I just tried to point out that dmcrypt is adds
additional restrictions not related to real underlying device
sector size. 
Today it works in all situations because 512B is always atomic.

The encryption unit size must be part of configuration, it cannot
be automatically derived from page size of hw sector size.
(e.g. mount image of disk through loopback will switch to 512B sector).

I am not saying it is not possible to use larger block sizes,
probably one day it will happen but it requires more changes in advance.

(and btw dmcrypt and cryptsetup are friedly to native 4k drives already,
just encryption unit is still 512B)


More information about the dm-crypt mailing list