Re: [PATCH liburing v5 2/2] test/splice: add basic splice tests

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

 



On 2/24/20 10:55 AM, Pavel Begunkov wrote:
> +static int copy_single(struct io_uring *ring,
> +			int fd_in, loff_t off_in,
> +			int fd_out, loff_t off_out,
> +			int pipe_fds[2],
> +			unsigned int len,
> +			unsigned flags1, unsigned flags2)
> +{
> +	struct io_uring_cqe *cqe;
> +	struct io_uring_sqe *sqe;
> +	int i, ret = -1;
> +
> +	sqe = io_uring_get_sqe(ring);
> +	if (!sqe) {
> +		fprintf(stderr, "get sqe failed\n");
> +		return -1;
> +	}
> +	io_uring_prep_splice(sqe, fd_in, off_in, pipe_fds[1], -1,
> +			     len, flags1);
> +	sqe->flags = IOSQE_IO_LINK;
> +
> +	sqe = io_uring_get_sqe(ring);
> +	if (!sqe) {
> +		fprintf(stderr, "get sqe failed\n");
> +		return -1;
> +	}
> +	io_uring_prep_splice(sqe, pipe_fds[0], -1, fd_out, off_out,
> +			     len, flags2);
> +
> +	ret = io_uring_submit(ring);
> +	if (ret <= 1) {
> +		fprintf(stderr, "sqe submit failed: %d\n", ret);
> +		return -1;
> +	}

This seems wrong, you prep one and submit, the right return value would
be 1. This check should be < 1, not <= 1. I'll make the change, rest
looks good to me. Thanks!

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux