mm/readahead: Fix for GKI

Fixes: c73d891d8e ("mm: optimize readahead for the file with fscrypt")
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I1db7d429e5ce34330d5c2d6737b520d3b6779977
This commit is contained in:
Tao Huang
2023-06-14 16:15:06 +08:00
parent 73b5dde370
commit d322685333

View File

@@ -27,7 +27,7 @@
#include "internal.h"
#ifdef CONFIG_ARCH_ROCKCHIP
#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI)
#include <linux/fscrypt.h>
#endif
@@ -291,7 +291,7 @@ void force_page_cache_ra(struct readahead_control *ractl,
struct address_space *mapping = ractl->mapping;
struct backing_dev_info *bdi = inode_to_bdi(mapping->host);
unsigned long max_pages, index;
#ifdef CONFIG_ARCH_ROCKCHIP
#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI)
bool force_lookahead = false;
#endif
@@ -305,7 +305,7 @@ void force_page_cache_ra(struct readahead_control *ractl,
*/
index = readahead_index(ractl);
max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages);
#ifdef CONFIG_ARCH_ROCKCHIP
#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI)
/* For files with fscrypt enabled, to allow IO and the encryption
* or decryption process to ping-pong, lookahead is forcibly enabled.
*/
@@ -319,7 +319,7 @@ void force_page_cache_ra(struct readahead_control *ractl,
if (this_chunk > nr_to_read)
this_chunk = nr_to_read;
ractl->_index = index;
#ifdef CONFIG_ARCH_ROCKCHIP
#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI)
if (force_lookahead)
do_page_cache_ra(ractl, this_chunk, this_chunk / 2);
else