From patchwork Fri Feb 26 20:07:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 8441611 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 DE6ED9F52D for ; Fri, 26 Feb 2016 20:07:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 023ED203AA for ; Fri, 26 Feb 2016 20:07:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 242BF20270 for ; Fri, 26 Feb 2016 20:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825AbcBZUHi (ORCPT ); Fri, 26 Feb 2016 15:07:38 -0500 Received: from mail-pa0-f65.google.com ([209.85.220.65]:36563 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750893AbcBZUHh (ORCPT ); Fri, 26 Feb 2016 15:07:37 -0500 Received: by mail-pa0-f65.google.com with SMTP id a7so3631493pax.3 for ; Fri, 26 Feb 2016 12:07:37 -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=PfeT1DE7s2CJu3qySnvU7Rkya06eTw/Y4Xfe2PrrS8XjngIefqj910VMiyxXc4w7jZ WtrpDOxey+cFT+JawGUJiiQ7mRuYTT8pX3nTDZLw+bTNsWX/EIfnqmnG00COGrv0NH74 GNWm2y9xyRsgvPgrz3nDyi+WU0+BvAJwRsvXXy6YNMlTo9fsZXpG8bhpjTDb/un7vzsK 51ln6C9R5249hD4efDBlufNR4Ne9/XvoDIXVvES0wTSawHM7pD2e7dC13E4r6j7TFn1h HSVTGFgG1OA9+01i5HJjkpSjd5aegBhqnAoDNmJ8e/qOdNGZHZ/1dGwl2O7MIGblxjtX uYLQ== 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=bdJFGC0QLWTPdf8Eve9mmSQFzx0XMPqTW8RzmmNQFfZTcM3QJ5uS6fly+3XxMdGEn/ xps4HU//fh+4kcLf9j8O+jF6o6pYxJjzJPx6lZzvstmz62e2sHf8Cnk3Vki2z23FvIGm qXZfcd5jPozrVW32JhWwyKWyTNScyHlxIR0O9CA9v7NEGQQGqCmJHnKL6CevAz6Flnq9 865eft7mO6I3VCQsoJF/K7KHYSCJTp8p+jyYBFl7Ax5SVYUw7ajDlhVcHl6sYKbW/JKZ ov/irfkmwyTYPEYqPEILwhNXX3V41ijOEAlUwSsAMl9PuU/wz6qgMSu7tZp59+GGH+/z Cq6A== X-Gm-Message-State: AD7BkJIpjiF5+yMY8uv1JnDvOoGMYOKeBp7+EO+ij1d9dm2DIe66dpgFPbj9Y1nlc/9E6g== X-Received: by 10.66.226.238 with SMTP id rv14mr4708888pac.41.1456517257153; Fri, 26 Feb 2016 12:07:37 -0800 (PST) Received: from localhost.localdomain (123202047244.ctinets.com. [123.202.47.244]) by smtp.gmail.com with ESMTPSA id wh9sm21243313pab.8.2016.02.26.12.07.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 12:07:36 -0800 (PST) Message-ID: <56d0b088.e99c420a.dbca1.0411@mx.google.com> X-Google-Original-Message-ID: <1456517250-2713-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 1/2] sd: add missing scenario for sd_config_write_same Date: Sat, 27 Feb 2016 04:07:29 +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);