Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

erofs: clean up preload_compressed_pages()

Rename preload_compressed_pages() as z_erofs_bind_cache()
since we're trying to prepare for adapting folios.

Also, add a comment for the gfp setting. No logic changes.

Link: https://lore.kernel.org/r/20220301194951.106227-2-hsiangkao@linux.alibaba.com
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

+10 -8
+10 -8
fs/erofs/zdata.c
··· 219 219 static struct page *z_pagemap_global[Z_EROFS_VMAP_GLOBAL_PAGES]; 220 220 static DEFINE_MUTEX(z_pagemap_global_lock); 221 221 222 - static void preload_compressed_pages(struct z_erofs_decompress_frontend *fe, 223 - struct address_space *mc, 224 - enum z_erofs_cache_alloctype type, 225 - struct page **pagepool) 222 + static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe, 223 + enum z_erofs_cache_alloctype type, 224 + struct page **pagepool) 226 225 { 226 + struct address_space *mc = MNGD_MAPPING(EROFS_I_SB(fe->inode)); 227 227 struct z_erofs_pcluster *pcl = fe->pcl; 228 228 bool standalone = true; 229 + /* 230 + * optimistic allocation without direct reclaim since inplace I/O 231 + * can be used if low memory otherwise. 232 + */ 229 233 gfp_t gfp = (mapping_gfp_mask(mc) & ~__GFP_DIRECT_RECLAIM) | 230 234 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN; 231 235 struct page **pages; ··· 707 703 WRITE_ONCE(fe->pcl->compressed_pages[0], fe->map.buf.page); 708 704 fe->mode = COLLECT_PRIMARY_FOLLOWED_NOINPLACE; 709 705 } else { 710 - /* preload all compressed pages (can change mode if needed) */ 706 + /* bind cache first when cached decompression is preferred */ 711 707 if (should_alloc_managed_pages(fe, sbi->opt.cache_strategy, 712 708 map->m_la)) 713 709 cache_strategy = TRYALLOC; 714 710 else 715 711 cache_strategy = DONTALLOC; 716 712 717 - preload_compressed_pages(fe, MNGD_MAPPING(sbi), 718 - cache_strategy, pagepool); 713 + z_erofs_bind_cache(fe, cache_strategy, pagepool); 719 714 } 720 - 721 715 hitted: 722 716 /* 723 717 * Ensure the current partial page belongs to this submit chain rather