public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Damien Le Moal <dlemoal@kernel.org>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v2 3/5] block: Remove a DMA segment boundary mask check
Date: Thu, 26 Mar 2026 22:51:57 +0800	[thread overview]
Message-ID: <acVIDQp5WWerx3lA@fedora> (raw)
In-Reply-To: <20260325213719.2850619-4-bvanassche@acm.org>

On Wed, Mar 25, 2026 at 02:37:13PM -0700, Bart Van Assche wrote:
> Commit d690cb8ae14b ("block: add an API to atomically update queue limits")
> introduced the following code:
> 
>        /*
>         * By default there is no limit on the segment boundary alignment,
>         * but if there is one it can't be smaller than the page size as
>         * that would break all the normal I/O patterns.
>         */
>        if (!lim->seg_boundary_mask)
>                lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
>        if (WARN_ON_ONCE(lim->seg_boundary_mask < PAGE_SIZE - 1))
>                return -EINVAL;
> 
> The comment about "breaking normal I/O patterns" is incorrect - block
> layer code like get_max_segment_size() supports arbitrary boundary mask
> values as long as the boundary mask is not zero. Remove the comment and
> the check because both are confusing.
> 
> This patch prepares for reducing the value of BLK_MIN_SEGMENT_SIZE.
> 
> Fixes: d690cb8ae14b ("block: add an API to atomically update queue limits")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  block/blk-settings.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index 13f5457f9f4e..8538e50afe2c 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -447,15 +447,9 @@ int blk_validate_limits(struct queue_limits *lim)
>  	if (!lim->max_discard_segments)
>  		lim->max_discard_segments = 1;
>  
> -	/*
> -	 * By default there is no limit on the segment boundary alignment,
> -	 * but if there is one it can't be smaller than the page size as
> -	 * that would break all the normal I/O patterns.
> -	 */
> +	/* By default there is no limit on the segment boundary alignment. */
>  	if (!lim->seg_boundary_mask)
>  		lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
> -	if (WARN_ON_ONCE(lim->seg_boundary_mask < BLK_MIN_SEGMENT_SIZE - 1))
> -		return -EINVAL;

Please fold this change into the real code for reducing
BLK_MIN_SEGMENT_SIZE, then it provides consistent handling/view about
->seg_boundary_mask and BLK_MIN_SEGMENT_SIZE.

Thanks,
Ming


  reply	other threads:[~2026-03-26 14:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 21:37 [PATCH v2 0/5] Enable testing small DMA segment sizes Bart Van Assche
2026-03-25 21:37 ` [PATCH v2 1/5] block: Fix a source code comment Bart Van Assche
2026-03-26 14:23   ` Christoph Hellwig
2026-03-26 14:48   ` Ming Lei
2026-03-25 21:37 ` [PATCH v2 2/5] block: Fix the max_user_sectors lower bound Bart Van Assche
2026-03-26 14:23   ` Christoph Hellwig
2026-03-26 14:46   ` Ming Lei
2026-03-25 21:37 ` [PATCH v2 3/5] block: Remove a DMA segment boundary mask check Bart Van Assche
2026-03-26 14:51   ` Ming Lei [this message]
2026-03-26 15:51     ` Bart Van Assche
2026-03-27  0:52       ` Ming Lei
2026-03-27  1:55         ` Bart Van Assche
2026-03-25 21:37 ` [PATCH v2 4/5] block: Reduce the minimum value for the maximum DMA segment size Bart Van Assche
2026-03-25 21:37 ` [PATCH v2 5/5] null_blk: Support configuring " Bart Van Assche

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=acVIDQp5WWerx3lA@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox