Message ID | 20210707052943.3960-1-satyaprateek2357@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | ensure bios aren't split in middle of crypto data unit | expand |
On Tue, Jul 06, 2021 at 10:29:34PM -0700, Satya Tangirala wrote: > > Changes v3 => v4 > - Patch 4 in v3 has been removed (Eric points out it isn't required > without some of the changes in the device mapper patchset at > https://lore.kernel.org/linux-block/20210604210908.2105870-1-satyat@google.com/ > so I'll add this patch to that series instead. Wouldn't it make more sense to have the blk-crypto-fallback change in this series? My concern was just that it didn't make sense to have it split between the two patch series -- it seemed like one logical change. - Eric
On Fri, Jul 23, 2021 at 09:49:52AM -0700, Eric Biggers wrote: > On Tue, Jul 06, 2021 at 10:29:34PM -0700, Satya Tangirala wrote: > > > > Changes v3 => v4 > > - Patch 4 in v3 has been removed (Eric points out it isn't required > > without some of the changes in the device mapper patchset at > > https://lore.kernel.org/linux-block/20210604210908.2105870-1-satyat@google.com/ > > so I'll add this patch to that series instead. > > Wouldn't it make more sense to have the blk-crypto-fallback change in this > series? My concern was just that it didn't make sense to have it split between > the two patch series -- it seemed like one logical change. This series also doesn't actually remove the data_unit_size bvec alignment requirement from block/blk-crypto.c. Isn't that the main goal here? So I expected that it would be included. Unless there are special considerations here, I'd expect that all the block layer changes needed for the fscrypt direct I/O support would be in one patch series that could go in together, and then the patch series with the direct I/O support would be only filesystem layer changes. - Eric
On Tue, Jul 06, 2021 at 10:29:34PM -0700, Satya Tangirala wrote: > When a bio has an encryption context, its size must be aligned to its > crypto data unit size. A bio must not be split in the middle of a data > unit. Currently, bios are split at logical block boundaries, but a crypto > data unit size might be larger than the logical block size - e.g. a machine > could be using fscrypt (which uses 4K crypto data units) with an eMMC block > device with inline encryption hardware that has a logical block size of 512 > bytes. > > Right now, the only user of blk-crypto is fscrypt (on ext4 and f2fs), which > (currently) only submits bios where the size of each segment is a multiple > of data_unit_size. That happens to avoid most of the cases where bios > could be split in the middle of a data unit. However, when support for > direct I/O on encrypted files is added, or when support for filesystem > metadata encryption is added, it will be possible for bios to have segment > lengths that are multiples of the logical block size, but not multiples of > the crypto data unit size. So the block layer needs to start handling this > case appropriately. I'm still not sold on this case yet. sector size aligned I/O is an optional feature, and I don't think it is worth this overhead. And while file systems metadata can be smaller than the file system block size in a few cases (e.g. XFS log writes), that is usually an extra performance optimization and can be trivially disabled in mkfs.