From patchwork Fri Oct 11 12:58:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Andersson X-Patchwork-Id: 1996110 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0PTF8dXv; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256 header.s=selector1 header.b=ZbK2nmQu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XQ6Fk5C3tz1xvg for ; Sat, 12 Oct 2024 00:01:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=61CXSHXPpWtxhPkRMMXyQaYniwAaWGaUXN1YbKBNZzE=; b=0PTF8dXveeh2x1 a30p80vLR8yRIQ8oKLppyjnQfGAo2vNW0X3w88uq8HZQHJm+npZzu/Bf1Y6apDip+/jaYRjIoT1uT QF6JvzIRmT80Gy7f1a6EQ7PT/Pjm643F0WAjJnqv78gybXfhSd2PwgrlfHOJAcLLHDaThxJtYqvI2 TfeMqrVUIuvhdRPpNbebSaw/7JboSMZny+wGPXZSytfuP45cHNFe8v8gPMHwa8Y5slPX8YAKzptT0 cohVatnH2nVlQmCx+VquWdAjpVyy7yGoxNcy0wOpdDamOzqwCFiJBxnxenni11ZxzOnQfUUNNYykJ xbMsuC1EM4ewTH28Abaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szFGg-0000000GNLO-42kA; Fri, 11 Oct 2024 13:01:18 +0000 Received: from mail-am6eur05on20610.outbound.protection.outlook.com ([2a01:111:f403:2612::610] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szFFE-0000000GN9q-0L5k for linux-mtd@lists.infradead.org; Fri, 11 Oct 2024 12:59:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X680eTSB7sjP7pM9ZtiGxiGs7Q75tegsFvhrVPsCiI1T6TgJoIvXy9KjLmfA4ZQ/5GDPXgphr3dl8xGVDnAI82TihkN/YrK17G8PHnXMCkd+AMmjHHcXmpeSHYVXBXeCUZxSwEiJMwF7KuCs9Iq9uN50xSG3gy9AtUooMgWslycT8fpiFn6/io2hseMpALTexDfxbOFFxx/QVxWToxzXZcvOBL30k9wXvPNLbJ1ldX3LTRDiGA5AMOQWOl7U37ktAHziynkYbMc5guOFoddCn0LxVk5UE3gD3Kr1iReT28pLSzjwOXK7HxyUAk4gbTc5BA3ncg9QK4QXRJ/6tMCXiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=frJxt+iDjdk5wKHYixWaRFrWgZsxxFKddoM0kALxXQI=; b=TqcvzIPwfhqqZ6vU8L8czNeKBV5IJiIZIOGsU7mOf+4xk1DIIM0pC54HzOqSnVuhubQtfNhplqmbEzBu88lUNAXiM8EjZyi6pu1NYFBHLhOMOKMksceJ+EEGU2ZUL8cWQ0TkVN69DYvAM18hueYWcOp2dbmxTyxt43qQpwX7Ftjh0q97c5XpN8xMEYX+mqkrWsNm7JJF6LX5VQ1zToB1SVFeceRwzwq0L8Z+lfBzv8wfC0gyVQzfmX+jKXKGKFhx7168GIFKO59hpdjorIt+hI07YoP9+OYRBPHySrCeOHo6IHPwzz28gPGET3Y59sC73ZWwpLtGBwhN3Y/FZZbaHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=nod.at smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=frJxt+iDjdk5wKHYixWaRFrWgZsxxFKddoM0kALxXQI=; b=ZbK2nmQuDGlPAhbgFcAJN3v5LVqd6c4zi4MB35a5zWwzqWpuYwVYuJc+yIow9e0c6IRUatbUTeZRIwx9QtNNEPFyf6v6gCYegxnKxP5/UAPXF9aJifV8vuQCx4urN7uFBKH1wYymiiQu/RSsJQgSjwGBu1i1vJ9M+Ewbiv+AJig= Received: from DB7PR05CA0010.eurprd05.prod.outlook.com (2603:10a6:10:36::23) by AS8PR02MB7788.eurprd02.prod.outlook.com (2603:10a6:20b:443::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Fri, 11 Oct 2024 12:59:44 +0000 Received: from DU2PEPF00028D02.eurprd03.prod.outlook.com (2603:10a6:10:36:cafe::99) by DB7PR05CA0010.outlook.office365.com (2603:10a6:10:36::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Fri, 11 Oct 2024 12:59:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DU2PEPF00028D02.mail.protection.outlook.com (10.167.242.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Fri, 11 Oct 2024 12:59:44 +0000 Received: from pc50632-2232.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 11 Oct 2024 14:59:42 +0200 From: Rickard Andersson To: , , , CC: , Subject: [PATCH v3 05/10] ubi: Expose max erase counter for data in sysfs Date: Fri, 11 Oct 2024 14:58:59 +0200 Message-ID: <20241011125904.2915983-5-rickard.andersson@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241011125904.2915983-1-rickard.andersson@axis.com> References: <20241011125904.2915983-1-rickard.andersson@axis.com> MIME-Version: 1.0 X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: se-mail02w.axis.com (10.20.40.8) To se-mail01w.axis.com (10.20.40.7) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D02:EE_|AS8PR02MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: 566f3955-0d38-44f3-0ccd-08dce9f493f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: /qB7xIoy5iG/5fjWZZXmAXPaq4wBw7QPOT4ffhQyOuRHbljB5gbZ2YzRUGJ9zzhwEqyPiYpD+3aXT0yHZvhlcHx99cJSy13JDQuqxKNl2we7mUldPAIuKYSEEE04RGqFwoo9loD0hCiNtaU/oWkoaqC/+2avMInNBT/DSVaFk2NjH8fc2m4zBPl5X2YJU5u8F4AqBdnpUKS2JHS0czTEdpXVN6NTeJWHN/WxDAXyq4R0Z2IBQ0nHBk/LnEkQJKuKV0bdq8DjHyODUy6kSrCzzjNjSCN4tJxe6yV/UbM/eIa94v3EUZ68JJ1cesL355u9li76eIQSZ5TFlP3maOK+iS1wnOV0M93Bnu2LjrdRl2nYrCZ3otYZFKae8D86mlbo8kGkf0SKRRrlTAFJ8chyQJIoHS7pYhC98yGmqBZ5JjyxGolBh7tEQB4CMnGRabL6sItV3KuV3zCQJXM3IJSHezS9kXZKUY8x6+NKBj5sznZPajQilSxQ11tztqA1CrnuqEzR9PMO8eisX7c1NNvnP6BbGLhTmRRGigpajuf/UrJ4XjYC+YcYjonkPJGnrYYuNolF/hgk9U412Yk86qCcJGwPS/X5SfVfdIvZT/cxqdnE6MfQcXmiswbvDQyY+/FsR7Lf4TyWpNbmZor6opwiXBLC3DRPoNShSXfrMKbn3JWS+lQvkxupNUX0KtvvAR1tiLeCwPARmkuKdtbRl+loIrdZkIWcgENANfUf8665bAC6CsKDU6mGt78Qd6bwYY8AdgT7haaWMHHvrNt20rj18pGK0ssuQ2ELljK1QWMEqpsUmJX6+1F/HodvuEIjdtuW6pQLXuDhDzs4p0zAglQqmO2Ik6ZidbVpB/rcc/l3iSqoKcrSv35CxEPOt2WsZIH/NOxazAs2MmVffKEkRoL+6a+QSzonRMfGJz3rPFJ1orT8cSeg664FEw//4bNsLpwUYPL2UvCC9a4fPrjVd6vydWpj3YJIQi1Pin5K+1hFEiEIhXsTWSMHYe+GzkU0D1/RdoxdcsUJGm9zLQjwVPoRhgHRt7BQ77TqpI3y237jxlagQS83OaXqLdSx2nQewNj38vyb3K+e1t8M3uCk7n8Q0xLCLwL5hZWkv+WYHTPM9YdSFOY8pA7cYj/SdeOlkmzC1VP75s7zXsFUkMhELG3bClsbn4A7C9wGWXXNBjl1ECW81xQQ5rqpdPZai/ZDEcIoC4JMiSa/cMrnkAr8sQp6T93lhnpv4sY52hYTkvHkCbul/x1nwyp3JISVxFQ8UndjhydfQ63Pr/A0oZoN59LGg/hzVBSaIYsF0ZB+7BOAgBZ+tq+PMKiNvxZIr+Z726U+0ajifl8gNB4ucYUeGg/RDH+40e25mLNsU0gNWgojTVQ12VOZGic9Q9ShlwR9/WZb X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 12:59:44.2261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 566f3955-0d38-44f3-0ccd-08dce9f493f0 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D02.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR02MB7788 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_055948_161748_C3E92EA8 X-CRM114-Status: UNSURE ( 9.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Expose max erase counter for data area in sysfs. Data area includes all blocks except for the fastmap area. This value can be used in order to estimate life expectancy of the flash. Reviewed-by: Zhihao Cheng Signed-off-by: Rickard Andersson --- drivers/mtd/ubi/build.c | 5 +++++ 1 file changed, 5 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 ARC_VALID Message has a valid ARC signature 0.0 ARC_SIGNED Message has a ARC signature -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Expose max erase counter for data area in sysfs. Data area includes all blocks except for the fastmap area. This value can be used in order to estimate life expectancy of the flash. Reviewed-by: Zhihao Cheng Signed-off-by: Rickard Andersson --- drivers/mtd/ubi/build.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 9cc7bc74f0d2..fa1ff0146572 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -138,6 +138,8 @@ static struct device_attribute dev_max_ec_fastmap = __ATTR(max_ec_fastmap, S_IRUGO, dev_attribute_show, NULL); static struct device_attribute dev_mean_ec_fastmap = __ATTR(mean_ec_fastmap, S_IRUGO, dev_attribute_show, NULL); +static struct device_attribute dev_max_ec_data = + __ATTR(max_ec_data, S_IRUGO, dev_attribute_show, NULL); static struct device_attribute dev_mean_ec_data = __ATTR(mean_ec_data, S_IRUGO, dev_attribute_show, NULL); #endif @@ -462,6 +464,8 @@ static ssize_t dev_attribute_show(struct device *dev, ret = sprintf(buf, "%d\n", ubi_calc_max_ec(ubi, 0, UBI_FM_MAX_START)); else if (attr == &dev_mean_ec_fastmap) ret = sprintf(buf, "%d\n", ubi_calc_mean_ec(ubi, 0, UBI_FM_MAX_START)); + else if (attr == &dev_max_ec_data) + ret = sprintf(buf, "%d\n", ubi_calc_max_ec(ubi, UBI_FM_MAX_START, ubi->peb_count)); else if (attr == &dev_mean_ec_data) ret = sprintf(buf, "%d\n", ubi_calc_mean_ec(ubi, UBI_FM_MAX_START, ubi->peb_count)); #endif @@ -495,6 +499,7 @@ static struct attribute *ubi_dev_attrs[] = { #ifdef CONFIG_MTD_UBI_FASTMAP &dev_max_ec_fastmap.attr, &dev_mean_ec_fastmap.attr, + &dev_max_ec_data.attr, &dev_mean_ec_data.attr, #endif &dev_reserved_for_bad.attr,