From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59658 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933767AbeALOK3 (ORCPT ); Fri, 12 Jan 2018 09:10:29 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0CE9pCv010659 for ; Fri, 12 Jan 2018 09:10:29 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fewx0jt3q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 12 Jan 2018 09:10:28 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jan 2018 07:10:28 -0700 From: Chandan Rajendra To: linux-ext4@vger.kernel.org Cc: Chandan Rajendra , linux-fsdevel@vger.kernel.org, tytso@mit.edu Subject: [RFC PATCH 1/8] ext4: use EXT4_INODE_ENCRYPT flag to detect encrypted bio Date: Fri, 12 Jan 2018 19:41:22 +0530 In-Reply-To: <20180112141129.27507-1-chandan@linux.vnet.ibm.com> References: <20180112141129.27507-1-chandan@linux.vnet.ibm.com> Message-Id: <20180112141129.27507-2-chandan@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: For supporting encryption in blocksize < pagesize scenario, bio->bi_private field will be needed to hold the address of the encryption context structure. Hence this commit uses ext4_encrypted_inode() to detect the encryption status of a file. Signed-off-by: Chandan Rajendra --- fs/ext4/readpage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 9ffa6fa..0be590b 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -50,7 +50,13 @@ static inline bool ext4_bio_encrypted(struct bio *bio) { #ifdef CONFIG_EXT4_FS_ENCRYPTION - return unlikely(bio->bi_private != NULL); + if (bio->bi_vcnt) { + struct inode *inode = bio->bi_io_vec->bv_page->mapping->host; + if (ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode)) + return true; + } + + return false; #else return false; #endif -- 2.9.5