Re: [PATCH v3 2/5] block: Introduce bio_needs_zone_write_plugging()

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

 



On 6/26/25 00:48, Bart Van Assche wrote:
> On 6/25/25 2:33 AM, Damien Le Moal wrote:
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index 4806b867e37d..0c61492724d2 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -3169,8 +3169,10 @@ void blk_mq_submit_bio(struct bio *bio)
>>   	if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
>>   		goto queue_exit;
>>   
>> -	if (blk_queue_is_zoned(q) && blk_zone_plug_bio(bio, nr_segs))
>> -		goto queue_exit;
>> +	if (bio_needs_zone_write_plugging(bio)) {
>> +		if (blk_zone_plug_bio(bio, nr_segs))
>> +			goto queue_exit;
>> +	}
> 
> Why nested if-statements instead of keeping "&&"? I prefer "&&".

I did this because bio_needs_zone_write_plugging() is inline and
blk_zone_plug_bio() is not, so this ensures that we do not have the function
call for nothing. Though I may be overthinking this since normally, the
generated assembler will not test the second part of a && condition if the first
part is false already.


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux