Re: [PATCH 1/2] nvme: Cleanup nvme_block_nr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-10-20 16:42, Damien Le Moal wrote:
> Use SECTOR_SHIFT instead of its hard coded value 9. Also add a comment
> to decribe this helper.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
> ---
>  drivers/nvme/host/nvme.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 22e8401352c2..a979b62ea4b2 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -419,9 +419,12 @@ static inline int nvme_reset_subsystem(struct nvme_ctrl *ctrl)
>  	return ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR, 0x4E564D65);
>  }
>  
> +/*
> + * Convert a 512B sector number to a block number.
> + */
>  static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
>  {
> -	return (sector >> (ns->lba_shift - 9));
> +	return sector >> (ns->lba_shift - SECTOR_SHIFT);
>  }

Has it been considered to rename nvme_block_nr() into
nvme_sect_to_lba()? I think the latter name is more clear.

Thanks,

Bart.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux