From patchwork Wed May 29 05:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13677779 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C66115CD43; Wed, 29 May 2024 05:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716959127; cv=none; b=YXHaVC9wFVCpwZlobjrntFZDb2kVbt+Y8QElbsZZcb/8BOoz+vAnjSDgqDn/37BVkDvQGRs6XkCyMobnCkunwqOIH/F3RWo4n8ZdFDOOJSkmbXrvRZnSsPndiHoWNg51H6rwaJPMZMWmyR7hNCSZFlVAorhtZuhaJIVFCjCRgvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716959127; c=relaxed/simple; bh=8Sv+AkOOTQLhsoaSUecc2q21uIJ3eXwSuyI27QZrzOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sdwrrXXIbDXOLAOhW+xqcnf/ycOJ7DqOYtZx+bGqXQHPujoQswk/KYovMY2Db4X8UcKB1fXQdSMx0IJkGiL5A+Aeqc/mNZgG9k+KfWlL/DBd3qtKsYBy+2vJTc7bzVZdZvN5XmAosIcdQFFPepox6WD6yq8NhOdBUS/q1JiPwpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=hT/SqbUW; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hT/SqbUW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=82BW6iQIk3FEFa4vhGtCkVzTHLP2megWywmDpB65ENg=; b=hT/SqbUWW+toXI5dMcqp4EA6Ee 2PfJQLcR6iUvvvln1Iq2dGvlxDcvOm3MLw+bOGmfLSogQIOvsjUL5vqFC3t73TNL6yM38fzzTaHrF n3z3Uvx+PGLTAB560kOxs7K1nVBdUv6SHEDRKzIXrl7rcheULwalz5Awc07DH0HXLqz81X274x5m9 4XGVCGLrrm21fNbYM3Tc6cbQkSazy+xeHzyQl85scPGKr1yLk0nmDJ6mvHN/CJr/bsmdhPJwzPQcW Cp1nnfhjKm1SYDktgoBXFVQycuzK0RJ/33dd5Y/upj+g1VIUurP/Ax3IWFmNEyPIcqKcAmzwwhJtu 1DkDX8nA==; Received: from 2a02-8389-2341-5b80-7775-b725-99f7-3344.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:7775:b725:99f7:3344] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCBV0-00000002pUR-1qVO; Wed, 29 May 2024 05:05:18 +0000 From: Christoph Hellwig To: Jens Axboe , "Martin K. Petersen" Cc: Richard Weinberger , Anton Ivanov , Johannes Berg , Josef Bacik , Ilya Dryomov , Dongsheng Yang , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, ceph-devel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org Subject: [PATCH 03/12] sd: simplify the ZBC case in provisioning_mode_store Date: Wed, 29 May 2024 07:04:05 +0200 Message-ID: <20240529050507.1392041-4-hch@lst.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240529050507.1392041-1-hch@lst.de> References: <20240529050507.1392041-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Don't reset the discard settings to no-op over and over when a user writes to the provisioning attribute as that is already the default mode for ZBC devices. In hindsight we should have made writing to the attribute fail for ZBC devices, but the code has probably been around for far too long to change this now. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3dff9150ce11e2..15d0035048d902 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -461,14 +461,13 @@ provisioning_mode_store(struct device *dev, struct device_attribute *attr, if (!capable(CAP_SYS_ADMIN)) return -EACCES; - if (sd_is_zoned(sdkp)) { - sd_config_discard(sdkp, SD_LBP_DISABLE); - return count; - } - if (sdp->type != TYPE_DISK) return -EINVAL; + /* ignore the proivisioning mode for ZBB devices */ + if (sd_is_zoned(sdkp)) + return count; + mode = sysfs_match_string(lbp_mode, buf); if (mode < 0) return -EINVAL;