diff options
author | Jia He <hejianet@gmail.com> | 2016-01-04 00:10:19 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-01-04 00:10:19 -0500 |
commit | 1d4292bfdc77f4f7c520064be15d0c46bd025fd2 (patch) | |
tree | 0caa65a6a56e13d269503b38c211aafaef6cad0b /fs/xfs | |
parent | 168309855a7d1e16db751e9c647119fe2d2dc878 (diff) |
libxfs: Optimize the loop for xfs_bitmap_empty
If there is any non zero bit in a long bitmap, it can jump out of the
loop and finish the function as soon as possible.
Signed-off-by: Jia He <hejianet@gmail.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_bit.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_bit.c b/fs/xfs/libxfs/xfs_bit.c index 0e8885a59646..0a94cce5ea35 100644 --- a/fs/xfs/libxfs/xfs_bit.c +++ b/fs/xfs/libxfs/xfs_bit.c | |||
@@ -32,13 +32,13 @@ int | |||
32 | xfs_bitmap_empty(uint *map, uint size) | 32 | xfs_bitmap_empty(uint *map, uint size) |
33 | { | 33 | { |
34 | uint i; | 34 | uint i; |
35 | uint ret = 0; | ||
36 | 35 | ||
37 | for (i = 0; i < size; i++) { | 36 | for (i = 0; i < size; i++) { |
38 | ret |= map[i]; | 37 | if (map[i] != 0) |
38 | return 0; | ||
39 | } | 39 | } |
40 | 40 | ||
41 | return (ret == 0); | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | /* | 44 | /* |