summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-10-09 13:49:53 +0100
committerJens Axboe <axboe@kernel.dk>2020-10-12 15:03:11 -0600
commit20a4be151c4ba3025e11acdd739fb420393a9ae5 (patch)
treed74670bf4d14834892f7eb470f1ff31e97a68312
parentb267238d1bf7c09f6f9c23b6b7547ab1e5b11cfc (diff)
io_uring: Convert advanced XArray uses to the normal API5.9-stable
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>
-rw-r--r--fs/io_uring.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 82c5bd58042a..f333ead8dc4e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8365,27 +8365,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);