All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "sagi@grimberg.me" <sagi@grimberg.me>, "hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH 2/9] nvmet: add ZNS support for bdev-ns
Date: Mon, 30 Nov 2020 00:18:21 +0000	[thread overview]
Message-ID: <CH2PR04MB652265309D7C6395773CF44AE7F50@CH2PR04MB6522.namprd04.prod.outlook.com> (raw)
In-Reply-To: BYAPR04MB496572575C9B29E682B0C25286F70@BYAPR04MB4965.namprd04.prod.outlook.com

On 2020/11/28 9:11, Chaitanya Kulkarni wrote:
> On 11/26/20 01:06, Damien Le Moal wrote:
>>> +
>>> +	desc_size = nvmet_zones_to_descsize(blk_queue_nr_zones(q));
>>> +	status = nvmet_bdev_zns_checks(req);
>>> +	if (status)
>>> +		goto out;
>>> +
>>> +	zones = kvcalloc(blkdev_nr_zones(nvmet_bdev(req)->bd_disk),
>>> +			      sizeof(struct blk_zone), GFP_KERNEL);
>>> +	if (!zones) {
>>> +		status = NVME_SC_INTERNAL;
>>> +		goto out;
>>> +	}
>>> +
>>> +	rz = __vmalloc(bufsize, GFP_KERNEL | __GFP_NORETRY);
>>> +	if (!rz) {
>>> +		status = NVME_SC_INTERNAL;
>>> +		goto out_free_zones;
>>> +	}
>>> +
>>> +	sect = nvmet_lba_to_sect(req->ns, le64_to_cpu(req->cmd->zmr.slba));
>>> +
>>> +	for (nz = blk_queue_nr_zones(q); desc_size >= bufsize; nz--)
>>> +		desc_size = nvmet_zones_to_descsize(nz);
>> desc_size is actually not used anywhere to do something. So what is the purpose
>> of this ? If only to determine nz, the number of zones that can be reported,
>> surely you can calculate it instead of using this loop.
>>
> It reads nicely. Let me see if I can get rid of the loop without having to
> add complex calculations.

I do not think it reads nicely at all: it makes what is being "calculated" hard
to understand. And that definitely looks to me like a waste of CPU cycles
compared to a real calculation.


-- 
Damien Le Moal
Western Digital Research

WARNING: multiple messages have this Message-ID (diff)
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "sagi@grimberg.me" <sagi@grimberg.me>, "hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH 2/9] nvmet: add ZNS support for bdev-ns
Date: Mon, 30 Nov 2020 00:18:21 +0000	[thread overview]
Message-ID: <CH2PR04MB652265309D7C6395773CF44AE7F50@CH2PR04MB6522.namprd04.prod.outlook.com> (raw)
In-Reply-To: BYAPR04MB496572575C9B29E682B0C25286F70@BYAPR04MB4965.namprd04.prod.outlook.com

On 2020/11/28 9:11, Chaitanya Kulkarni wrote:
> On 11/26/20 01:06, Damien Le Moal wrote:
>>> +
>>> +	desc_size = nvmet_zones_to_descsize(blk_queue_nr_zones(q));
>>> +	status = nvmet_bdev_zns_checks(req);
>>> +	if (status)
>>> +		goto out;
>>> +
>>> +	zones = kvcalloc(blkdev_nr_zones(nvmet_bdev(req)->bd_disk),
>>> +			      sizeof(struct blk_zone), GFP_KERNEL);
>>> +	if (!zones) {
>>> +		status = NVME_SC_INTERNAL;
>>> +		goto out;
>>> +	}
>>> +
>>> +	rz = __vmalloc(bufsize, GFP_KERNEL | __GFP_NORETRY);
>>> +	if (!rz) {
>>> +		status = NVME_SC_INTERNAL;
>>> +		goto out_free_zones;
>>> +	}
>>> +
>>> +	sect = nvmet_lba_to_sect(req->ns, le64_to_cpu(req->cmd->zmr.slba));
>>> +
>>> +	for (nz = blk_queue_nr_zones(q); desc_size >= bufsize; nz--)
>>> +		desc_size = nvmet_zones_to_descsize(nz);
>> desc_size is actually not used anywhere to do something. So what is the purpose
>> of this ? If only to determine nz, the number of zones that can be reported,
>> surely you can calculate it instead of using this loop.
>>
> It reads nicely. Let me see if I can get rid of the loop without having to
> add complex calculations.

I do not think it reads nicely at all: it makes what is being "calculated" hard
to understand. And that definitely looks to me like a waste of CPU cycles
compared to a real calculation.


-- 
Damien Le Moal
Western Digital Research

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2020-11-30  0:19 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  2:40 [PATCH 0/9] nvmet: add genblk ZBD backend Chaitanya Kulkarni
2020-11-26  2:40 ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 1/9] block: export __bio_iov_append_get_pages() Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:09   ` Damien Le Moal
2020-11-26  8:09     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 2/9] nvmet: add ZNS support for bdev-ns Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:36   ` Damien Le Moal
2020-11-26  8:36     ` Damien Le Moal
2020-11-28  0:09     ` Chaitanya Kulkarni
2020-11-28  0:09       ` Chaitanya Kulkarni
2020-11-30  0:16       ` Damien Le Moal
2020-11-30  0:16         ` Damien Le Moal
2020-11-26  9:06   ` Damien Le Moal
2020-11-26  9:06     ` Damien Le Moal
     [not found]     ` <BYAPR04MB496572575C9B29E682B0C25286F70@BYAPR04MB4965.namprd04.prod.outlook.com>
2020-11-30  0:18       ` Damien Le Moal [this message]
2020-11-30  0:18         ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 3/9] nvmet: trim down id-desclist to use req->ns Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 4/9] nvmet: add NVME_CSI_ZNS in ns-desc for zbdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 5/9] nvmet: add cns-cs-ctrl in id-ctrl for ZNS bdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:39   ` Damien Le Moal
2020-11-26  8:39     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 6/9] nvmet: add cns-cs-ns " Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:40   ` Damien Le Moal
2020-11-26  8:40     ` Damien Le Moal
     [not found]     ` <BYAPR04MB4965E885FFD93A530AF315B886F70@BYAPR04MB4965.namprd04.prod.outlook.com>
2020-11-30  0:21       ` Damien Le Moal
2020-11-30  0:21         ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 7/9] nvmet: add zns cmd effects to support zbdev Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:40   ` Damien Le Moal
2020-11-26  8:40     ` Damien Le Moal
2020-11-26  2:40 ` [PATCH 8/9] nvmet: add zns bdev config support Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  2:40 ` [PATCH 9/9] nvmet: add ZNS based I/O cmds handlers Chaitanya Kulkarni
2020-11-26  2:40   ` Chaitanya Kulkarni
2020-11-26  8:45   ` Damien Le Moal
2020-11-26  8:45     ` Damien Le Moal
2020-11-26  8:07 ` [PATCH 0/9] nvmet: add genblk ZBD backend Damien Le Moal
2020-11-26  8:07   ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR04MB652265309D7C6395773CF44AE7F50@CH2PR04MB6522.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.