erofs: drop z_erofs_page_mark_eio()
It can be folded into z_erofs_onlinepage_endio() to simplify the code. Reviewed-by: Yue Hu <huyue2@coolpad.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20230817082813.81180-5-hsiangkao@linux.alibaba.com
This commit is contained in:
@ -143,22 +143,17 @@ static inline void z_erofs_onlinepage_split(struct page *page)
|
|||||||
atomic_inc((atomic_t *)&page->private);
|
atomic_inc((atomic_t *)&page->private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void z_erofs_page_mark_eio(struct page *page)
|
static void z_erofs_onlinepage_endio(struct page *page, int err)
|
||||||
{
|
{
|
||||||
int orig;
|
int orig, v;
|
||||||
|
|
||||||
|
DBG_BUGON(!PagePrivate(page));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
orig = atomic_read((atomic_t *)&page->private);
|
orig = atomic_read((atomic_t *)&page->private);
|
||||||
} while (atomic_cmpxchg((atomic_t *)&page->private, orig,
|
v = (orig - 1) | (err ? Z_EROFS_PAGE_EIO : 0);
|
||||||
orig | Z_EROFS_PAGE_EIO) != orig);
|
} while (atomic_cmpxchg((atomic_t *)&page->private, orig, v) != orig);
|
||||||
}
|
|
||||||
|
|
||||||
static inline void z_erofs_onlinepage_endio(struct page *page)
|
|
||||||
{
|
|
||||||
unsigned int v;
|
|
||||||
|
|
||||||
DBG_BUGON(!PagePrivate(page));
|
|
||||||
v = atomic_dec_return((atomic_t *)&page->private);
|
|
||||||
if (!(v & ~Z_EROFS_PAGE_EIO)) {
|
if (!(v & ~Z_EROFS_PAGE_EIO)) {
|
||||||
set_page_private(page, 0);
|
set_page_private(page, 0);
|
||||||
ClearPagePrivate(page);
|
ClearPagePrivate(page);
|
||||||
@ -1067,9 +1062,7 @@ next_part:
|
|||||||
goto repeat;
|
goto repeat;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (err)
|
z_erofs_onlinepage_endio(page, err);
|
||||||
z_erofs_page_mark_eio(page);
|
|
||||||
z_erofs_onlinepage_endio(page);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,9 +1165,7 @@ static void z_erofs_fill_other_copies(struct z_erofs_decompress_backend *be,
|
|||||||
cur += len;
|
cur += len;
|
||||||
}
|
}
|
||||||
kunmap_local(dst);
|
kunmap_local(dst);
|
||||||
if (err)
|
z_erofs_onlinepage_endio(bvi->bvec.page, err);
|
||||||
z_erofs_page_mark_eio(bvi->bvec.page);
|
|
||||||
z_erofs_onlinepage_endio(bvi->bvec.page);
|
|
||||||
list_del(p);
|
list_del(p);
|
||||||
kfree(bvi);
|
kfree(bvi);
|
||||||
}
|
}
|
||||||
@ -1345,9 +1336,7 @@ out:
|
|||||||
/* recycle all individual short-lived pages */
|
/* recycle all individual short-lived pages */
|
||||||
if (z_erofs_put_shortlivedpage(be->pagepool, page))
|
if (z_erofs_put_shortlivedpage(be->pagepool, page))
|
||||||
continue;
|
continue;
|
||||||
if (err)
|
z_erofs_onlinepage_endio(page, err);
|
||||||
z_erofs_page_mark_eio(page);
|
|
||||||
z_erofs_onlinepage_endio(page);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (be->decompressed_pages != be->onstack_pages)
|
if (be->decompressed_pages != be->onstack_pages)
|
||||||
|
Reference in New Issue
Block a user