summaryrefslogtreecommitdiff
path: root/fs/io-wq.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-03-22 01:58:28 +0000
committerJens Axboe <axboe@kernel.dk>2021-04-11 17:41:59 -0600
commit8418f22a53795f4478a302aaec3d056795f56089 (patch)
tree0e3717dcc45f2c9e96c16c3e95bcb2ccedcfeb7e /fs/io-wq.c
parent05356d86c64271b6f545fc14342526ab33514682 (diff)
io-wq: refactor *_get_acct()
Extract a helper for io_work_get_acct() and io_wqe_get_acct() to avoid duplication. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r--fs/io-wq.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c
index 4eba531bea5a..315b54eb0548 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -147,23 +147,20 @@ static void io_worker_release(struct io_worker *worker)
complete(&worker->ref_done);
}
+static inline struct io_wqe_acct *io_get_acct(struct io_wqe *wqe, bool bound)
+{
+ return &wqe->acct[bound ? IO_WQ_ACCT_BOUND : IO_WQ_ACCT_UNBOUND];
+}
+
static inline struct io_wqe_acct *io_work_get_acct(struct io_wqe *wqe,
struct io_wq_work *work)
{
- if (work->flags & IO_WQ_WORK_UNBOUND)
- return &wqe->acct[IO_WQ_ACCT_UNBOUND];
-
- return &wqe->acct[IO_WQ_ACCT_BOUND];
+ return io_get_acct(wqe, !(work->flags & IO_WQ_WORK_UNBOUND));
}
static inline struct io_wqe_acct *io_wqe_get_acct(struct io_worker *worker)
{
- struct io_wqe *wqe = worker->wqe;
-
- if (worker->flags & IO_WORKER_F_BOUND)
- return &wqe->acct[IO_WQ_ACCT_BOUND];
-
- return &wqe->acct[IO_WQ_ACCT_UNBOUND];
+ return io_get_acct(worker->wqe, worker->flags & IO_WORKER_F_BOUND);
}
static void io_worker_exit(struct io_worker *worker)