linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: improve xfs_bitmap_empty()
@ 2014-01-31 14:13 Jeff Liu
  2014-01-31 15:07 ` Eric Sandeen
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Liu @ 2014-01-31 14:13 UTC (permalink / raw)
  To: xfs@oss.sgi.com

From: Jie Liu <jeff.liu@oracle.com>

There is no need to travel through the whole bitmap items to verify
if the bitmap array is empty or not, instead, just return 0 directly
if an item is detected in bitmap array.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/xfs/xfs_bit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_bit.c b/fs/xfs/xfs_bit.c
index 0e8885a..ae0acc2 100644
--- a/fs/xfs/xfs_bit.c
+++ b/fs/xfs/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])
+			return 0;
 	}
 
-	return (ret == 0);
+	return 1;
 }
 
 /*
-- 
1.8.3.2

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-04 15:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-31 14:13 [PATCH] xfs: improve xfs_bitmap_empty() Jeff Liu
2014-01-31 15:07 ` Eric Sandeen
2014-01-31 15:28   ` Jeff Liu
2014-01-31 15:30     ` Eric Sandeen
2014-01-31 15:51       ` Jeff Liu
2014-01-31 16:28         ` Mark Tinguely
2014-01-31 16:47           ` Eric Sandeen
2014-02-01  3:48           ` Jeff Liu
2014-02-02 21:52             ` Dave Chinner
2014-02-04 15:10               ` Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).