summaryrefslogtreecommitdiff
path: root/drivers/staging/erofs
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2018-11-23 01:21:48 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-23 10:53:08 +0100
commit2d9b5dcd99428f9b8faea7f76c3e30c37c32cc9c (patch)
tree57f8c12e6425e2eb00b93a1f0695d7fecf1ef4be /drivers/staging/erofs
parent23edf3abe7abb1d1ab856c893629b96209473a5b (diff)
staging: erofs: decompress asynchronously if PG_readahead page at first
For the case of nr_to_read == lookahead_size, it is better to decompress asynchronously as well since no page will be needed immediately. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs')
-rw-r--r--drivers/staging/erofs/unzip_vle.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
index 6aa3c989dd4e..fab907e0fe06 100644
--- a/drivers/staging/erofs/unzip_vle.c
+++ b/drivers/staging/erofs/unzip_vle.c
@@ -1345,8 +1345,8 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
{
struct inode *const inode = mapping->host;
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
- const bool sync = __should_decompress_synchronously(sbi, nr_pages);
+ bool sync = __should_decompress_synchronously(sbi, nr_pages);
struct z_erofs_vle_frontend f = VLE_FRONTEND_INIT(inode);
gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL);
struct page *head = NULL;
@@ -1364,6 +1364,13 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
prefetchw(&page->flags);
list_del(&page->lru);
+ /*
+ * A pure asynchronous readahead is indicated if
+ * a PG_readahead marked page is hitted at first.
+ * Let's also do asynchronous decompression for this case.
+ */
+ sync &= !(PageReadahead(page) && !head);
+
if (add_to_page_cache_lru(page, mapping, page->index, gfp)) {
list_add(&page->lru, &pagepool);
continue;