From patchwork Tue Jul 2 03:01:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haoqian He X-Patchwork-Id: 809781 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A47A317741 for ; Tue, 2 Jul 2024 03:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889327; cv=none; b=gYF0IrNlTlYUdhsr1OWmuW9hZN0lBAxetGzWHnpyEU8PmdwS0N/GzeEP867auLJTe31y7oOrWmfFn18bdMXlM9gD2m4vYIGAzhGFzJLaXi9yTCHJAp0KGjezzX8JrfRa3Bs0vpr0gsgny1In8f0qUlEflutjsvgdG6/3ezV6uOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889327; c=relaxed/simple; bh=UCDnIvlbXHxWl6+e8JWZ0SNO53U4L0Z7h4tlBztH4UQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O5FXuDjYx7Udlw1Cb87t0YpS1KRxhciIhqPAgtLWSutNMMbD3NltKzX5GJOsDWJxT4PiudnObpGdzGLRotgVMqCcvcd2MJiM/W8cp2A/Nslg3EwUmwwhP4X8VzX02RM85DJqpuWtrU7i2ZCo32ZFgnc6/MHeXe6fpT0bcKg/CB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com; spf=pass smtp.mailfrom=smartx.com; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b=zZGPYgax; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=smartx.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b="zZGPYgax" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3d565deea08so1987476b6e.1 for ; Mon, 01 Jul 2024 20:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1719889325; x=1720494125; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3Ch/9fGznoGin7U6AIXHdIml+kYt3GcqbmvGBGuHu5s=; b=zZGPYgaxE2Z6VL0Yz1OjdOMuiXYT9UMnziWmUaK9F36QwROACJqmHRgGMcF1Q9nlZ7 NLFwkeQgNkladn/lRh6XHHy5VNdT51ATVpJPVhoQvi3tHcKY4XjtGYxv9aOpZATrk8SM 342z2AGJCOE5Hr202r1fx2UT/NTJ3f3FRwdMCPShK0xBEfWE+3IJvxTIcY4U+q/fsl4S QbpNsgGP4Qv3apT2qNj5e+q6h8IUBs/w0Drg/YyIipxjKKkZeqLPtcMfiyyNO/9DpeGL z21TJcSK+dipfVlaMQ4x1YXw0J7m/WheCMcKZ6Qxcu/Rhz2y09HfFspmZiHzOXZ3w/iH 4MEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719889325; x=1720494125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Ch/9fGznoGin7U6AIXHdIml+kYt3GcqbmvGBGuHu5s=; b=lcG8mODcVBb6l5cOsozDXy9nBOnnN8Nd2goiq9FYt8nHaG39HdAUcJHtI8s9i77I8e C4LpjT53cWCvznz/OU9HLW8BpWr5OERCpOz3dwHJDmjdWXL7+r4V1+z6i1J2+DFdZV5n 0A+ThR/WCCab1dMr8cZVV0len7Adg9U9o3uyLLNqZ7giZ8LP7HRohacFak4Y2fzuSq9v EG4z2YaN1TsY/bUeAJrqmDZsKCDB4XMVOA/qTMwCD2M09XTbkwD9alji82Z1TrGYeMET 59bnzcJ2OqG90A5NWQTyiTZ8KhTzO9H5QRaAktYZn49HPhIBOp18FbIT2sZYolps2rzx twIA== X-Forwarded-Encrypted: i=1; AJvYcCXVwNEbVpIa+XwSkdlEDcksSFYEgvIgf30P2D8srb6V9dxX90Lh0eQU0/FaE7/VCBE6h4kqrapGc4rMx5S//rEMAU8Rf1a4RLlvgQ== X-Gm-Message-State: AOJu0YzVFAjpTAowSkcAi5ZNeR5SOfuE8vHuPc/uT0tEKsVJwzM89md2 eaED+vr55xe+jGNSt6EOyNyqtEwtm3gP+haQpECk2EyBnqESbJh221tb9oa2RmE= X-Google-Smtp-Source: AGHT+IE8j5Q1KWMxYedKMDkgJWz8EFzYcNYme7sBG3zoeLzjnHa41Q/99KbfcYc4l/efnsIjcK9n7Q== X-Received: by 2002:a05:6808:1823:b0:3d6:9c05:1aff with SMTP id 5614622812f47-3d6b2b257e1mr12177786b6e.10.1719889324671; Mon, 01 Jul 2024 20:02:04 -0700 (PDT) Received: from fedora.smartx.com ([103.172.41.200]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-72c6a8dbb2fsm4792904a12.31.2024.07.01.20.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 20:02:04 -0700 (PDT) From: Haoqian He To: Christoph Hellwig , "James E.J. Bottomley" , linux-kernel@vger.kernel.org (open list), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), "Martin K. Petersen" Cc: fengli@smartx.com Subject: [PATCH 1/3] scsi: sd: disable discard when set target full provisioning Date: Mon, 1 Jul 2024 23:01:14 -0400 Message-ID: <20240702030118.2198570-2-haoqian.he@smartx.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240702030118.2198570-1-haoqian.he@smartx.com> References: <20240702030118.2198570-1-haoqian.he@smartx.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the target lun is set to full provisioning, the kernel cannot perceive this change, so the kernel still thinks the device supports the discard feature. Discard will be disabled only after encountering a discard IO error (a fully provisioned logical unit does not support logical block provisioning management, so subsequent discard IO will fail) or reconnection. To fix this issue, we can disable device discard feature as soon as possible during the iSCSI initiator rescanning session. Specifically, we can reset lbpme bit 0 during the SCSI probe if found the target lun does not support lbpm, then adjust the discard mode to SD_LBP_DISABLE. With this patch, the kernel can sync whether the target lun supports logical block provisioning management after the iSCSI initiator rescanning session, without IO error or reconnection. Signed-off-by: Haoqian He Signed-off-by: Li Feng --- drivers/scsi/sd.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 548c74ecc836..44a19945b5b6 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2709,6 +2709,9 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, if (buffer[14] & 0x40) /* LBPRZ */ sdkp->lbprz = 1; + } else { + sdkp->lbpme = 0; + sdkp->lbprz = 0; } sdkp->capacity = lba + 1; @@ -3303,12 +3306,9 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) static unsigned int sd_discard_mode(struct scsi_disk *sdkp) { - if (!sdkp->lbpvpd) { - /* LBP VPD page not provided */ - if (sdkp->max_unmap_blocks) - return SD_LBP_UNMAP; - return SD_LBP_WS16; - } + if (!sdkp->lbpvpd) + /* Disable discard if LBP VPD page not provided */ + return SD_LBP_DISABLE; /* LBP VPD page tells us what to use */ if (sdkp->lbpu && sdkp->max_unmap_blocks) @@ -3343,8 +3343,12 @@ static void sd_read_block_limits(struct scsi_disk *sdkp, sdkp->max_ws_blocks = (u32)get_unaligned_be64(&vpd->data[36]); - if (!sdkp->lbpme) + if (!sdkp->lbpme) { + sdkp->max_unmap_blocks = 0; + sdkp->unmap_granularity = 0; + sdkp->unmap_alignment = 0; goto config_atomic; + } lba_count = get_unaligned_be32(&vpd->data[20]); desc_count = get_unaligned_be32(&vpd->data[24]); @@ -3425,8 +3429,13 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) { struct scsi_vpd *vpd; - if (sdkp->lbpme == 0) + if (!sdkp->lbpme) { + sdkp->lbpvpd = 0; + sdkp->lbpu = 0; + sdkp->lbpws = 0; + sdkp->lbpws10 = 0; return; + } rcu_read_lock(); vpd = rcu_dereference(sdkp->device->vpd_pgb2); From patchwork Tue Jul 2 03:01:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haoqian He X-Patchwork-Id: 809292 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1057B85934 for ; Tue, 2 Jul 2024 03:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889334; cv=none; b=sNlrquXJ6ZTPYX9xIgi7kee9pwa23CXWNDpdoAyqu50i64oWJJyq+9nTrnZmzbT52+4sMC0YYXRo6942lq4BXYsguZvnoyXtLusDh4cMUsnkcfIxd67U+8CHjBLzuTukPJuXfGz1QhAJKoTVNUbKKrxtMM/3Eah9t2Rvi6PpW1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889334; c=relaxed/simple; bh=yiJFaJgdWIpSzq4I1bh4NFNS0sS3mumsKHKQMWi9Duw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EBbm7n3IICYM/Pf9J6+ZEDxMNumO6ejeCg4/15MYUMDRlD3aMiO24Z0FfFXvxzUNdMjhCU8tKV032ZeILvDgOqclmFhnbBwLzEyV59P+x7sH5Rbsf85rq8xQsTI5Hcm0lE8UMm1PgEP8fjPHnLXSvgBOFgNcgyF1FlJzspt7dr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com; spf=none smtp.mailfrom=smartx.com; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b=opkiiNOE; arc=none smtp.client-ip=209.85.166.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=smartx.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b="opkiiNOE" Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-37611e6ed4dso14513605ab.2 for ; Mon, 01 Jul 2024 20:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1719889332; x=1720494132; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z5wro2DPQQzDm4JEbFr9RFX4ZrKb+KLG6vY37L6bP9Y=; b=opkiiNOE6G/+ZxDBex22KOc3oTB0pSYB7lJfPDnTQc16jMbCY81GKcS5sNUI4BgVwb o7VkuUq+B/oXK/1YjvPZnPRSoEK7+Yrj/ij+4udZwSAAcveIYl9W4jtuCEiCbH9+WfkR 4f2SxYVJhFRF7gICy/UG09xXuDXJXuqaP3FwDaiX6rQMYM0WjIG6Mn+2BSqrMe3dRk0G aE3omH3f9AsaAThh+5RaEEy3yf+rnOq5BrN9f064V58bZ2Gi5Z5cDImjEC02V13NKWmj PV/LHColcl3zbJDA/E/XNfuYaxn/P178CCQtm24f92k/V0k9bukr3uoLS/2FNqH7Cqko 72Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719889332; x=1720494132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z5wro2DPQQzDm4JEbFr9RFX4ZrKb+KLG6vY37L6bP9Y=; b=r3W/IMBaPmQIF8kGxaeGdYYgISZ54joyodWF5eauVY3rSmaNroePpGWFU3U8DPdAnh yAodYiW7A35/9ZTb093DjEhEVo7ITf8WBPxlOaMgd3lkkwmkH7yKDW5MCe0jJvf3VKEJ BZh03XJEZHvL+b4u9aY6xV6s9QrCd4bNwmUQJFkzs/gdvKJY/DOhmb7lDgINjd32ZVeC GZJeNd3DAyDpUXo7oPXlUwSZC5pYFX0pP8ZY1/1TxAy80qUTtln4/hhf3+3dTCvHTtwO vwqesR3neSQZAP/imUaO+XV96gQ6xKvWxhpDAALnZ6qwR+oCwHWn5+dJuKpFJoNCwo3r dKqw== X-Forwarded-Encrypted: i=1; AJvYcCU3V+YJ5pqtgtpe+hNJI/e3+qLNkdouPYvciBOP7Es1Q+I4MGImRiYVazcryDqBgeKI1rnyfFK5liMYh3P+7kcjRS4vpLx3vEzl0Q== X-Gm-Message-State: AOJu0YzKVMyYY0undqV4r/dJqMt11vinRFO9y9wn/K+7DXIpRf9yaXo1 H15P0hu6t5e5rAYtffG5YY0yryelc+pi41n0/qfYxu+xfJfItz4wsaJ2xMe9+Nc= X-Google-Smtp-Source: AGHT+IEpTMk59V3NV8KVvtbOMVVsa4fULF1zm0uglqoSp4Io1UgeVjGAy7FP7CAi425G0Y2cNLDt1A== X-Received: by 2002:a92:c54b:0:b0:374:5a2d:178 with SMTP id e9e14a558f8ab-37cd07285b2mr89734205ab.2.1719889332060; Mon, 01 Jul 2024 20:02:12 -0700 (PDT) Received: from fedora.smartx.com ([103.172.41.200]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-72c6a8dbb2fsm4792904a12.31.2024.07.01.20.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 20:02:11 -0700 (PDT) From: Haoqian He To: Christoph Hellwig , "James E.J. Bottomley" , linux-kernel@vger.kernel.org (open list), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), "Martin K. Petersen" Cc: fengli@smartx.com Subject: [PATCH 2/3] scsi: sd: remove scsi_disk field lbpvpd Date: Mon, 1 Jul 2024 23:01:15 -0400 Message-ID: <20240702030118.2198570-3-haoqian.he@smartx.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240702030118.2198570-1-haoqian.he@smartx.com> References: <20240702030118.2198570-1-haoqian.he@smartx.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The lbpme bit in scsi_disk can be used directly to indicate if the logical unit supports logical block provisioning management. The lbpvpd bit is no longer needed, so remove this field from scsi_disk. Signed-off-by: Haoqian He Signed-off-by: Li Feng --- drivers/scsi/sd.c | 8 ++++---- drivers/scsi/sd.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 44a19945b5b6..b49bab1d8610 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3306,8 +3306,10 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) static unsigned int sd_discard_mode(struct scsi_disk *sdkp) { - if (!sdkp->lbpvpd) - /* Disable discard if LBP VPD page not provided */ + if (!sdkp->lbpme) + /* LBPME was not set means the logical unit + * is fully provisioned, so disable discard. + */ return SD_LBP_DISABLE; /* LBP VPD page tells us what to use */ @@ -3430,7 +3432,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) struct scsi_vpd *vpd; if (!sdkp->lbpme) { - sdkp->lbpvpd = 0; sdkp->lbpu = 0; sdkp->lbpws = 0; sdkp->lbpws10 = 0; @@ -3445,7 +3446,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) return; } - sdkp->lbpvpd = 1; sdkp->lbpu = (vpd->data[5] >> 7) & 1; /* UNMAP */ sdkp->lbpws = (vpd->data[5] >> 6) & 1; /* WRITE SAME(16) w/ UNMAP */ sdkp->lbpws10 = (vpd->data[5] >> 5) & 1; /* WRITE SAME(10) w/ UNMAP */ diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index 36382eca941c..ff9ff2655c25 100644 --- a/drivers/scsi/sd.h +++ b/drivers/scsi/sd.h @@ -146,7 +146,6 @@ struct scsi_disk { unsigned lbpu : 1; unsigned lbpws : 1; unsigned lbpws10 : 1; - unsigned lbpvpd : 1; unsigned ws10 : 1; unsigned ws16 : 1; unsigned rc_basis: 2; From patchwork Tue Jul 2 03:01:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haoqian He X-Patchwork-Id: 809780 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 835CA12EBD6 for ; Tue, 2 Jul 2024 03:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889340; cv=none; b=LSjwM9EFSxi/z45b/YwahgpdnT7eUTfsu0FY59dq35nVsTYL1oCes81CxTAqUu26dEuYrET+RPs/bdFRxRUsx1dvMf8WblBOxmUlnntb3buWtdI9nhOdPAnb/LEuiQvGSGNXIxuPz+mT+gfNhDcQycqcWT9Nw6DmKy2XNO4tF7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719889340; c=relaxed/simple; bh=76AMBBXtU5aCqHyAiKD9DbjKd2koPJbTbe5mV7L1o6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TPY5yjZBfLBB+Asozu4O/w3LupRbHZlT1yddZsW16uXr+PNxjM3C8DtDAuzRLJFYfbtGpr0utHhOeAnCD6zl58JMm71KXq2OcnKSNJNJY7RfBNARQw4wtA2rZi68eDNBx3w8GKRYf1DZkJHlFTmenopYvEIZYsougHSXGXdx7RM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com; spf=none smtp.mailfrom=smartx.com; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b=lRW/TU5+; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=smartx.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=smartx.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smartx-com.20230601.gappssmtp.com header.i=@smartx-com.20230601.gappssmtp.com header.b="lRW/TU5+" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700cc8e447aso2110213a34.2 for ; Mon, 01 Jul 2024 20:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1719889337; x=1720494137; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QQQwXyMsRqqUNEWCeRrNsfzgQh+cx/wn5vbkQhMYQAQ=; b=lRW/TU5+JlaDB6RTSJh2UefQqtuM/TxtLjVqRhugqTyBRyWMBFo1QMjsUPVouHSIL7 LLO5Zldc56NstXoWgmUUtb7rdCZYnJhuj315RAMA2UuHBfBPR4/47I14ljvOd5LZt8kt 8+N2oBHllEE08j+NrDijsmQcabHESFhilUVNZb+ZEl9odQ18jRrV2Ah5fHlT3pSE5tkI sOLpxtPJfnXt8F46LXt2fck9RoYkhVfzKI3M44jnnxVCjp4JF6Qy0167Y18lLySyYpXb WtVAIgoytYrRHbi9kvhItuypxA9ebEUkM/ddRpAROTt/UiQwHxQFUzHqIPrMF6si9QbH awAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719889337; x=1720494137; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QQQwXyMsRqqUNEWCeRrNsfzgQh+cx/wn5vbkQhMYQAQ=; b=hk0qXOWdqj5J2GUM5cep0Pk7+VBFmceoEU5tzgRUEnsZON2NEqMQCuwK39cLDoFU/g G4Z1aGX3fElvkjCbawwm3XHygDjvqiWgcxKVd7UDt5vPf0eCm35KIrkfeh43O/ufvsov C8DYw1lHL9Rzu/iNnoOTiWoMty3v7LPl7396XqCQeo/yxIjtwaAsh0vLtw0hhssmg2IV K5RIBedxYw6Tpfq5mQXWpZS/DuNYLFvnwzHmMXLge6uR419sXlt107mTASJVDkSwba8b pU7IEW/WPD4xFJPB8OMT65MznFHb5kQLCIyaU+uKFH4s5HUtfUkWtO2RzwII2o8pFq3q qT8g== X-Forwarded-Encrypted: i=1; AJvYcCUS2nPR7QduwoVkTTRRQPzOOp4MaU5hi9AVoFW6rrX1s1nr4M3a6DUwmX68mIxAbZq7ASp/xfR8wse1WjnrmRPOll4SZeNyZd6fKQ== X-Gm-Message-State: AOJu0YwVxPt1jecdrt8u/Zw5IYZr++rw73vfaMFT2kSNkW/FyfHe5QNG EkgAXDDR18SLrdrymanRsa43xg09ookPs8BnPPZEez6AZ/s290UvE50XaFmC/VDLKzVyGQV8lzl vfrY= X-Google-Smtp-Source: AGHT+IEo6Ekcikz9MU8COKrqbNv2gz5ysi3gbJlGTeBCwSZVzy9i9s/b1kCO7DSOJ+UAekre76dXuA== X-Received: by 2002:a05:6830:6b47:b0:702:59b:d26 with SMTP id 46e09a7af769-7020766b795mr8938625a34.27.1719889337505; Mon, 01 Jul 2024 20:02:17 -0700 (PDT) Received: from fedora.smartx.com ([103.172.41.200]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-72c6a8dbb2fsm4792904a12.31.2024.07.01.20.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 20:02:17 -0700 (PDT) From: Haoqian He To: Christoph Hellwig , "James E.J. Bottomley" , linux-kernel@vger.kernel.org (open list), linux-scsi@vger.kernel.org (open list:SCSI SUBSYSTEM), "Martin K. Petersen" Cc: fengli@smartx.com Subject: [PATCH 3/3] scsi: sd: remove some redundant initialization code Date: Mon, 1 Jul 2024 23:01:16 -0400 Message-ID: <20240702030118.2198570-4-haoqian.he@smartx.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240702030118.2198570-1-haoqian.he@smartx.com> References: <20240702030118.2198570-1-haoqian.he@smartx.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since the memory allocated by kzalloc for sdkp has been initialized to 0, the code that initializes some sdkp fields to 0 is no longer needed. Signed-off-by: Haoqian He Signed-off-by: Li Feng --- drivers/scsi/sd.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index b49bab1d8610..c7268780c642 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3957,7 +3957,6 @@ static int sd_probe(struct device *dev) sdkp->disk = gd; sdkp->index = index; sdkp->max_retries = SD_MAX_RETRIES; - atomic_set(&sdkp->openers, 0); atomic_set(&sdkp->device->ioerr_cnt, 0); if (!sdp->request_queue->rq_timeout) { @@ -3990,13 +3989,7 @@ static int sd_probe(struct device *dev) /* defaults, until the device tells us otherwise */ sdp->sector_size = 512; - sdkp->capacity = 0; sdkp->media_present = 1; - sdkp->write_prot = 0; - sdkp->cache_override = 0; - sdkp->WCE = 0; - sdkp->RCD = 0; - sdkp->ATO = 0; sdkp->first_scan = 1; sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;