Skip to content

e4defrag: fragmentation score rework and cleanups

Kazuya Mio linux-ext4 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest11 patches 0 repliesNew
  2. v212 patches 3 repliesSuperseded
  3. v1 posting 2/211 patches 23 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 posting 1/211 patches1 replySuperseded

Changes in v3 from the cover letter

- Don't treat integer variables as boolean in some conditions for good readability
- Output the progress of the defrag like mke2fs to reduce log file size
- Revert to checking st_blocks to skip defrag safety if file has no blocks

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11libe2p: Add new function e2p_get_fragscore()lib/e2p/Makefile.in lib/e2p/e2p.h lib/e2p/fragment_score.c+140 -20 replies
2/11e4defrag: Remove -c option which checks the file fragmentationmisc/e4defrag.8.in misc/e4defrag.c+12 -4240 replies
3/11e4defrag: Remove old fragmentation score calculation codemisc/e4defrag.c+30 -3190 replies
4/11e4defrag: Use e2p_get_fragscore() for decision of whether to defragmisc/Makefile.in misc/e4defrag.c+61 -70 replies
5/11e4defrag: Add force option for e4defragmisc/e4defrag.8.in misc/e4defrag.c+14 -50 replies
6/11e4defrag: Allow user who has read+write access to defragmisc/e4defrag.8.in misc/e4defrag.c+4 -190 replies
7/11e4defrag: Allow user who can use reserved blocks to defragmisc/e4defrag.c+6 -280 replies
8/11e4defrag: Use libext2fs definitionsmisc/e4defrag.c+6 -120 replies
9/11e4defrag: Fix error messages more clearlymisc/e4defrag.c+19 -140 replies
10/11e4defrag: Fix the method of progress outputmisc/e4defrag.c+29 -100 replies
11/11e4defrag: Remove unnecessary codemisc/e4defrag.c+12 -380 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 00/11] e4defrag: fragmentation score rework and cleanups

Hi,

This patch set adds the new function e2p_get_fragscore() to libe2p, that calculates the fragmentation score. Fragmentation score shows how badly fragmented the file might be. e4defrag uses it to determine smarter whether to call EXT4_IOC_MOVE_EXT ioctl.

In addition, the 6th to the last is bugfix or cleanup patch.

v2 -> v3

- Don't treat integer variables as boolean in some conditions for good readability
- Output the progress of the defrag like mke2fs to reduce log file size
- Revert to checking st_blocks to skip defrag safety if file has no blocks

Thanks for the above helpful comments, Dilger.

v1 -> v2
- Fix the method of calculating fragmentation score to show the number of extents per specified blocks
- Remove the check of filesystem type to calculate the fragmentation score for the file in non-ext4 filesystem
- Drop the patch for filefrag
- Fix free blocks check to use reserved blocks by users specified by resuid/resgid mount option
- Add -F option to defrag a file if the fragment can get better even if the fragmentation score of donor file is bigger than 1

This patch set is for e2fsprogs git tree. (commit:6b967cd6f1)

Kazuya Mio (11):
libe2p: Add new function e2p_get_fragscore()
e4defrag: Remove -c option which checks the file fragmentation
e4defrag: Remove old fragmentation score calculation code
e4defrag: Use e2p_get_fragscore() for decision of whether to defrag
e4defrag: Add -F option for force defrag
e4defrag: Allow user who has read+write permission to defrag
e4defrag: Allow user who can use reserved blocks to defrag
e4defrag: Use libext2fs definitions
e4defrag: Fix error messages more clearly
e4defrag: Fix the method of progress output
e4defrag: Remove unnecessary code

 lib/e2p/Makefile.in      |    6 
 lib/e2p/e2p.h            |    3 
 lib/e2p/fragment_score.c |  133 ++++++
 misc/Makefile.in         |    4 
 misc/e4defrag.8.in       |   33 -
 misc/e4defrag.c          |  950 +++++++----------------------------------------
 6 files changed, 290 insertions(+), 839 deletions(-)

Regards,
Kazuya Mio