[LTP] [PATCH v2 2/3] io_uring: Test READV and WRITEV operations
Sachin Sant
sachinp@linux.ibm.com
Wed Apr 15 15:56:39 CEST 2026
>> +static void prepare_read_buffers(void)
>> +{
>> + size_t i;
>> +
>> + for (i = 0; i < NUM_VECS; i++)
>> + memset(read_iovs[i].iov_base, 0, read_iovs[i].iov_len);
>> +}
>> +
>> +static void clear_iovec_buffers(struct iovec *iovs, int nvecs)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < nvecs; i++)
>> + memset(iovs[i].iov_base, 0, iovs[i].iov_len);
>> +}
> These two functions are nearly identical, we really need only one
> function to clear the buffers.
>
Indeed. Good catch. Will merge them.
>> +static void test_varying_sizes(void)
>> +{
>> + int fd;
>> + int expected_size = VAR_BUF1_SIZE + VAR_BUF2_SIZE + VAR_BUF3_SIZE;
>> +
>> + tst_res(TINFO, "Testing vectors with varying sizes including zero-length buffer");
>> +
>> + io_uring_init_buffer_pattern(var_write_iovs[0].iov_base, VAR_BUF1_SIZE, 'X');
>> + io_uring_init_buffer_pattern(var_write_iovs[2].iov_base, VAR_BUF2_SIZE, 'Y');
>> + io_uring_init_buffer_pattern(var_write_iovs[3].iov_base, VAR_BUF3_SIZE, 'Z');
> Can we handle this with the prepare_write_buffers() as well?
These two functions implement different logic. prepare_write_buffers()
create a rotating
pattern unique to each vector while io_uring_init_buffer_pattern() fills
a buffer with
a single repeating character.
But I see your point. I will merge these two as well.
Thank You for the detailed review.
--
Thanks
- Sachin
More information about the ltp
mailing list