Improve user experience with xfs_fsr
v3 cover Improve user experience with xfs_fsr
From: Carlos Maiolino <[email protected]>
This is the V3 of this series,
this fixes an issue based on an user report via IRC in January.
Patch 1 implement changes suggested by Darric, while patch 2 has no change other than being rebased on top of patch 1
Carlos Maiolino (2):
fsr: package function should check for negative errors
fsr: always print error messages from xfrog_defragrange()
fsr/xfs_fsr.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.53.0
PATCH v3 1/2 fsr: package function should check for negative errors
From: Carlos Maiolino <[email protected]>
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.
---
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(-)
fsr/xfs_fsr.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
PATCH v3 2/2 fsr: always print error messages from xfrog_defragrange()
In reply to [email protected]From: Carlos Maiolino <[email protected]>
Error messages from xfrog_defragrange() are only printed when verbose/debug flags are used.
We had reports from users complaining it's hard to find out the error messages lost in the middle of dozens of other informational messages.
Change packfile() behavior to print errors independently of verbose or debug flags.
---
V3: Rebase on top of patch 1 changes
V2: Update commit description
fsr/xfs_fsr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
fsr/xfs_fsr.c +2 -7
@@ -1464,19 +1464,14 @@ packfile(case 0 :break ;case ENOTSUP : -if (vflag || dflag) -fsrprintf (_ ("%s: file type not supported\n" ), fname);break ;case EFAULT :/* The file has changed since we started the copy */ -if (vflag || dflag) -fsrprintf (_ ("%s: file modified defrag aborted\n" ), - fname); +fsrprintf (_ ("%s: file modified defrag aborted\n" ), fname);break ;case EBUSY :/* Timestamp has changed or mmap'ed file */ -if (vflag || dflag) -fsrprintf (_ ("%s: file busy\n" ), fname); +fsrprintf (_ ("%s: file busy\n" ), fname);break ;default : fsrprintf(_("XFS_IOC_SWAPEXT failed: %s: %s\n"),
Signature · 1 line
2.53.0
Re: [PATCH v3 1/2] fsr: package function should check for negative errors
In reply to [email protected]Quoted 10 lines · On Tue, Mar 31, 2026 at 02:26:30PM +0200, [email protected] wrote:
From: Carlos Maiolino <[email protected]>
xfrog_defragrangeas most other functions from libfrog return a negative error value, while xfs_fsr'spackfile(), expects a positive error value.Whenever
xfrog_defragrangefails, the switch case always falls into the default clausule, making the error message pointless.
Fix this by invertingxfrog_defragrange()return value call.
Quoted 5 lines
Signed-off-by Carlos Maiolino <[email protected]>---
V3:
Just changexfrog_defragrange()return signal.
Looks good to me, thanks for fixing this :)
--D
Quoted 25 lines
V2:
Changepackfile()to check for negative error values instead of changing the return sign fromxfrog_defragrange().fsr/xfs_fsr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fsr/xfs_fsr.c +1
-1@@ -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 ;Signature · 1 line
2.53.0
Re: [PATCH v3 2/2] fsr: always print error messages from xfrog_defragrange()
In reply to [email protected]Quoted 25 lines · On Tue, Mar 31, 2026 at 02:26:31PM +0200, [email protected] wrote:
From: Carlos Maiolino <[email protected]>
Error messages from
xfrog_defragrange()are only printed when verbose/debug flags are used.We had reports from users complaining it's hard to find out the error messages lost in the middle of dozens of other informational messages.
Change
packfile()behavior to print errors independently of verbose or debug flags.Signed-off-by Carlos Maiolino <[email protected]>---
V3: Rebase on top of patch 1 changes
V2: Update commit descriptionfsr/xfs_fsr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)fsr/xfs_fsr.c +0
-0
fsr/xfs_fsr.c packfile( · line 1468
Quoted 5 lines
fsr/xfs_fsr.c +0
-2@@ -1464,19 +1464,14 @@ packfile(case 0 :break ;case ENOTSUP : -if (vflag || dflag) -fsrprintf (_ ("%s: file type not supported\n" ), fname);
Err.. did you mean to delete the fsrprintf call here as well?
--D
Quoted 20 lines
fsr/xfs_fsr.c +2
-5break ;case EFAULT :/* The file has changed since we started the copy */ -if (vflag || dflag) -fsrprintf (_ ("%s: file modified defrag aborted\n" ), - fname); +fsrprintf (_ ("%s: file modified defrag aborted\n" ), fname);break ;case EBUSY :/* Timestamp has changed or mmap'ed file */ -if (vflag || dflag) -fsrprintf (_ ("%s: file busy\n" ), fname); +fsrprintf (_ ("%s: file busy\n" ), fname);break ;default : fsrprintf(_("XFS_IOC_SWAPEXT failed: %s: %s\n"),Signature · 1 line
2.53.0
Re: [PATCH v3 2/2] fsr: always print error messages from xfrog_defragrange()
Quoted 21 lines · Darrick J. Wong
Quoted 20 lines · On Tue, Mar 31, 2026 at 02:26:31PM +0200, [email protected] wrote:
From: Carlos Maiolino <[email protected]>
Error messages from
xfrog_defragrange()are only printed when verbose/debug flags are used.We had reports from users complaining it's hard to find out the error messages lost in the middle of dozens of other informational messages.
Change
packfile()behavior to print errors independently of verbose or debug flags.Signed-off-by Carlos Maiolino <[email protected]>---
V3: Rebase on top of patch 1 changes
V2: Update commit descriptionfsr/xfs_fsr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Quoted 12 lines
fsr/xfs_fsr.c packfile( · line 1468
Quoted 10 lines
fsr/xfs_fsr.c +0
-2@@ -1464,19 +1464,14 @@ packfile(case 0 :break ;case ENOTSUP : -if (vflag || dflag) -fsrprintf (_ ("%s: file type not supported\n" ), fname);Err.. did you mean to delete the fsrprintf call here as well?
No, I probably should have messed it up when rebasing on top of patch 1. I'll fix it.
Quoted 24 lines
--D
Quoted 20 lines
fsr/xfs_fsr.c +2
-5break ;case EFAULT :/* The file has changed since we started the copy */ -if (vflag || dflag) -fsrprintf (_ ("%s: file modified defrag aborted\n" ), - fname); +fsrprintf (_ ("%s: file modified defrag aborted\n" ), fname);break ;case EBUSY :/* Timestamp has changed or mmap'ed file */ -if (vflag || dflag) -fsrprintf (_ ("%s: file busy\n" ), fname); +fsrprintf (_ ("%s: file busy\n" ), fname);break ;default : fsrprintf(_("XFS_IOC_SWAPEXT failed: %s: %s\n"),Signature · 1 line
2.53.0