From patchwork Thu Jun 9 03:39:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 9166183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A609960467 for ; Thu, 9 Jun 2016 03:40:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 898A827248 for ; Thu, 9 Jun 2016 03:40:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E0BC282F9; Thu, 9 Jun 2016 03:40:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 234FE27248 for ; Thu, 9 Jun 2016 03:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161142AbcFIDjy (ORCPT ); Wed, 8 Jun 2016 23:39:54 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:25245 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751664AbcFIDjx (ORCPT ); Wed, 8 Jun 2016 23:39:53 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u593dili024885 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Jun 2016 03:39:44 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u593dhtU002864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Jun 2016 03:39:44 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u593dff9030236; Thu, 9 Jun 2016 03:39:41 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Jun 2016 20:39:40 -0700 To: Shaun Tancheff Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Shaun Tancheff Subject: Re: [PATCH] Add support for SCT Write Same From: "Martin K. Petersen" Organization: Oracle Corporation References: <1465235890-15703-1-git-send-email-shaun@tancheff.com> <1465235890-15703-2-git-send-email-shaun@tancheff.com> Date: Wed, 08 Jun 2016 23:39:38 -0400 In-Reply-To: <1465235890-15703-2-git-send-email-shaun@tancheff.com> (Shaun Tancheff's message of "Mon, 6 Jun 2016 12:58:10 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP >>>>> "Shaun" == Shaun Tancheff writes: Shaun, Shaun> SATA drives may support write same via SCT. This is useful for Shaun> setting the drive contents to a specific pattern (0's). index 428c03e..c5c8424 100644 No ATA stuff in sd.c, please. @@ -2761,24 +2762,26 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) { struct scsi_device *sdev = sdkp->device; - if (sdev->host->no_write_same) { - sdev->no_write_same = 1; - - return; - } - if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { - /* too large values might cause issues with arcmsr */ - int vpd_buf_len = 64; - sdev->no_report_opcodes = 1; /* Disable WRITE SAME if REPORT SUPPORTED OPERATION * CODES is unsupported and the device has an ATA * Information VPD page (SAT). */ The above comment tells you how to enable WRITE SAME in libata's SCSI-ATA translation. - if (!scsi_get_vpd_page(sdev, 0x89, buffer, vpd_buf_len)) + if (!scsi_get_vpd_page(sdev, 0x89, buffer, SD_BUF_SIZE)) That vpd_buf_len is intentional. --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include