All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: Re: [PATCH v3 8/9] block: mq-deadline: Handle requeued requests correctly
Date: Fri, 28 Apr 2023 07:54:43 +0200	[thread overview]
Message-ID: <20230428055443.GI8549@lst.de> (raw)
In-Reply-To: <20230424203329.2369688-9-bvanassche@acm.org>

On Mon, Apr 24, 2023 at 01:33:28PM -0700, Bart Van Assche wrote:
> Start dispatching from the start of a zone instead of from the starting
> position of the most recently dispatched request.
> 
> If a zoned write is requeued with an LBA that is lower than already
> inserted zoned writes, make sure that it is submitted first.
> 
> Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  block/mq-deadline.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index bf1dfe9fe9c9..2de6c63190d8 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -156,13 +156,23 @@ deadline_latter_request(struct request *rq)
>  	return NULL;
>  }
>  
> -/* Return the first request for which blk_rq_pos() >= pos. */
> +/*
> + * Return the first request for which blk_rq_pos() >= @pos. For zoned devices,
> + * return the first request after the highest zone start <= @pos.
> + */
>  static inline struct request *deadline_from_pos(struct dd_per_prio *per_prio,
>  				enum dd_data_dir data_dir, sector_t pos)
>  {
>  	struct rb_node *node = per_prio->sort_list[data_dir].rb_node;
>  	struct request *rq, *res = NULL;
>  
> +	if (!node)
> +		return NULL;
> +
> +	rq = rb_entry_rq(node);
> +	if (blk_rq_is_seq_zoned_write(rq))
> +		pos -= bdev_offset_from_zone_start(rq->q->disk->part0, pos);

This looks a bit odd.  I'd write this as:

	if (blk_rq_is_seq_zoned_write(rq))
		pos = round_down(pos, rq->q->limits.chunk_sectors);

> @@ -821,7 +833,16 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  		 * set expire time and add to fifo list
>  		 */
>  		rq->fifo_time = jiffies + dd->fifo_expire[data_dir];
> -		list_add_tail(&rq->queuelist, &per_prio->fifo_list[data_dir]);
> +		insert_before = &per_prio->fifo_list[data_dir];
> +#ifdef CONFIG_BLK_DEV_ZONED
> +		if (blk_rq_is_seq_zoned_write(rq)) {
> +			struct request *rq2 = deadline_latter_request(rq);
> +
> +			if (rq2 && blk_rq_zone_no(rq2) == blk_rq_zone_no(rq))
> +				insert_before = &rq2->queuelist;
> +		}
> +#endif

Why does this need an ifdef?

Also can you please always add comments for these special cases?
Same for the one above.

> +		list_add_tail(&rq->queuelist, insert_before);
>  	}
>  }
>  
---end quoted text---

  reply	other threads:[~2023-04-28  5:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 20:33 [PATCH v3 0/9] mq-deadline: Improve support for zoned block devices Bart Van Assche
2023-04-24 20:33 ` [PATCH v3 1/9] block: Simplify blk_req_needs_zone_write_lock() Bart Van Assche
2023-04-24 20:33 ` [PATCH v3 2/9] block: Micro-optimize blk_req_needs_zone_write_lock() Bart Van Assche
2023-04-28  5:44   ` Christoph Hellwig
2023-04-28 19:46     ` Bart Van Assche
2023-05-01  4:34       ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 3/9] block: Introduce blk_rq_is_seq_zoned_write() Bart Van Assche
2023-04-28  5:45   ` Christoph Hellwig
2023-04-28 19:59     ` Bart Van Assche
2023-04-24 20:33 ` [PATCH v3 4/9] block: mq-deadline: Clean up deadline_check_fifo() Bart Van Assche
2023-04-28  5:46   ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 5/9] block: mq-deadline: Simplify deadline_skip_seq_writes() Bart Van Assche
2023-04-28  5:47   ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 6/9] block: mq-deadline: Improve deadline_skip_seq_writes() Bart Van Assche
2023-04-28  5:48   ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 7/9] block: mq-deadline: Track the dispatch position Bart Van Assche
2023-04-28  5:50   ` Christoph Hellwig
2023-04-28 17:04     ` Bart Van Assche
2023-04-28 20:04     ` Bart Van Assche
2023-05-01  4:35       ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 8/9] block: mq-deadline: Handle requeued requests correctly Bart Van Assche
2023-04-28  5:54   ` Christoph Hellwig [this message]
2023-04-28 17:03     ` Bart Van Assche
2023-05-01  4:37       ` Christoph Hellwig
2023-04-24 20:33 ` [PATCH v3 9/9] block: mq-deadline: Fix handling of at-head zoned writes Bart Van Assche
2023-04-28  5:58   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230428055443.GI8549@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.