Btrfs: heuristic: add byte core set calculation
authorTimofey Titovets <nefelim4ag@gmail.com>
Thu, 28 Sep 2017 14:33:41 +0000 (17:33 +0300)
committerDavid Sterba <dsterba@suse.com>
Wed, 1 Nov 2017 19:45:36 +0000 (20:45 +0100)
commit858177d38d4681dad6efc015b99e4c786a34aca5
tree9867f207eadb3114bae7e39d4140604d0787e4ae
parenta288e92cacdc4729ad8f83d018fb0f3f5ded6c37
Btrfs: heuristic: add byte core set calculation

Calculate byte core set for data sample:
- sort buckets' numbers in decreasing order
- count how many values cover 90% of the sample

If the core set size is low (<=25%), data are easily compressible.
If the core set size is high (>=80%), data are not compressible.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update comments ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c