@@ -548,7 +548,6 @@ struct z_erofs_decompress_frontend {
548
548
z_erofs_next_pcluster_t owned_head ;
549
549
enum z_erofs_pclustermode mode ;
550
550
551
- bool readahead ;
552
551
/* used for applying cache strategy on the fly */
553
552
bool backmost ;
554
553
erofs_off_t headoffset ;
@@ -1104,7 +1103,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
1104
1103
return err ;
1105
1104
}
1106
1105
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 ,
1108
1107
unsigned int readahead_pages )
1109
1108
{
1110
1109
/* auto: enable for read_folio, disable for readahead */
@@ -1672,7 +1671,7 @@ static void z_erofs_decompressqueue_endio(struct bio *bio)
1672
1671
static void z_erofs_submit_queue (struct z_erofs_decompress_frontend * f ,
1673
1672
struct page * * pagepool ,
1674
1673
struct z_erofs_decompressqueue * fgq ,
1675
- bool * force_fg )
1674
+ bool * force_fg , bool readahead )
1676
1675
{
1677
1676
struct super_block * sb = f -> inode -> i_sb ;
1678
1677
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,
1763
1762
bio -> bi_iter .bi_sector = (sector_t )cur <<
1764
1763
(sb -> s_blocksize_bits - 9 );
1765
1764
bio -> bi_private = q [JQ_SUBMIT ];
1766
- if (f -> readahead )
1765
+ if (readahead )
1767
1766
bio -> bi_opf |= REQ_RAHEAD ;
1768
1767
++ nr_bios ;
1769
1768
}
@@ -1799,13 +1798,13 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
1799
1798
}
1800
1799
1801
1800
static 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 )
1803
1802
{
1804
1803
struct z_erofs_decompressqueue io [NR_JOBQUEUES ];
1805
1804
1806
1805
if (f -> owned_head == Z_EROFS_PCLUSTER_TAIL )
1807
1806
return ;
1808
- z_erofs_submit_queue (f , pagepool , io , & force_fg );
1807
+ z_erofs_submit_queue (f , pagepool , io , & force_fg , ra );
1809
1808
1810
1809
/* handle bypass queue (no i/o pclusters) immediately */
1811
1810
z_erofs_decompress_queue (& io [JQ_BYPASS ], pagepool );
@@ -1903,8 +1902,8 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
1903
1902
(void )z_erofs_collector_end (& f );
1904
1903
1905
1904
/* 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 );
1908
1907
1909
1908
if (err )
1910
1909
erofs_err (inode -> i_sb , "failed to read, err [%d]" , err );
@@ -1922,7 +1921,6 @@ static void z_erofs_readahead(struct readahead_control *rac)
1922
1921
struct page * pagepool = NULL , * head = NULL , * page ;
1923
1922
unsigned int nr_pages ;
1924
1923
1925
- f .readahead = true;
1926
1924
f .headoffset = readahead_pos (rac );
1927
1925
1928
1926
z_erofs_pcluster_readmore (& f , rac , f .headoffset +
@@ -1953,7 +1951,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
1953
1951
(void )z_erofs_collector_end (& f );
1954
1952
1955
1953
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 );
1957
1955
erofs_put_metabuf (& f .map .buf );
1958
1956
erofs_release_pages (& pagepool );
1959
1957
}
0 commit comments