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

Calculate byte set size for data sample:
- calculate how many unique bytes have been in the sample
- for all bytes count > 0, check if we're still in the low count range
  (~25%), such data are easily compressible, otherwise furhter analysis
  is needed

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