diff options
author | David Sterba <dsterba@suse.com> | 2022-10-27 00:25:14 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-12-05 20:00:48 +0300 |
commit | 428c8e03109e717d90e0d1329dc3d926b9421ad3 (patch) | |
tree | ff641f6749860e7305e4cf920d9596f1215b2912 /fs/btrfs/block-rsv.h | |
parent | 20af93d97f46a824647326278df7d377ba3269ff (diff) | |
download | linux-428c8e03109e717d90e0d1329dc3d926b9421ad3.tar.xz |
btrfs: simplify percent calculation helpers, rename div_factor
The div_factor* helpers calculate fraction or percentage fraction. The
name is a bit confusing, we use it only for percentage calculations and
there are two helpers.
There's a helper mult_frac that's for general fractions, that tries to
be accurate but we multiply and divide by small numbers so we can use
the div_u64 helper.
Rename the div_factor* helpers and use 1..100 percentage range, also drop
the case checking for percentage == 100, it's never hit.
The conversions:
* div_factor calculates tenths and the numbers need to be adjusted
* div_factor_fine is direct replacement
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/block-rsv.h')
-rw-r--r-- | fs/btrfs/block-rsv.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h index e2cf0dd43203..4cc41c9aaa82 100644 --- a/fs/btrfs/block-rsv.h +++ b/fs/btrfs/block-rsv.h @@ -63,7 +63,7 @@ void btrfs_free_block_rsv(struct btrfs_fs_info *fs_info, int btrfs_block_rsv_add(struct btrfs_fs_info *fs_info, struct btrfs_block_rsv *block_rsv, u64 num_bytes, enum btrfs_reserve_flush_enum flush); -int btrfs_block_rsv_check(struct btrfs_block_rsv *block_rsv, int min_factor); +int btrfs_block_rsv_check(struct btrfs_block_rsv *block_rsv, int min_percent); int btrfs_block_rsv_refill(struct btrfs_fs_info *fs_info, struct btrfs_block_rsv *block_rsv, u64 min_reserved, enum btrfs_reserve_flush_enum flush); |