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 <chandan@xxxxxxxxxxxxxxxxxx> --- 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