Re: [PATCH v2 01/12] block: Send zoned writes to the I/O scheduler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/8/23 08:58, Bart Van Assche wrote:
> Send zoned writes inserted by the device mapper to the I/O scheduler.
> This prevents that zoned writes get reordered if a device mapper driver
> has been stacked on top of a driver for a zoned block device.
> 
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
> Cc: Ming Lei <ming.lei@xxxxxxxxxx>
> Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> ---
>  block/blk-mq.c | 16 +++++++++++++---
>  block/blk.h    | 19 +++++++++++++++++++
>  2 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index db93b1a71157..fefc9a728e0e 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -3008,9 +3008,19 @@ blk_status_t blk_insert_cloned_request(struct request *rq)
>  	blk_account_io_start(rq);
>  
>  	/*
> -	 * Since we have a scheduler attached on the top device,
> -	 * bypass a potential scheduler on the bottom device for
> -	 * insert.
> +	 * Send zoned writes to the I/O scheduler if an I/O scheduler has been
> +	 * attached.
> +	 */
> +	if (q->elevator && blk_rq_is_seq_zoned_write(rq)) {
> +		blk_mq_sched_insert_request(rq, /*at_head=*/false,
> +					    /*run_queue=*/true,
> +					    /*async=*/false);
> +		return BLK_STS_OK;
> +	}

Looks OK to me, but as I understand it, this function is used only for request
based device mapper, none of which currently support zoned block devices if I a
not mistaken. So is this change really necessary ?

> +
> +	/*
> +	 * If no I/O scheduler has been attached or if the request is not a
> +	 * zoned write bypass the I/O scheduler attached to the bottom device.
>  	 */
>  	blk_mq_run_dispatch_ops(q,
>  			ret = blk_mq_request_issue_directly(rq, true));
> diff --git a/block/blk.h b/block/blk.h
> index d65d96994a94..4b6f8d7a6b84 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -118,6 +118,25 @@ static inline bool bvec_gap_to_prev(const struct queue_limits *lim,
>  	return __bvec_gap_to_prev(lim, bprv, offset);
>  }
>  
> +/**
> + * blk_rq_is_seq_zoned_write() - Whether @rq is a write request for a sequential zone.
> + * @rq: Request to examine.
> + *
> + * In this context sequential zone means either a sequential write required or
> + * to a sequential write preferred zone.
> + */
> +static inline bool blk_rq_is_seq_zoned_write(struct request *rq)
> +{
> +	switch (req_op(rq)) {
> +	case REQ_OP_WRITE:
> +	case REQ_OP_WRITE_ZEROES:
> +		return disk_zone_is_seq(rq->q->disk, blk_rq_pos(rq));
> +	case REQ_OP_ZONE_APPEND:
> +	default:
> +		return false;
> +	}
> +}
> +
>  static inline bool rq_mergeable(struct request *rq)
>  {
>  	if (blk_rq_is_passthrough(rq))




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux