Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp988777rwo; Sat, 22 Jul 2023 04:38:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlF6A7Y8X/n1hjciGXhuJprOkLUJtn574C8eSmQqF/0WW/IGcVVsg1DDXNSnxbT0M0Kfi9D9 X-Received: by 2002:a17:90a:4ec3:b0:263:f674:490e with SMTP id v3-20020a17090a4ec300b00263f674490emr7155457pjl.3.1690025911764; Sat, 22 Jul 2023 04:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690025911; cv=none; d=google.com; s=arc-20160816; b=TDJvn54wU3p6VQFBj3/Z1bhqPmFm9XVmbZ+D2on5b2YihzMjarRoXW49wBp0kzHa2E wUkNtInTFimSvku5Q2QAP1g8dHQJSyqSf2+Anoa7eYzvk66kxy9JbjcIqEx+ojbuu+mT aAieRsafgCcCXpDUs0NykIPBpkSwuiwl5fKA8u5TtMCVIIRRDnshoZNfFHOuFcTp+wNT BIfbyhT9XUqJUsJkxXMrXKSodtu3Xx+7Z7gHzJAHZmBcDmqxBr5r0vWiPnoxpf/Laz+R ecGZY5Fz9DdJgYDh8+xe1PERf1R/RRneEgSey3669r1cJvBF3VJ6dZvWmEwqELM4avr1 7eWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6QPsSeTAJEj07UHx/evr9sl1PrgMm2thzqQ+WgYiFvI=; fh=wVYnlJkdCBQCsPBltOpwRZY1Ob8weyxSizm8alLbX9s=; b=0vJLSsL3JkwYLjgSHS21eGhX9eFFcDowcQ8sqBmFlPugETa8f15cXq9JGkvrurfskP GSXNi6bPcq8hPmqkZg+cmlO1oeBXNOT7rHOdu9rd1Si0c4S/fPeOs04915dfm4VkSTYb wUZvLTnqvgqh+CpvskSwNX4jHQbhzOG+P6TihN6q0WnWkRy1wh0f1yMYT/8zrltV9KbZ Y1e4l1f7T6TmYI6V5jCXTTIpUDpCZTLYtEwd4DaTyqbX2XKQYqUlEaU/MnMq3TyXdcEg lJb0AJh6RZozGXO+TuBAGKqcGL/FrJ+850ZfDXgEX2/ZzNWLNh6olIwsQ64HZP8UA1Hn 3H7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b0055c95b1a6c3si4419984pgv.880.2023.07.22.04.38.19; Sat, 22 Jul 2023 04:38:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjGVK0L (ORCPT + 99 others); Sat, 22 Jul 2023 06:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjGVK0I (ORCPT ); Sat, 22 Jul 2023 06:26:08 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201C926A3 for ; Sat, 22 Jul 2023 03:26:07 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R7Mvl6WNKzHqXC; Sat, 22 Jul 2023 18:23:31 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 22 Jul 2023 18:26:02 +0800 From: ZhaoLong Wang To: , , CC: , , , , Subject: [RFC 0/1] ubi: An interface for dump the mapping between LEBs and PEBs Date: Sat, 22 Jul 2023 18:23:01 +0800 Message-ID: <20230722102302.1848135-1-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a metadata exception occurs on a device using UBIFS, we can easily obtain the LEB number of the data exception from the log, but the PEB number corresponding to the LEB cannot be obtained. In some production lines, the NAND flash produced by the NAND flash cannot provide reliable ECC error correction capabilities. The file system damage is always related to the flash eraseblock exception. Therefore, I hope that there is a way to quickly obtain the mapping between LEBs and PEBs in the user space. In this way, the tool of user mode can be used to debug possible faulty physical blocks more conveniently. Currently, the implementation of this interface is rough. It does not obtain necessary locks when traversing the entire eba_tbl. Therefore, this operation race with the volume update process (such as resize and wear-leveling). As a result, the user mode obtains incorrect mapping information. However, in practice, when the development and O&M need to use this interface, frequent volume management operations do not occur. Therefore, this problem may be tolerated. I hope the experts will give valuable comments on this patch. If this interface is acceptable, I'll make it perform as well as I can. ZhaoLong Wang (1): ubi: An interface is added for dump the mapping between LEBs and PEBs drivers/mtd/ubi/debug.c | 104 ++++++++++++++++++++++++++++++++++++++++ drivers/mtd/ubi/eba.c | 24 ---------- drivers/mtd/ubi/ubi.h | 24 ++++++++++ 3 files changed, 128 insertions(+), 24 deletions(-) -- 2.31.1