Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1424167pxj; Fri, 4 Jun 2021 14:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzc18YF3N5V58r/7reZxChpZINWj3UqPKrUsjGNXQG/GRikmCivJQyd7TP75v5nKfAbLqqn X-Received: by 2002:a17:907:9047:: with SMTP id az7mr6091203ejc.4.1622841080605; Fri, 04 Jun 2021 14:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622841080; cv=none; d=google.com; s=arc-20160816; b=uyrWi3nruhFTojrFhP35sS73S0XwoQ2J37Y/phbfuW+/WVp61BHZO/YoODb3/hFrn+ 6sKD7iT50TGxlfBBIJC3asGSxiv44fNH2HiByERjjMmmJuON2G4SdvdxcYAZC5pYExnW ewCnUmLfxoDqo/PfqcwYY9Q+86+G6XoNH1tZFBFRJNVAs431U6zKn2Ci59xI95rPfyJ1 gQkiGy4pHPYDN1qxUJSxO6qdQDNpaKON7uqr5IQVwgS3+BHB0fn5Kj3evZwUsuX+d+I9 +ymhu07YGccaneELvArzQDPHFl0FPS138sY02IvGqdh5OFrHe+lrw3bxB9rN+RfW912i uTDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=P+DRV+1kr28zVJ/U3wDOfdSPd3HkANrRfuFzxqlC4Pc=; b=M3CTMXo5kQZM6mlOyWRVhblWCpkoVBstX08qP6DUmE9ErfB6uBLIiYNRFCKoqmdHlX WBSiwzV1RQc5AT2wbb0Z2V+eMMU0oY3wYfA5MT42szHv8QKU5/MA01FradjYphyvntPP HNkkPhqhtpPz3q6ocko2ALbyqUN3T+LuGQPaRPMVWSCkkaRVMqHB1UMw7/adwe8IhHaz EADhp1J4WeryEDZPcCSmar1UIQcHfr0dV6CIIkEgFlOf+F8JsO8+rNbnQ2qh9eHzUiSj 0tFH3ABrpfH/EGY1OvWVaPaqXYds/sR6XpbEfm+nZpnICMg2EjJUaInOSDt4TQ8t/8Go f+SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BD3ZmfBd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh8si6696671ejb.109.2021.06.04.14.10.56; Fri, 04 Jun 2021 14:11:20 -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=@google.com header.s=20161025 header.b=BD3ZmfBd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbhFDVLN (ORCPT + 99 others); Fri, 4 Jun 2021 17:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbhFDVLM (ORCPT ); Fri, 4 Jun 2021 17:11:12 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E55E1C061768 for ; Fri, 4 Jun 2021 14:09:25 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id o1-20020a17090a4201b029015c8f11f550so8369520pjg.5 for ; Fri, 04 Jun 2021 14:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=P+DRV+1kr28zVJ/U3wDOfdSPd3HkANrRfuFzxqlC4Pc=; b=BD3ZmfBd88tZgrK5VWyAdL43R8ifUsR8x6sFdE82nRuDKynYAWDrzE4ViAPmykHBE4 iyytiZIYdAESIcvzY6xdWybqTUGCNisGZiXWYfKieKbymZmV/yt7zvjY9NFl3juibb/s ikEDpwDO3GTB7QBr/5PZz/yTynDJQ+EVyDbqXYxqVspW4jHjr6GfHmb6aePCiI+9M6Vd nAWhQ+RRLTv2OXSWhOZSnRNx4+nvq3NfPSSnycc4sLlhRuBgnNb++2d32IlTONdzLlpM 5aRbbSRXEHIXxwZ6wYXd6/i1swYlGsa4c2M1WAwUuXtMLF2EffxUpGOmrT0pPALk2QKG mb2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=P+DRV+1kr28zVJ/U3wDOfdSPd3HkANrRfuFzxqlC4Pc=; b=Mwsx6UVhET9XAn8Xepr69Qx40icjbaPQPQGgQZO+4aK2zcaq/8AjH+2HHwMC3W68cj 2f3E+AaooOU32br3tJ4wfqXDYdNdGcONApvvZ3mpdUIpikC0qb3ITRIGCZzdEs5DfOUc TuIeopoeGM63ViUsihOIP4COIdniSDH04zIzJz/IGnkd72NsoGsMwLzhzhmhone1g8iI f+XJsVTZj67+VPqm7atGLrjwOr0s/COA2fn65QEqG/8Qjeqy7uMREHC6pri5I7dl3MKb 4ewVhsHtKU5PsJCleFXD+/YahsHKCiZha8/wErzpXvIebSgU6+kHi4wbuc9UOx3sWEN6 2SEA== X-Gm-Message-State: AOAM532gOBHq7CtMlo9CbDxzhHFKN8JywiIISHSr1lPbiQeLhChjVN/Z vFKwpXZcDKj6xo6+TOuZhGGpQTv8sG4= X-Received: from satyaprateek.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:1092]) (user=satyat job=sendgmr) by 2002:a63:1e55:: with SMTP id p21mr6828807pgm.412.1622840965137; Fri, 04 Jun 2021 14:09:25 -0700 (PDT) Date: Fri, 4 Jun 2021 21:09:07 +0000 In-Reply-To: <20210604210908.2105870-1-satyat@google.com> Message-Id: <20210604210908.2105870-9-satyat@google.com> Mime-Version: 1.0 References: <20210604210908.2105870-1-satyat@google.com> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog Subject: [PATCH v9 8/9] f2fs: support direct I/O with fscrypt using blk-crypto From: Satya Tangirala To: "Theodore Y . Ts'o" , Jaegeuk Kim , Eric Biggers , Chao Yu , Jens Axboe , "Darrick J . Wong" Cc: linux-kernel@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, Eric Biggers , Satya Tangirala Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Eric Biggers Wire up f2fs with fscrypt direct I/O support. direct I/O with fscrypt is only supported through blk-crypto (i.e. CONFIG_BLK_INLINE_ENCRYPTION must have been enabled, the 'inlinecrypt' mount option must have been specified, and either hardware inline encryption support must be present or CONFIG_BLK_INLINE_ENCYRPTION_FALLBACK must have been enabled). Further, direct I/O on encrypted files is only supported when the *length* of the I/O is aligned to the filesystem block size (which is *not* necessarily the same as the block device's block size). Signed-off-by: Eric Biggers Co-developed-by: Satya Tangirala Signed-off-by: Satya Tangirala Acked-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index c83d90125ebd..a416ea3a1a04 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4181,7 +4181,11 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, struct f2fs_sb_info *sbi = F2FS_I_SB(inode); int rw = iov_iter_rw(iter); - if (f2fs_post_read_required(inode)) + if (!fscrypt_dio_supported(iocb, iter)) + return true; + if (fsverity_active(inode)) + return true; + if (f2fs_compressed_file(inode)) return true; if (f2fs_is_multi_device(sbi)) return true; -- 2.32.0.rc1.229.g3e70b5a671-goog