From: Daniele Di Proietto <daniele.di.proietto@gmail.com>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
Pavel Begunkov <asml.silence@gmail.com>,
linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Daniele Di Proietto <daniele.di.proietto@gmail.com>
Subject: [PATCH v3 0/4] New IORING_OP_DUP
Date: Sat, 21 Mar 2026 23:21:38 +0000 [thread overview]
Message-ID: <20260321232142.911280-1-daniele.di.proietto@gmail.com> (raw)
The new operation is like dup3(). The source file can be a regular file
descriptor or a direct descriptor. The destination is a regular file
descriptor.
The direct descriptor variant is useful to move a descriptor to an fd
and close the existing fd with a single acquisition of the `struct
files_struct` `file_lock`. Combined with IORING_OP_ACCEPT or
IORING_OP_OPENAT2 with direct descriptors, it can reduce lock contention
for multithreaded applications.
Changes since v2:
* Split the fs/ changes into separate commits
* Minor fixes, as suggested
* Avoided use of gotos in io_dup_to_fd() with guard(), as suggested
v2: https://lore.kernel.org/io-uring/20260320182341.780295-1-daniele.di.proietto@gmail.com/T/#t
Changes since v1:
* Implemented dup to direct descriptors as well
* dup from fd to fd is now atomic
* Punt to io-wq if the operation might sleep
* Removed prep() check on fd
* Avoided use of IOSQE_FIXED_FILE flag
v1: https://lore.kernel.org/io-uring/086190ca-1c34-448f-a565-aa41f671971f@gmail.com/T/#t
Daniele Di Proietto (4):
io_uring: Extract io_file_get_fixed_node() helper
fs: Export expand_files()
fs: Export new helper do_replace_fd_locked()
io_uring: Add IORING_OP_DUP
fs/file.c | 102 ++++++++++++-------
fs/internal.h | 5 +
include/uapi/linux/io_uring.h | 17 ++++
io_uring/io_uring.c | 20 +++-
io_uring/io_uring.h | 2 +
io_uring/opdef.c | 8 ++
io_uring/openclose.c | 180 ++++++++++++++++++++++++++++++++++
io_uring/openclose.h | 4 +
io_uring/splice.c | 6 +-
9 files changed, 298 insertions(+), 46 deletions(-)
--
2.43.0
next reply other threads:[~2026-03-21 23:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 23:21 Daniele Di Proietto [this message]
2026-03-21 23:21 ` [PATCH v3 1/4] io_uring: Extract io_file_get_fixed_node() helper Daniele Di Proietto
2026-03-21 23:21 ` [PATCH v3 2/4] fs: Export expand_files() Daniele Di Proietto
2026-03-21 23:21 ` [PATCH v3 3/4] fs: Export new helper do_replace_fd_locked() Daniele Di Proietto
2026-03-23 12:00 ` Christian Brauner
2026-03-23 14:20 ` Jens Axboe
2026-03-21 23:21 ` [PATCH v3 4/4] io_uring: Add IORING_OP_DUP Daniele Di Proietto
2026-03-23 14:23 ` 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 \
--in-reply-to=20260321232142.911280-1-daniele.di.proietto@gmail.com \
--to=daniele.di.proietto@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=jack@suse.cz \
--cc=kbusch@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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