public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: hejianet <hejianet@gmail.com>
To: xfs@oss.sgi.com, david@fromorbit.com
Cc: Brian Foster <bfoster@redhat.com>
Subject: Re: [PATCH v2] libxfs: Optimize the loop for xfs_bitmap_empty
Date: Wed, 16 Dec 2015 11:04:56 +0800	[thread overview]
Message-ID: <5670D4D8.9090500@gmail.com> (raw)
In-Reply-To: <20151111124833.GB52153@bfoster.bfoster>

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:
>> 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 <hejianet@gmail.com>
>> Cc: Dave Chinner <david@fromorbit.com>
>> Cc: Brian Foster <bfoster@redhat.com>
>> ---
> Looks good to me:
>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
>
>>   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

      reply	other threads:[~2015-12-16  3:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5670D4D8.9090500@gmail.com \
    --to=hejianet@gmail.com \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox