Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp808317lqt; Thu, 6 Jun 2024 21:34:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkZzIyS3vSzdDCQaWkppSey3YeYtYaPZszGYFskIeHs58I3HMuiElkL6EpCCohTB2TLkZ96yRxn2QcFxUdYyJjBSUSlBznWX1uoIITWg== X-Google-Smtp-Source: AGHT+IH9pwOhzzZLL3ZSga8nasjJ6hSo9sqi0xe8+GfAO5PEBsK/aOVgUJhXQ6FQ950FE45mWK2B X-Received: by 2002:a05:6a20:5613:b0:1af:9ec6:afbd with SMTP id adf61e73a8af0-1b2f96a39d3mr1280776637.11.1717734872222; Thu, 06 Jun 2024 21:34:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717734872; cv=pass; d=google.com; s=arc-20160816; b=RFCojPpifUkyxeQoARHorUgnD3b5xrVHiTbKQs6VeFuHDfPbqNaXqWPC5x0d/isE2n c1g6PqYnZrvV7PVuneS0h+tDvzwAkA6vUYfHE4PqmJQz9fizXSgmDL5L8YlzEokDtBrk WEJg6i4DCcodwFQ/3Cr1aEzV7IXoebvl1ojzk5caXeIWXLStWw/oLB4qhauND8aU79Fz QR88hqZBE2n0zSPDcintxWKtqngK2M+mJT9KZocOBTJuyY+t31XgU6P7eqlUYaBrbbqE Vc9ijo+CNheDgZnwwsNyWywAOyjIg7SEVDjkumkTVIezq1Rjv2k1eIRpPxa/0NHqSuya QRow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=TBqPC8Y9Bf/vSRtjw7LIuHLamLs3tiakmjDzh7uPdYs=; fh=yXYChwFvQA/NaaLzCC0IJdkW11OhjXgO4DHXzVmnGFw=; b=q5CrgS8fjQscYCyEgR1xsObMa9nnq+W9bniMAXvUcJxWoqh0zV0dNdgI9kgaVADVeO tatxC+j9MSTYa27D1XZ5zxU9e3QpJMOFusHmiwKNdjpv0cXeKk8sW1fxbNySnccIVIs1 47i1Rc9HUMGs0i5aUDltdyrzfLbUkyJGNDvOxIRYXYTvg2j/BYpH5L0XAvhmf7FWe2YE ANJmrxLdsQAQNrNaSib3wKqGZkF1BQjao5pC2dnyQI17qPxaNodULPxQMft2MXNNVLjM 6M6bTQ62vABPrNM82Fs+R+9GSmWqwXHZJ9iUlCJOa8SoQH1XL7k4fg8CbHsawhYqMrtr xrhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-205314-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd81d85fsi8984125ad.536.2024.06.06.21.34.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 21:34:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205314-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-205314-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D058028AECC for ; Fri, 7 Jun 2024 04:34:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37C9F155A52; Fri, 7 Jun 2024 04:27:16 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 C3A79155721 for ; Fri, 7 Jun 2024 04:27:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717734434; cv=none; b=H07UoPX8GRK5djUs8VBVOasOLQbsouhOEPMFkGg1TlQ6hr9H4VUzDAk5ID3bsiw1LOyqHG45bcq8FgSqCzwYZgkD8HbwmPD02Vsj72EF4cvjMvpG/4fEFsKBWmR7iieo47onrdSlqs87zVKrMBOKSgi6REREPZ+t4bfPgwEjCOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717734434; c=relaxed/simple; bh=H5g+ozEoXYHRgM2mWeR1WnD3zFm8t3yW/MmLkD2THLs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZCJoVP451zozQ9fCbf7V5TxFuZid7MjfUZAN82IK9nrne53gG+jZpkJ2TReHtxZvbbjfU7HdS2XHzKqjjOPhzSAdp6Op2vOHTWKQeeT2xkhArzE4lx7FCR3GQHfGz2L2jeMsmLDJpQgXMrM3I3vKm6jAx6S/Jx6fggOVpzBMMv0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VwSjr2m1jzsTRt; Fri, 7 Jun 2024 12:23:12 +0800 (CST) Received: from kwepemm600013.china.huawei.com (unknown [7.193.23.68]) by mail.maildlp.com (Postfix) with ESMTPS id 0EF8E18007E; Fri, 7 Jun 2024 12:27:11 +0800 (CST) Received: from huawei.com (10.175.104.67) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 7 Jun 2024 12:26:55 +0800 From: Zhihao Cheng To: , , , , , CC: , Subject: [RFC PATCH mtd-utils 039/110] ubifs-utils: Adapt log.c in libubifs Date: Fri, 7 Jun 2024 12:25:04 +0800 Message-ID: <20240607042615.2069840-40-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240607042615.2069840-1-chengzhihao1@huawei.com> References: <20240607042615.2069840-1-chengzhihao1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600013.china.huawei.com (7.193.23.68) Adapt log.c in libubifs, compared with linux kernel implementations: 1. Remove debug related implementations(eg. dbg_check_bud_bytes), debug functions are not needed by fsck, because fsck will check fs in another way. Signed-off-by: Zhihao Cheng --- ubifs-utils/libubifs/log.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/ubifs-utils/libubifs/log.c b/ubifs-utils/libubifs/log.c index b6ac9c42..0d459261 100644 --- a/ubifs-utils/libubifs/log.c +++ b/ubifs-utils/libubifs/log.c @@ -15,7 +15,13 @@ * journal. */ +#include "linux_err.h" +#include "bitops.h" +#include "kmem.h" #include "ubifs.h" +#include "defs.h" +#include "debug.h" +#include "misc.h" static int dbg_check_bud_bytes(struct ubifs_info *c); @@ -737,26 +743,7 @@ out_free: * ('c->bud_bytes' is correct). Returns zero in case of success and %-EINVAL in * case of failure. */ -static int dbg_check_bud_bytes(struct ubifs_info *c) +static int dbg_check_bud_bytes(__unused struct ubifs_info *c) { - int i, err = 0; - struct ubifs_bud *bud; - long long bud_bytes = 0; - - if (!dbg_is_chk_gen(c)) - return 0; - - spin_lock(&c->buds_lock); - for (i = 0; i < c->jhead_cnt; i++) - list_for_each_entry(bud, &c->jheads[i].buds_list, list) - bud_bytes += c->leb_size - bud->start; - - if (c->bud_bytes != bud_bytes) { - ubifs_err(c, "bad bud_bytes %lld, calculated %lld", - c->bud_bytes, bud_bytes); - err = -EINVAL; - } - spin_unlock(&c->buds_lock); - - return err; + return 0; } -- 2.13.6