All of lore.kernel.org
 help / color / mirror / Atom feed
From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH] NVMe: Set block queue max sectors
Date: Thu, 26 Jul 2012 12:22:16 -0400	[thread overview]
Message-ID: <20120726162216.GD22985@linux.intel.com> (raw)
In-Reply-To: <1343254030-309-1-git-send-email-keith.busch@intel.com>

On Wed, Jul 25, 2012@04:07:10PM -0600, Keith Busch wrote:
> Set the max hw sectors in a namespace's request queue if the nvme device has a
> max data transfer size.

Could I trouble you to reflow your comments in the future?  When one
types 'git log', it inserts four spaces before the message, so this
would look like:

    Set the max hw sectors in a namespace's request queue if the nvme device has a
    max data transfer size.

I find that typing !{fmt in vi does the right thing (it defaults to 75
columns), but I don't know which editor you use.

>  	memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr));
> +	if (ctrl->mdts)
> +		dev->max_hw_sectors = ((1 << ctrl->mdts) * (1 << (12 +
> +				NVME_CAP_MPSMIN(readq(&dev->bar->cap))))) >> 9;
>  

There's something about seeing five close-parens in a row that makes
me uncomfortable.  Maybe I was molested by a lisp compiler as a child
or something, but it tends to indicate an overly complex expression.

Let's see, what might look better ...

	if (ctrl->mdts) {
		int mpsmin = 1 << (NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12);
		dev->max_hw_sectors = ((1 << ctrl->mdts) * mpsmin) >> 9;
	}

Alternatively, we could redistribute some of the arithmetic ...

	if (ctrl->mdts)
		dev->max_hw_sectors = 1 << (12 - 9 + ctrl->mdts +
					NVME_CAP_MPSMIN(readq(&dev->bar->cap)));

but that's a little obscure.  Perhaps a little less obscure:

	if (ctrl->mdts) {
		int shift = NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12;
		dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9);
	}

  reply	other threads:[~2012-07-26 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 22:07 [PATCH] NVMe: Set block queue max sectors Keith Busch
2012-07-26 16:22 ` Matthew Wilcox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-07-26 17:29 Keith Busch
2012-07-26 17:43 ` Matthew Wilcox

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=20120726162216.GD22985@linux.intel.com \
    --to=willy@linux.intel.com \
    /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.