btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

btrfs-progs: new --inode-flags option

Open adam900710 opened this issue 7 months ago • 2 comments

The new --inode-flags option allows us to specify certain btrfs specific flags to each inode.

Currently we only support nodatacow and nodatasum.

But in the future compression flag can also be added, allowing more accurate per-file compression.

Furthermore child inodes will inherit the flag from their parents, meaning one only needs to specify the flag to the parent directory, then all children files/directories will have the flag.

This new option also works well with --subvol, although one has to note that, the inode flag inheritance does not cross subvolume boundary (the same as the kernel).

Finally, nodatacow and nodatasum will disable compression, just like the kernel.

I hope this will helps projects like mkosi and yocto to build their images with more btrfs specific flags.

The only downside for now is the memory usage, both --subvol and --inode-flags will take over 8K for each specification. So one should not specify them too many times.

adam900710 avatar May 21 '25 09:05 adam900710

Something missing is the help entry:

        OPTLINE("--inode-flags FLAGS:PATH", "specify that path to have inode flags, other than the default one, can be specified multiple times"),
        OPTLINE("", "FLAGS is one of:"),
        OPTLINE("", "- nodatacow - disable data CoW, implies nodatasum for regular files"),
        OPTLINE("", "- nodatasum - disable data checksum only"),

aplanas avatar Jun 04 '25 18:06 aplanas

Thanks a lot, a new fix is sent. And if David is fine with the fix, it can be folded into the original patch (which is still only in devel branch).

adam900710 avatar Jun 04 '25 23:06 adam900710

Merged to devel, thanks.

kdave avatar Jun 20 '25 17:06 kdave