@@ -1202,34 +1202,27 @@ static int z_erofs_parse_in_bvecs(struct z_erofs_decompress_backend *be,
1202
1202
struct z_erofs_bvec * bvec = & pcl -> compressed_bvecs [i ];
1203
1203
struct page * page = bvec -> page ;
1204
1204
1205
- /* compressed pages ought to be present before decompressing */
1205
+ /* compressed data ought to be valid before decompressing */
1206
1206
if (!page ) {
1207
- DBG_BUGON ( 1 ) ;
1207
+ err = - EIO ;
1208
1208
continue ;
1209
1209
}
1210
1210
be -> compressed_pages [i ] = page ;
1211
1211
1212
- if (z_erofs_is_inline_pcluster (pcl )) {
1212
+ if (z_erofs_is_inline_pcluster (pcl ) ||
1213
+ erofs_page_is_managed (EROFS_SB (be -> sb ), page )) {
1213
1214
if (!PageUptodate (page ))
1214
1215
err = - EIO ;
1215
1216
continue ;
1216
1217
}
1217
1218
1218
1219
DBG_BUGON (z_erofs_page_is_invalidated (page ));
1219
- if (!z_erofs_is_shortlived_page (page )) {
1220
- if (erofs_page_is_managed (EROFS_SB (be -> sb ), page )) {
1221
- if (!PageUptodate (page ))
1222
- err = - EIO ;
1223
- continue ;
1224
- }
1225
- z_erofs_do_decompressed_bvec (be , bvec );
1226
- * overlapped = true;
1227
- }
1220
+ if (z_erofs_is_shortlived_page (page ))
1221
+ continue ;
1222
+ z_erofs_do_decompressed_bvec (be , bvec );
1223
+ * overlapped = true;
1228
1224
}
1229
-
1230
- if (err )
1231
- return err ;
1232
- return 0 ;
1225
+ return err ;
1233
1226
}
1234
1227
1235
1228
static int z_erofs_decompress_pcluster (struct z_erofs_decompress_backend * be ,
@@ -1238,7 +1231,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
1238
1231
struct erofs_sb_info * const sbi = EROFS_SB (be -> sb );
1239
1232
struct z_erofs_pcluster * pcl = be -> pcl ;
1240
1233
unsigned int pclusterpages = z_erofs_pclusterpages (pcl );
1241
- const struct z_erofs_decompressor * decompressor =
1234
+ const struct z_erofs_decompressor * decomp =
1242
1235
& erofs_decompressors [pcl -> algorithmformat ];
1243
1236
int i , err2 ;
1244
1237
struct page * page ;
@@ -1274,10 +1267,8 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
1274
1267
err2 = z_erofs_parse_in_bvecs (be , & overlapped );
1275
1268
if (err2 )
1276
1269
err = err2 ;
1277
- if (err )
1278
- goto out ;
1279
-
1280
- err = decompressor -> decompress (& (struct z_erofs_decompress_req ) {
1270
+ if (!err )
1271
+ err = decomp -> decompress (& (struct z_erofs_decompress_req ) {
1281
1272
.sb = be -> sb ,
1282
1273
.in = be -> compressed_pages ,
1283
1274
.out = be -> decompressed_pages ,
@@ -1291,7 +1282,6 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
1291
1282
.fillgaps = pcl -> multibases ,
1292
1283
}, be -> pagepool );
1293
1284
1294
- out :
1295
1285
/* must handle all compressed pages before actual file pages */
1296
1286
if (z_erofs_is_inline_pcluster (pcl )) {
1297
1287
page = pcl -> compressed_bvecs [0 ].page ;
@@ -1302,7 +1292,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
1302
1292
/* consider shortlived pages added when decompressing */
1303
1293
page = be -> compressed_pages [i ];
1304
1294
1305
- if (erofs_page_is_managed (sbi , page ))
1295
+ if (! page || erofs_page_is_managed (sbi , page ))
1306
1296
continue ;
1307
1297
(void )z_erofs_put_shortlivedpage (be -> pagepool , page );
1308
1298
WRITE_ONCE (pcl -> compressed_bvecs [i ].page , NULL );
0 commit comments