From patchwork Tue Sep 10 15:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13798709 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 1A818199952 for ; Tue, 10 Sep 2024 15:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725981065; cv=none; b=X2yvLUKa233QehPV6HDy42p4zo/Cdd2i7AHymvpA6pusgtHmYJq+Mo6WozYtSBJeaI+Es7lq8G4x1slqE8Tp/bUTizA/wrwCuB2CfLI7yI+4RkUvvJa7aFPy2yrG9zEFXBWIdR4P8APkIfC4+M7te6a1pv1uWrN4RGSLBjhec3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725981065; c=relaxed/simple; bh=0BcmOldoB+WCX31xfylNUt7pSKNOVFJfJRF4uZUT0pM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=jDkBoLua8an2ahd+ZArd+Jil0sTowytDb9ZELmEhdMMK/fBBQhs4M5mDBcTjN2fzAAfSy3GZ9XJkORK4Si2FoAZrV2IZb9VrrUMnFRe9OoGXXq9kjeGr2Id1zc7FqhJvchJ/QDJWeMDp+m679zrhaRriFjcXcpyZwQBcu3imcAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=lzD0bH/D; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="lzD0bH/D" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240910151101epoutp02c431494df4a7d68fc509d12d17e2875a~z6qF1fkcD2368423684epoutp02y for ; Tue, 10 Sep 2024 15:11:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240910151101epoutp02c431494df4a7d68fc509d12d17e2875a~z6qF1fkcD2368423684epoutp02y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1725981061; bh=kDAlnsSf6+fQcESYLjvnBr4Ul7FSOPIoyRTSELKQNY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lzD0bH/DyhG9JSoiUA6y0vgKdmCRz9nZ7S+vyxUxDhxf0AEPXiiOjZBBV3XB6EiJ6 m47D9953n+81Y6d7IYrH6p4F4WAgSqNrr9lWRZZXVkfQk841U2B7fJjdJsYbLlh32T 5vfYytHIa+EaUznHwjarBvZju7cHzUQickfmOe30= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240910151100epcas5p2681730c3de752f6820679dcd4fe7927e~z6qFEM1LQ2551025510epcas5p2m; Tue, 10 Sep 2024 15:11:00 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.183]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4X36bP5DNNz4x9Px; Tue, 10 Sep 2024 15:10:57 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 0D.6F.19863.18160E66; Wed, 11 Sep 2024 00:10:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20240910151057epcas5p3369c6257a6f169b4caa6dd59548b538c~z6qBz-63r3222232222epcas5p3U; Tue, 10 Sep 2024 15:10:57 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240910151057epsmtrp2126a8f34a06203ecb93029dde710d3e6~z6qBzAS1z0448904489epsmtrp22; Tue, 10 Sep 2024 15:10:57 +0000 (GMT) X-AuditID: b6c32a50-ef5fe70000004d97-53-66e061816a21 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3B.DC.08964.08160E66; Wed, 11 Sep 2024 00:10:56 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240910151052epsmtip2a6272dcf0635487a8ae424134981622e~z6p98Iw6Q1662516625epsmtip2n; Tue, 10 Sep 2024 15:10:52 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jaegeuk@kernel.org, jlayton@kernel.org, chuck.lever@oracle.com, bvanassche@acm.org Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, javier.gonz@samsung.com, Nitesh Shetty , Kanchan Joshi Subject: [PATCH v5 4/5] sd: limit to use write life hints Date: Tue, 10 Sep 2024 20:31:59 +0530 Message-Id: <20240910150200.6589-5-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240910150200.6589-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA01TbTBcVxh2790vZlZvkXGy2pA7bSe02K3ddZig0kzdSTpTM2mnKdPqjb2s WXZ39gPRThCDRNJoUKlFmEZlWEQQ9TlpVraKNBLaJFTYKKU0hEXH+Op+SJt/z/vO85z3ed5z DgdzWWXxOAlyDa2SU4kEy4nR2uPt45tJmeL4+u/fgPrH+Sw437OMwOJn6xjceTyDwpEf21FY ozeisPRSFgqnrukweD2fA/8YM7PhenUtGxp3nrJggeEBArtH34RD30XAru4+BqyonmbDcw/b WPBq7zYKWzcqMNgwv8iAg1u9TDioK2O/404O/3qUHBy/ziCLC/pZ5PAvWrKp9iyLbK5KJzsr zSjZOZLBIpemRxnkhZZahLxTeZtNmpv2kU1TT9FIbpTsoJSmJLTKi5bHKiQJ8vgQ4uixmHdj RGK+wFcQBAMJLzmVRIcQh9+P9H0vIdESnPBKphK1llYkpVYT/qEHVQqthvaSKtSaEIJWShKV QqWfmkpSa+XxfnJaEyzg898WWYify6QmvYmhXHJKvdUoyUA2OHmIIwfgQlBXOMfIQ5w4LngX ArLySln2YhkBmfdvYvZiDQGnr+QynkuM5w27rG4E3N0xI/bCjIC17SGLhMNh4d7gXqHW2nfD L6Pgp3tGGwnDO1FQpJthWo9yxYPAtnEZtWIG/joYu7zCtIq5eCDY6ne3T/MEJUP/sK3YEYdg 5mqdjc7FXwZ9JVM2R5iFk3Wj1GYV4JccQb+uedfqYVA4cR6zY1cw19vCtmMeMC90s+xYBkyT pl3+l6Ct+QLTjsNAxuYjmx/MEuZah799ljP4amMKtbYBzgVnclzs7P1gvGB6V+kOnnxbxbRT SGDM3GtfzzkETA7Vsb9GPHUvJNC9kED3/7BKBKtFeLRSnRRPx4qUAl85nfLfxcYqkpoQ2/v3 iWxD9I1bfgYE5SAGBHAwwo2bHzoe58KVUCfTaJUiRqVNpNUGRGRZ8UWMtydWYflAck2MQBjE F4rFYm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VqUX58UWlOanFhxilOViUxHnFX/SmCAmkJ5akZqemFqQWwWSZODilGphS WebtPPDIx/VC/hKXm9J2S3aniYkq3Ps9TUjv+dJo8ZrLe/u/za3Iz2Fd/ugC51TN71qPlm3K 7l2ZqByuEhz+vTn9mfEV84RTax1figVHa52+L2/N+Pf034kbZztFZf+PPrd+o9zZj3vecDX5 WF/4fPhM516nKYYrXFPP7Z7K9erFhT1flyqbz+uT/R2n/2LXMnVgOs6yX/N/8syFB2+vfKOQ dff1uvVfhBdGLjdbnFUS8OqUiPFBTWcdhtKL65bNsJ+Qb7Dk7J1TYTyBNdw76hJ2zWhzjDc0 0n/WZD1z+8EIjZmzDzmzVu19ErfbzZ+viqP1pkSuU87fg6nZX/4Ivlc1OmRSvXDZ0W2Ma9c8 UGIpzkg01GIuKk4EAGXB181KAwAA X-CMS-MailID: 20240910151057epcas5p3369c6257a6f169b4caa6dd59548b538c X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240910151057epcas5p3369c6257a6f169b4caa6dd59548b538c References: <20240910150200.6589-1-joshi.k@samsung.com> From: Nitesh Shetty The incoming hint value maybe either lifetime hint or placement hint. Make SCSI interpret only temperature-based write lifetime hints. Signed-off-by: Nitesh Shetty Signed-off-by: Kanchan Joshi --- drivers/scsi/sd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index dad3991397cf..82bd4b07314e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1191,8 +1191,8 @@ static u8 sd_group_number(struct scsi_cmnd *cmd) if (!sdkp->rscs) return 0; - return min3((u32)rq->write_hint, (u32)sdkp->permanent_stream_count, - 0x3fu); + return min3((u32)WRITE_LIFETIME_HINT(rq->write_hint), + (u32)sdkp->permanent_stream_count, 0x3fu); } static blk_status_t sd_setup_rw32_cmnd(struct scsi_cmnd *cmd, bool write, @@ -1390,7 +1390,8 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd) ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks, protect | fua, dld); } else if ((nr_blocks > 0xff) || (lba > 0x1fffff) || - sdp->use_10_for_rw || protect || rq->write_hint) { + sdp->use_10_for_rw || protect || + WRITE_LIFETIME_HINT(rq->write_hint)) { ret = sd_setup_rw10_cmnd(cmd, write, lba, nr_blocks, protect | fua); } else {