mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: linan666@huaweicloud.com
Cc: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com,
	hare@suse.de, martin.petersen@oracle.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org, yangerkun@huawei.com,
	zhangxiaoxu5@huawei.com, wanghai38@huawei.com
Subject: Re: [PATCH 1/4] block: factor out a helper to set logical/physical block size
Date: Mon, 7 Apr 2025 07:52:29 -0700	[thread overview]
Message-ID: <Z_PmrUtXtCY6FCcw@infradead.org> (raw)
In-Reply-To: <20250304121918.3159388-2-linan666@huaweicloud.com>

On Tue, Mar 04, 2025 at 08:19:15PM +0800, linan666@huaweicloud.com wrote:
> +extern int blk_set_block_size(struct queue_limits *t, unsigned int logical_block_size,

No need for the extern.

> +int blk_set_block_size(struct queue_limits *t, unsigned int logical_block_size,
> +		     unsigned int physical_block_size)


As Bart said this really needs documentation, both in the commit message
and the code.  It appears to be a subset of the queue limits stacking,
but I have no idea why that is needed, and the set_ name also confers
the wrong implications to me gіven the stacking logic.

> +{
> +	int ret = 0;

ret is always 0 or -1, so using a bool would be better.

> +	t->max_sectors = blk_round_down_sectors(t->max_sectors, t->logical_block_size);
> +	t->max_hw_sectors = blk_round_down_sectors(t->max_hw_sectors, t->logical_block_size);
> +	t->max_dev_sectors = blk_round_down_sectors(t->max_dev_sectors, t->logical_block_size);

Please avoid the overly long lines.

> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(blk_set_block_size);

At best this should be a EXPORT_SYMBOL_GPL.


  parent reply	other threads:[~2025-04-07 14:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 12:19 [PATCH 0/4] bugfix of logical_block_size and make it configurable linan666
2025-03-04 12:19 ` [PATCH 1/4] block: factor out a helper to set logical/physical block size linan666
2025-03-04 14:32   ` Bart Van Assche
2025-04-07 11:25     ` Li Nan
2025-04-07 14:52   ` Christoph Hellwig [this message]
2025-03-04 12:19 ` [PATCH 2/4] md: make raid logical_block_size configurable linan666
2025-03-04 12:19 ` [PATCH 3/4] md: prevent adding disks with larger logical_block_size to active arrays linan666
2025-03-04 12:19 ` [PATCH 4/4] md: Fix the return value of mddev_stack_new_rdev linan666

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=Z_PmrUtXtCY6FCcw@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=linan666@huaweicloud.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=song@kernel.org \
    --cc=wanghai38@huawei.com \
    --cc=yangerkun@huawei.com \
    --cc=yukuai3@huawei.com \
    --cc=zhangxiaoxu5@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®