summaryrefslogtreecommitdiffstats
path: root/drivers/staging/erofs/internal.h
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2018-09-20 00:06:56 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-20 12:25:36 +0200
commit5fb76bb04216fdbbee3fec544a0c16e990fefdfb (patch)
treec2f3baf642d671df6528ffc9cc21f6528ef48fb0 /drivers/staging/erofs/internal.h
parente5e3abbadf0dbd1068f64f8abe70401c5a178180 (diff)
downloadlinux-5fb76bb04216fdbbee3fec544a0c16e990fefdfb.tar.bz2
staging: erofs: cleanup `z_erofs_vle_normalaccess_readpages'
This patch introduces `__should_decompress_synchronously' to cleanup `z_erofs_vle_normalaccess_readpages'. Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs/internal.h')
-rw-r--r--drivers/staging/erofs/internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
index cfcc6db11cea..c2cc4a016d9e 100644
--- a/drivers/staging/erofs/internal.h
+++ b/drivers/staging/erofs/internal.h
@@ -95,6 +95,9 @@ struct erofs_sb_info {
/* the dedicated workstation for compression */
struct radix_tree_root workstn_tree;
+ /* threshold for decompression synchronously */
+ unsigned int max_sync_decompress_pages;
+
#ifdef EROFS_FS_HAS_MANAGED_CACHE
struct inode *managed_cache;
#endif
@@ -273,6 +276,14 @@ extern int erofs_try_to_free_cached_page(struct address_space *mapping,
struct page *page);
#endif
+#define DEFAULT_MAX_SYNC_DECOMPRESS_PAGES 3
+
+static inline bool __should_decompress_synchronously(struct erofs_sb_info *sbi,
+ unsigned int nr)
+{
+ return nr <= sbi->max_sync_decompress_pages;
+}
+
#endif
/* we strictly follow PAGE_SIZE and no buffer head yet */