[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220429172354.GB174938@bgt-140510-bm01>
Date: Fri, 29 Apr 2022 17:23:54 +0000
From: Adam Manzanares <a.manzanares@...sung.com>
To: Pankaj Raghav <p.raghav@...sung.com>
CC: "jaegeuk@...nel.org" <jaegeuk@...nel.org>,
"axboe@...nel.dk" <axboe@...nel.dk>,
"snitzer@...nel.org" <snitzer@...nel.org>,
"hch@....de" <hch@....de>, "mcgrof@...nel.org" <mcgrof@...nel.org>,
"naohiro.aota@....com" <naohiro.aota@....com>,
"sagi@...mberg.me" <sagi@...mberg.me>,
"damien.lemoal@...nsource.wdc.com" <damien.lemoal@...nsource.wdc.com>,
"dsterba@...e.com" <dsterba@...e.com>,
"johannes.thumshirn@....com" <johannes.thumshirn@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
"clm@...com" <clm@...com>,
"gost.dev@...sung.com" <gost.dev@...sung.com>,
"chao@...nel.org" <chao@...nel.org>,
"linux-f2fs-devel@...ts.sourceforge.net"
<linux-f2fs-devel@...ts.sourceforge.net>,
"josef@...icpanda.com" <josef@...icpanda.com>,
"jonathan.derrick@...ux.dev" <jonathan.derrick@...ux.dev>,
"agk@...hat.com" <agk@...hat.com>,
"kbusch@...nel.org" <kbusch@...nel.org>,
"kch@...dia.com" <kch@...dia.com>,
"linux-nvme@...ts.infradead.org" <linux-nvme@...ts.infradead.org>,
"dm-devel@...hat.com" <dm-devel@...hat.com>,
"bvanassche@....org" <bvanassche@....org>,
"jiangbo.365@...edance.com" <jiangbo.365@...edance.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"matias.bjorling@....com" <matias.bjorling@....com>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>
Subject: Re: [PATCH 05/16] nvme: zns: Allow ZNS drives that have
non-power_of_2 zone size
On Wed, Apr 27, 2022 at 06:02:44PM +0200, Pankaj Raghav wrote:
> Remove the condition which disallows non-power_of_2 zone size ZNS drive
> to be updated and use generic method to calculate number of zones
> instead of relying on log and shift based calculation on zone size.
>
> The power_of_2 calculation has been replaced directly with generic
> calculation without special handling. Both modified functions are not
> used in hot paths, they are only used during initialization &
> revalidation of the ZNS device.
>
> Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
> ---
> drivers/nvme/host/zns.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
> index 9f81beb4df4e..2087de0768ee 100644
> --- a/drivers/nvme/host/zns.c
> +++ b/drivers/nvme/host/zns.c
> @@ -101,13 +101,6 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
> }
>
> ns->zsze = nvme_lba_to_sect(ns, le64_to_cpu(id->lbafe[lbaf].zsze));
> - if (!is_power_of_2(ns->zsze)) {
> - dev_warn(ns->ctrl->device,
> - "invalid zone size:%llu for namespace:%u\n",
> - ns->zsze, ns->head->ns_id);
> - status = -ENODEV;
> - goto free_data;
> - }
>
> blk_queue_set_zoned(ns->disk, BLK_ZONED_HM);
> blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
> @@ -129,7 +122,7 @@ static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns,
> sizeof(struct nvme_zone_descriptor);
>
> nr_zones = min_t(unsigned int, nr_zones,
> - get_capacity(ns->disk) >> ilog2(ns->zsze));
> + div64_u64(get_capacity(ns->disk), ns->zsze));
>
> bufsize = sizeof(struct nvme_zone_report) +
> nr_zones * sizeof(struct nvme_zone_descriptor);
> @@ -197,7 +190,7 @@ int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector,
> c.zmr.zrasf = NVME_ZRASF_ZONE_REPORT_ALL;
> c.zmr.pr = NVME_REPORT_ZONE_PARTIAL;
>
> - sector &= ~(ns->zsze - 1);
> + sector = rounddown(sector, ns->zsze);
> while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) {
> memset(report, 0, buflen);
>
> --
> 2.25.1
>
Looks good.
Reviewed by: Adam Manzanares <a.manzanares@...sung.com>
Powered by blists - more mailing lists