[PATCH v2] nvme: change the return type of nvme_poll()

Yongsoo Joo ysjoo at kookmin.ac.kr
Mon Dec 9 13:39:42 PST 2024


On Mon, Dec 09, 2024 at 08:44:28AM -0700, Keith Busch wrote:
> On Mon, Dec 09, 2024 at 01:33:44PM +0000, Yongsoo Joo wrote:
> > -static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
> > +static bool nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
> >  {
> >  	struct nvme_queue *nvmeq = hctx->driver_data;
> >  	bool found;
> > -- 
> 
> This function is registered with blk_mq_ops, so you would have to change
> the prototype there too, and every other driver that also registers a
> poll op. Honestly, it may not be worth the effort.
Oh, I overlooked the issue you pointed out, which brings me back to my initial 
suggestion. The function nvme_poll_cq() returns the number of found CQEs, but 
nvme_poll() seems to unnecessarily reduce this information to a boolean.
A minimal change from “bool found” to “int found” in nvme_poll() would 
preserve this information, allowing any interested researcher to make use of 
it. Also, the description of poll in blk_mq_ops can be expanded as follows:
	/**
	 * @poll: Called to poll for completion of a specific tag.
         * Returns the number of CQEs found.
	 */
Thank you for your time, and I look forward to hearing your opinion.

-- 




More information about the Linux-nvme mailing list