lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z_PmrUtXtCY6FCcw@infradead.org>
Date: Mon, 7 Apr 2025 07:52:29 -0700
From: Christoph Hellwig <hch@...radead.org>
To: linan666@...weicloud.com
Cc: axboe@...nel.dk, song@...nel.org, yukuai3@...wei.com, hare@...e.de,
	martin.petersen@...cle.com, linux-block@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
	yangerkun@...wei.com, zhangxiaoxu5@...wei.com, wanghai38@...wei.com
Subject: Re: [PATCH 1/4] block: factor out a helper to set logical/physical
 block size

On Tue, Mar 04, 2025 at 08:19:15PM +0800, linan666@...weicloud.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.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ