Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1632521ybh; Thu, 16 Jul 2020 18:36:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx00R0A00yfvZp56CC1B6fEyf5jJXAWC4DT2t4yA5+v5k6626bV/J5xSHTJafNieHItjY1D X-Received: by 2002:a50:8143:: with SMTP id 61mr7189137edc.202.1594949770718; Thu, 16 Jul 2020 18:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594949770; cv=none; d=google.com; s=arc-20160816; b=R1PoDUs1e4kWx6WR9i5956wmSo534DTh6OB3+Zssse1REHAS7u9+iOij8nx3pECOgb wPBPf5T2LOv635cidbZOFQ71mJ3tAU7fuM1x/aM5SmGRKxQmpM74wh7uzGQLDLXvqwB/ MYrDjhNm6L+RCMHQcC/xJ9WKi4+h2JDY681Ku/gdebOqBsY3WJL+hz8Rtz4psLrKjRQc eqG/11vb10oBKQPdYUs3w8rQgnTik1g4ds3q6WXVpWULQGmZ10opzLAXHs+A6yHbz2T3 AsmjNKWsO46EylKL507GZh9I2Z4qeqn+8gM/9c5He1w18EFOR5euStHhzEIW951RC0jZ atFg== 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=EGfUSkd3PX04sac8ZrIh0PsfCbpmGciCE9wmbT6iFlz8DZho2QuVM+i6gJhdKoxt9n RwfX0wIN5lTPKmmnqs597EBuP08n0zpE3H7wluvD5Pr9XKlObNblGETTEntlqXkJ6cUq 1yAgh4awvp8FpscqpdfOQvTg1wtFkJdb1hmrje7LQoTsIL8JBtrfvJoPdvfiCj29Ltpg +bmTOjlRpFB1F7LvbVC0Oz5zUH+V35Sif1QI+0QMjoCT23YFfP8YCMwfaFDmkRMOkwVi KVFigHMCGcHiRD9tI/ohmj8AkvaNfIxuw+I7zuV4vjr/M6QGUTg+ie2KVE0jPepqXf1T U7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oxCwlxw8; 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 oa24si4112882ejb.571.2020.07.16.18.35.47; Thu, 16 Jul 2020 18:36:10 -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=oxCwlxw8; 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 S1726975AbgGQBfg (ORCPT + 99 others); Thu, 16 Jul 2020 21:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726858AbgGQBff (ORCPT ); Thu, 16 Jul 2020 21:35:35 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A74C061755 for ; Thu, 16 Jul 2020 18:35:35 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id i203so9510236yba.9 for ; Thu, 16 Jul 2020 18:35:35 -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=oxCwlxw8hiOmpc9dDE5VHP0nyw8uhX2w43IaKudLEwrXxdgnP120llEreKyOOyh1yb 1WL8Dz+vf62oDSYhDCJMemrgkfz8WYWqfwvE/k3RuBACwKsg9UN/b/70jtV8Bh5s5ZUl WrqxtcHQKHwvgHTdS5R/09Di9WRfeq7aFwIAp6PB4QWEH0TDZQQYq6ccRf0UpNNMbFFl k4ZGdek4wV3r5+sTAIYfuP/jWrOw9Pbl+P1VkdzDRNqXM7DL0BJSJwO91JPyC0vA5ApC ngAIgB1BKgaFCSFN5dAUqxUK11W1Cw9dSBzo0il3J6r3PmLNgtmOY/hVfrka9zORhpXj ZLCA== 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=mLUd5fjj103gLox+h33g6auHhKe0E8cBEIDC/GBbbPXbu6ORH9whK4Ip1Zuhr0/JZI QmkZ6dxW4n8sx9bVrHclS7hsHYHGVPq59VyFi+GaYLQWa/JJ76yRG9YfV0RmheJzOdq2 bC4xL+h3E01xdN/UorS4BK4RarYkJmhIH6iudOokZ9PZkolkh1er8/0V9I28p+EVBHMI oFHmwFgrrz0wtrZArE5Y3/3H2yy99GtGCa7rr9vYkhdZYEz5QQz40L2prWTCY9YpG4eV MWp9a9lYkC4/fmDfGhhsBHlLPGEupoaKiu3Nmi26in/agJvogt+2KXxFdbUUY0vRZr+o DCnw== X-Gm-Message-State: AOAM53237WR97s5wX0cgiJef3eZFI1BfQNQQKkhVZHKF7jaL8jWNp4Or Iq/jSCD8wTusMnCF3Kj2Asxtf5KbJjQ= X-Received: by 2002:a25:e790:: with SMTP id e138mr11127098ybh.114.1594949734407; Thu, 16 Jul 2020 18:35:34 -0700 (PDT) Date: Fri, 17 Jul 2020 01:35:16 +0000 In-Reply-To: <20200717013518.59219-1-satyat@google.com> Message-Id: <20200717013518.59219-6-satyat@google.com> Mime-Version: 1.0 References: <20200717013518.59219-1-satyat@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH v2 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