Thread (6 messages) 6 messages, 2 authors, 2015-12-16

Re: [PATCH v2] libxfs: Optimize the loop for xfs_bitmap_empty

From: hejianet <hidden>
Date: 2015-12-16 03:05:06

Hi David

Do you have any comments from your point of view? Thanks ;)

B.R.
Justin

在 11/11/15 8:48 PM, Brian Foster 写道:
On Wed, Nov 11, 2015 at 03:49:01PM +0800, Jia He wrote:
quoted
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 <redacted>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Brian Foster <redacted>
---
Looks good to me:

Reviewed-by: Brian Foster <redacted>
quoted
  fs/xfs/libxfs/xfs_bit.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_bit.c b/fs/xfs/libxfs/xfs_bit.c
index 0e8885a..0a94cce 100644
--- a/fs/xfs/libxfs/xfs_bit.c
+++ b/fs/xfs/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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help