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

Damien Le Moal
2022-08-15T16:31:21Z

On 2022/08/14 16:44, Bart Van Assche wrote:
> On 8/14/22 10:13, Damien Le Moal wrote:
>> And writes to zoned drives never get plugged in the first place, scheduler
>> present or not.
>
> Hi Damien,
>
> 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:
>
> 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);
> }

As far as I understand it, and checking the call sites, this is for LLD internal
commands only. And I think Pankaj has a good point for a fix to this one. Though
I would hate to see an LLD issue a write request though.

For f2fs, it seems to me that the problem is more with the code in
block/blk-flush.c where functions bypassing the scheduler are used for writes,
e.g. blk_insert_flush() / blk_mq_request_bypass_insert(). I am not 100% sure
though but that definitely looks very suspicious.

>
> Thanks,
>
> Bart.

--
Damien Le Moal
Western Digital Research