#314 e4defrag presentation error

open
nobody
None
5
2012-11-28
2012-06-13
No

The "Tota/best extents" calculation for done in the e4defrag program doesn't seems to not consider the limit of 32768 file system blocks (see /usr/src/linux/fs/ext4/ext4_extents.h comment EXT_INIT_MAX_LEN) in an extent when computing the "best" value. It seems to presume 2G is the best extent size, but on a file system with a 4kb block size the largest available extent is 128M not 2G.

(The best extent size calculation in e4defrag seems to be based on block group size but the underlying implementaiton in the kernel is limited to a __le16 blocks and uses up one whole bit of that to flag whether the extent is initialized, which actually produces a one-block purturbation in the actual limit based on how the extent was allocated (e.g. whether falloc used FS_KEEP_SIZE or not), go go gadget purturbed math. 8-)).

Example:
-rw-r--r-- 1 rwhite rwhite 5.0G Jun 13 16:28 CentOS.qcow2

yeilds output: (where "/3" is wrong).

Total/best extents 152/3

The e4defrag program should

ASIDE: I -thought- I was supposed to be able to make 2G extents in ext4 but on intel platforms with a 4kb memory page, the file system block size is capped at 4kb as well which caps the extent length at 128Mb. The 2G limit is apparently for processors with larger memory pages and therefore file system block sizes. I was bummed to learn this. I suspect that this is a case of false advertising by the ext4 guys not tracing all their dependencies and limits. /sigh. 8-)

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-09-05

    I would like to second fixing this bug. It appears on any summary screen, e.g. at the end of a defrag or when using -c. For example:

    <Fragmented files> now/best size/ext
    1. /disk2/Streams/Yuru Yuri S2-10-12_TVTokyo-2-1-59.part1.rar
    8/1 62500 KB

    Total/best extents 16208/14647

    ---

    -rw-r--r-- 1 transport ftp 512000000 Sep 3 13:33 /disk2/Streams/Yuru Yuri S2-10-12_TVTokyo-2-1-59.part1.rar

    ---

    So as we can see, this is a fairly large file and the "best" number of extents should be greater than 1 (technically it should be 4), due to the maximum extent size of 128 MB.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-09-05

    That being said, I fixed it. Patch here: http://pastebin.com/9XTFcVM0

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks