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