All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: clean up a loop
@ 2022-07-18 11:20 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-07-18 11:20 UTC (permalink / raw)
  To: Gao Xiang; +Cc: Chao Yu, Yue Hu, Jeffle Xu, linux-erofs, kernel-janitors

It's easier to see what this loop is doing when the decrement is in
the normal place.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/erofs/zdata.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 601cfcb07c50..2691100eb231 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -419,8 +419,8 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,
 {
 	struct z_erofs_pcluster *const pcl = fe->pcl;
 
-	while (fe->icur > 0) {
-		if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page,
+	while (fe->icur--) {
+		if (!cmpxchg(&pcl->compressed_bvecs[fe->icur].page,
 			     NULL, bvec->page)) {
 			pcl->compressed_bvecs[fe->icur] = *bvec;
 			return true;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-18 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-18 11:20 [PATCH] erofs: clean up a loop Dan Carpenter
2022-07-18 11:20 ` Dan Carpenter
2022-07-18 11:36 ` Gao Xiang
2022-07-18 11:36   ` Gao Xiang
2022-07-18 12:23   ` Dan Carpenter
2022-07-18 12:23     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.