From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id 802497F37 for ; Fri, 31 Jan 2014 08:13:55 -0600 (CST) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay3.corp.sgi.com (Postfix) with ESMTP id 21006AC00D for ; Fri, 31 Jan 2014 06:13:52 -0800 (PST) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) by cuda.sgi.com with ESMTP id 9oN2dgA70mIdTkHl (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 31 Jan 2014 06:13:47 -0800 (PST) Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s0VEDjT6008182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 31 Jan 2014 14:13:46 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s0VEDi7U018550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 31 Jan 2014 14:13:45 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0VEDi1i026555 for ; Fri, 31 Jan 2014 14:13:44 GMT Message-ID: <52EBAF91.10608@oracle.com> Date: Fri, 31 Jan 2014 22:13:37 +0800 From: Jeff Liu MIME-Version: 1.0 Subject: [PATCH] xfs: improve xfs_bitmap_empty() List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: "xfs@oss.sgi.com" From: Jie Liu 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 --- 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