@@ -548,7 +548,6 @@ struct z_erofs_decompress_frontend {
548548 z_erofs_next_pcluster_t owned_head ;
549549 enum z_erofs_pclustermode mode ;
550550
551- bool readahead ;
552551 /* used for applying cache strategy on the fly */
553552 bool backmost ;
554553 erofs_off_t headoffset ;
@@ -1104,7 +1103,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
11041103 return err ;
11051104}
11061105
1107- static bool z_erofs_get_sync_decompress_policy (struct erofs_sb_info * sbi ,
1106+ static bool z_erofs_is_sync_decompress (struct erofs_sb_info * sbi ,
11081107 unsigned int readahead_pages )
11091108{
11101109 /* auto: enable for read_folio, disable for readahead */
@@ -1672,7 +1671,7 @@ static void z_erofs_decompressqueue_endio(struct bio *bio)
16721671static void z_erofs_submit_queue (struct z_erofs_decompress_frontend * f ,
16731672 struct page * * pagepool ,
16741673 struct z_erofs_decompressqueue * fgq ,
1675- bool * force_fg )
1674+ bool * force_fg , bool readahead )
16761675{
16771676 struct super_block * sb = f -> inode -> i_sb ;
16781677 struct address_space * mc = MNGD_MAPPING (EROFS_SB (sb ));
@@ -1763,7 +1762,7 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
17631762 bio -> bi_iter .bi_sector = (sector_t )cur <<
17641763 (sb -> s_blocksize_bits - 9 );
17651764 bio -> bi_private = q [JQ_SUBMIT ];
1766- if (f -> readahead )
1765+ if (readahead )
17671766 bio -> bi_opf |= REQ_RAHEAD ;
17681767 ++ nr_bios ;
17691768 }
@@ -1799,13 +1798,13 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
17991798}
18001799
18011800static void z_erofs_runqueue (struct z_erofs_decompress_frontend * f ,
1802- struct page * * pagepool , bool force_fg )
1801+ struct page * * pagepool , bool force_fg , bool ra )
18031802{
18041803 struct z_erofs_decompressqueue io [NR_JOBQUEUES ];
18051804
18061805 if (f -> owned_head == Z_EROFS_PCLUSTER_TAIL )
18071806 return ;
1808- z_erofs_submit_queue (f , pagepool , io , & force_fg );
1807+ z_erofs_submit_queue (f , pagepool , io , & force_fg , ra );
18091808
18101809 /* handle bypass queue (no i/o pclusters) immediately */
18111810 z_erofs_decompress_queue (& io [JQ_BYPASS ], pagepool );
@@ -1903,8 +1902,8 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
19031902 (void )z_erofs_collector_end (& f );
19041903
19051904 /* if some compressed cluster ready, need submit them anyway */
1906- z_erofs_runqueue (& f , & pagepool ,
1907- z_erofs_get_sync_decompress_policy ( sbi , 0 ) );
1905+ z_erofs_runqueue (& f , & pagepool , z_erofs_is_sync_decompress ( sbi , 0 ),
1906+ false );
19081907
19091908 if (err )
19101909 erofs_err (inode -> i_sb , "failed to read, err [%d]" , err );
@@ -1922,7 +1921,6 @@ static void z_erofs_readahead(struct readahead_control *rac)
19221921 struct page * pagepool = NULL , * head = NULL , * page ;
19231922 unsigned int nr_pages ;
19241923
1925- f .readahead = true;
19261924 f .headoffset = readahead_pos (rac );
19271925
19281926 z_erofs_pcluster_readmore (& f , rac , f .headoffset +
@@ -1953,7 +1951,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
19531951 (void )z_erofs_collector_end (& f );
19541952
19551953 z_erofs_runqueue (& f , & pagepool ,
1956- z_erofs_get_sync_decompress_policy (sbi , nr_pages ));
1954+ z_erofs_is_sync_decompress (sbi , nr_pages ), true );
19571955 erofs_put_metabuf (& f .map .buf );
19581956 erofs_release_pages (& pagepool );
19591957}
0 commit comments