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

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

 



> +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_sys_ftruncate(ft->dfd, ft->len, 1);

This needs a __do_ftruncate() or something helper that takes a struct
file, that should be done as a prep patch. Then do_sys_ftruncate() can
call that helper as well, once it's done the fget.

With that, you also then remove the restriction you currently have that
it can't work on fixed files, there's no reason for that restriction to
be there.

Same comments on len vs offset, and the CLEANUP part. Both need to get
done here as well.

-- 
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