Message ID | 20191020234220.14888-2-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Small cleanups | expand |
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@wdc.com> > --- > 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.
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); } static inline void nvme_end_request(struct request *req, __le16 status,
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@wdc.com> --- drivers/nvme/host/nvme.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)