Skip to content

Commit

Permalink
erofs: fix mis-inplace determination related with noio chain
Browse files Browse the repository at this point in the history
Fix a recent cleanup patch. noio (bypass) chain is
handled asynchronously against submit chain, therefore
inplace I/O or pagevec cannot be applied to such pages.
Add detailed comment for this as well.

Fixes: 97e86a8 ("staging: erofs: tidy up decompression frontend")
Reviewed-by: Chao Yu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Gao Xiang <[email protected]>
  • Loading branch information
Gao Xiang committed Sep 30, 2019
1 parent 55252ab commit dc76ea8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions fs/erofs/zdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
struct erofs_map_blocks *const map = &fe->map;
struct z_erofs_collector *const clt = &fe->clt;
const loff_t offset = page_offset(page);
bool tight = (clt->mode >= COLLECT_PRIMARY_HOOKED);
bool tight = true;

enum z_erofs_cache_alloctype cache_strategy;
enum z_erofs_page_type page_type;
Expand Down Expand Up @@ -628,8 +628,16 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
preload_compressed_pages(clt, MNGD_MAPPING(sbi),
cache_strategy, pagepool);

tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED);
hitted:
/*
* Ensure the current partial page belongs to this submit chain rather
* than other concurrent submit chains or the noio(bypass) chain since
* those chains are handled asynchronously thus the page cannot be used
* for inplace I/O or pagevec (should be processed in strict order.)
*/
tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED &&
clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE);

cur = end - min_t(unsigned int, offset + end - map->m_la, end);
if (!(map->m_flags & EROFS_MAP_MAPPED)) {
zero_user_segment(page, cur, end);
Expand Down

0 comments on commit dc76ea8

Please sign in to comment.