From patchwork Thu Mar 10 08:16:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 8554381 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 C17D99F7CA for ; Thu, 10 Mar 2016 08:16:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6632202F0 for ; Thu, 10 Mar 2016 08:16:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92E86202FE for ; Thu, 10 Mar 2016 08:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754478AbcCJIQg (ORCPT ); Thu, 10 Mar 2016 03:16:36 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35147 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932691AbcCJIQZ (ORCPT ); Thu, 10 Mar 2016 03:16:25 -0500 Received: by mail-pf0-f193.google.com with SMTP id u190so2076526pfb.2 for ; Thu, 10 Mar 2016 00:16: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=pSZOLtXkP1O97088v2a1rtePEMzVIRTE1yIGbwgVTs4=; b=uHV/YjyGoLe9V7lFEzhvJFNq/9DI+mJGfiAdoOYdSGD4NWkfG0rRevuwCaCDprcFkt b/y02/xQYhDwVTMcBGclCxqWL3N8Ld8Bkxqev8Z1NBuMRLwyVOWfQrorHle65+mZ327H 8VWOQkE8O3bec2NiqMAMRxmYhRBkyPCpIGMtqhJRffg/GggAyVI1eN0U7IIEbKczvUhf bjYjTGaljHm2YUMI31vmni2Duz3tLMGTd3oz0LS+G81cuNxPeWgVxBRChOk6IeGsxRha rCaLVRpAcmLdHDtaFZP46KubNaqR+yuPGzt6P6eLEaqDKKhsKYFiDCYYWg5z3fItROSE A0Ew== 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=pSZOLtXkP1O97088v2a1rtePEMzVIRTE1yIGbwgVTs4=; b=PKrAOH018w+Nz1eVEapdGs0Wr2MrAcIhcbVEVWi08eb9KwVp2AKm0ZGfsOmystSFE6 MCkOYzoHJl6Vt6ODJG00ZnHrV8gLjBwhqqPrCaiODIMxaWcBUsStitukyHzCho5KheCU O+r3FdO7pssMyJKgsma6K7QG7fSpmuL8nzszLoCCu5nZqhxMl14Dp0SBv6vRJp6EngR9 WHaiiuo536g1n/sBb3/qbQhmaHYIrmYM35uCg7Pi+zcIXi0qIvBQ78Ua9/kNkFc9UllL pTtUOxlRSctafxmwsTE0Ax1dy98ANKdLzPSe4Ec5Hoh5hh60jJH2Ww5RrbqZNarf8dm3 90Kw== X-Gm-Message-State: AD7BkJKkO+Un783ctp6+M9hZPE8q5l3+3VLzEBSKZAF8VhCvvDyAIcP3wd/1tK2W+uuvFw== X-Received: by 10.98.64.144 with SMTP id f16mr3032639pfd.159.1457597784376; Thu, 10 Mar 2016 00:16:24 -0800 (PST) Received: from localhost.localdomain (123202047244.ctinets.com. [123.202.47.244]) by smtp.gmail.com with ESMTPSA id q72sm3409656pfa.70.2016.03.10.00.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Mar 2016 00:16:23 -0800 (PST) Message-ID: <56e12d57.4b43620a.4c8c0.ffff9bc5@mx.google.com> X-Google-Original-Message-ID: <1457597778-5051-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: fix lbprz discard granularity as expected Date: Thu, 10 Mar 2016 16:16:18 +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 According to its own comment, the discard granularity should fixed to the logical block size. However, the actual code has it hardcoded as 1 byte. Changing it to logical_block_size. Signed-off-by: Tom Yan diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d749da7..5a5457a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -648,7 +648,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) */ if (sdkp->lbprz) { q->limits.discard_alignment = 0; - q->limits.discard_granularity = 1; + q->limits.discard_granularity = logical_block_size; } else { q->limits.discard_alignment = sdkp->unmap_alignment * logical_block_size;