diff options
| author | Noctis Ackerman <noctis.akm@gmail.com> | 2018-12-06 23:04:05 +0800 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2019-01-11 15:57:44 +0100 |
| commit | d5b96952149c4e021e9fa18a82a817c5067dda97 (patch) | |
| tree | ea669e195bf7c00da20290a7577da0878b1ae448 | |
| parent | 46b831137bbfc711054b862b2c86fd0f1df322b2 (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.
Signed-off-by: Noctis Ackerman <noctis.akm@gmail.com>
| -rw-r--r-- | dfr.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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: |
