public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Caleb Sander Mateos <csander@purestorage.com>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>
Cc: Uday Shankar <ushankar@purestorage.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Caleb Sander Mateos <csander@purestorage.com>
Subject: [PATCH v2 4/9] ublk: take const ubq pointer in ublk_get_iod()
Date: Wed, 30 Apr 2025 16:52:29 -0600	[thread overview]
Message-ID: <20250430225234.2676781-5-csander@purestorage.com> (raw)
In-Reply-To: <20250430225234.2676781-1-csander@purestorage.com>

ublk_get_iod() doesn't modify the struct ublk_queue it is passed.
Clarify that by making the argument a const pointer.

Move the function definition earlier in the file so it doesn't need a
forward declaration.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 drivers/block/ublk_drv.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 4967a5d72029..f4c1db2e7f54 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -203,12 +203,17 @@ struct ublk_params_header {
 static void ublk_stop_dev_unlocked(struct ublk_device *ub);
 static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq);
 static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub,
 		struct ublk_queue *ubq, int tag, size_t offset);
 static inline unsigned int ublk_req_build_flags(struct request *req);
-static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq,
-						   int tag);
+
+static inline struct ublksrv_io_desc *
+ublk_get_iod(const struct ublk_queue *ubq, unsigned tag)
+{
+	return &ubq->io_cmd_buf[tag];
+}
+
 static inline bool ublk_dev_is_user_copy(const struct ublk_device *ub)
 {
 	return ub->dev_info.flags & (UBLK_F_USER_COPY | UBLK_F_SUPPORT_ZERO_COPY);
 }
 
@@ -692,16 +697,10 @@ static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev,
 static inline bool ublk_rq_has_data(const struct request *rq)
 {
 	return bio_has_data(rq->bio);
 }
 
-static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq,
-		int tag)
-{
-	return &ubq->io_cmd_buf[tag];
-}
-
 static inline struct ublksrv_io_desc *
 ublk_queue_cmd_buf(struct ublk_device *ub, int q_id)
 {
 	return ublk_get_queue(ub, q_id)->io_cmd_buf;
 }
-- 
2.45.2


  parent reply	other threads:[~2025-04-30 22:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 22:52 [PATCH v2 0/9] ublk: simplify NEED_GET_DATA handling and request lookup Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 1/9] ublk: factor out ublk_commit_and_fetch Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 2/9] ublk: fix "immepdately" typo in comment Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 3/9] ublk: remove misleading "ubq" in "ubq_complete_io_cmd()" Caleb Sander Mateos
2025-04-30 22:52 ` Caleb Sander Mateos [this message]
2025-05-02 13:39   ` [PATCH v2 4/9] ublk: take const ubq pointer in ublk_get_iod() Ming Lei
2025-04-30 22:52 ` [PATCH v2 5/9] ublk: don't log uring_cmd cmd_op in ublk_dispatch_req() Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 6/9] ublk: factor out ublk_start_io() helper Caleb Sander Mateos
2025-05-02 14:01   ` Ming Lei
2025-04-30 22:52 ` [PATCH v2 7/9] ublk: don't call ublk_dispatch_req() for NEED_GET_DATA Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 8/9] ublk: check UBLK_IO_FLAG_OWNED_BY_SRV in ublk_abort_queue() Caleb Sander Mateos
2025-04-30 22:52 ` [PATCH v2 9/9] ublk: store request pointer in ublk_io Caleb Sander Mateos
2025-05-02 15:25 ` [PATCH v2 0/9] ublk: simplify NEED_GET_DATA handling and request lookup 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=20250430225234.2676781-5-csander@purestorage.com \
    --to=csander@purestorage.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --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