Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp148415ybh; Mon, 20 Jul 2020 12:41:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8HXn509Cji5s1tF4yNM+X3fmZf/NiTqSyP+ZnI+YtsJIp9oo3f6CjlQkO/zDS2Jl5jnbS X-Received: by 2002:a17:906:7005:: with SMTP id n5mr20974760ejj.130.1595274061526; Mon, 20 Jul 2020 12:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595274061; cv=none; d=google.com; s=arc-20160816; b=OS1YzG3ZaKAIq+vRAIJKHoQJaKd7QE4EgTLy89QRint8Erc0pOgo/VwYAUyMKIgRYX FXgjWlVpX0SQjrwgJcrWaLx8Y/ZK3RKUV1EdIX2dy/Be0rTdQKXKL3axpuHETSdSUZGa zLmNU1zljBon3FFJO7DJW1GpcoLzneBYPaaAdCBgOnE7k9LqCud4EvfS7WHcBAgEju+F E1YPveENX7MVQCHVslIT7dG+CjgQJppINDMhgG8whdrTcC+7WESBdVKcYwfKt7gfVcwY hcVVPLtXhJOrSNVLDenwKQ7pBxtIPMsoJkq6ixAJfe93aJSjGWXz7l2soCShjncyhkuO Irvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Y6BVDpL52lCgALkuLLIFKysM/ajhZN7Q5+fbXzkSpik=; b=l02zdgYl+L/WIDBsHzxiid2MnlRdPOsXSmHL5TSulTHd89waNmtjOesnEm1aqLVc4P W+VNK4ju7yOvZdmYQlZOKEWHidsrMmjqCgo6iKCl1Os3aAI0B8OhP7DqkAj0t1Ooai9k 1Qp0bmCe5jxjnR+zQ/dCUY3WWUNJpPLd4Trkppmce+yaalgdGs2d6OA1VZBD29J1ceWV tbAznUj7v51K6XPZVRscsg4BagCaIyksW6eD8t7tSUUfBkv2YuppsLj2lJK46ZCffPg1 49cNB8mz/zAdwUUn1lstK8pYrXtdDaf23wKUaQenRLOJQscqhFJsTC4al3ShtjGkMAkB FfFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xintglz7; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds12si9479479ejc.147.2020.07.20.12.40.37; Mon, 20 Jul 2020 12:41:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xintglz7; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729445AbgGTTkd (ORCPT + 99 others); Mon, 20 Jul 2020 15:40:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:54794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgGTTkd (ORCPT ); Mon, 20 Jul 2020 15:40:33 -0400 Received: from gmail.com (unknown [104.132.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 328B920672; Mon, 20 Jul 2020 19:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595274032; bh=lAH/pO7NHoNYrDfJluSLCpW3uOX8+hweYMlfZ1rH62Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xintglz7XrZi1QsSOvZaC1N4Gx4Y0EBpdxbtteU3G7LoI/O6Cy9epxk2ektQ5pK1I GmAWXF+s74OAODL31vHTzmZ8JGtJHWc/hpKps/NK/BV+9jEoO69bK7NXwh9vKWQBjG bEHvuN4oIUxfjPkvNMRfQ6Ba/4N/GAqUL3xNfgq8= Date: Mon, 20 Jul 2020 12:40:30 -0700 From: Eric Biggers To: Satya Tangirala Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v3 7/7] fscrypt: update documentation for direct I/O support Message-ID: <20200720194030.GI1292162@gmail.com> References: <20200717014540.71515-1-satyat@google.com> <20200717014540.71515-8-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200717014540.71515-8-satyat@google.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Jul 17, 2020 at 01:45:40AM +0000, Satya Tangirala wrote: > Update fscrypt documentation to reflect the addition of direct I/O support > and document the necessary conditions for direct I/O on encrypted files. > > Signed-off-by: Satya Tangirala > --- > Documentation/filesystems/fscrypt.rst | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst > index f3d87a1a0a7f..95c76a5f0567 100644 > --- a/Documentation/filesystems/fscrypt.rst > +++ b/Documentation/filesystems/fscrypt.rst > @@ -1049,8 +1049,10 @@ astute users may notice some differences in behavior: > may be used to overwrite the source files but isn't guaranteed to be > effective on all filesystems and storage devices. > > -- Direct I/O is not supported on encrypted files. Attempts to use > - direct I/O on such files will fall back to buffered I/O. > +- Direct I/O is supported on encrypted files only under some circumstances > + (see `Direct I/O support`_ for details). When these circumstances are not > + met, attempts to use direct I/O on such files will fall back to buffered > + I/O. Nit: "such files" => "encrypted files". Nit: most of the text in this file is formatted with textwidth=70. > > - The fallocate operations FALLOC_FL_COLLAPSE_RANGE and > FALLOC_FL_INSERT_RANGE are not supported on encrypted files and will > @@ -1257,6 +1259,20 @@ without the key is subject to change in the future. It is only meant > as a way to temporarily present valid filenames so that commands like > ``rm -r`` work as expected on encrypted directories. > > +Direct I/O support > +------------------ > + > +Direct I/O on encrypted files is supported through blk-crypto. In > +particular, this means the kernel must have CONFIG_BLK_INLINE_ENCRYPTION > +enabled, the filesystem must have had the 'inlinecrypt' mount option > +specified, and either hardware inline encryption must be present, or > +CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK must have been enabled. Further, > +any I/O must be aligned to the filesystem block size (*not* necessarily > +the same as the block device's block size) - in particular, any userspace > +buffer into which data is read/written from must also be aligned to the > +filesystem block size. If any of these conditions isn't met, attempts to do > +direct I/O on an encrypted file will fall back to buffered I/O. This is placing "Direct I/O support" as a subsection of the "Implementation details" section. But the direct I/O support is more than just an implementation detail. How about moving it to a top-level section? I'd probably put it between "Access semantics" and "Encryption policy enforcement". - Eric