Skip to content

Commit 63bbb85

Browse files
committed
erofs: shouldn't churn the mapping page for duplicated copies
If other duplicated copies exist in one decompression shot, should leave the old page as is rather than replace it with the new duplicated one. Otherwise, the following cold path to deal with duplicated copies will use the invalid bvec. It impacts compressed data deduplication. Also, shift the onlinepage EIO bit to avoid touching the signed bit. Fixes: 267f249 ("erofs: introduce multi-reference pclusters (fully-referenced)") Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 664609e commit 63bbb85

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

fs/erofs/zdata.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,15 +888,13 @@ static void z_erofs_do_decompressed_bvec(struct z_erofs_decompress_backend *be,
888888

889889
if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK)) {
890890
unsigned int pgnr;
891-
struct page *oldpage;
892891

893892
pgnr = (bvec->offset + be->pcl->pageofs_out) >> PAGE_SHIFT;
894893
DBG_BUGON(pgnr >= be->nr_pages);
895-
oldpage = be->decompressed_pages[pgnr];
896-
be->decompressed_pages[pgnr] = bvec->page;
897-
898-
if (!oldpage)
894+
if (!be->decompressed_pages[pgnr]) {
895+
be->decompressed_pages[pgnr] = bvec->page;
899896
return;
897+
}
900898
}
901899

902900
/* (cold path) one pcluster is requested multiple times */

fs/erofs/zdata.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ static inline unsigned int z_erofs_pclusterpages(struct z_erofs_pcluster *pcl)
126126
}
127127

128128
/*
129-
* bit 31: I/O error occurred on this page
130-
* bit 0 - 30: remaining parts to complete this page
129+
* bit 30: I/O error occurred on this page
130+
* bit 0 - 29: remaining parts to complete this page
131131
*/
132-
#define Z_EROFS_PAGE_EIO (1 << 31)
132+
#define Z_EROFS_PAGE_EIO (1 << 30)
133133

134134
static inline void z_erofs_onlinepage_init(struct page *page)
135135
{

0 commit comments

Comments
 (0)