From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Uday Shankar <ushankar@purestorage.com>,
Caleb Sander Mateos <csander@purestorage.com>,
Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V3 11/17] selftests: ublk: remove `tag` parameter of ->tgt_io_done()
Date: Sun, 13 Jul 2025 22:34:06 +0800 [thread overview]
Message-ID: <20250713143415.2857561-12-ming.lei@redhat.com> (raw)
In-Reply-To: <20250713143415.2857561-1-ming.lei@redhat.com>
The `tag` parameter can be figured out from cqe->user_data, and that is
also the only way to get the info, so remove `tag` parameter, and
let target code retrieve it from cqe->user_data.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
tools/testing/selftests/ublk/fault_inject.c | 3 ++-
tools/testing/selftests/ublk/file_backed.c | 3 ++-
tools/testing/selftests/ublk/kublk.c | 4 +---
tools/testing/selftests/ublk/kublk.h | 3 +--
tools/testing/selftests/ublk/null.c | 3 ++-
tools/testing/selftests/ublk/stripe.c | 3 ++-
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/ublk/fault_inject.c b/tools/testing/selftests/ublk/fault_inject.c
index 6e60f7d97125..c980958ec045 100644
--- a/tools/testing/selftests/ublk/fault_inject.c
+++ b/tools/testing/selftests/ublk/fault_inject.c
@@ -55,9 +55,10 @@ static int ublk_fault_inject_queue_io(struct ublk_queue *q, int tag)
return 0;
}
-static void ublk_fault_inject_tgt_io_done(struct ublk_queue *q, int tag,
+static void ublk_fault_inject_tgt_io_done(struct ublk_queue *q,
const struct io_uring_cqe *cqe)
{
+ unsigned tag = user_data_to_tag(cqe->user_data);
const struct ublksrv_io_desc *iod = ublk_get_iod(q, tag);
if (cqe->res != -ETIME)
diff --git a/tools/testing/selftests/ublk/file_backed.c b/tools/testing/selftests/ublk/file_backed.c
index cfa59b631693..02fb8a411d3b 100644
--- a/tools/testing/selftests/ublk/file_backed.c
+++ b/tools/testing/selftests/ublk/file_backed.c
@@ -108,9 +108,10 @@ static int ublk_loop_queue_io(struct ublk_queue *q, int tag)
return 0;
}
-static void ublk_loop_io_done(struct ublk_queue *q, int tag,
+static void ublk_loop_io_done(struct ublk_queue *q,
const struct io_uring_cqe *cqe)
{
+ unsigned tag = user_data_to_tag(cqe->user_data);
unsigned op = user_data_to_op(cqe->user_data);
struct ublk_io *io = ublk_get_io(q, tag);
diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c
index e2d2042810d4..fba4e80e9bab 100644
--- a/tools/testing/selftests/ublk/kublk.c
+++ b/tools/testing/selftests/ublk/kublk.c
@@ -717,8 +717,6 @@ static int ublk_thread_is_done(struct ublk_thread *t)
static inline void ublksrv_handle_tgt_cqe(struct ublk_queue *q,
struct io_uring_cqe *cqe)
{
- unsigned tag = user_data_to_tag(cqe->user_data);
-
if (cqe->res < 0 && cqe->res != -EAGAIN)
ublk_err("%s: failed tgt io: res %d qid %u tag %u, cmd_op %u\n",
__func__, cqe->res, q->q_id,
@@ -726,7 +724,7 @@ static inline void ublksrv_handle_tgt_cqe(struct ublk_queue *q,
user_data_to_op(cqe->user_data));
if (q->tgt_ops->tgt_io_done)
- q->tgt_ops->tgt_io_done(q, tag, cqe);
+ q->tgt_ops->tgt_io_done(q, cqe);
}
static void ublk_handle_cqe(struct ublk_thread *t,
diff --git a/tools/testing/selftests/ublk/kublk.h b/tools/testing/selftests/ublk/kublk.h
index 6be601536b3d..d7b711e63822 100644
--- a/tools/testing/selftests/ublk/kublk.h
+++ b/tools/testing/selftests/ublk/kublk.h
@@ -145,8 +145,7 @@ struct ublk_tgt_ops {
void (*deinit_tgt)(struct ublk_dev *);
int (*queue_io)(struct ublk_queue *, int tag);
- void (*tgt_io_done)(struct ublk_queue *,
- int tag, const struct io_uring_cqe *);
+ void (*tgt_io_done)(struct ublk_queue *, const struct io_uring_cqe *);
/*
* Target specific command line handling
diff --git a/tools/testing/selftests/ublk/null.c b/tools/testing/selftests/ublk/null.c
index afe0b99d77ee..ea3da53437e9 100644
--- a/tools/testing/selftests/ublk/null.c
+++ b/tools/testing/selftests/ublk/null.c
@@ -87,9 +87,10 @@ static int null_queue_auto_zc_io(struct ublk_queue *q, int tag)
return 1;
}
-static void ublk_null_io_done(struct ublk_queue *q, int tag,
+static void ublk_null_io_done(struct ublk_queue *q,
const struct io_uring_cqe *cqe)
{
+ unsigned tag = user_data_to_tag(cqe->user_data);
unsigned op = user_data_to_op(cqe->user_data);
struct ublk_io *io = ublk_get_io(q, tag);
diff --git a/tools/testing/selftests/ublk/stripe.c b/tools/testing/selftests/ublk/stripe.c
index 37d50bbf5f5e..53cefffaf32e 100644
--- a/tools/testing/selftests/ublk/stripe.c
+++ b/tools/testing/selftests/ublk/stripe.c
@@ -226,9 +226,10 @@ static int ublk_stripe_queue_io(struct ublk_queue *q, int tag)
return 0;
}
-static void ublk_stripe_io_done(struct ublk_queue *q, int tag,
+static void ublk_stripe_io_done(struct ublk_queue *q,
const struct io_uring_cqe *cqe)
{
+ unsigned tag = user_data_to_tag(cqe->user_data);
const struct ublksrv_io_desc *iod = ublk_get_iod(q, tag);
unsigned op = user_data_to_op(cqe->user_data);
struct ublk_io *io = ublk_get_io(q, tag);
--
2.47.0
next prev parent reply other threads:[~2025-07-13 14:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 14:33 [PATCH V3 00/17] ublk: cleanup for supporting batch IO command Ming Lei
2025-07-13 14:33 ` [PATCH V3 01/17] ublk: validate ublk server pid Ming Lei
2025-07-15 14:50 ` Caleb Sander Mateos
2025-07-15 15:42 ` Ming Lei
2025-07-15 15:48 ` Caleb Sander Mateos
2025-07-15 22:39 ` Ming Lei
2025-07-13 14:33 ` [PATCH V3 02/17] ublk: look up ublk task via its pid in timeout handler Ming Lei
2025-07-13 14:33 ` [PATCH V3 03/17] ublk: move fake timeout logic into __ublk_complete_rq() Ming Lei
2025-07-13 14:33 ` [PATCH V3 04/17] ublk: let ublk_fill_io_cmd() cover more things Ming Lei
2025-07-15 15:22 ` Caleb Sander Mateos
2025-07-13 14:34 ` [PATCH V3 05/17] ublk: avoid to pass `struct ublksrv_io_cmd *` to ublk_commit_and_fetch() Ming Lei
2025-07-13 14:34 ` [PATCH V3 06/17] ublk: move auto buffer register handling into one dedicated helper Ming Lei
2025-07-13 14:34 ` [PATCH V3 07/17] ublk: store auto buffer register data into `struct ublk_io` Ming Lei
2025-07-13 14:34 ` [PATCH V3 08/17] ublk: add helper ublk_check_fetch_buf() Ming Lei
2025-07-13 14:34 ` [PATCH V3 09/17] ublk: remove ublk_commit_and_fetch() Ming Lei
2025-07-15 15:38 ` Caleb Sander Mateos
2025-07-13 14:34 ` [PATCH V3 10/17] ublk: pass 'const struct ublk_io *' to ublk_[un]map_io() Ming Lei
2025-07-13 14:34 ` Ming Lei [this message]
2025-07-13 14:34 ` [PATCH V3 12/17] selftests: ublk: pass 'ublk_thread *' to ->queue_io() and ->tgt_io_done() Ming Lei
2025-07-13 14:34 ` [PATCH V3 13/17] selftests: ublk: pass 'ublk_thread *' to more common helpers Ming Lei
2025-07-13 14:34 ` [PATCH V3 14/17] selftests: ublk: remove ublk queue self-defined flags Ming Lei
2025-07-13 14:34 ` [PATCH V3 15/17] selftests: ublk: improve flags naming Ming Lei
2025-07-13 14:34 ` [PATCH V3 16/17] selftests: ublk: add helper ublk_handle_uring_cmd() for handle ublk command Ming Lei
2025-07-13 14:34 ` [PATCH V3 17/17] selftests: ublk: add utils.h Ming Lei
2025-07-15 14:07 ` [PATCH V3 00/17] ublk: cleanup for supporting batch IO command Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250713143415.2857561-12-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=ushankar@purestorage.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).