]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: Convert advanced XArray uses to the normal API
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 9 Oct 2020 12:49:53 +0000 (13:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Nov 2020 11:45:36 +0000 (12:45 +0100)
commit 5e2ed8c4f45093698855b1f45cdf43efbf6dd498 upstream.

There are no bugs here that I've spotted, it's just easier to use the
normal API and there are no performance advantages to using the more
verbose advanced API.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index f8053e85f5b0ecfb2cd616d822f278b97fa7516c..8e9c58fa76362fea5bf8714c85d5563828d978d9 100644 (file)
@@ -7958,27 +7958,17 @@ static int io_uring_add_task_file(struct file *file)
 static void io_uring_del_task_file(struct file *file)
 {
        struct io_uring_task *tctx = current->io_uring;
-       XA_STATE(xas, &tctx->xa, (unsigned long) file);
 
        if (tctx->last == file)
                tctx->last = NULL;
-
-       xas_lock(&xas);
-       file = xas_store(&xas, NULL);
-       xas_unlock(&xas);
-
+       file = xa_erase(&tctx->xa, (unsigned long)file);
        if (file)
                fput(file);
 }
 
 static void __io_uring_attempt_task_drop(struct file *file)
 {
-       XA_STATE(xas, &current->io_uring->xa, (unsigned long) file);
-       struct file *old;
-
-       rcu_read_lock();
-       old = xas_load(&xas);
-       rcu_read_unlock();
+       struct file *old = xa_load(&current->io_uring->xa, (unsigned long)file);
 
        if (old == file)
                io_uring_del_task_file(file);