public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: Fix incorrect reporting of host protection capabilities
Date: Thu, 15 Oct 2009 13:18:18 -0600	[thread overview]
Message-ID: <20091015191818.GN7545@parisc-linux.org> (raw)
In-Reply-To: <yq18wfc8phm.fsf@sermon.lab.mkp.net>

On Thu, Oct 15, 2009 at 02:46:13PM -0400, Martin K. Petersen wrote:
> 
> The advent of DIF Type 2 devices exposed these missing break statements.

Is there not a similar problem in scsi_host_dix_capable()?

And are these performance path?  If not, it might be nice to move them
out of line and code them like this:

unsigned scsi_host_dif_capable(struct Scsi_Host *shost, unsigned target_type)
{
	static unsigned cap[4] = {
		0, SHOST_DIF_TYPE1_PROTECTION,
		SHOST_DIF_TYPE2_PROTECTION, SHOST_DIF_TYPE3_PROTECTION
	};
	unsigned type = cap[target_type];
	return (shost->prot_capabilities & type) ? 1 : 0;
}

unsigned scsi_host_dix_capable(struct Scsi_Host *shost, unsigned target_type)
{
	static unsigned cap[4] = {
		SHOST_DIX_TYPE0_PROTECTION, SHOST_DIX_TYPE1_PROTECTION,
		SHOST_DIF_TYPE2_PROTECTION, SHOST_DIF_TYPE3_PROTECTION
	};
	unsigned type = cap[target_type];
	return (shost->prot_capabilities & type) ? 1 : 0;
}

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2009-10-15 19:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 18:46 [PATCH] scsi: Fix incorrect reporting of host protection capabilities Martin K. Petersen
2009-10-15 19:18 ` Matthew Wilcox [this message]
2009-10-30  2:32   ` Martin K. Petersen

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=20091015191818.GN7545@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox