compsize 1.5 Find compression type/ratio on Btrfs files
compsize takes a list of files (given as arguments) on a Btrfs file system and measures used compression types and effective compression ratio, producing a report.
A directory has no extents but has a (recursive) list of files. A non-regular file is silently ignored.
As it makes no sense to talk about compression ratio of a partial extent, every referenced extent is counted whole, exactly once -- no matter if you use only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the uncompressed size will not match the number given by
du. On the other hand, the space used should be accurate (although obviously it can be shared with files outside our set).