Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933297AbcJUNRJ (ORCPT ); Fri, 21 Oct 2016 09:17:09 -0400 Received: from b.ns.miles-group.at ([95.130.255.144]:44724 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933011AbcJUNRH (ORCPT ); Fri, 21 Oct 2016 09:17:07 -0400 Subject: Re: [PATCH 01/26] fscrypto: Add buffer operations To: Christoph Hellwig References: <1477054121-10198-1-git-send-email-richard@nod.at> <1477054121-10198-2-git-send-email-richard@nod.at> <20161021130558.GA2411@infradead.org> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dedekind1@gmail.com, adrian.hunter@intel.com, tytso@mit.edu, jaegeuk@kernel.org, david@sigma-star.at, wd@denx.de, sbabic@denx.de, dengler@linutronix.de From: Richard Weinberger Message-ID: <9c80d1d0-0237-606f-91ce-a004c3694aa5@nod.at> Date: Fri, 21 Oct 2016 15:17:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <20161021130558.GA2411@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 28 Christoph, On 21.10.2016 15:05, Christoph Hellwig wrote: > On Fri, Oct 21, 2016 at 02:48:16PM +0200, Richard Weinberger wrote: >> Not all filesystems operate on pages, therefore offer >> operations to en/decrypt buffers. >> Of course these buffers have to be allocated in a way such that >> the kernel crypto framework can work with them. > > Which means they need to be backed by the page allocator eventually. > I think we'd better off providing the pages from ubifs from the API > point of view. What are the issues with doing that? > UBIFS works on kmalloc()'ed buffers where it constructs the NAND/NOR pages which will be written to the MTD. JFFS2 does the same. So you suggest obtaining the struct page from the kmalloc()'ed buffer and feeding it into fscrypto? This should work too. I found the buffer operations approach more suitable. Another reason why I did the buffer functions is because fscrypt_encrypt_page() always allocates a bounce page as temporary memory. For ext4 this is needed, for UBIFS not. UBIFS has already a construction buffer, especially since it also does compression. Thanks, //richard