summaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorTimofey Titovets <nefelim4ag@gmail.com>2017-10-08 16:11:59 +0300
committerDavid Sterba <dsterba@suse.com>2017-11-01 20:45:36 +0100
commit19562430c6213925faba3baa9e8cb224ddd47ee6 (patch)
tree46dd57e47b8378576f60e777887ca7bac729a9c9 /fs/direct-io.c
parent858177d38d4681dad6efc015b99e4c786a34aca5 (diff)
downloadlinux-19562430c6213925faba3baa9e8cb224ddd47ee6.tar.bz2
Btrfs: heuristic: add Shannon entropy calculation
Byte distribution check in heuristic will filter edge data cases and some time fail to classify input data. Let's fix that by adding Shannon entropy calculation, that will cover classification of most other data types. As Shannon entropy needs log2 with some precision to work, let's use ilog2(N) and for increased precision, by do ilog2(pow(N, 4)). Shannon entropy has been slightly changed to avoid signed numbers and division. The calculation is direct by the formula, successor of precalculated table or chains of if-else. The accuracy errors of ilog2 are compensated by @ENTROPY_LVL_ACEPTABLE 70 -> 65 @ENTROPY_LVL_HIGH 85 -> 80 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>
Diffstat (limited to 'fs/direct-io.c')
0 files changed, 0 insertions, 0 deletions