Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764399AbcLVJA3 (ORCPT ); Thu, 22 Dec 2016 04:00:29 -0500 Received: from helcar.hengli.com.au ([209.40.204.226]:55305 "EHLO helcar.apana.org.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752694AbcLVJA1 (ORCPT ); Thu, 22 Dec 2016 04:00:27 -0500 Date: Thu, 22 Dec 2016 16:59:27 +0800 From: Herbert Xu To: Binoy Jayan Cc: Milan Broz , Oded , Ofir , Arnd Bergmann , Mark Brown , Alasdair Kergon , "David S. Miller" , private-kwg@linaro.org, dm-devel@redhat.com, linux-crypto@vger.kernel.org, Rajendra , Linux kernel mailing list , linux-raid@vger.kernel.org, Shaohua Li , Mike Snitzer Subject: Re: dm-crypt optimization Message-ID: <20161222085927.GB2160@gondor.apana.org.au> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 31 On Thu, Dec 22, 2016 at 01:55:59PM +0530, Binoy Jayan wrote: > > > Support of bigger block sizes would be unsafe without additional mechanism that provides > > atomic writes of multiple sectors. Maybe it applies to 4k as well on some devices though...) > > Did you mean write to the crypto output buffers or the actual disk write? > I didn't quite understand how the block size for encryption affects atomic > writes as it is the block layer which handles them. As far as dm-crypt is, > concerned it just encrypts/decrypts a 'struct bio' instance and submits the IO > operation to the block layer. I think Milan's talking about increasing the real block size, which would obviously require the hardware to be able to write that out atomically, as otherwise it breaks the crypto. But if we can instead do the IV generation within the crypto API, then the block size won't be an issue at all. Because you can supply as many blocks as you want and they would be processed block-by-block. Now there is a disadvantage to this approach, and that is you have to wait for the whole thing to be encrypted before you can start doing the IO. I'm not sure how big a problem that is but if it is bad enough to affect performance, we can look into adding some form of partial completion to the crypto API. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt