Skip to content

Commit c34a8b0

Browse files
taigerhugregkh
authored andcommitted
erofs: remove the member readahead from struct z_erofs_decompress_frontend
[ Upstream commit ef4b4b46c6aaf8edeea9a79320627fe10993f153 ] The struct member is only used to add REQ_RAHEAD during I/O submission. So it is cleaner to pass it as a parameter than keep it in the struct. Also, rename function z_erofs_get_sync_decompress_policy() to z_erofs_is_sync_decompress() for better clarity and conciseness. Signed-off-by: Yue Hu <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]> Stable-dep-of: 99f7619a77a0 ("erofs: fix to add missing tracepoint in erofs_read_folio()") Signed-off-by: Sasha Levin <[email protected]>
1 parent 91fa560 commit c34a8b0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

fs/erofs/zdata.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ struct z_erofs_decompress_frontend {
407407
z_erofs_next_pcluster_t owned_head;
408408
enum z_erofs_pclustermode mode;
409409

410-
bool readahead;
411410
/* used for applying cache strategy on the fly */
412411
bool backmost;
413412
erofs_off_t headoffset;
@@ -949,7 +948,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
949948
return err;
950949
}
951950

952-
static bool z_erofs_get_sync_decompress_policy(struct erofs_sb_info *sbi,
951+
static bool z_erofs_is_sync_decompress(struct erofs_sb_info *sbi,
953952
unsigned int readahead_pages)
954953
{
955954
/* auto: enable for read_folio, disable for readahead */
@@ -1482,7 +1481,7 @@ static void z_erofs_decompressqueue_endio(struct bio *bio)
14821481
static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
14831482
struct page **pagepool,
14841483
struct z_erofs_decompressqueue *fgq,
1485-
bool *force_fg)
1484+
bool *force_fg, bool readahead)
14861485
{
14871486
struct super_block *sb = f->inode->i_sb;
14881487
struct address_space *mc = MNGD_MAPPING(EROFS_SB(sb));
@@ -1568,7 +1567,7 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
15681567
bio->bi_iter.bi_sector = (sector_t)cur <<
15691568
(sb->s_blocksize_bits - 9);
15701569
bio->bi_private = q[JQ_SUBMIT];
1571-
if (f->readahead)
1570+
if (readahead)
15721571
bio->bi_opf |= REQ_RAHEAD;
15731572
++nr_bios;
15741573
}
@@ -1604,13 +1603,13 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f,
16041603
}
16051604

16061605
static void z_erofs_runqueue(struct z_erofs_decompress_frontend *f,
1607-
struct page **pagepool, bool force_fg)
1606+
struct page **pagepool, bool force_fg, bool ra)
16081607
{
16091608
struct z_erofs_decompressqueue io[NR_JOBQUEUES];
16101609

16111610
if (f->owned_head == Z_EROFS_PCLUSTER_TAIL)
16121611
return;
1613-
z_erofs_submit_queue(f, pagepool, io, &force_fg);
1612+
z_erofs_submit_queue(f, pagepool, io, &force_fg, ra);
16141613

16151614
/* handle bypass queue (no i/o pclusters) immediately */
16161615
z_erofs_decompress_queue(&io[JQ_BYPASS], pagepool);
@@ -1708,8 +1707,8 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
17081707
(void)z_erofs_collector_end(&f);
17091708

17101709
/* if some compressed cluster ready, need submit them anyway */
1711-
z_erofs_runqueue(&f, &pagepool,
1712-
z_erofs_get_sync_decompress_policy(sbi, 0));
1710+
z_erofs_runqueue(&f, &pagepool, z_erofs_is_sync_decompress(sbi, 0),
1711+
false);
17131712

17141713
if (err)
17151714
erofs_err(inode->i_sb, "failed to read, err [%d]", err);
@@ -1727,7 +1726,6 @@ static void z_erofs_readahead(struct readahead_control *rac)
17271726
struct page *pagepool = NULL, *head = NULL, *page;
17281727
unsigned int nr_pages;
17291728

1730-
f.readahead = true;
17311729
f.headoffset = readahead_pos(rac);
17321730

17331731
z_erofs_pcluster_readmore(&f, rac, f.headoffset +
@@ -1758,7 +1756,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
17581756
(void)z_erofs_collector_end(&f);
17591757

17601758
z_erofs_runqueue(&f, &pagepool,
1761-
z_erofs_get_sync_decompress_policy(sbi, nr_pages));
1759+
z_erofs_is_sync_decompress(sbi, nr_pages), true);
17621760
erofs_put_metabuf(&f.map.buf);
17631761
erofs_release_pages(&pagepool);
17641762
}

0 commit comments

Comments
 (0)