From patchwork Wed Jun 12 16:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13695359 Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (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 9A825181BAB; Wed, 12 Jun 2024 16:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718211207; cv=none; b=snJj9ZXC7jsSk5x5XpzGM2egSskaCyrfSjDBWrRoMEda1v8zsGGxQvZBT5vijCKgESqcXPm+uwznikzQcHnwMw0oh3o8QiwY1N01WwTQ6T+htNlmMLY4GunRJOdckeODwBL0iHr8BhPbb6Y/PRdH+VnoH+aU+4vCgDS3EKb3fDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718211207; c=relaxed/simple; bh=qVdsce9kI7phLWSg6H8f1oBYl958AVtUymwUn2irbvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q5lXF5alz7GCITu1a6hM7nj+i5118zmR9uzkTHmIQoahGRW8JEcQiLQK+NGbcKSbZS1IdPAXi+qyz1ke5GPRePVnuQh1wHp8mHIdF1hYbC1XR21TwW05JfBpvHI5wWAEZ9bJPPA+55vb967BK5KQA1vrKF/MPwRuUPvtbOOp2f8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=k0afUE6r; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="k0afUE6r" Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4Vzs720TxKz6Cnk8t; Wed, 12 Jun 2024 16:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1718211193; x=1720803194; bh=yEYek 9bgEzYOmdogb2Tp0iSUExccUecXfH9k7dVFWHc=; b=k0afUE6rL2twrqKfTMT7q 7HTZ4ZRm5GA09ocoi/y82YPA0JOPT035Qcn6Wy3zN6LfRDdOuRigmiCTMR1MW6DW VkakGL1aNm5s9CDFI7/4ClFCAlmRJl0WKDAPDuk7rcmas/hz3s6tVG4NWdFfNLh9 LU+KcmmdV7k9JlK28zwzeSCSgjychtGBjMl3xNGIQKPdaccQNlLCZbQzQcKOUfME qQFib6xaEsuCN/AJIds67nALZEhjXakgbpA/hqs9C7jcitSfbGI3NPraQlkG06Bu 1Nv4TWOhQ5Zwq9qym+04Iol1xXbGYNFKiCYyoMJENXpy3W8YQ84LOWBXNgBWtVtu g== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id Uje01OWT_d2e; Wed, 12 Jun 2024 16:53:13 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.132.0.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4Vzs6w14JRz6Cnv3Q; Wed, 12 Jun 2024 16:53:12 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: Alan Stern , linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, Bart Van Assche , Joao Machado , Andy Shevchenko , Christian Heusel , stable@vger.kernel.org, "James E.J. Bottomley" Subject: [PATCH 1/2] scsi: core: Introduce the BLIST_SKIP_IO_HINTS flag Date: Wed, 12 Jun 2024 09:52:48 -0700 Message-ID: <20240612165249.2671204-2-bvanassche@acm.org> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612165249.2671204-1-bvanassche@acm.org> References: <20240612165249.2671204-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Prepare for skipping reading the IO hints VPD page for USB storage devices. Cc: Alan Stern Cc: Joao Machado Cc: Andy Shevchenko Cc: Christian Heusel Cc: stable@vger.kernel.org Fixes: 4f53138fffc2 ("scsi: sd: Translate data lifetime information") Signed-off-by: Bart Van Assche --- drivers/scsi/sd.c | 4 ++++ include/scsi/scsi_devinfo.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3a43e2209751..fcf3d7730466 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -3117,6 +3118,9 @@ static void sd_read_io_hints(struct scsi_disk *sdkp, unsigned char *buffer) struct scsi_mode_data data; int res; + if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS) + return; + res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a, /*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT, sdkp->max_retries, &data, &sshdr); diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h index 6b548dc2c496..fa8721e49dec 100644 --- a/include/scsi/scsi_devinfo.h +++ b/include/scsi/scsi_devinfo.h @@ -69,8 +69,10 @@ #define BLIST_RETRY_ITF ((__force blist_flags_t)(1ULL << 32)) /* Always retry ABORTED_COMMAND with ASC 0xc1 */ #define BLIST_RETRY_ASC_C1 ((__force blist_flags_t)(1ULL << 33)) +/* Do not read the I/O hints mode page */ +#define BLIST_SKIP_IO_HINTS ((__force blist_flags_t)(1ULL << 34)) -#define __BLIST_LAST_USED BLIST_RETRY_ASC_C1 +#define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS #define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \ (__force blist_flags_t) \