| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 01/14] libxfs: Optimize the loop for xfs_bitmap_empty |
| From: | Dave Chinner <david@xxxxxxxxxxxxx> |
| Date: | Mon, 15 Feb 2016 17:18:12 +1100 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1455517105-20033-1-git-send-email-david@xxxxxxxxxxxxx> |
| References: | <1455517105-20033-1-git-send-email-david@xxxxxxxxxxxxx> |
From: Jia He <hejianet@xxxxxxxxx>
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@xxxxxxxxx>
Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>
Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
---
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
|
| Previous by Date: | [PATCH 07/14] xfs: bmapbt checking on debug kernels too expensive, Dave Chinner |
|---|---|
| Next by Date: | [PATCH 0/14] xfsprogs: kernel libxfs sync up to 4.5-rc2, Dave Chinner |
| Previous by Thread: | [PATCH 07/14] xfs: bmapbt checking on debug kernels too expensive, Dave Chinner |
| Next by Thread: | [PATCH 11/14] xfs: swap leaf buffer into path struct atomically during path shift, Dave Chinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |