From patchwork Fri Feb 26 21:16:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 8441891 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A97A89F2F0 for ; Fri, 26 Feb 2016 21:16:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC61B203B6 for ; Fri, 26 Feb 2016 21:16:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E59B6203B8 for ; Fri, 26 Feb 2016 21:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825AbcBZVQP (ORCPT ); Fri, 26 Feb 2016 16:16:15 -0500 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34985 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbcBZVQO (ORCPT ); Fri, 26 Feb 2016 16:16:14 -0500 Received: by mail-pa0-f66.google.com with SMTP id fl4so5030552pad.2 for ; Fri, 26 Feb 2016 13:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=1z/F+nkDfmpRT7d7RRQW1ieJM93JWsK2/FKbQk8enhs=; b=mxlh4cnVRQf3d4MhI+PMQD4kQm0HKLi0gr/xPUy84UwEehqDlpW0vdi3h1TetHh8UL XEiBp9DNgUKi1liP/GjWeRuPV2PiE8Trd2iVHGCifPHtPFwhstS6CtjrbCv2rjF2i8it evx1q/GKstO3pX5YYLB5Aj+wtmPeZBbFHC6/SlDWs9voIo1osg/5XxXB/sPYcxcnEnYN ckisQoubVuRkD9IlOBfSPpQXaUqQERV/Ei7bWI2+YVlTF853/jlV8hkpTwl58ayOnB1o R4FJKcSN2FiBSsRxsinMfvZndGf+2+45nEtVFvRBA3+GES7H2tB9eKgZG796dmlaF+qf tFXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=1z/F+nkDfmpRT7d7RRQW1ieJM93JWsK2/FKbQk8enhs=; b=PrQvDlqu2z8f5rXW8AXq+lwegET7Jzwa8/9YPjcu2+1hNtehEYrz1cqZ6Gx31EG5OB Li/qTOTH/ATQ3RNjE9GzIpyMROArbMusrzm8OuampLt79HSvEUvntRIb0RBRhYyFoPu5 xZRl4TYROlmHovnxZnFORK/ENJmugBhvafm3dkkMI0BVdwFSgOcBJppNjsxAXgMHJACH Crna1iOuib49HKE/pYPSLxHoUnIR86EUgzZDeFDGHnXr7AEpzT8Yjd3onfTv3M7Hg/pn D0P6jlG/iN+x+k2BhDKV9VTDB86Vq9xX7+u/n0Q2Prkiu0WnlBZgpuzA8b2Pzb0MVFoo pUPA== X-Gm-Message-State: AD7BkJKjPPXAQWtbpdzNyAAPnOs7pDx29c5hrGuWU4CiU0RVX40VRo8NB3Y1ORRbIkLQOg== X-Received: by 10.66.222.129 with SMTP id qm1mr5140569pac.22.1456521373954; Fri, 26 Feb 2016 13:16:13 -0800 (PST) Received: from localhost.localdomain (123202047244.ctinets.com. [123.202.47.244]) by smtp.gmail.com with ESMTPSA id t87sm21366020pfa.14.2016.02.26.13.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 13:16:13 -0800 (PST) Message-ID: <56d0c09d.5a46620a.e4c6.0855@mx.google.com> X-Google-Original-Message-ID: <1456521366-3290-1-git-send-email-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: linux-scsi@vger.kernel.org Cc: Tom Yan Subject: [PATCH v2 1/1] sd: add missing scenario for sd_config_write_same Date: Sat, 27 Feb 2016 05:16:06 +0800 X-Mailer: git-send-email 2.7.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan Example: [root@localhost ~]# sg_opcodes /dev/sdb > /dev/null Report supported operation codes: Illegal request, invalid opcode [root@localhost ~]# sg_vpd -p bl /dev/sdb | grep 'write same' Maximum write same length: 0x0 blocks [root@localhost ~]# cat /sys/block/sdb/queue/write_same_max_bytes 33553920 Signed-off-by: Tom Yan diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d749da7..1179ec1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -807,6 +807,8 @@ static void sd_config_write_same(struct scsi_disk *sdkp) if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS) sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)SD_MAX_WS16_BLOCKS); + else if (sdkp->max_ws_blocks == 0 && sdkp->device->no_report_opcodes) + sdkp->device->no_write_same = 1; else if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes) sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)SD_MAX_WS10_BLOCKS);