public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Tony Solomonik <[email protected]>,
	[email protected], [email protected]
Subject: Re: [PATCH 2/2] io_uring: add support for ftruncate
Date: Mon, 22 Jan 2024 13:12:16 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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



  reply	other threads:[~2024-01-22 20:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 19:37 [PATCH 1/2] io_uring: add support for truncate Tony Solomonik
2024-01-22 19:37 ` [PATCH 2/2] io_uring: add support for ftruncate Tony Solomonik
2024-01-22 20:12   ` Jens Axboe [this message]
2024-01-22 19:56 ` [PATCH 1/2] io_uring: add support for truncate Breno Leitao
2024-01-22 20:10 ` Jens Axboe
2024-01-22 20:12 ` Gabriel Krisman Bertazi
2024-01-22 20:22   ` Jens Axboe
2024-01-22 20:21 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox