I had the same problem. I found this which had the answer:
Migrating files to extents
Warning: Do NOT use the following method with Mercurial repository that have been cloned locally, as doing so will corrupt the repository. It might also corrupt other hard link in the filesystem.
Even though the filesystem is now converted to ext4, all files that have been written before the conversion do not yet take advantage of the new extents of ext4, which will improve large file performance and reduce fragmentation and filesystem check time. In order to fully take advantage of ext4, all files would have to be rewritten on disk. A utility called
e4defrag is being developed and will take care of this task; however, it is not yet ready for production.
Fortunately, it is possible to use the
chattr program, which will cause the kernel to rewrite the file using extents. It is possible to run this command on all files and directories of one partition (e.g. if
/home is on a dedicated partition): (Must be run as root)
find /home -xdev -type f -print0 | xargs -0 chattr +e
find /home -xdev -type d -print0 | xargs -0 chattr +e
It is recommended to test this command on a small number of files first, and check if everything is going all right. It may also be useful to check the filesystem after conversion.
lsattr command, it is possible to check that files are now using extents. The letter 'e' should appear in the attribute list of the listed files.
Note: I had assumed e4defrag could convert the files to use extents. The failed ioctl is the one that does that afaik, so I am a little confused as to why it doesn't work, but
chattr +e did work for me. After you have
chattr +e the files, you can then use
e4defrag on them. Obviously make sure you have a backup etc just in case (I would have thought this is safe, but you never know - there is a warning here about hardlinks but I find no other reference to known issues with hardlinks).