Skip to content

Commit 30fb1a3

Browse files
hsiangkaogregkh
authored andcommitted
erofs: get rid of {get,put}_page() for ztailpacking data
[ Upstream commit 96debe8 ] The compressed data for the ztailpacking feature is fetched from the metadata inode (e.g., bd_inode), which is folio-based. Therefore, the folio interface should be used instead. Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20250626085459.339830-1-hsiangkao@linux.alibaba.com Stable-dep-of: 131897c ("erofs: fix invalid algorithm for encoded extents") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9f0e225 commit 30fb1a3

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

fs/erofs/zdata.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ static int z_erofs_pcluster_begin(struct z_erofs_frontend *fe)
805805
struct erofs_map_blocks *map = &fe->map;
806806
struct super_block *sb = fe->inode->i_sb;
807807
struct z_erofs_pcluster *pcl = NULL;
808+
void *ptr;
808809
int ret;
809810

810811
DBG_BUGON(fe->pcl);
@@ -854,15 +855,13 @@ static int z_erofs_pcluster_begin(struct z_erofs_frontend *fe)
854855
/* bind cache first when cached decompression is preferred */
855856
z_erofs_bind_cache(fe);
856857
} else {
857-
void *mptr;
858-
859-
mptr = erofs_read_metabuf(&map->buf, sb, map->m_pa, false);
860-
if (IS_ERR(mptr)) {
861-
ret = PTR_ERR(mptr);
858+
ptr = erofs_read_metabuf(&map->buf, sb, map->m_pa, false);
859+
if (IS_ERR(ptr)) {
860+
ret = PTR_ERR(ptr);
862861
erofs_err(sb, "failed to get inline data %d", ret);
863862
return ret;
864863
}
865-
get_page(map->buf.page);
864+
folio_get(page_folio(map->buf.page));
866865
WRITE_ONCE(fe->pcl->compressed_bvecs[0].page, map->buf.page);
867866
fe->pcl->pageofs_in = map->m_pa & ~PAGE_MASK;
868867
fe->mode = Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE;
@@ -1325,9 +1324,8 @@ static int z_erofs_decompress_pcluster(struct z_erofs_backend *be, int err)
13251324

13261325
/* must handle all compressed pages before actual file pages */
13271326
if (pcl->from_meta) {
1328-
page = pcl->compressed_bvecs[0].page;
1327+
folio_put(page_folio(pcl->compressed_bvecs[0].page));
13291328
WRITE_ONCE(pcl->compressed_bvecs[0].page, NULL);
1330-
put_page(page);
13311329
} else {
13321330
/* managed folios are still left in compressed_bvecs[] */
13331331
for (i = 0; i < pclusterpages; ++i) {

0 commit comments

Comments
 (0)