1 ext4: optimize test_root()
3 The test_root() function could potentially loop forever due to
4 overflow issues. So rewrite test_root() to avoid this issue; as a
5 bonus, it is 38% faster when benchmarked via a test loop:
7 int main(int argc, char **argv)
11 for (i = 0; i < 1 << 24; i++) {
17 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
19 fs/ext4/balloc.c | 14 +++++++++-----
20 1 file changed, 9 insertions(+), 5 deletions(-)
22 diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
23 index d0f13ea..5833939 100644
24 --- a/fs/ext4/balloc.c
25 +++ b/fs/ext4/balloc.c
26 @@ -682,11 +682,15 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
28 static inline int test_root(ext4_group_t a, int b)
46 static int ext4_group_sparse(ext4_group_t group)