Re: [PATCH v2 2/2] io_uring: add support for ftruncate

Jens Axboe
2024-01-23T15:46:14Z

On 1/23/24 4:33 AM, Tony Solomonik wrote:
> +int io_ftruncate(struct io_kiocb *req, unsigned int issue_flags)
> +{
> + struct io_ftrunc *ft = io_kiocb_to_cmd(req, struct io_ftrunc);
> + int ret;
> +
> + WARN_ON_ONCE(issue_flags & IO_URING_F_NONBLOCK);
> +
> + ret = __do_ftruncate(req->file, ft->len, 1);

Should this not pass 0 at the end for small == 0, as this variant should
be 64-bit clean from the get-go?

Another thing to add to the test case, create a large sparse file that
is eg 8G and truncate it to 6G. That would catch an issue with that.

--
Jens Axboe