From: Dan Carpenter <dan.carpenter@oracle.com>
To: Gao Xiang <xiang@kernel.org>
Cc: kernel-janitors@vger.kernel.org, linux-erofs@lists.ozlabs.org,
Yue Hu <huyue2@coolpad.com>
Subject: [PATCH] erofs: clean up a loop
Date: Mon, 18 Jul 2022 14:20:08 +0300 [thread overview]
Message-ID: <YtVB6GBWHVSc6fbU@kili> (raw)
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
next reply other threads:[~2022-07-18 11:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 11:20 Dan Carpenter [this message]
2022-07-18 11:36 ` [PATCH] erofs: clean up a loop Gao Xiang
2022-07-18 12:23 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YtVB6GBWHVSc6fbU@kili \
--to=dan.carpenter@oracle.com \
--cc=huyue2@coolpad.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox