Skip to content

Add option to btrfs filesystem defragment to not defragment shared extents #519

Open
@crass

Description

@crass

Its a well known issue that running defragment will break up reflink clones. One can google and see this is the source of a lot of headaches for users and I bet will continue to be. I'm hoping that this could be the start of remedying that.

This big idea here is to allow for a sub-optimal defragmentation that does not break up reflinks or shared extents in general. I noticed that the defragment command can take a starting byte offset and a length in bytes arguments. So it seems defragment should be able to (easily?) look at the extents of a given file and only defragment sequential extents that do not contain shared extents. Currently a script could be written to do this by getting the FIEMAP and running a series of defragment operations specifying start and length. It would be better to have this be done internally as an option for defragment. There should be a note in the documentation for this option that its a sub-optimal defragmentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsChanges in documentation or help textenhancementkernelsomething in kernel has to be done too

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions