public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops
@ 2021-01-02 21:04 noah
  0 siblings, 0 replies; only message in thread
From: noah @ 2021-01-02 21:04 UTC (permalink / raw)
  Cc: goldstein.w.n, Jens Axboe, Alexander Viro, open list:IO_URING,
	open list:FILESYSTEMS (VFS and infrastructure), open list

This patch drops unnecessary comparisons to turn return values into
booleans. There is no reason to do a != for cancelled and posted as
they can be set to a boolean directly more efficiently.

Signed-off-by: noah <[email protected]>
---
 fs/io_uring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca46f314640b..6a46594e749a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1607,11 +1607,11 @@ static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk,
 	list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) {
 		if (io_match_task(req, tsk, files)) {
 			io_kill_timeout(req);
-			canceled++;
+			canceled = 1;
 		}
 	}
 	spin_unlock_irq(&ctx->completion_lock);
-	return canceled != 0;
+	return canceled;
 }
 
 static void __io_queue_deferred(struct io_ring_ctx *ctx)
@@ -5491,7 +5491,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
 		list = &ctx->cancel_hash[i];
 		hlist_for_each_entry_safe(req, tmp, list, hash_node) {
 			if (io_match_task(req, tsk, files))
-				posted += io_poll_remove_one(req);
+				posted |= io_poll_remove_one(req);
 		}
 	}
 	spin_unlock_irq(&ctx->completion_lock);
@@ -5499,7 +5499,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
 	if (posted)
 		io_cqring_ev_posted(ctx);
 
-	return posted != 0;
+	return posted;
 }
 
 static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-02 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-02 21:04 [PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops noah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox