Compression has landed
Added 2016-08-02 10:39:12 +0000 UTCThe last bit - disk space accounting - is finished, so it should actually be useful now.
Please test it out - I'd like to hear how well it's working for people.
Currently lz4 and gzip are supported, and lz4 is the recommended option. I'd like to add more compression algorithms in the future - in particular, lzma for cold data would be really nifty.
What's still missing is interfaces/tooling: right now, the only way to see compressed and uncompressed numbers is via /sys/fs/bcache/<uuid>/internal/alloc_debug, and that's only filesystem wide, not per inode. We'll want to add this to the bcache tool in the future, possibly elsewhere.
Storing the compressed size of an individual inode is something we'd like to do too, but there's a complication: moving data around in the background (e.g. tiering, copygc) can change the compressed size (compressing and recompressing fragmented data), and so if we add that field to the inode then the inode would have to be changed. But currently the tiering/copygc/data migration code has no knowledge of the filesystem code or inodes, and I'm somewhat loathe to change that. Might have to revisit that later.
In the shorter term, I might add an xattr that when queried just walks all the extents and adds up the current compressed size. This would be a hack, but would at least get us something.
Also, at some point in the future I'll definitely add xattrs so that compression can be controlled per inode, not just filesystem wide.