[PATCH v3 02/10] iov_iter: add iterator type for dmabuf maps
Pavel Begunkov
asml.silence at gmail.com
Mon May 18 02:24:35 PDT 2026
On 5/13/26 14:29, David Laight wrote:
> On Wed, 13 May 2026 11:05:57 +0100
> David Laight <david.laight.linux at gmail.com> wrote:
>
> ...
>>> @@ -575,7 +575,8 @@ void iov_iter_advance(struct iov_iter *i, size_t size)
>>> {
>>> if (unlikely(i->count < size))
>>> size = i->count;
>>> - if (likely(iter_is_ubuf(i)) || unlikely(iov_iter_is_xarray(i))) {
>>> + if (likely(iter_is_ubuf(i)) || unlikely(iov_iter_is_xarray(i)) ||
>>> + unlikely(iov_iter_is_dmabuf_map(i))) {
>>
>>
>> Doesn't the extra check add more code to all the non-ubuf cases?
>> This could be fixed by either making iter_type a bitmask (with one bit set)
Not going to do that. It was specifically converted from bitmask
before, and the check optimisations like this were voiced back than.
>> or writing an iter_is_one_of(i, ITER_xxx, ITER_yyy) define that uses
>> '(1 << i->iter_type) & ((1 << ITER_xxx) | ...)'
>
> This seems to DTRT:
>
> #define _ITER_IS_ONE_OF(iter, t1, t2, t3, t4, t5, t6, t7, t8, ...) \
> ((1u << (iter)->iter_type) & ((1u << ITER_##t1) | (1u << ITER_##t2) | \
> (1u << ITER_##t3) | (1u << ITER_##t4) | (1u << ITER_##t5) | \
> (1u << ITER_##t6) | (1u << ITER_##t7) | (1u << ITER_##t8)))
> #define ITER_IS_ONE_OF(iter, t, ...) \
> _ITER_IS_ONE_OF(iter, t, ## __VA_ARGS__, t, t, t, t, t, t, t)
We definitely don't want that, using them directly would've been
much cleaner.
if (get_type_mask(i) & (TYPE1 | TYPE2)) ...
--
Pavel Begunkov
More information about the Linux-nvme
mailing list