Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp277559ybh; Mon, 20 Jul 2020 16:39:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUSILYQFM1xYn5C0cflCMLfeRfDA0ZKJDHcktW8JifyuVEnAp/Ws5G+MfsSLKa5oiWrE9J X-Received: by 2002:a17:906:40cb:: with SMTP id a11mr21962448ejk.340.1595288343330; Mon, 20 Jul 2020 16:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595288343; cv=none; d=google.com; s=arc-20160816; b=SKvsgp9NzIAbzZKWIQVfjoncKCADCUZEazjB/SUmg9zosPh7KTYUKI6UmjHD57oCBN t8Tcemlf7V5fwpTHE9gEoPceZh3h73o3CujW1Ai2kBn70ngULXs0XJ21nv3yAnfrayIP /6UDiqMuXDWfJ9t3AU38GAyyehtTt7P6M/BRb2xUbtcYD5iYmhZfU2TmcYJdNCWkPWHa Hos+XyqAeIuurUokS7ZaaE66qBKLypPcTyNTXpMdd25aRCbfEmgjC2uYwkmANQY7i58z VvnP10e3k79/Hr4Yvxm8DiM6Sh1qNPTn74NPwVVltCueTddd2kQIL2UhiEH0RA6di4RI jOkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=ORAQciKgJGVxLPMl88O8FRaS7Y2vfgBBYDIN8L834Cw=; b=zoKXVp000DRwxKsw4lt/Ko62aAP7bjFZaf0nQW9LPUxEDdpKfq+Fgdix3YPRpZMRY+ /GPD4l/IsVK5AgKhLPWodSZ0A0+er62R0lkoeFLWR6egT3SBa3CHXVzpbOMbqEHuquVG Y3KqywI2vw4tVXEqepUYaEg606JyT3KJz2Xchfif1Gx0FaJNaEgPyNkHBNGkw93dAkFF tPrP0g1dMKWfepmpDG4vgDnSrepnxuXZeNbbN4yYpOwoqEVIgGjtwDf1K3HnMZxeH9rl aS/YkOUzn6yArXsYezA6hUsfq3ReViWnpG3agc0yI3njVwnFXPwFWW2PiGgbq+4OMWAw cnAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lw5TetxA; 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 c2si11859809edq.228.2020.07.20.16.38.40; Mon, 20 Jul 2020 16:39:03 -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=lw5TetxA; 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 S1728161AbgGTXiA (ORCPT + 99 others); Mon, 20 Jul 2020 19:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728098AbgGTXhv (ORCPT ); Mon, 20 Jul 2020 19:37:51 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168D5C0619D5 for ; Mon, 20 Jul 2020 16:37:51 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id q5so11341069plr.14 for ; Mon, 20 Jul 2020 16:37:51 -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=ORAQciKgJGVxLPMl88O8FRaS7Y2vfgBBYDIN8L834Cw=; b=lw5TetxAIlCI7U6av5shkKyjO6ThYv7yDbySa3SgWcGSwSgPPaWjP++XkjFPG4OI6Z zWsLpvD626keD3tI0jFOivGvaW9+0l5eZ4l7hYSrpPYOPlwsi9MGB5ODpbI/7AA04Zb6 tCC6woja7XRBkrAJHy6DcRwqP6vgX9nv2QZPhmI0hiNoTeqEbeuJdvn+TgYDZ0U60y3g wohrCT9NyZKibcZkl+RWiaSOHqiofv/sVgqViMF4tlhAtCQWBZ6HI7L1fDpq7bbcky5t iAtFFwrxXVO/FU54Nfq5i3XKHkcF5DMzbZKLz73/s51/PlZliyzBh0FjxR+L3S2QGwsQ HjDw== 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=ORAQciKgJGVxLPMl88O8FRaS7Y2vfgBBYDIN8L834Cw=; b=HYNQ+G5HfG2ru2MbR5ORsDDVx2LazV+RzjpJsneJzUrw6m3flhd3ZXOs30mmQwxRQ+ cdhyncxnA2mrbACv7K5upeH2VkwrcL9xd3xkNmJ64oM7Gow2X5vvnCPbQ1MGQkAtKXVc UZsRYIsRetIuo7AvRY/KegAtX/y2bedpaNIbOvLpZMXGf9UWa7qprIG2UPAT/hiSQbVZ CAkjvt+PuBGpGFovlGD04fvKselgS0g/HStDYxpTah6WSweWjDSCjzw9uRJNDa75LCSB Nsg9JIiDUVWl1gWI7xKc/OAX7IsuF3FrLY9zSlsrfR3231MZiDjbXfwGrHUnPrdSMKV/ dgAA== X-Gm-Message-State: AOAM532TeW5Ne0/ze6j9ThCyho+hU9RHW06TK7zY5GZEQvEQf7XxGNPw GyH6BOfomPfb2hmH7wHL1U98PiTOJsk= X-Received: by 2002:a17:90b:358e:: with SMTP id mm14mr1889035pjb.54.1595288270643; Mon, 20 Jul 2020 16:37:50 -0700 (PDT) Date: Mon, 20 Jul 2020 23:37:37 +0000 In-Reply-To: <20200720233739.824943-1-satyat@google.com> Message-Id: <20200720233739.824943-6-satyat@google.com> Mime-Version: 1.0 References: <20200720233739.824943-1-satyat@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH v4 5/7] f2fs: support direct I/O with fscrypt using blk-crypto From: Satya Tangirala To: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org Cc: linux-xfs@vger.kernel.org, Eric Biggers , Satya Tangirala Content-Type: text/plain; charset="UTF-8" Sender: linux-ext4-owner@vger.kernel.org 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 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 --- 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 b35a50f4953c..978130b5a195 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4082,7 +4082,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.28.0.rc0.105.gf9edc3c819-goog