On Tue, Mar 28, 2023 at 11:36:07AM -0600, Jens Axboe wrote: > This returns the number of user segments in an iov_iter. The input can > either be an ITER_IOVEC, where it'll return the number of iovecs. Or it > can be an ITER_UBUF, in which case the number of segments is always 1. > > Outside of those two, no user backed iterators exist. Just return 0 for > those. Umm... Why not set ->nr_segs to 1 in iov_iter_ubuf() instead? Note that it won't be more costly; that part of struct iov_iter (8 bytes at offset 40 on amd64) is *not* left uninitialized - zero gets stored there. That way you'll get constant 1 stored there, which is just as cheap...