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>
Subject: Re: [PATCH v3 4/6] block: Reduce the minimum value for the maximum DMA segment size
Date: Sun, 29 Mar 2026 22:38:14 +0800 [thread overview]
Message-ID: <ack5VqUS_gRuxodF@fedora> (raw)
In-Reply-To: <20260327211349.2239633-5-bvanassche@acm.org>
On Fri, Mar 27, 2026 at 02:13:44PM -0700, Bart Van Assche wrote:
> All block devices that are supported by the Linux kernel have a DMA engine
> that supports DMA segments of 4 KiB or larger. Allow smaller DMA segment
> sizes because these are useful for block layer testing. Reject values below
Can you share why/what it is useful just for test purpose?
If there isn't such real device with 512 segment size, why do we want this
change for covering it?
> 512 because such values would result in an excessive number of DMA
> segments. Move the BLK_MIN_SEGMENT_SIZE definition into <linux/blkdev.h>.
> This will allow the BLK_MIN_SEGMENT_SIZE constant to be used in the
> null_blk and scsi_debug drivers.
>
> The only code affected by this change is the following code:
>
> if (WARN_ON_ONCE(lim->max_segment_size < BLK_MIN_SEGMENT_SIZE))
> return -EINVAL;
>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> block/blk.h | 1 -
> include/linux/blkdev.h | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk.h b/block/blk.h
> index 103cb1d0b9cb..b30ff8db3cac 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -23,7 +23,6 @@ struct elv_change_ctx;
> #define BLK_DEF_MAX_SECTORS_CAP (SZ_4M >> SECTOR_SHIFT)
>
> #define BLK_DEV_MAX_SECTORS (LLONG_MAX >> 9)
> -#define BLK_MIN_SEGMENT_SIZE 4096
>
> /* Max future timer expiry for timeouts */
> #define BLK_MAX_TIMEOUT (5 * HZ)
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index b8e7f42aee71..109d5fa5e190 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1311,6 +1311,7 @@ static inline bool bdev_is_partition(struct block_device *bdev)
> enum blk_default_limits {
> BLK_MAX_SEGMENTS = 128,
> BLK_SAFE_MAX_SECTORS = 255,
> + BLK_MIN_SEGMENT_SIZE = 512,
> BLK_MAX_SEGMENT_SIZE = 65536,
> BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
This change actually becomes not consistent with previous patch, in which ->seg_boundary_mask
can be 4095.
Thank,
Ming
next prev parent reply other threads:[~2026-03-29 14:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 21:13 [PATCH v3 0/6] Enable testing small DMA segment sizes Bart Van Assche
2026-03-27 21:13 ` [PATCH v3 1/6] block: Fix a source code comment Bart Van Assche
2026-03-27 21:13 ` [PATCH v3 2/6] block: Fix the max_user_sectors lower bound Bart Van Assche
2026-03-27 21:13 ` [PATCH v3 3/6] block: Fix the DMA segment boundary mask check Bart Van Assche
2026-03-27 21:13 ` [PATCH v3 4/6] block: Reduce the minimum value for the maximum DMA segment size Bart Van Assche
2026-03-29 14:38 ` Ming Lei [this message]
2026-03-27 21:13 ` [PATCH v3 5/6] null_blk: Support configuring " Bart Van Assche
2026-03-29 12:30 ` Nilay Shroff
2026-03-30 2:23 ` Ming Lei
2026-03-27 21:13 ` [PATCH v3 6/6] scsi_debug: Support configuring the maximum " 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=ack5VqUS_gRuxodF@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=dlemoal@kernel.org \
--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