lkml.org 
[lkml]   [2023]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 18/21] scsi: sd: Support reading atomic properties from block limits VPD
From
On 9/29/23 03:27, John Garry wrote:
> +static void sd_config_atomic(struct scsi_disk *sdkp)
> +{
> + unsigned int logical_block_size = sdkp->device->sector_size;
> + struct request_queue *q = sdkp->disk->queue;
> +
> + if (sdkp->max_atomic) {

Please use the "return early" style here to keep the indentation
level in this function low.

> + unsigned int max_atomic = max_t(unsigned int,
> + rounddown_pow_of_two(sdkp->max_atomic),
> + rounddown_pow_of_two(sdkp->max_atomic_with_boundary));
> + unsigned int unit_min = sdkp->atomic_granularity ?
> + rounddown_pow_of_two(sdkp->atomic_granularity) :
> + physical_block_size_sectors;
> + unsigned int unit_max = max_atomic;
> +
> + if (sdkp->max_atomic_boundary)
> + unit_max = min_t(unsigned int, unit_max,
> + rounddown_pow_of_two(sdkp->max_atomic_boundary));

Why does "rounddown_pow_of_two()" occur in the above code?

Thanks,

Bart.

\
 
 \ /
  Last update: 2023-09-29 19:55    [W:0.435 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site