[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140716110111.GA7382@infradead.org>
Date: Wed, 16 Jul 2014 04:01:11 -0700
From: "hch@...radead.org" <hch@...radead.org>
To: "Martin K. Petersen" <martin.petersen@...cle.com>
Cc: KY Srinivasan <kys@...rosoft.com>,
"hch@...radead.org" <hch@...radead.org>,
James Bottomley <jbottomley@...allels.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"apw@...onical.com" <apw@...onical.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"ohering@...e.com" <ohering@...e.com>,
"jasowang@...hat.com" <jasowang@...hat.com>
Subject: Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16
On Sun, Jul 13, 2014 at 08:58:34AM -0400, Martin K. Petersen wrote:
> >>>>> "KY" == KY Srinivasan <kys@...rosoft.com> writes:
>
> KY> Windows hosts do support UNMAP and set the field in the
> KY> EVPD. However, since the host advertises SPC-2 compliance, Linux
> KY> does not even query the VPD page.
>
> >> If we want to enable UNMAP in this case I'd prefer a blacklist entry
> >> than trying UNMAP despite the device not advertising it.
>
> I agree with that. We could do something like the patch below.
>
> However, I do think it's a good idea that you guys are looking into
> reporting SPC-3.
KY mentioned that they have a prototype for that now.
Btw, I looked over sd.c a bit more, and I think I understand why they
get the WRITE SAME commands now:
read_capacity_16 calls sd_config_discard(sdkp, SD_LBP_WS16) if the LPBME
bit is set. At least older SBC drafts left it wide open if a target
supports WRITE SAME with UNMAP or UNMAP in this case. So I think we'd
still want a patch to use UNMAP instead of WRITE SAME for this case,
which should also fix hyperv. Below is the quick hack version of that
that just checks the host no_write_same flag, as the one on the device
isn't set yet - I guess we need to refactor some of that logic.
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 87566b5..4480fdf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2035,7 +2035,10 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
if (buffer[14] & 0x40) /* LBPRZ */
sdkp->lbprz = 1;
- sd_config_discard(sdkp, SD_LBP_WS16);
+ if (sdp->host->no_write_same)
+ sd_config_discard(sdkp, SD_LBP_UNMAP);
+ else
+ sd_config_discard(sdkp, SD_LBP_WS16);
}
sdkp->capacity = lba + 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists