All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: hch@lst.de, linux-nvme@lists.infradead.org, sagi@grimberg.me
Subject: Re: [PATCH 3/4] nvme-pci: use max of PRP or SGL for iod size
Date: Wed, 8 Jul 2020 15:26:49 -0700	[thread overview]
Message-ID: <20200708222649.GB2288916@dhcp-10-100-145-180.wdl.wdc.com> (raw)
In-Reply-To: <20200708005831.10013-4-chaitanya.kulkarni@wdc.com>

On Tue, Jul 07, 2020 at 05:58:30PM -0700, Chaitanya Kulkarni wrote:
>  static size_t nvme_pci_iod_alloc_size(struct nvme_dev *dev,
> -		unsigned int size, unsigned int nseg, bool use_sgl)
> +		unsigned int size, unsigned int nseg)
>  {
> -	size_t alloc_size;
> +	size_t npages_sgl = nvme_pci_npages_sgl(nseg);
> +	size_t npages = nvme_npages(size, dev);
> +	size_t alloc_size = sizeof(__le64 *);
>  
> -	if (use_sgl)
> -		alloc_size = sizeof(__le64 *) * nvme_pci_npages_sgl(nseg);
> -	else
> -		alloc_size = sizeof(__le64 *) * nvme_npages(size, dev);
> +	alloc_size *= (npages_sgl > npages ? npages_sgl : npages);

This would look better as:

	alloc_size *= max(npages, npages_sgl);

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

  reply	other threads:[~2020-07-08 22:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  0:58 [PATCH 0/4] nvme: fix iod size calculation in nvme_probe() Chaitanya Kulkarni
2020-07-08  0:58 ` [PATCH 1/4] nvme-core: use macro for ctrl page size default value Chaitanya Kulkarni
2020-07-08 22:23   ` Keith Busch
2020-07-08 23:28     ` Chaitanya Kulkarni
2020-07-08  0:58 ` [PATCH 2/4] nvme-pci: don't use ctrl page size value in probe Chaitanya Kulkarni
2020-07-08  0:58 ` [PATCH 3/4] nvme-pci: use max of PRP or SGL for iod size Chaitanya Kulkarni
2020-07-08 22:26   ` Keith Busch [this message]
2020-07-08 23:28     ` Chaitanya Kulkarni
2020-07-08  0:58 ` [PATCH 4/4] nvme-core: fix checkpatch warnings Chaitanya Kulkarni

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=20200708222649.GB2288916@dhcp-10-100-145-180.wdl.wdc.com \
    --to=kbusch@kernel.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --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.