[PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache()

From: Yue Hu
Date: Tue Dec 06 2022 - 00:37:23 EST


From: Yue Hu <huyue2@xxxxxxxxxxx>

Do cmpxchg_relaxed() is only for successful allocation if I/O is needed.

Fixes: 69b511baa0be ("erofs: clean up cached I/O strategies")
Signed-off-by: Yue Hu <huyue2@xxxxxxxxxxx>
---
fs/erofs/zdata.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 2584a62c9d28..b66c16473273 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -333,19 +333,19 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe,
} else {
/* I/O is needed, no possible to decompress directly */
standalone = false;
- if (shouldalloc) {
- /*
- * try to use cached I/O if page allocation
- * succeeds or fallback to in-place I/O instead
- * to avoid any direct reclaim.
- */
- newpage = erofs_allocpage(pagepool, gfp);
- if (!newpage)
- continue;
- set_page_private(newpage,
- Z_EROFS_PREALLOCATED_PAGE);
- t = tag_compressed_page_justfound(newpage);
- }
+ if (!shouldalloc)
+ continue;
+
+ /*
+ * try to use cached I/O if page allocation
+ * succeeds or fallback to in-place I/O instead
+ * to avoid any direct reclaim.
+ */
+ newpage = erofs_allocpage(pagepool, gfp);
+ if (!newpage)
+ continue;
+ set_page_private(newpage, Z_EROFS_PREALLOCATED_PAGE);
+ t = tag_compressed_page_justfound(newpage);
}

if (!cmpxchg_relaxed(&pcl->compressed_bvecs[i].page, NULL,
--
2.17.1