diff mbox series

[05/12] io_uring: use __anon_inode_getfd

Message ID 20200508153634.249933-6-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/12] fd: add a new __anon_inode_getfd helper | expand

Commit Message

Christoph Hellwig May 8, 2020, 3:36 p.m. UTC
Use __anon_inode_getfd instead of opencoding the logic using
get_unused_fd_flags + anon_inode_getfile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/io_uring.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 5190bfb6a6657..4104f8a45d11e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7709,18 +7709,11 @@  static int io_uring_get_fd(struct io_ring_ctx *ctx)
 		return ret;
 #endif
 
-	ret = get_unused_fd_flags(O_RDWR | O_CLOEXEC);
+	ret = __anon_inode_getfd("[io_uring]", &io_uring_fops, ctx,
+			O_RDWR | O_CLOEXEC, &file);
 	if (ret < 0)
 		goto err;
 
-	file = anon_inode_getfile("[io_uring]", &io_uring_fops, ctx,
-					O_RDWR | O_CLOEXEC);
-	if (IS_ERR(file)) {
-		put_unused_fd(ret);
-		ret = PTR_ERR(file);
-		goto err;
-	}
-
 #if defined(CONFIG_UNIX)
 	ctx->ring_sock->file = file;
 #endif