Re: [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 28, 2018 at 09:01:42AM +0200, Nikolay Borisov wrote:
>
>
>On 28.11.18 г. 5:21 ч., Lu Fengqi wrote:
>> The @found is always false when it comes to the if branch. Besides, the
>> bool type is more suitable for @found.
>
>Well if you are ranging the type of found variable it also makes sense
>to change the return value of the function to bool as well.

Good catch.

-- 
Thanks,
Lu

>
>> 
>> Signed-off-by: Lu Fengqi <lufq.fnst@xxxxxxxxxxxxxx>
>> ---
>>  fs/btrfs/extent_io.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>> 
>> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
>> index 582b4b1c41e0..b4ee3399be96 100644
>> --- a/fs/btrfs/extent_io.c
>> +++ b/fs/btrfs/extent_io.c
>> @@ -1461,7 +1461,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
>>  	struct rb_node *node;
>>  	struct extent_state *state;
>>  	u64 cur_start = *start;
>> -	u64 found = 0;
>> +	bool found = false;
>>  	u64 total_bytes = 0;
>>  
>>  	spin_lock(&tree->lock);
>> @@ -1472,8 +1472,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
>>  	 */
>>  	node = tree_search(tree, cur_start);
>>  	if (!node) {
>> -		if (!found)
>> -			*end = (u64)-1;
>> +		*end = (u64)-1;
>>  		goto out;
>>  	}
>>  
>> @@ -1493,7 +1492,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
>>  			*cached_state = state;
>>  			refcount_inc(&state->refs);
>>  		}
>> -		found++;
>> +		found = true;
>>  		*end = state->end;
>>  		cur_start = state->end + 1;
>>  		node = rb_next(node);
>> 
>
>





[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux