From: cem@kernel.org
To: aalbersh@redhat.com
Cc: linux-xfs@vger.kernel.org, djwong@kernel.org
Subject: [PATCH v4 1/2] fsr: package function should check for negative errors
Date: Tue, 7 Apr 2026 13:14:59 +0200 [thread overview]
Message-ID: <20260407111507.79977-2-cem@kernel.org> (raw)
In-Reply-To: <20260407111507.79977-1-cem@kernel.org>
From: Carlos Maiolino <cem@kernel.org>
xfrog_defragrange as most other functions from libfrog return
a negative error value, while xfs_fsr's packfile(), expects
a positive error value.
Whenever xfrog_defragrange fails, the switch case always falls into the
default clausule, making the error message pointless.
Fix this by inverting xfrog_defragrange() return value call.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
V4: Add Darrick's RwB
V3:
Just change xfrog_defragrange() return signal.
V2:
Change packfile() to check for negative error values
instead of changing the return sign from xfrog_defragrange().
fsr/xfs_fsr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 8845ff172fcb..390f7c5276df 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -1459,7 +1459,7 @@ packfile(
}
/* Swap the extents */
- error = xfrog_defragrange(file_fd->fd, &xdf);
+ error = -xfrog_defragrange(file_fd->fd, &xdf);
switch (error) {
case 0:
break;
--
2.53.0
next prev parent reply other threads:[~2026-04-07 11:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 11:14 [PATCH v4 0/2] Improve user experience with xfs_fsr cem
2026-04-07 11:14 ` cem [this message]
2026-04-07 11:15 ` [PATCH v4 2/2] fsr: always print error messages from xfrog_defragrange() cem
2026-04-07 15:07 ` Darrick J. Wong
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=20260407111507.79977-2-cem@kernel.org \
--to=cem@kernel.org \
--cc=aalbersh@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.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