Re: [PATCH v3 04/10] block: introduce dma map backed bio type

From: Christoph Hellwig

Date: Mon May 18 2026 - 08:57:20 EST


On Mon, May 18, 2026 at 11:29:54AM +0100, Pavel Begunkov wrote:
> On 5/13/26 09:19, Christoph Hellwig wrote:
>>> + if (!bio_flagged(bio_src, BIO_DMABUF_MAP)) {
>>> + bio->bi_io_vec = bio_src->bi_io_vec;
>>> + } else {
>>> + bio->dmabuf_map = bio_src->dmabuf_map;
>>> + bio_set_flag(bio, BIO_DMABUF_MAP);
>>> + }
>>
>> This is backwards, please avoid pointless negations:
>
> I can flip it, but compilers tend to prefer the true branch. E.g. this

What kind of compiler optimization do you expect from code where
both sides of the conditional assign different arms of the same union
and just propagate the bit that was set?