* [PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache()
@ 2022-12-06 5:36 Yue Hu
2022-12-06 5:59 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Yue Hu @ 2022-12-06 5:36 UTC (permalink / raw)
To: xiang, chao, linux-erofs; +Cc: linux-kernel, zhangwen, Yue Hu
From: Yue Hu <huyue2@coolpad.com>
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@coolpad.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache()
2022-12-06 5:36 [PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache() Yue Hu
@ 2022-12-06 5:59 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2022-12-06 5:59 UTC (permalink / raw)
To: Yue Hu; +Cc: xiang, chao, linux-erofs, linux-kernel, zhangwen, Yue Hu
Hi Yue,
On Tue, Dec 06, 2022 at 01:36:33PM +0800, Yue Hu wrote:
> From: Yue Hu <huyue2@coolpad.com>
>
> 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@coolpad.com>
Thanks for the catch, it looks good to me.
Let's fold this into the original patch.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-06 6:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-06 5:36 [PATCH] erofs: fix missing continue for !shouldalloc in z_erofs_bind_cache() Yue Hu
2022-12-06 5:59 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox