From: Damien Le Moal <dlemoal@kernel.org>
To: John Garry <john.g.garry@oracle.com>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, martin.petersen@oracle.com,
hch@lst.de, hare@suse.de, bvanassche@acm.org
Subject: Re: [PATCH v2 2/2] block: Enforce power-of-2 physical block size
Date: Tue, 29 Jul 2025 20:03:14 +0900 [thread overview]
Message-ID: <cc2ed0c4-05a1-4870-9577-28f5bf10f549@kernel.org> (raw)
In-Reply-To: <20250729091448.1691334-3-john.g.garry@oracle.com>
On 7/29/25 18:14, John Garry wrote:
> The merging/splitting code and other queue limits checking depends on the
> physical block size being a power-of-2, so enforce it.
>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
> block/blk-settings.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index fa53a330f9b99..5ae0a253e43fd 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -274,6 +274,10 @@ int blk_validate_limits(struct queue_limits *lim)
> }
> if (lim->physical_block_size < lim->logical_block_size)
> lim->physical_block_size = lim->logical_block_size;
> + else if (!is_power_of_2(lim->physical_block_size)) {
> + pr_warn("Invalid physical block size (%d)\n", lim->physical_block_size);
Nit: format should use %u
> + return -EINVAL;
> + }
Nit: Add the curly brackets to the if part too.
Other than that, looks OK to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
>
> /*
> * The minimum I/O size defaults to the physical block size unless
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2025-07-29 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 9:14 [PATCH v2 0/2] block: make some queue limits checks more robust John Garry
2025-07-29 9:14 ` [PATCH v2 1/2] block: avoid possible overflow for chunk_sectors check in blk_stack_limits() John Garry
2025-07-29 11:05 ` Damien Le Moal
2025-07-29 9:14 ` [PATCH v2 2/2] block: Enforce power-of-2 physical block size John Garry
2025-07-29 10:19 ` Hannes Reinecke
2025-07-29 11:03 ` Damien Le Moal [this message]
2025-07-29 12:27 ` [PATCH v2 0/2] block: make some queue limits checks more robust Jens Axboe
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=cc2ed0c4-05a1-4870-9577-28f5bf10f549@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.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.