library: Enable transparent compression of btrfs file systems
-
Reduces write amplification on flash based storage.
-
Improve read/write performance on slow disks.
-
Reduce the disk usage of files.
-
Uses more CPU and reduces overall throughput but this is not noticeable in most common scenarios.
-
It is possible to compress the files while the image is being prepared. This leads to significantly less size occupied by files (~1.7GiB uncompressed vs. ~0.8GiB compressed) in the final system. However, the size of the final xz image has doubled to more than 1GiB. This happens even when highest compression level (zstd:15) is used in btrfs/zstd. Due to concern for increased download image size, this change is not pursued at the moment.
Tests:
-
Build amd64, arm64 and raspberry3b-plus image with the patch. Build is successful.
-
In the built images, /etc/fstab has compress=zstd:1 only for btrfs partitions.
-
Run amd64 image. It boots without issues.
-
Install btrfs-compsize package inside the running image. Reinstall a package like freedombox-doc-en. Notice that running
compsize /usr/share/freedombox
now shows that some of the files are now compressed.
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org