aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorNoctis Ackerman <noctis.akm@gmail.com>2018-12-06 23:04:05 +0800
committerMoyster <oysterized@gmail.com>2019-05-02 14:30:26 +0200
commit6b97f43fee3117f8f49c79830c0771399dba75e1 (patch)
tree7db5a0672db7e46d36752af928b0ab115c717829 /fs
parente74405332aadff45a0b1df198810fe6d55d58482 (diff)
fs: sdfat: Fix frag_ratio formula
When there is no full au in AMAP, if we use the number of non-clean au divides fsi->used_clusters * CLUS_PER_AU(sb), the frag_ratio is always smaller than (or equal with) 100%, which is not right. Actually, frag_ratio should be the the ratio that non-clean aus divides the number of aus if all used_clusters are contiguous. Change-Id: I7c26422f5145c3bd97b9dbfcde133972ce51f1d4 Signed-off-by: Noctis Ackerman <noctis.akm@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/sdfat/dfr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/sdfat/dfr.c b/fs/sdfat/dfr.c
index 2853fe425..abb4710b4 100644
--- a/fs/sdfat/dfr.c
+++ b/fs/sdfat/dfr.c
@@ -1248,7 +1248,7 @@ defrag_check_defrag_required(
frag_ratio = ((amap->n_au - amap->n_clean_au) * 100) / amap->n_full_au;
else
frag_ratio = ((amap->n_au - amap->n_clean_au) * 100) /
- (fsi->used_clusters * CLUS_PER_AU(sb));
+ (fsi->used_clusters / CLUS_PER_AU(sb) + 1);
/*
* Wake-up defrag_daemon: