clean io_wq->do_work()
cover clean io_wq->do_work()
Small io-wq cleanups after getting rid of per-work callbacks.
Pavel Begunkov (2):
io-wq: compact io-wq flags numbers
io-wq: return next work from ->do_work() directly
fs/io-wq.c | 8 +++----- fs/io-wq.h | 10 +++++----- fs/io_uring.c | 53 ++++++++++++++++++++------------------------------- 3 files changed, 29 insertions(+), 42 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/2 io-wq: compact io-wq flags numbers
Renumerate IO_WQ flags, so they take adjacent bits
Signed-off-by Pavel Begunkov <[email protected]>
--- fs/io-wq.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/io-wq.h +4 -4
@@ -5,10 +5,10 @@ struct io_wq;enum {IO_WQ_WORK_CANCEL =1 , -IO_WQ_WORK_HASHED =4 , -IO_WQ_WORK_UNBOUND =32 , -IO_WQ_WORK_NO_CANCEL =256 , -IO_WQ_WORK_CONCURRENT =512 , +IO_WQ_WORK_HASHED =2 , +IO_WQ_WORK_UNBOUND =4 , +IO_WQ_WORK_NO_CANCEL =8 , +IO_WQ_WORK_CONCURRENT =16 ,IO_WQ_HASH_SHIFT =24 ,/* upper 8 bits are used for hash key */ };
Signature · 1 line
2.24.0
PATCH 2/2 io-wq: return next work from ->do_work() directly
In reply to Pavel BegunkovIt's easier to return next work from ->do_work() than having an in-out argument. Looks nicer and easier to compile. Also, merge io_wq_assign_next() into its only user.
Signed-off-by Pavel Begunkov <[email protected]>
--- fs/io-wq.c | 8 +++----- fs/io-wq.h | 2 +- fs/io_uring.c | 53 ++++++++++++++++++++------------------------------- 3 files changed, 25 insertions(+), 38 deletions(-)
fs/io-wq.c +3 -5
@@ -523,9 +523,8 @@ static void io_worker_handle_work(struct io_worker *worker) work->flags |=IO_WQ_WORK_CANCEL ; hash =io_get_work_hash (work); - linked = old_work = work; - wq->do_work (&linked); - linked = (old_work == linked) ?NULL : linked; + old_work = work; + linked = wq->do_work (work); work = next_hashed;if (!work && linked && !io_wq_is_hashed (linked)) {
@@ -781,8 +780,7 @@ static void io_run_cancel(struct io_wq_work *work, struct io_wqe *wqe)struct io_wq_work *old_work = work; work->flags |=IO_WQ_WORK_CANCEL ; - wq->do_work (&work); - work = (work == old_work) ?NULL : work; + work = wq->do_work (work); wq->free_work (old_work); }while (work); }
fs/io-wq.h +1 -1
@@ -101,7 +101,7 @@ static inline struct io_wq_work *wq_next_work(struct io_wq_work *work) }typedef void (free_work_fn )(struct io_wq_work *); -typedef void (io_wq_work_fn )(struct io_wq_work **); +typedef struct io_wq_work *(io_wq_work_fn )(struct io_wq_work *);struct io_wq_data {struct user_struct *user;
fs/io_uring.c +21 -32
88 lines not on this page · raw message
Signature · 1 line
2.24.0
Quoted 10 lines · Pavel Begunkov
Small io-wq cleanups after getting rid of per-work callbacks.
Pavel Begunkov (2):
io-wq: compact io-wq flags numbers
io-wq: return next work from ->do_work() directlyfs/io-wq.c | 8 +++----- fs/io-wq.h | 10 +++++----- fs/io_uring.c | 53 ++++++++++++++++++++------------------------------- 3 files changed, 29 insertions(+), 42 deletions(-)
Applied, thanks.
Signature · 1 line
Jens Axboe