Skip to contentSkip to conversation

filefrag: minor usability improvements

PATCH Applied Andreas Dilger 2 participants 2 messages Mar 10, 2021 – Apr 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 filefrag: minor usability improvements

Add '-V' to filefrag to print the installed version of the tool.

If '-V' is used twice, print out the list of supported FIEMAP flags. This can be used to check if filefrag understands a specific feature.

Include FIEMAP in the error message printed when filefrag cannot get the file layout. Since FIEMAP is commonly available and tried first, it should also be mentioned in the error message unless it was requested to only run FIBMAP.

Update filefrag.1.in man page to cover the new -V option.

Fix a formatting error with the recently added '-P' options, and include '-E' and '-P' in the SYNOPSIS section.

Lustre-bug-id: https://jira.whamcloud.com/browse/LU-11848

Change-Id Ib126bdd70efa1775aef6db761f54e27a593ebbe5
---
 misc/filefrag.8.in | 21 ++++++----
 misc/filefrag.c    | 96 +++++++++++++++++++++++++++++-----------------
 2 files changed, 75 insertions(+), 42 deletions(-)
misc/filefrag.8.in +14 -7
index d15d3632..984db306 100644
@@ -8,7 +8,7 @@ filefrag \- report on file fragmentation
 .BI \-b blocksize
 ]
 [
-.B \-BeksvxX
+.B \-BeEkPsvVxX
 ]
 [
 .I files...
@@ -38,7 +38,10 @@ filesystem blocksize.  For compatibility with earlier versions of
 .BR filefrag ,
 if
 .I blocksize
-is unspecified it defaults to 1024 bytes.
+is unspecified it defaults to 1024 bytes.  Since
+.I blocksize
+is an optional argument, it must be added without any space after
+.BR -b .
 .TP
 .B \-e
 Print output in extent format, even for block-mapped files.
@@ -47,12 +50,12 @@ Print output in extent format, even for block-mapped files.
 Display the contents of ext4's extent status cache.  This feature is not
 supported on all kernels, and is only supported on ext4 file systems.
 .TP
-.TP
-.B -P
-Pre-load the ext4's extent status cache for the file.  This feature is not
-supported on all kernels, and is only supported on ext4 file systems.
 .B \-k
-Use 1024\-byte blocksize for output (identical to '\-b 1024').
+Use 1024\-byte blocksize for output (identical to '\-b1024').
+.TP
+.B -P
+Pre-load the ext4 extent status cache for the file.  This is not
+supported on all kernels, and is only supported on ext4 filesystems.
 .TP
 .B \-s
 Sync the file before requesting the mapping.
@@ -60,6 +63,10 @@ Sync the file before requesting the mapping.
 .B \-v
 Be verbose when checking for file fragmentation.
 .TP
+.B \-V
+Print version number of program and library.  If given twice, also
+print the FIEMAP flags that are understood by the current version.
+.TP
 .B \-x
 Display mapping of extended attributes.
 .TP
misc/filefrag.c +61 -35

166 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 12 lines · Andreas Dilger

Add '-V' to filefrag to print the installed version of the tool.

If '-V' is used twice, print out the list of supported FIEMAP flags. This can be used to check if filefrag understands a specific feature.

Include FIEMAP in the error message printed when filefrag cannot get the file layout. Since FIEMAP is commonly available and tried first, it should also be mentioned in the error message unless it was requested to only run FIBMAP.

Update filefrag.1.in man page to cover the new -V option.

Quoted 7 lines

Fix a formatting error with the recently added '-P' options, and include '-E' and '-P' in the SYNOPSIS section.

Lustre-bug-id: https://jira.whamcloud.com/browse/LU-11848

Change-Id Ib126bdd70efa1775aef6db761f54e27a593ebbe5

Applied, thanks.

- Ted