Thread (27 messages) 27 messages, 5 authors, 2025-11-25

Re: [PATCH V5 1/6] loop: add helper lo_cmd_nr_bvec()

From: Bart Van Assche <bvanassche@acm.org>
Date: 2025-10-15 15:49:57
Also in: linux-fsdevel

On 10/15/25 4:07 AM, Ming Lei wrote:
+static inline unsigned lo_cmd_nr_bvec(struct loop_cmd *cmd)
+{
+	struct request *rq = blk_mq_rq_from_pdu(cmd);
+	struct req_iterator rq_iter;
+	struct bio_vec tmp;
+	int nr_bvec = 0;
+
+	rq_for_each_bvec(tmp, rq, rq_iter)
+		nr_bvec++;
+
+	return nr_bvec;
+}
'cmd' is not used in this function other than in the conversion to a
struct request. Has it been considered to change the argument type of
this function from 'struct loop_cmd *' into 'struct request *'? That
will allow to leave out the blk_mq_rq_from_pdu() from this function.
Otherwise this patch looks good to me.

Thanks,

Bart.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help