| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH] libxfs: Optimize the loop for xfs_bitmap_empty |
| From: | Jia He <hejianet@xxxxxxxxx> |
| Date: | Mon, 9 Nov 2015 22:31:22 +0800 |
| Cc: | Jia He <hejianet@xxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Brian Foster <bfoster@xxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JFwAWHP8+Xu5Dpj8CsVH9agAhJihFoZ0XraKVITcleU=; b=mGtvJZJGmmNFTqGFi0pNcHAGz+zGi/YjKA0cWorc2gUlOzt3qRHMASyosAITXLUjM3 HUbpfmwktLMX067EvESc60rGwMTe2cLHCWV/I6si07sm54vup5ZXsDfeQh5BNO7bFa94 vHrMluls4ZrfvjBcbnaYcALbiiTVStqQim8UXHBcxbZGrCsIAZVkdeqDOkdQ6Cglt2fF g1eAyYsDPr8fU142ho5leMRQWdGfbi9ec2rHYdJwO/p3cFq2eGw2ovKsJxlg2P56/PQe UwyQzR92DRgOYLsnwhc+KDKTA66Ikqz64Zit3Q1xPDON0rOmM2pdpT0kJPpaLi9leaw6 3VDA== |
If there is any non zero bit in a long bitmap, it can jump out of the for
loop and finish the function as soon as possible.
Signed-off-by: Jia He <hejianet@xxxxxxxxx>
Cc: Dave Chinner <david@xxxxxxxxxxxxx>
Cc: Brian Foster <bfoster@xxxxxxxxxx>
---
fs/xfs/libxfs/xfs_bit.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_bit.c b/fs/xfs/libxfs/xfs_bit.c
index 0e8885a..84614b0 100644
--- a/fs/xfs/libxfs/xfs_bit.c
+++ b/fs/xfs/libxfs/xfs_bit.c
@@ -36,6 +36,8 @@ xfs_bitmap_empty(uint *map, uint size)
for (i = 0; i < size; i++) {
ret |= map[i];
+ if (ret != 0)
+ return 0;
}
return (ret == 0);
--
2.5.0
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | ITC Administrator., tariq . na33 |
|---|---|
| Next by Date: | Re: [PATCH v2 03/51] xfs_io: support reflink and dedupe of file ranges, Darrick J. Wong |
| Previous by Thread: | ITC Administrator., tariq . na33 |
| Next by Thread: | Re: [PATCH] libxfs: Optimize the loop for xfs_bitmap_empty, Brian Foster |
| Indexes: | [Date] [Thread] [Top] [All Lists] |