Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1268761pxu; Thu, 8 Oct 2020 07:30:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhSDtASukS1M+xVd5rEEdeEv6I5ytqK3WNmRHHwg955i7w/OPuuOn1GC9RRWbQd6L7H9FU X-Received: by 2002:a17:906:a198:: with SMTP id s24mr8765077ejy.154.1602167404187; Thu, 08 Oct 2020 07:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602167404; cv=none; d=google.com; s=arc-20160816; b=L73FuqRvLrSm0tDXYfDqs4BVLRIM8+AemKSCgLrS3J+okI9eXK1RGce+HIlugBGWBP a3sum8TGpV1FeN6xZium9zWiBE8WMPyy7sNvycGdhaN4Vm4pCwYIkvGokeDpYiEiwPjh /iH6KWBV1nVC80hyJziv/FR4u1ElcGv2lUGSXfScBnWi4qUdJHPe/jFd2dCJ6NJ6YSm7 WNNE6fUmdDNBSJLE/rwZKDIWIoi1W1dtUJZ1gbWqhwtTNjTECyDOkUCLbAE8AASCmT4o f9qkplQYB8DX9lTSHwjb82PxkC4aQLuig5zaKQ+GgsbJkzt3LciW761tmN2RyzzYeTob QZUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=WsE6vlmD9PjpvVzoPnqJMKBuzypaiKtsmjNNqhDX95o=; b=PFop8wCV4UU7rKM/bEXIck5/ZxMen9h6EsymorZ3J/NAjNMe0AzdHQQwkMXJI3rGpX 4AeiiHt8oN7HkPlAjkBr4Y96Nfd76krX28Ftl/5LsWPSmJMDK9agmnxNDfb2aMw7kw3b kh09oLzyksXRx7MqlsiBkkMy21trHV7YFYJOtn/Py4l0eVe1Widjl8DjFOBqEW4uSGdS fMWKMlB6V791lKOEtNy6vO1xE2cCP3GWDp9AHq3+JKH0oEE5nV/8xaebvWYTG8C7KGSy FMc59x0z3TyTEI6SxEG639HCnTfgp+qTn46jqddtbGgvLCY9an/uFa/Gzxy0tnvF1CnD 5zbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q/lRCt6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si3686695edy.137.2020.10.08.07.29.39; Thu, 08 Oct 2020 07:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q/lRCt6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730587AbgJHOYj (ORCPT + 99 others); Thu, 8 Oct 2020 10:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730582AbgJHOYg (ORCPT ); Thu, 8 Oct 2020 10:24:36 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BFA0C061755; Thu, 8 Oct 2020 07:24:36 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e18so6819784wrw.9; Thu, 08 Oct 2020 07:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=WsE6vlmD9PjpvVzoPnqJMKBuzypaiKtsmjNNqhDX95o=; b=q/lRCt6Ss8/vdI0hDNrUbNoiPMjEJRCygt9VTkjMe73GWTFfGT9/VDFg8j/7d6q9vP /2f7drWDk6NF6Q8bhw3blFG0QqDKQ4mWDf1jk+Q0G4X/Sc73XBpR2V5zwRyr0eNq7IZc 9luh3Tvi0rxUNHOACa9y0iRUi5ALtOZVZtLDQFgl6SWhWaQG4C2kHEFdY6sG9QTXTGAg mc9b19i0ENGgSEm29dEMVJR/J9NakcEmZGvn32Y72CrT9JihNGLHZCkU7oDkT9r6uwBR 7khEbO2/XxpygmBxuWFCC6Ry/XxB0h0Z5sUq6TMjxOhnE7ihI+6Af1cnUolQ1mDPqhJg UoIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=WsE6vlmD9PjpvVzoPnqJMKBuzypaiKtsmjNNqhDX95o=; b=ew6d7MAC87TWlJfntkO/vg2HA4rNPem5qPqoDcqZp66rECG9W1yoLa9fLFGjFJ/sJj ysR2gTlBg1p2qhtRz0LUUc2tZoXwo90sPur2njkYmPjXx4EnVHZLrmT2lDP3O3iyrZeN IhxsopuzsuRpDT3+zv4dPf7ZrpOgF8TyPteWRMG5UByU3v5n+JcfFFKb8KueIBuk65Qy jK4Z29oEunAjgGh7SMpM+XemIX9AKkjH4h74M4UATHpuaEXzVSI0C05I4WwXx4P6IUSU 8YPTYTfJdvIHTCUtDUSXJDHwBLPHJW0Ehb4gfaq4LoA5ROHbYkWtXlO5t7RewrjUdlPb sIwA== X-Gm-Message-State: AOAM533GOlLZRpRsiJ7/TC78HNXxVJUr64PFFHrVqYXmPRtR8pgSKSSN 4Q/G46E3G4pDtoSQGcxGaQc= X-Received: by 2002:adf:d849:: with SMTP id k9mr1036584wrl.332.1602167074799; Thu, 08 Oct 2020 07:24:34 -0700 (PDT) Received: from ubuntu-laptop ([165.225.203.62]) by smtp.googlemail.com with ESMTPSA id t5sm7741882wrb.21.2020.10.08.07.24.33 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Oct 2020 07:24:34 -0700 (PDT) Message-ID: Subject: Re: [PATCH] scsi: sd: Use UNMAP in case the device doesn't support WRITE_SAME From: Bean Huo To: "Martin K. Petersen" Cc: jejb@linux.ibm.com, bvanassche@acm.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Bean Huo Date: Thu, 08 Oct 2020 16:24:31 +0200 In-Reply-To: References: <20201007104220.8772-1-huobean@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-10-07 at 23:47 -0400, Martin K. Petersen wrote: > > support WRITE_SAME. The problem is that WRITE SAME heuristics > > doesn't work > > for this kind of storage device since its block limits VPD page > > doesn't > > contain the LBP information. Currently we set its provisioning_mode > > "writesame_16" and didn't check "no_write_same". > > There is something odd with what your device is reporting. > > We support WRITE SAME on a bunch of devices that predate the Logical > Block Provisioning VPD page and the various Block Limits parameters > being introduced to the spec. Consequently we set the provisioning > mode > to "writesame_16" if the device reports LBPME=1 in READ CAPACITY(16) > and > nothing relevant is reported in the VPD pages. That is by design. > > > If we didn't manually change this default provisioning_mode to > > "unmap" > > through sysfs, provisioning_mode will be set to "disabled" after > > the > > first WRITE_SAME command with the following error occurs: > > If your device supports UNMAP it *must* report it in the Logical > Block > Provisioning VPD by setting LBPU=1 and report MAXIMUM UNMAP LBA COUNT > and MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT in the Block Limits VPD. > > Also, "no_write_same" disables attempting to use WRITE SAME to zero > block ranges. That's orthogonal to the logic controlling which > command > to use for performing an unmap operation. An unfortunate choice of > naming which can be attributed to the SCSI protocol using the WRITE > SAME > command for two completely different operations. > Hi Martin thanks very much for your above comments, very detailed. The case I encountered is very strange to me as well. I will double check on the product level. thanks, Bean