[PATCH 01/14] libxfs: Optimize the loop for xfs_bitmap_empty
Dave Chinner
david at fromorbit.com
Mon Feb 15 00:18:12 CST 2016
From: Jia He <hejianet at gmail.com>
Source kernel commit 1d4292bfdc77f4f7c520064be15d0c46bd025fd2
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 at gmail.com>
Reviewed-by: Brian Foster <bfoster at redhat.com>
Signed-off-by: Dave Chinner <david at fromorbit.com>
---
libxfs/xfs_bit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libxfs/xfs_bit.c b/libxfs/xfs_bit.c
index 8b5b81c..041557a 100644
--- a/libxfs/xfs_bit.c
+++ b/libxfs/xfs_bit.c
@@ -32,13 +32,13 @@ int
xfs_bitmap_empty(uint *map, uint size)
{
uint i;
- uint ret = 0;
for (i = 0; i < size; i++) {
- ret |= map[i];
+ if (map[i] != 0)
+ return 0;
}
- return (ret == 0);
+ return 1;
}
/*
--
2.5.0
More information about the xfs
mailing list