public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxfs: Optimize the loop for xfs_bitmap_empty
@ 2015-11-09 14:31 Jia He
  2015-11-10 12:54 ` Brian Foster
  0 siblings, 1 reply; 6+ messages in thread
From: Jia He @ 2015-11-09 14:31 UTC (permalink / raw)
  To: xfs; +Cc: Jia He, Brian Foster

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@gmail.com>
Cc: Dave Chinner <david@fromorbit.com> 
Cc: Brian Foster <bfoster@redhat.com> 
---
 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

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

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

end of thread, other threads:[~2015-12-16  3:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-09 14:31 [PATCH] libxfs: Optimize the loop for xfs_bitmap_empty Jia He
2015-11-10 12:54 ` Brian Foster
2015-11-11  6:37   ` hejianet
2015-11-11  7:49   ` [PATCH v2] " Jia He
2015-11-11 12:48     ` Brian Foster
2015-12-16  3:04       ` hejianet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox