summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2018-09-18 22:27:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-18 16:34:35 +0200
commit1e05ff36e6921ca61bdbf779f81a602863569ee3 (patch)
tree63d9bc6917d268c83f8714f262686c0ee583bffe /drivers
parent0734ffbf574ee813b20899caef2fe0ed502bb783 (diff)
downloadlinux-stable-1e05ff36e6921ca61bdbf779f81a602863569ee3.tar.gz
linux-stable-1e05ff36e6921ca61bdbf779f81a602863569ee3.tar.bz2
linux-stable-1e05ff36e6921ca61bdbf779f81a602863569ee3.zip
staging: erofs: complete error handing of z_erofs_do_read_page
This patch completes error handing code of z_erofs_do_read_page. PG_error will be set when some read error happens, therefore z_erofs_onlinepage_endio will unlock this page without setting PG_uptodate. Reviewed-by: Chao Yu <yucxhao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/erofs/unzip_vle.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c
index 3296538d791e..08c424ce74f5 100644
--- a/drivers/staging/erofs/unzip_vle.c
+++ b/drivers/staging/erofs/unzip_vle.c
@@ -611,7 +611,7 @@ static int z_erofs_do_read_page(struct z_erofs_vle_frontend *fe,
enum z_erofs_page_type page_type;
unsigned int cur, end, spiltted, index;
- int err;
+ int err = 0;
/* register locked file pages as online pages in pack */
z_erofs_onlinepage_init(page);
@@ -638,12 +638,11 @@ repeat:
if (unlikely(err))
goto err_out;
- /* deal with hole (FIXME! broken now) */
if (unlikely(!(map->m_flags & EROFS_MAP_MAPPED)))
goto hitted;
DBG_BUGON(map->m_plen != 1 << sbi->clusterbits);
- BUG_ON(erofs_blkoff(map->m_pa));
+ DBG_BUGON(erofs_blkoff(map->m_pa));
err = z_erofs_vle_work_iter_begin(builder, sb, map, &fe->owned_head);
if (unlikely(err))
@@ -688,7 +687,7 @@ retry:
err = z_erofs_vle_work_add_page(builder,
newpage, Z_EROFS_PAGE_TYPE_EXCLUSIVE);
- if (!err)
+ if (likely(!err))
goto retry;
}
@@ -699,9 +698,10 @@ retry:
/* FIXME! avoid the last relundant fixup & endio */
z_erofs_onlinepage_fixup(page, index, true);
- ++spiltted;
- /* also update nr_pages and increase queued_pages */
+ /* bump up the number of spiltted parts of a page */
+ ++spiltted;
+ /* also update nr_pages */
work->nr_pages = max_t(pgoff_t, work->nr_pages, index + 1);
next_part:
/* can be used for verification */
@@ -711,16 +711,18 @@ next_part:
if (end > 0)
goto repeat;
+out:
/* FIXME! avoid the last relundant fixup & endio */
z_erofs_onlinepage_endio(page);
debugln("%s, finish page: %pK spiltted: %u map->m_llen %llu",
__func__, page, spiltted, map->m_llen);
- return 0;
+ return err;
+ /* if some error occurred while processing this page */
err_out:
- /* TODO: the missing error handing cases */
- return err;
+ SetPageError(page);
+ goto out;
}
static void z_erofs_vle_unzip_kickoff(void *ptr, int bios)