Skip to content

Commit 90cd33d

Browse files
committed
erofs: convert z_erofs_read_fragment() to folios
Just a straight-forward conversion. No logic changes. Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1a4821a commit 90cd33d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/erofs/zdata.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ static void z_erofs_pcluster_end(struct z_erofs_decompress_frontend *fe)
925925
fe->pcl = NULL;
926926
}
927927

928-
static int z_erofs_read_fragment(struct super_block *sb, struct page *page,
928+
static int z_erofs_read_fragment(struct super_block *sb, struct folio *folio,
929929
unsigned int cur, unsigned int end, erofs_off_t pos)
930930
{
931931
struct inode *packed_inode = EROFS_SB(sb)->packed_inode;
@@ -938,14 +938,13 @@ static int z_erofs_read_fragment(struct super_block *sb, struct page *page,
938938

939939
buf.mapping = packed_inode->i_mapping;
940940
for (; cur < end; cur += cnt, pos += cnt) {
941-
cnt = min_t(unsigned int, end - cur,
942-
sb->s_blocksize - erofs_blkoff(sb, pos));
941+
cnt = min(end - cur, sb->s_blocksize - erofs_blkoff(sb, pos));
943942
src = erofs_bread(&buf, pos, EROFS_KMAP);
944943
if (IS_ERR(src)) {
945944
erofs_put_metabuf(&buf);
946945
return PTR_ERR(src);
947946
}
948-
memcpy_to_page(page, cur, src, cnt);
947+
memcpy_to_folio(folio, cur, src, cnt);
949948
}
950949
erofs_put_metabuf(&buf);
951950
return 0;
@@ -959,7 +958,7 @@ static int z_erofs_scan_folio(struct z_erofs_decompress_frontend *fe,
959958
const loff_t offset = folio_pos(folio);
960959
const unsigned int bs = i_blocksize(inode), fs = folio_size(folio);
961960
bool tight = true, exclusive;
962-
unsigned int cur, end, len, split;
961+
unsigned int cur, end, split;
963962
int err = 0;
964963

965964
z_erofs_onlinefolio_init(folio);
@@ -989,9 +988,9 @@ static int z_erofs_scan_folio(struct z_erofs_decompress_frontend *fe,
989988
if (map->m_flags & EROFS_MAP_FRAGMENT) {
990989
erofs_off_t fpos = offset + cur - map->m_la;
991990

992-
len = min_t(unsigned int, map->m_llen - fpos, end - cur);
993-
err = z_erofs_read_fragment(inode->i_sb, &folio->page, cur,
994-
cur + len, EROFS_I(inode)->z_fragmentoff + fpos);
991+
err = z_erofs_read_fragment(inode->i_sb, folio, cur,
992+
cur + min(map->m_llen - fpos, end - cur),
993+
EROFS_I(inode)->z_fragmentoff + fpos);
995994
if (err)
996995
goto out;
997996
tight = false;

0 commit comments

Comments
 (0)