From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BB7E3546C1; Mon, 13 Jul 2026 02:39:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783910392; cv=none; b=Wfk0vfgFdiv7e/GyYQNsZguyL3aEDAxisSXyow+7HphT2NvQz1/S7SkBHgT04EHRR+vT7v5S4ggg9i8P5O5sU1KHbn2OkG7JYGziEC/fSq9gYOqTrHPJ1HmtDZOCQ3hA41tIoe3GUbp1shuyXYzBHyTEw3YMXwctuaDva8zftTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783910392; c=relaxed/simple; bh=RHxIgbhBrruKkjLQj7tF6Os862sU/dl1dRXbzjsdxk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XFOc+508ojbEHGqtCdbdukt6WjP72/UcO6cQZH8v3SUZ/tqDe0LT/rewXACYGJfC1Smzwek7NJYMQmQs/gw3+bZwx4XYCZvfsTFZ3P2/pj8DyUqP3uTEvB6HvrT5K21PKAEXQDoQDGSCwCW4UdVuG0UUbB3Vp8XKB8djHlcvr1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ndaxoUNS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ndaxoUNS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F80F1F00A3F; Mon, 13 Jul 2026 02:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783910390; bh=bvixfnNTZ6JKiWa0QbNPZbAZZhqRDEEPo5VoHOqsM7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ndaxoUNS3+xgvoK9Pswmoy34DaNx2gPHFtz9XNSC7wvMdwS7EOmhKXETLVHy1lHpp NcZwZghkpTMmiVCQ/1Q+pzCHkQKAQvbRA1AkgyD9BWPl3h8rE9nELFCa6gYP+UlKXr q59Qz/UZEQGyMV1t0NGX+a7ChTA+kiEJWicY1sgxzzKrb1zBy6VqEGaCqpVDHBlVYC wLQ3obKg3JjMAGiXA8/HNamfUrcq86IuZsT/jVJAW4eUtrjhad15ac9mO0tqbyzUOH uCd+R+8mz0yrR2f3T6LtA/WUmuuVuiDsDH0C9rOuNc30w/3Gh3HfjrRfJlbE/NC0ga IWIHPnwWkOntQ== From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, Christoph Hellwig , Theodore Ts'o , Andreas Dilger , Baokun Li , Jan Kara , Ojaswin Mujoo , Ritesh Harjani , Zhang Yi , Jaegeuk Kim , Chao Yu , Eric Biggers Subject: [PATCH v3 12/17] fscrypt: Replace calls to fscrypt_inode_uses_inline_crypto() Date: Sun, 12 Jul 2026 22:37:03 -0400 Message-ID: <20260713023708.9245-13-ebiggers@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260713023708.9245-1-ebiggers@kernel.org> References: <20260713023708.9245-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Now that fscrypt's file contents en/decryption is always implemented using blk-crypto when the filesystem is block-based, the calls to fscrypt_inode_uses_inline_crypto() in fs/crypto/inline_crypt.c (which contains functions that are called only from block-based filesystems) are equivalent to checking whether the file is an encrypted regular file, i.e. fscrypt_needs_contents_encryption(). Use that instead. Reviewed-by: Christoph Hellwig Signed-off-by: Eric Biggers --- fs/crypto/inline_crypt.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c index 3a92bd57e3eb..685815fa71a6 100644 --- a/fs/crypto/inline_crypt.c +++ b/fs/crypto/inline_crypt.c @@ -228,8 +228,8 @@ static void fscrypt_generate_dun(const struct fscrypt_inode_info *ci, * @gfp_mask: memory allocation flags - these must be a waiting mask so that * bio_crypt_set_ctx can't fail. * - * If the contents of the file should be encrypted (or decrypted) with inline - * encryption, then assign the appropriate encryption context to the bio. + * If the contents of the file should be encrypted (or decrypted), then assign + * the appropriate encryption context to the bio. * * Normally the bio should be newly allocated (i.e. no pages added yet), as * otherwise fscrypt_mergeable_bio() won't work as intended. @@ -242,7 +242,7 @@ void fscrypt_set_bio_crypt_ctx(struct bio *bio, const struct inode *inode, const struct fscrypt_inode_info *ci; u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE]; - if (!fscrypt_inode_uses_inline_crypto(inode)) + if (!fscrypt_needs_contents_encryption(inode)) return; ci = fscrypt_get_inode_info_raw(inode); @@ -257,12 +257,12 @@ EXPORT_SYMBOL_GPL(fscrypt_set_bio_crypt_ctx); * @inode: the inode for the next part of the I/O * @pos: the next file position (in bytes) in the I/O * - * When building a bio which may contain data which should undergo inline - * encryption (or decryption) via fscrypt, filesystems should call this function - * to ensure that the resulting bio contains only contiguous data unit numbers. - * This will return false if the next part of the I/O cannot be merged with the - * bio because either the encryption key would be different or the encryption - * data unit numbers would be discontiguous. + * When building a bio which may contain data which should undergo encryption + * (or decryption) via fscrypt, filesystems should call this function to ensure + * that the resulting bio contains only contiguous data unit numbers. This will + * return false if the next part of the I/O cannot be merged with the bio + * because either the encryption key would be different or the encryption data + * unit numbers would be discontiguous. * * fscrypt_set_bio_crypt_ctx() must have already been called on the bio. * @@ -279,7 +279,7 @@ bool fscrypt_mergeable_bio(struct bio *bio, const struct inode *inode, const struct fscrypt_inode_info *ci; u64 next_dun[BLK_CRYPTO_DUN_ARRAY_SIZE]; - if (!!bc != fscrypt_inode_uses_inline_crypto(inode)) + if (!!bc != fscrypt_needs_contents_encryption(inode)) return false; if (!bc) return true; @@ -337,7 +337,7 @@ bool fscrypt_dio_supported(struct inode *inode) */ return false; } - return fscrypt_inode_uses_inline_crypto(inode); + return true; } EXPORT_SYMBOL_GPL(fscrypt_dio_supported); @@ -366,7 +366,7 @@ u64 fscrypt_limit_io_blocks(const struct inode *inode, u64 lblk, u64 nr_blocks) const struct fscrypt_inode_info *ci; u32 dun; - if (!fscrypt_inode_uses_inline_crypto(inode)) + if (!fscrypt_needs_contents_encryption(inode)) return nr_blocks; if (nr_blocks <= 1) -- 2.55.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA2C9C44508 for ; Mon, 13 Jul 2026 02:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=K6gRicOaJTjiwfjyh8DUJDrG28PHBBJ/Hf2MsoAcjyo=; b=k6KWJTpdaxqvqXNGFAPZw+5j+o eNsmF/QaG1SuSuPd7eye97s0L6xfqZvyff3WAhHCd93SCKNBdAUYsrTOkIaXr3F2ZSckvoFoGMTot iWxFzFGZ5+Gc5TN8ieyyKleDpiFYrycCDyolhpQO7tqWnl6JMQXvvdoc5zibL0GVYGHY=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wj6aL-0006dr-O0; Mon, 13 Jul 2026 02:39:58 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wj6aK-0006db-Hb for linux-f2fs-devel@lists.sourceforge.net; Mon, 13 Jul 2026 02:39:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bvixfnNTZ6JKiWa0QbNPZbAZZhqRDEEPo5VoHOqsM7s=; b=D2SWAbwKtR2N4lqEdmXbfumty6 B8hL2yeSSC+tn5uL7QW9V6l8/PYPkQkFQqGnH/1GJLN6sHVd+GzMW5z4gh4e80Y0+ozbS8jsocZOc HwNuhgBmdtq0aeAVui5JLYqlmoTzsNmN7n8MEcuOtyGyHqJEyVTKpszd96RPo3RzRmZ4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=bvixfnNTZ6JKiWa0QbNPZbAZZhqRDEEPo5VoHOqsM7s=; b=X1/gHh7Lo56RK6hcvFZsGkjwx9 wnymKsAJ47dVs3HsjXHlt3DwqoQAY9L3e1qlI4QRqEzZLxWfXuWX1Pj7nYb8kcPOhWXbptcHzHUJX CiGDd02HWvRG7wignq5ZlpY8kE40OJ1DVCD08AmKQu9z6/SQes4HyyUNODtVd8xmorU4=; Received: from sea.source.kernel.org ([172.234.252.31]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wj6aJ-0003C3-LY for linux-f2fs-devel@lists.sourceforge.net; Mon, 13 Jul 2026 02:39:57 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5FF994362D; Mon, 13 Jul 2026 02:39:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F80F1F00A3F; Mon, 13 Jul 2026 02:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783910390; bh=bvixfnNTZ6JKiWa0QbNPZbAZZhqRDEEPo5VoHOqsM7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ndaxoUNS3+xgvoK9Pswmoy34DaNx2gPHFtz9XNSC7wvMdwS7EOmhKXETLVHy1lHpp NcZwZghkpTMmiVCQ/1Q+pzCHkQKAQvbRA1AkgyD9BWPl3h8rE9nELFCa6gYP+UlKXr q59Qz/UZEQGyMV1t0NGX+a7ChTA+kiEJWicY1sgxzzKrb1zBy6VqEGaCqpVDHBlVYC wLQ3obKg3JjMAGiXA8/HNamfUrcq86IuZsT/jVJAW4eUtrjhad15ac9mO0tqbyzUOH uCd+R+8mz0yrR2f3T6LtA/WUmuuVuiDsDH0C9rOuNc30w/3Gh3HfjrRfJlbE/NC0ga IWIHPnwWkOntQ== To: linux-fscrypt@vger.kernel.org Date: Sun, 12 Jul 2026 22:37:03 -0400 Message-ID: <20260713023708.9245-13-ebiggers@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260713023708.9245-1-ebiggers@kernel.org> References: <20260713023708.9245-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1wj6aJ-0003C3-LY Subject: [f2fs-dev] [PATCH v3 12/17] fscrypt: Replace calls to fscrypt_inode_uses_inline_crypto() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eric Biggers via Linux-f2fs-devel Reply-To: Eric Biggers Cc: Ritesh Harjani , Theodore Ts'o , Zhang Yi , linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, Andreas Dilger , Ojaswin Mujoo , Baokun Li , Jaegeuk Kim , linux-fsdevel@vger.kernel.org, Jan Kara , linux-ext4@vger.kernel.org, Christoph Hellwig , Eric Biggers Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Now that fscrypt's file contents en/decryption is always implemented using blk-crypto when the filesystem is block-based, the calls to fscrypt_inode_uses_inline_crypto() in fs/crypto/inline_crypt.c (which contains functions that are called only from block-based filesystems) are equivalent to checking whether the file is an encrypted regular file, i.e. fscrypt_needs_contents_encryption(). Use that instead. Reviewed-by: Christoph Hellwig Signed-off-by: Eric Biggers --- fs/crypto/inline_crypt.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c index 3a92bd57e3eb..685815fa71a6 100644 --- a/fs/crypto/inline_crypt.c +++ b/fs/crypto/inline_crypt.c @@ -228,8 +228,8 @@ static void fscrypt_generate_dun(const struct fscrypt_inode_info *ci, * @gfp_mask: memory allocation flags - these must be a waiting mask so that * bio_crypt_set_ctx can't fail. * - * If the contents of the file should be encrypted (or decrypted) with inline - * encryption, then assign the appropriate encryption context to the bio. + * If the contents of the file should be encrypted (or decrypted), then assign + * the appropriate encryption context to the bio. * * Normally the bio should be newly allocated (i.e. no pages added yet), as * otherwise fscrypt_mergeable_bio() won't work as intended. @@ -242,7 +242,7 @@ void fscrypt_set_bio_crypt_ctx(struct bio *bio, const struct inode *inode, const struct fscrypt_inode_info *ci; u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE]; - if (!fscrypt_inode_uses_inline_crypto(inode)) + if (!fscrypt_needs_contents_encryption(inode)) return; ci = fscrypt_get_inode_info_raw(inode); @@ -257,12 +257,12 @@ EXPORT_SYMBOL_GPL(fscrypt_set_bio_crypt_ctx); * @inode: the inode for the next part of the I/O * @pos: the next file position (in bytes) in the I/O * - * When building a bio which may contain data which should undergo inline - * encryption (or decryption) via fscrypt, filesystems should call this function - * to ensure that the resulting bio contains only contiguous data unit numbers. - * This will return false if the next part of the I/O cannot be merged with the - * bio because either the encryption key would be different or the encryption - * data unit numbers would be discontiguous. + * When building a bio which may contain data which should undergo encryption + * (or decryption) via fscrypt, filesystems should call this function to ensure + * that the resulting bio contains only contiguous data unit numbers. This will + * return false if the next part of the I/O cannot be merged with the bio + * because either the encryption key would be different or the encryption data + * unit numbers would be discontiguous. * * fscrypt_set_bio_crypt_ctx() must have already been called on the bio. * @@ -279,7 +279,7 @@ bool fscrypt_mergeable_bio(struct bio *bio, const struct inode *inode, const struct fscrypt_inode_info *ci; u64 next_dun[BLK_CRYPTO_DUN_ARRAY_SIZE]; - if (!!bc != fscrypt_inode_uses_inline_crypto(inode)) + if (!!bc != fscrypt_needs_contents_encryption(inode)) return false; if (!bc) return true; @@ -337,7 +337,7 @@ bool fscrypt_dio_supported(struct inode *inode) */ return false; } - return fscrypt_inode_uses_inline_crypto(inode); + return true; } EXPORT_SYMBOL_GPL(fscrypt_dio_supported); @@ -366,7 +366,7 @@ u64 fscrypt_limit_io_blocks(const struct inode *inode, u64 lblk, u64 nr_blocks) const struct fscrypt_inode_info *ci; u32 dun; - if (!fscrypt_inode_uses_inline_crypto(inode)) + if (!fscrypt_needs_contents_encryption(inode)) return nr_blocks; if (nr_blocks <= 1) -- 2.55.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel