Re: [PATCH] block: Submit flush requests to the I/O scheduler

Pankaj Raghav
2022-08-15T09:06:13Z

On Sun, Aug 14, 2022 at 04:44:31PM -0700, Bart Van Assche wrote:
> I agree that blk_mq_submit_bio() does not plug writes to zoned drives
> because of the following code in blk_mq_plug():
>
> /* Zoned block device write operation case: do not plug the BIO */
> if (bdev_is_zoned(bio->bi_bdev) && op_is_write(bio_op(bio)))
> return NULL;
>
> However, I have not found any code in blk_execute_rq_nowait() that causes
> the plugging mechanism to be skipped for zoned writes. Did I perhaps
> overlook something? The current blk_execute_rq_nowait() implementation is as
> follows:
>
IIUC, blk_execute_rq_nowait() is used mainly by lower level drivers to send
commands but current->plug is not initialized with blk_start_plug() in those
drivers. So, the rqs are not added to the plug list.

I did a quick test with fio with the new uring_cmd IO path that uses
blk_execute_rq_nowait() and it never plugged the rqs.

fio --filename=/dev/ng0n3 --size=128M --rw=write --bs=4k --zonemode=zbd --ioengine=io_uring_cmd --name=zoned

Did you notice it otherwise?

But I think it is better if we change current->plug to blk_mq_plug() to
be on the safer side.
> void blk_execute_rq_nowait(struct request *rq, bool at_head)
> {
> WARN_ON(irqs_disabled());
> WARN_ON(!blk_rq_is_passthrough(rq));
>
> blk_account_io_start(rq);
> if (current->plug)
> blk_add_rq_to_plug(current->plug, rq);
> else
> blk_mq_sched_insert_request(rq, at_head, true, false);
> }
>
> Thanks,
>
> Bart.

--
Pankaj Raghav