From patchwork Wed Mar 9 03:26:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 8541881 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2ECB4C0554 for ; Wed, 9 Mar 2016 03:26:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59C1320204 for ; Wed, 9 Mar 2016 03:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 686F320220 for ; Wed, 9 Mar 2016 03:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbcCID0c (ORCPT ); Tue, 8 Mar 2016 22:26:32 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34264 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbcCID0a (ORCPT ); Tue, 8 Mar 2016 22:26:30 -0500 Received: by mail-pf0-f193.google.com with SMTP id 184so2516041pff.1 for ; Tue, 08 Mar 2016 19:26:25 -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=63X3DqIhhUjpmPs7ImIHyHUmClUO4edNWXyaZSeegt4=; b=zKZcT026AMconaUJcFd/Hh56e2ffAHPTqclo0lPmu8T+woAC26WpYi3mbBXTzu5GJ3 EjpGWUcxERThHsyc6Uuzw9+FfA+BqrE6SowsbGuSBfNqRIiWtqY5YQxEHVZ6Wnn1wLHH KsdXGJmQJaVsQJxvdYg0SU0veXRlFay9apqGAZ0ZiN9fTHgjdF8kUxLbTocIfOTMvcqk jtZMY/qLYWpiu7FORl8JmNdbEVe/S2tHy24GtaUzXBoG/579lSiCEMw5vY403dNxAAhc 9+LWBpKcnocmQrWecR7/qejOG8X+ELPtPC1ShwpnukTTFDXli/UQ1TNB47tG3LZ5wr8e 7qag== 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=63X3DqIhhUjpmPs7ImIHyHUmClUO4edNWXyaZSeegt4=; b=JmQtJQQPBD0tDEkfoxR23JhAW+JZBnxab8fJUXcDm5spCmi2d7jOuZI0NY5A3MdxdO 0kpYH8lnPaIzkb+wvpnLWeyBk55huVPnY+lku7j211Rdi9BJ/BTlyaEWS63d5m4AnueZ YT8rx4QmzM83wiY14yZRjUR973R4bkyQlzlnYoQC+kgK8Y2gdy2ufSdxn1P0ibhJT8uU Jo4ik0L9yasyF9guYPV3ZXl45w3HrDItxXjihyou1N5zmNejyZrkumkeeSqHeUMjcYqR 9LO0lXLkQjDZ8uDQd4jMENsqZE2BXjw/hDwMaGgVxss0vIvD/O5uqVNl5q2iBCJUwUcZ wL1A== X-Gm-Message-State: AD7BkJK8UGP7k5G4qfbwwEska8RjjjremvIyZRSHLLfXMkbbE1CRtoTNbDIC+VY7mwsrkg== X-Received: by 10.98.71.92 with SMTP id u89mr42302232pfa.100.1457493984782; Tue, 08 Mar 2016 19:26:24 -0800 (PST) Received: from localhost.localdomain (123202047244.ctinets.com. [123.202.47.244]) by smtp.gmail.com with ESMTPSA id rq16sm8081273pab.29.2016.03.08.19.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Mar 2016 19:26:24 -0800 (PST) Message-ID: <56df97e0.d08d420a.58e8f.3162@mx.google.com> X-Google-Original-Message-ID: <1457493976-2082-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/1] sd: do not let LBPME bit stop the VPDs speak Date: Wed, 9 Mar 2016 11:26:16 +0800 X-Mailer: git-send-email 2.7.2 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 Some devices have details of their support on unmapping on the Block Limits and/or Logical Block Provisioning VPDs while they do not set the LBPME bit to 1. Though this is required by the SCSI standards, the VPDs are giving even more concrete details about the support, so they should be used even when the bit is set to 0. Signed-off-by: Tom Yan diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d749da7..a0d7c73 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2670,9 +2670,6 @@ static void sd_read_block_limits(struct scsi_disk *sdkp) sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]); - if (!sdkp->lbpme) - goto out; - lba_count = get_unaligned_be32(&buffer[20]); desc_count = get_unaligned_be32(&buffer[24]); @@ -2747,9 +2744,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) unsigned char *buffer; const int vpd_len = 8; - if (sdkp->lbpme == 0) - return; - buffer = kmalloc(vpd_len, GFP_KERNEL); if (!buffer || scsi_get_vpd_page(sdkp->device, 0xb2, buffer, vpd_len))