From patchwork Wed Sep 18 11:36:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 1986764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=jei2=qq=vger.kernel.org=linux-ext4+bounces-4205-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7xF95vprz1y2l for ; Wed, 18 Sep 2024 21:26:53 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4X7xF92W18z4xbv for ; Wed, 18 Sep 2024 21:26:53 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4X7xF92QTqz4xbw; Wed, 18 Sep 2024 21:26:53 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:45e3:2400::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658813; cv=pass; b=YqNshTSwMdHtUKyclMScBO3SivYEqyEy5d+/sVT7eqOCcWvCwpIx3EXSlE7o8XU69BBvqDDqEcFTZrdPl+C6HnVueD4fxdtGD0GbVbb4tdV2nYtmAKu9ZczkvpRJNzlkz9cf2FztUJV0/5qmQyffvC/9NH5SVY5Q/wgCwiK0b6zzWKF3dMZR8pbLe1DPjvW/qjsNOCmiEapr/0dV+GuxmXA8Z1P13s4lXXI/hQnl66yv18PGuKmlB9S19bOmF4PvWHQtBAUSnjcLwIq4a6/U1f/m4EHv9txVIlGA0DnZrpsdOdsumvuhqVqOGQ7qu+UdM0Wd84ymwiVlr6hNjhA8JQ== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658813; c=relaxed/relaxed; bh=PMNzXJ13MTJd190O1wodNw5Mtqg6UkvlzCbrX5v/DT8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HDVVDp5Sfhv1zkh4DNis89jDR1+9VXzyn4W77JILCFkWyIosGHI6Bblyle04ABx78MoLptB+SfnVXpZjS5+XlpR351ejfUgalZbfY7yzkbmGLfBdcDciEjZI8BJOMgjWacpoxBedGK8MHdYzX/pL67+nB8JZymeKjOrwUbgR+pzHlokFfjfMYtu+GBbIWXf7t7TLvCwDrGL+OdaDBgZG5hKRwYz6+j3vAtz3Qxmz9hDW0sM77/DrcBWUKkmVPzJ6jFGW62W2IlzzPQ8hmDW5cC/M5UQFKie7dCHOaqV//GIU4BAo27jUW3OEbCUx1Ojq2jkPelHK53ydZ0s629lyZg== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4205-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4205-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4X7xF907nPz4xbv for ; Wed, 18 Sep 2024 21:26:53 +1000 (AEST) 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 D42BE288685 for ; Wed, 18 Sep 2024 11:26:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B63A18858E; Wed, 18 Sep 2024 11:26:44 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 9E1DB175D4C for ; Wed, 18 Sep 2024 11:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; cv=none; b=VVLqX0v1SO/7RNQMWqgNmp47cam8n6N2tsFuif3K3WrOBfbQJvMmh465gQLRXeLJSMJZ6RUbY+Qi9Tu2yMZWQQzUDFp1IrsC9wSvbJ3T6VVPgUKd+WyF6TWLPF3PYG8qlWLKY4/V3ZhnprQfjjYBpbEzy840rw0OKDYAays+hsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; c=relaxed/simple; bh=YtwPVE+l3Cf1+TcdBlZASDxTQn3uFS/nBp8vI4qU9PA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jmlWjhm5bhcpPLC3ZTxbBdBd12Jo4BqoZ1QCMBExLSejU3QXHyQKKSwSljjtadeAAsi2EfYUo4+HHkBTt7SehVMdUMGP/RVsSNuIAbNXiaYGeBBDy5+HYmg8D4Z9RWd5rSF3SU7CLFJdXqs/Gam2ZPcz0sPkuiNpPkheYB7yEyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4X7xDg45j9z4f3jZQ for ; Wed, 18 Sep 2024 19:26:27 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 7D7951A018D for ; Wed, 18 Sep 2024 19:26:38 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgD3LMnsuOpmuiKqBg--.12650S5; Wed, 18 Sep 2024 19:26:38 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: jack@suse.cz, zhangxiaoxu5@huawei.com Subject: [PATCH 1/5] jbd2: remove redundant judgments for check v1 checksum Date: Wed, 18 Sep 2024 19:36:00 +0800 Message-Id: <20240918113604.660640-2-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240918113604.660640-1-yebin@huaweicloud.com> References: <20240918113604.660640-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgD3LMnsuOpmuiKqBg--.12650S5 X-Coremail-Antispam: 1UD129KBjvdXoWrtF1UKryfJFyrWFy8CFy8Zrb_yoW3JwbEgw 40krZYvw1xXFnFya45Jw15WF1a9rsxur1fCwn2y34a9a4UXF1kXrWDX34DXryDu39I9FWr CrZrWFWxtFZ3tjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbqxYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r18M2 8IrcIa0xkI8VCY1x0267AKxVWUXVWUCwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK 021l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwCY1x0262kKe7AKxVWUAVWUtwCF04k20xvY0x0EwIxGrw CF54CYxVCY1x0262kKe7AKxVWUAVWUtwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02 F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw 1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7Cj xVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r 1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1m0 PDUUUUU== X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ From: Ye Bin 'need_check_commit_time' is only used by v2/v3 checksum, so there isn't need to add 'need_check_commit_time' judegement for v1 checksum logic. Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 667f67342c52..5efbca6a98c4 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -619,7 +619,6 @@ static int do_one_pass(journal_t *journal, if (pass != PASS_REPLAY) { if (pass == PASS_SCAN && jbd2_has_feature_checksum(journal) && - !need_check_commit_time && !info->end_transaction) { if (calc_chksums(journal, bh, &next_log_block, From patchwork Wed Sep 18 11:36:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 1986763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=qbx8=qq=vger.kernel.org=linux-ext4+bounces-4203-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (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 4X7xF95r64z1y1m for ; Wed, 18 Sep 2024 21:26:52 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4X7xF72GyDz4xZh for ; Wed, 18 Sep 2024 21:26:51 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4X7xF729gvz4xbv; Wed, 18 Sep 2024 21:26:51 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:45d1:ec00::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658811; cv=pass; b=hkx2w7D3WrbDY7FlnNbXLnK4vGjqTjsuo5mowNTNFvlsbYdv+98M8sdX9E4Sa5IYPzm3qf1d1Sua703HhQTmAKnJlMWfCRD//ApUAx3vIs1BCY4LksqkYHU/KKzYTsZ0SpfLNSLrOn7TMw2+uRMdayyDbabSed3thi0g4D9+Ha7zmFPjzfy8bj3nNx/sHc6LdmKU8350U7PKwcRgTxTrQT8fPH+YtzXz6VmPyktI0YhVqZTOAuKcgj8h77NJ1F5kPAoFtY+WrtBBtZJZ9J8EfwUpUUFlG8CulAeZ5buJio/CbBmjiSMbkb8vDXfYNF5QRMbl1d72ji9LZ0dJJQzoJw== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658811; c=relaxed/relaxed; bh=BNQ/OC3L55RUnYskBTSNpQyrKQuFId2A19eO/tgVBAg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SNgRXYHr7SBpQ9vf9gx1zHuvjlA4eIvCMff3lLoxivNtrZGm+/t4ZtgsPR2m70+9j4n3AvD9sWxOCkxBzB6V25Ur1IHanYKa74fKxuKyZzRwy71wRgIeb04BSfUHNB3529LrHuNTiWN0nzVfaFpqjahni/YV7ZUquI3VNj9sDNMCBMSOvdBRVGQNnqzJk/HBc6vr+Nk84LQjJZUz4eTNbfCkSKBnOjwOfCO3r1LE//ITUGSbUChRwgJO9a6zUVWOTCoSf3bjUQ945FFbyjFgz9TaLUtf8Q4ZExsukBG85C4U/QH0CZO2fHanH2rbsKCdgyrQdLRG6xza+spQVypYdQ== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4203-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4203-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4X7xF61kqNz4xZh for ; Wed, 18 Sep 2024 21:26:50 +1000 (AEST) 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 668D51C21EA0 for ; Wed, 18 Sep 2024 11:26:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4AED180A6A; Wed, 18 Sep 2024 11:26:43 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 9E173266D4 for ; Wed, 18 Sep 2024 11:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658803; cv=none; b=Cu5Ya3OERdsNna6Qj/gS8Pr7k3Z4naaw4AQ1T+i2dVgr90exOg+XSS2hgpP9P4q4Ai4jstCdh6vX/PvFJ4g8aGFZ//vS31abzFH0xUxgy3CqUjTk8b/jhIutclzbOQOtLxnyzMMJfKbCRpxFvgj0VIiKB3h0+9qF3TwJF/u6pBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658803; c=relaxed/simple; bh=h8c11Y5XLAzibBI5SiBMt1Vxragi6MmO1DZBrxIOSic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MsVlMg5JmQK7LHwekuKHBD1bH1JUnWfZ+kSHWQofnN91UcOconbadJAlSy/Z8i/EJgu07cDx7u927YcJ2cM8SFVUcUBlqxYg8z5kxhXGDOv3Hpm1rlAUkcFXH0XF9yuNOmhkEA1+lZKrkYA5CCmlxoFq/vwEOP2HMLSxuTWBwQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4X7xDZ1Bs2z4f3lV7 for ; Wed, 18 Sep 2024 19:26:22 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id BE2731A0C23 for ; Wed, 18 Sep 2024 19:26:38 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgD3LMnsuOpmuiKqBg--.12650S6; Wed, 18 Sep 2024 19:26:38 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: jack@suse.cz, zhangxiaoxu5@huawei.com Subject: [PATCH 2/5] jbd2: unified release of buffer_head in do_one_pass() Date: Wed, 18 Sep 2024 19:36:01 +0800 Message-Id: <20240918113604.660640-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240918113604.660640-1-yebin@huaweicloud.com> References: <20240918113604.660640-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgD3LMnsuOpmuiKqBg--.12650S6 X-Coremail-Antispam: 1UD129KBjvJXoWxAFy8Gr18tr4kWrWkJryxKrg_yoWrCrWUpw sxGrWkuFyqvw1ayas7tFZ8XrWjvF4jyFyUWF1q93Zayw43trnrt34Iqr1ftFW5JFWfZas5 XF4rAw1qkw1rKa7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPab4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUXw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr4 1l4c8EcI0Ec7CjxVAaw2AFwI0_JF0_Jw1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAq x4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r 1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF 7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxV WUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU 7PfHUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ From: Ye Bin Now buffer_head free is very fragmented in do_one_pass(), unified release of buffer_head in do_one_pass() Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 5efbca6a98c4..0adf0cb31a03 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -493,7 +493,7 @@ static int do_one_pass(journal_t *journal, int err, success = 0; journal_superblock_t * sb; journal_header_t * tmp; - struct buffer_head * bh; + struct buffer_head *bh = NULL; unsigned int sequence; int blocktype; int tag_bytes = journal_tag_bytes(journal); @@ -552,6 +552,8 @@ static int do_one_pass(journal_t *journal, * record. */ jbd2_debug(3, "JBD2: checking block %ld\n", next_log_block); + brelse(bh); + bh = NULL; err = jread(&bh, journal, next_log_block); if (err) goto failed; @@ -567,20 +569,16 @@ static int do_one_pass(journal_t *journal, tmp = (journal_header_t *)bh->b_data; - if (tmp->h_magic != cpu_to_be32(JBD2_MAGIC_NUMBER)) { - brelse(bh); + if (tmp->h_magic != cpu_to_be32(JBD2_MAGIC_NUMBER)) break; - } blocktype = be32_to_cpu(tmp->h_blocktype); sequence = be32_to_cpu(tmp->h_sequence); jbd2_debug(3, "Found magic %d, sequence %d\n", blocktype, sequence); - if (sequence != next_commit_ID) { - brelse(bh); + if (sequence != next_commit_ID) break; - } /* OK, we have a valid descriptor block which matches * all of the sequence number checks. What are we going @@ -603,7 +601,6 @@ static int do_one_pass(journal_t *journal, pr_err("JBD2: Invalid checksum recovering block %lu in log\n", next_log_block); err = -EFSBADCRC; - brelse(bh); goto failed; } need_check_commit_time = true; @@ -622,16 +619,12 @@ static int do_one_pass(journal_t *journal, !info->end_transaction) { if (calc_chksums(journal, bh, &next_log_block, - &crc32_sum)) { - put_bh(bh); + &crc32_sum)) break; - } - put_bh(bh); continue; } next_log_block += count_tags(journal, bh); wrap(journal, next_log_block); - put_bh(bh); continue; } @@ -701,7 +694,6 @@ static int do_one_pass(journal_t *journal, "JBD2: Out of memory " "during recovery.\n"); err = -ENOMEM; - brelse(bh); brelse(obh); goto failed; } @@ -733,7 +725,6 @@ static int do_one_pass(journal_t *journal, break; } - brelse(bh); continue; case JBD2_COMMIT_BLOCK: @@ -781,7 +772,6 @@ static int do_one_pass(journal_t *journal, pr_err("JBD2: Invalid checksum found in transaction %u\n", next_commit_ID); err = -EFSBADCRC; - brelse(bh); goto failed; } ignore_crc_mismatch: @@ -791,7 +781,6 @@ static int do_one_pass(journal_t *journal, */ jbd2_debug(1, "JBD2: Invalid checksum ignored in transaction %u, likely stale data\n", next_commit_ID); - brelse(bh); goto done; } @@ -811,7 +800,6 @@ static int do_one_pass(journal_t *journal, if (info->end_transaction) { journal->j_failed_commit = info->end_transaction; - brelse(bh); break; } @@ -847,7 +835,6 @@ static int do_one_pass(journal_t *journal, if (!jbd2_has_feature_async_commit(journal)) { journal->j_failed_commit = next_commit_ID; - brelse(bh); break; } } @@ -856,7 +843,6 @@ static int do_one_pass(journal_t *journal, last_trans_commit_time = commit_time; head_block = next_log_block; } - brelse(bh); next_commit_ID++; continue; @@ -875,14 +861,11 @@ static int do_one_pass(journal_t *journal, /* If we aren't in the REVOKE pass, then we can * just skip over this block. */ - if (pass != PASS_REVOKE) { - brelse(bh); + if (pass != PASS_REVOKE) continue; - } err = scan_revoke_records(journal, bh, next_commit_ID, info); - brelse(bh); if (err) goto failed; continue; @@ -890,12 +873,12 @@ static int do_one_pass(journal_t *journal, default: jbd2_debug(3, "Unrecognised magic %d, end of scan.\n", blocktype); - brelse(bh); goto done; } } done: + brelse(bh); /* * We broke out of the log scan loop: either we came to the * known end of the log or we found an unexpected block in the @@ -931,6 +914,7 @@ static int do_one_pass(journal_t *journal, return success; failed: + brelse(bh); return err; } From patchwork Wed Sep 18 11:36:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 1986768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org; envelope-from=srs0=bkzt=qq=vger.kernel.org=linux-ext4+bounces-4208-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (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 4X7xFL3sg1z1y2m for ; Wed, 18 Sep 2024 21:27:02 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4X7xFL3B3Yz4xZ7 for ; Wed, 18 Sep 2024 21:27:02 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4X7xFL37Xxz4xZh; Wed, 18 Sep 2024 21:27:02 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:45e3:2400::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658822; cv=pass; b=Jlkc5/9Hbv8pZiZUv/Y0kkbqcTcwrXuZ5CCgNXvCHVobxSVGzUHsKmadiXbRObo/AnYABf1JSWpibKfUyL2nio8GXyVlRjTuig92jaPldgzgVxFzliR+jStjCcbJFZQJMBDzYCP2bNAMyPZpGgY1z6Bzvik0oNGYennp1U0zu9p53nvtVDr88SOeP3o17K8wrOkENWXUyvXif5Ea56TKO0YF/zsB30p6CZAbDdA5Pt+QKvw/vbZBrUEQnN5/ySGA3PAx95I02JXb3u8WW5ubcMFeytYkfIcDzxMJTPxvEn0nbhuECLmU//l+YkBHi42QTmVdE2cGrNVW03hrGd8Bdg== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658822; c=relaxed/relaxed; bh=tlVeg8AR7t29qFgUCY49u4VjTGcmrp30Jy/xpXMC95Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M8qHWeK6A4DtvS8kb2de0mNpWYcZlTabtVycQzwiA3+L0b/RTVEFhHIK+CAe4FP9Mj6DWIFQm6PCFWRYjYrwHhtMpVfwcXcWYSAJLNaT12P/f4bkNhREY3/Y8oWAhWL4YshLvr6vEfmUi5FNkVbGlB1UxIcArIo9CIFA10MDG5i+8AnFWiRxg6rssdi6UtkuvpiPSqHklKPwWgy5tEpZDpWSMAlQnZB26RJbfkKE7RpCKaW+UzsgFEHL94eJVARTsDp01vNnKY4lDEWe4ILGRsJBAfijxod6/P++UZ02Lj2t8+0orfWDTFrNLyQ6Xywoh0O9vn6zsAosfHcEYyJEnw== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4208-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4208-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4X7xFL0trKz4xZ7 for ; Wed, 18 Sep 2024 21:27:02 +1000 (AEST) 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 F327E2885D7 for ; Wed, 18 Sep 2024 11:27:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 287B81891C7; Wed, 18 Sep 2024 11:26:46 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 361CB266D4 for ; Wed, 18 Sep 2024 11:26:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658806; cv=none; b=XPSFJyz1dOJS5SCyckRZGg7Yz9v18am0MLvFb8MASsdI+TXoh2FcamrKxbV9PwwIZaF5wJokOJqzYkGl1+/A0ub0MrFwaBrtRCQ9diyjPpiZFyPRNOM5QX6CWEL9UMxsgsuRSsU1EIfwHxVLIIM+xOJlDYIxpUR77+/2bl/U+WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658806; c=relaxed/simple; bh=3X5P+C9W25nt5C5oOL5qM3puZ87HZm4vmK5cgkqZeUk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YVogPhf5Vey3fw/LcFES1ELOUqOPbn1cVV4v9Cjk1XtKICq9NiuheWs8y5sluEDkczShRV6W1nCQSDm64f4eZVjR8hI1S3eDeKAYktDXiY8JbDyYJpkuOy1g1HwP+i1T4yoLrb3gj/dUpW6HWS7GQKrDtPq1BtlUWHYTVHymeoU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4X7xDZ3FQHz4f3lVM for ; Wed, 18 Sep 2024 19:26:22 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 0FEAD1A0359 for ; Wed, 18 Sep 2024 19:26:39 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgD3LMnsuOpmuiKqBg--.12650S7; Wed, 18 Sep 2024 19:26:38 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: jack@suse.cz, zhangxiaoxu5@huawei.com Subject: [PATCH 3/5] jbd2: refactor JBD2_COMMIT_BLOCK process in do_one_pass() Date: Wed, 18 Sep 2024 19:36:02 +0800 Message-Id: <20240918113604.660640-4-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240918113604.660640-1-yebin@huaweicloud.com> References: <20240918113604.660640-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgD3LMnsuOpmuiKqBg--.12650S7 X-Coremail-Antispam: 1UD129KBjvJXoWxXFW5Aw1DAry3Gr4DWw1kuFg_yoW5GF4kpw s8CwnxKrWUJr1SvFs3Jr1UZFW5W3Wvya4UuFnFkwn7XasxKwnFgws2qrySqry5AF93u34r uF15Awn8Kw1xC37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPab4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vIr4 1l4c8EcI0Ec7CjxVAaw2AFwI0_JF0_Jw1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAq x4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r 1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF 7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxV WUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU c4SoDUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ From: Ye Bin To make JBD2_COMMIT_BLOCK process more clean, no functional change. Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 55 ++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 0adf0cb31a03..0d697979d83e 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -728,6 +728,11 @@ static int do_one_pass(journal_t *journal, continue; case JBD2_COMMIT_BLOCK: + if (pass != PASS_SCAN) { + next_commit_ID++; + continue; + } + /* How to differentiate between interrupted commit * and journal corruption ? * @@ -790,8 +795,7 @@ static int do_one_pass(journal_t *journal, * much to do other than move on to the next sequence * number. */ - if (pass == PASS_SCAN && - jbd2_has_feature_checksum(journal)) { + if (jbd2_has_feature_checksum(journal)) { struct commit_header *cbh = (struct commit_header *)bh->b_data; unsigned found_chksum = @@ -815,34 +819,33 @@ static int do_one_pass(journal_t *journal, goto chksum_error; crc32_sum = ~0; + goto chksum_ok; } - if (pass == PASS_SCAN && - !jbd2_commit_block_csum_verify(journal, - bh->b_data)) { - if (jbd2_commit_block_csum_verify_partial( - journal, - bh->b_data)) { - pr_notice("JBD2: Find incomplete commit block in transaction %u block %lu\n", - next_commit_ID, next_log_block); - goto chksum_ok; - } - chksum_error: - if (commit_time < last_trans_commit_time) - goto ignore_crc_mismatch; - info->end_transaction = next_commit_ID; - info->head_block = head_block; - if (!jbd2_has_feature_async_commit(journal)) { - journal->j_failed_commit = - next_commit_ID; - break; - } + if (jbd2_commit_block_csum_verify(journal, bh->b_data)) + goto chksum_ok; + + if (jbd2_commit_block_csum_verify_partial(journal, + bh->b_data)) { + pr_notice("JBD2: Find incomplete commit block in transaction %u block %lu\n", + next_commit_ID, next_log_block); + goto chksum_ok; } - if (pass == PASS_SCAN) { - chksum_ok: - last_trans_commit_time = commit_time; - head_block = next_log_block; + +chksum_error: + if (commit_time < last_trans_commit_time) + goto ignore_crc_mismatch; + info->end_transaction = next_commit_ID; + info->head_block = head_block; + + if (!jbd2_has_feature_async_commit(journal)) { + journal->j_failed_commit = next_commit_ID; + break; } + +chksum_ok: + last_trans_commit_time = commit_time; + head_block = next_log_block; next_commit_ID++; continue; From patchwork Wed Sep 18 11:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 1986767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=1lfz=qq=vger.kernel.org=linux-ext4+bounces-4207-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7xFJ2fnzz1y1m for ; Wed, 18 Sep 2024 21:27:00 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4X7xFJ12t7z4xWm for ; Wed, 18 Sep 2024 21:27:00 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4X7xFJ10N6z4xZh; Wed, 18 Sep 2024 21:27:00 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip=147.75.199.223 arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658820; cv=pass; b=PKbn/kYvxSCV8wP488TLC6wDOXQ7gSaiMSKsJnfHPqjLlSvqdqML2dcGYVP5HBbemgF7a33JKSdviMXtV6v3nDaRUS7ymSgRmAp0JzCxEEHkYDAko+vnIOjqFiuGqUWxtcbCH3hzLfbtDQmr65t4UoXeZRh3AmtmH3/Zw3Nu483bhupoEEV60dR/QfbQvby+ltdr4GsIt0kstbLAe7VxKaejx2oNhRf2aGfuRSXGQ+fyugJket75Zio3GMnSXnEdU08EdyXTU9PLptyjeV6LYHY74Fzs88VKNlh1CzU/hMV4p83g1K5RHVWczOWWHe+9RLVim+mhtUIZm7YH0MTNrw== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658820; c=relaxed/relaxed; bh=yJFHc3pvP6vzoe8MJVsgc8IWNeuhCaavaqQFSLJCPNY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jo9LaxTrOCUdPyUj2jyLoGUeqH6cYpy/1ku3XLj87F8Xxb9bqTCxetRAfRCDCMfx8KgtgxR3AI+Sum/54Lolb1Mffo8Q5RA+MI0YzvjcE3TYESab5n20IxS7oR9eNoI3YvJm7pb1GsrtYSOsVynlXpPSst2DjWJ7kN3vzFX/+/6LyJyFezAw/ulGCspOOFlJJDkCrmHQgYl0gliOuHUyvDADhZjJhWSwRrkop5EOYqbI74cQoG6ZbNOyQLTi7lEkVg6Uf4MwYpVvfPE8cDvcDNudyHA7HwS9ORikkf68IyjJHldRfNehoiCOSzEpYuq1c30wvLztrPXIIc6MmIisJw== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4207-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4207-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4X7xFH4tjMz4xWm for ; Wed, 18 Sep 2024 21:26:59 +1000 (AEST) 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E628E1C22E41 for ; Wed, 18 Sep 2024 11:26:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE8D7291E; Wed, 18 Sep 2024 11:26:44 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 9049E176248 for ; Wed, 18 Sep 2024 11:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; cv=none; b=KwfxtHfhILiUKU7SDxsmXj7s0+QF6uMTDI/ceD/08E1L9neGps1Jr7epm1MCaamltPh1R1bPwsrHhEpUKafOjLPv7Y+MOjj/nucVeCSs8rZQOrUyHDL+anGgqqk2pbli0hJK/k7B6Q8uEKz8USuQTCpEdodWVj40wjCSJMS1wOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; c=relaxed/simple; bh=/obPIjfdVBv/SJjBrv7LSuavUku33y9tZYJKNghP6Cw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pSjaEXe/szIWxYIQc+9CKYaTApDoKkIgLBy9TD7ESkWQQj5PAPRBobRjiN/znan0rdIFsN5fVY3KnTQDN0x7bWzrlEbiZnZOuCj5JIeSe113kFqb0a18ij5UhB6ctKKvDfZxNN7UlhE7ASRamAQ/UWd6ud2eVDuGHOAqe/MIJQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4X7xDb3WNFz4f3jYJ for ; Wed, 18 Sep 2024 19:26:23 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 531BD1A08DC for ; Wed, 18 Sep 2024 19:26:39 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgD3LMnsuOpmuiKqBg--.12650S8; Wed, 18 Sep 2024 19:26:39 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: jack@suse.cz, zhangxiaoxu5@huawei.com Subject: [PATCH 4/5] jbd2: factor out jbd2_do_replay() Date: Wed, 18 Sep 2024 19:36:03 +0800 Message-Id: <20240918113604.660640-5-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240918113604.660640-1-yebin@huaweicloud.com> References: <20240918113604.660640-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgD3LMnsuOpmuiKqBg--.12650S8 X-Coremail-Antispam: 1UD129KBjvJXoW3GFyfWF4UKw1xtr18AF47Jwb_yoWxur4DpF 1Yk390gr909r1IvF1IqFn8XrWag3W2ya4UGF1DCwnaya90yr1ag3s2qr90qFyYyry2vas0 gF4rAa4DGw10kr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPvb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64 vIr41l4c8EcI0Ec7CjxVAaw2AFwI0_JF0_Jw1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2Iq xVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r 126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY 6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67 AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuY vjxUcD73DUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ From: Ye Bin Factor out jbd2_do_replay() no funtional change. Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 219 +++++++++++++++++++++++---------------------- 1 file changed, 110 insertions(+), 109 deletions(-) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 0d697979d83e..05ea449b95c4 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -485,6 +485,105 @@ static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag, return tag->t_checksum == cpu_to_be16(csum32); } +static __always_inline int jbd2_do_replay(journal_t *journal, + struct recovery_info *info, + struct buffer_head *bh, + unsigned long *next_log_block, + unsigned int next_commit_ID, + int *success, int *block_error) +{ + char *tagp; + int flags; + int err; + int tag_bytes = journal_tag_bytes(journal); + int descr_csum_size = 0; + unsigned long io_block; + journal_block_tag_t tag; + struct buffer_head *obh; + struct buffer_head *nbh; + + if (jbd2_journal_has_csum_v2or3(journal)) + descr_csum_size = sizeof(struct jbd2_journal_block_tail); + + tagp = &bh->b_data[sizeof(journal_header_t)]; + while ((tagp - bh->b_data + tag_bytes) <= + journal->j_blocksize - descr_csum_size) { + + memcpy(&tag, tagp, sizeof(tag)); + flags = be16_to_cpu(tag.t_flags); + + io_block = (*next_log_block)++; + wrap(journal, *next_log_block); + err = jread(&obh, journal, io_block); + if (err) { + /* Recover what we can, but report failure at the end. */ + *success = err; + pr_err("JBD2: IO error %d recovering block %lu in log\n", + err, io_block); + } else { + unsigned long long blocknr; + + J_ASSERT(obh != NULL); + blocknr = read_tag_block(journal, &tag); + + /* If the block has been revoked, then we're all done here. */ + if (jbd2_journal_test_revoke(journal, blocknr, + next_commit_ID)) { + brelse(obh); + ++info->nr_revoke_hits; + goto skip_write; + } + + /* Look for block corruption */ + if (!jbd2_block_tag_csum_verify(journal, &tag, + (journal_block_tag3_t *)tagp, obh->b_data, + next_commit_ID)) { + brelse(obh); + *success = -EFSBADCRC; + pr_err("JBD2: Invalid checksum recovering data block %llu in journal block %lu\n", + blocknr, io_block); + *block_error = 1; + goto skip_write; + } + + /* Find a buffer for the new data being restored */ + nbh = __getblk(journal->j_fs_dev, blocknr, + journal->j_blocksize); + if (nbh == NULL) { + pr_err("JBD2: Out of memory during recovery.\n"); + brelse(obh); + return -ENOMEM; + } + + lock_buffer(nbh); + memcpy(nbh->b_data, obh->b_data, journal->j_blocksize); + if (flags & JBD2_FLAG_ESCAPE) { + *((__be32 *)nbh->b_data) = + cpu_to_be32(JBD2_MAGIC_NUMBER); + } + + BUFFER_TRACE(nbh, "marking dirty"); + set_buffer_uptodate(nbh); + mark_buffer_dirty(nbh); + BUFFER_TRACE(nbh, "marking uptodate"); + ++info->nr_replays; + unlock_buffer(nbh); + brelse(obh); + brelse(nbh); + } + +skip_write: + tagp += tag_bytes; + if (!(flags & JBD2_FLAG_SAME_UUID)) + tagp += 16; + + if (flags & JBD2_FLAG_LAST_TAG) + break; + } + + return 0; +} + static int do_one_pass(journal_t *journal, struct recovery_info *info, enum passtype pass) { @@ -496,9 +595,7 @@ static int do_one_pass(journal_t *journal, struct buffer_head *bh = NULL; unsigned int sequence; int blocktype; - int tag_bytes = journal_tag_bytes(journal); __u32 crc32_sum = ~0; /* Transactional Checksums */ - int descr_csum_size = 0; int block_error = 0; bool need_check_commit_time = false; __u64 last_trans_commit_time = 0, commit_time; @@ -528,12 +625,6 @@ static int do_one_pass(journal_t *journal, */ while (1) { - int flags; - char * tagp; - journal_block_tag_t tag; - struct buffer_head * obh; - struct buffer_head * nbh; - cond_resched(); /* If we already know where to stop the log traversal, @@ -587,11 +678,7 @@ static int do_one_pass(journal_t *journal, switch(blocktype) { case JBD2_DESCRIPTOR_BLOCK: /* Verify checksum first */ - if (jbd2_journal_has_csum_v2or3(journal)) - descr_csum_size = - sizeof(struct jbd2_journal_block_tail); - if (descr_csum_size > 0 && - !jbd2_descriptor_block_csum_verify(journal, + if (!jbd2_descriptor_block_csum_verify(journal, bh->b_data)) { /* * PASS_SCAN can see stale blocks due to lazy @@ -628,102 +715,16 @@ static int do_one_pass(journal_t *journal, continue; } - /* A descriptor block: we can now write all of - * the data blocks. Yay, useful work is finally - * getting done here! */ - - tagp = &bh->b_data[sizeof(journal_header_t)]; - while ((tagp - bh->b_data + tag_bytes) - <= journal->j_blocksize - descr_csum_size) { - unsigned long io_block; - - memcpy(&tag, tagp, sizeof(tag)); - flags = be16_to_cpu(tag.t_flags); - - io_block = next_log_block++; - wrap(journal, next_log_block); - err = jread(&obh, journal, io_block); - if (err) { - /* Recover what we can, but - * report failure at the end. */ - success = err; - printk(KERN_ERR - "JBD2: IO error %d recovering " - "block %lu in log\n", - err, io_block); - } else { - unsigned long long blocknr; - - J_ASSERT(obh != NULL); - blocknr = read_tag_block(journal, - &tag); - - /* If the block has been - * revoked, then we're all done - * here. */ - if (jbd2_journal_test_revoke - (journal, blocknr, - next_commit_ID)) { - brelse(obh); - ++info->nr_revoke_hits; - goto skip_write; - } - - /* Look for block corruption */ - if (!jbd2_block_tag_csum_verify( - journal, &tag, (journal_block_tag3_t *)tagp, - obh->b_data, be32_to_cpu(tmp->h_sequence))) { - brelse(obh); - success = -EFSBADCRC; - printk(KERN_ERR "JBD2: Invalid " - "checksum recovering " - "data block %llu in " - "journal block %lu\n", - blocknr, io_block); - block_error = 1; - goto skip_write; - } - - /* Find a buffer for the new - * data being restored */ - nbh = __getblk(journal->j_fs_dev, - blocknr, - journal->j_blocksize); - if (nbh == NULL) { - printk(KERN_ERR - "JBD2: Out of memory " - "during recovery.\n"); - err = -ENOMEM; - brelse(obh); - goto failed; - } - - lock_buffer(nbh); - memcpy(nbh->b_data, obh->b_data, - journal->j_blocksize); - if (flags & JBD2_FLAG_ESCAPE) { - *((__be32 *)nbh->b_data) = - cpu_to_be32(JBD2_MAGIC_NUMBER); - } - - BUFFER_TRACE(nbh, "marking dirty"); - set_buffer_uptodate(nbh); - mark_buffer_dirty(nbh); - BUFFER_TRACE(nbh, "marking uptodate"); - ++info->nr_replays; - unlock_buffer(nbh); - brelse(obh); - brelse(nbh); - } - - skip_write: - tagp += tag_bytes; - if (!(flags & JBD2_FLAG_SAME_UUID)) - tagp += 16; - - if (flags & JBD2_FLAG_LAST_TAG) - break; - } + /* + * A descriptor block: we can now write all of the + * data blocks. Yay, useful work is finally getting + * done here! + */ + err = jbd2_do_replay(journal, info, bh, &next_log_block, + next_commit_ID, &success, + &block_error); + if (err) + goto failed; continue; From patchwork Wed Sep 18 11:36:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 1986766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=150.107.74.76; helo=mail.ozlabs.org; envelope-from=srs0=ogkc=qq=vger.kernel.org=linux-ext4+bounces-4206-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X7xFG4jrhz1y1m for ; Wed, 18 Sep 2024 21:26:58 +1000 (AEST) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4X7xFG3nycz4xWm for ; Wed, 18 Sep 2024 21:26:58 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4X7xFG3lLNz4xZh; Wed, 18 Sep 2024 21:26:58 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip=147.75.80.249 arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658818; cv=pass; b=XFu+5QrlXVNgq7JwMhuG3B8/uMq4H3S2U8kSZ65QkzXtHSTW0TjirHDq2wtIoEDLUpUPXBaxAm4hLmtPRtctgKHyKq/G3WHj2R7VJLZAdIux+0fDKBltQJPKMd2eStPveTXDDdcVG3SOOvk7W7v5Zi5EGI9FSlkTvwXe4dKmQ0oN3nzGvBEYInDHfDLgaJXUBY5J9B35ZWlZCFikdhFsz5TGx9/0erEWo9E3ltrdDGnsy1dfxN6OphYw6PMf4U5FNWAG3YDN1DX2/1o6WHxsL2ocPWXkhFVD1JDG76L0xC6mVPk1GkeFQyV7aFt4mfYcgAy8mvnz/wO77KBIBPvmpw== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1726658818; c=relaxed/relaxed; bh=oZYB5lRec2vcgP21rnzWW/E4epThq5K0wbg+vTwSC00=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P1h/44xs2eE4u9Ay0h81wkmh1YJy56j7hoBBIl25T4y046pF2g2hqXRzYIUxa0uaDGXsu9VyovMQicKcqvrlVoYYbvwYn5BHXDdFuWgOcozqbbI1kcNwuV1B2bldffsU/3jLwVaMiuIMY0TMEoFPW26jZgSqTA5sem532S+5ydnhlfvfa91Sv9BaXXUkSaKZGsJLPpH6zgOZLHtMZZLZ9D3uttqk1dmqqpSvjOJ1e947cqWeyGGwPszSxlNRfOtWJuNFyOg2gqySoyqyZbeSig2kedPiZxV0fZLP+ooHMsLCg0VfFb48Vp1uwwwDh/o1FwhO3a5nQUqWsppPv+6I6w== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4206-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-ext4+bounces-4206-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4X7xFF6pJxz4xWm for ; Wed, 18 Sep 2024 21:26:57 +1000 (AEST) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 98E5A1F26DFD for ; Wed, 18 Sep 2024 11:26:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B64CF188A31; Wed, 18 Sep 2024 11:26:44 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 9050017AE0C for ; Wed, 18 Sep 2024 11:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; cv=none; b=nn8IwCa/MParAINXOaj+bqJzyCLqyyAh5mF2xc8yU49nigLjPay/A3gkafvG3wzDO+fOXYqr7qRybLHNwlgb3ua8c5wIebhwcMaugj3PNbNfR8HLfHSQmFOiZoqQBzyKRDdDkUB1EzRSUQgVZ/NOYuEkkwu+651ABJiVcgh5gDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726658804; c=relaxed/simple; bh=iejLb8zfehXtxpvrT+rrvSACP2cbpUxcD7JhHw1ftnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FsbrkUheQTpbxoEJEZs2lhUJLmceQA5M8CblKmUGnCcgLL2zKLhqDLzzydn/tMigLo0JU+Xikfjv+QT/QK9oSGJaZIPQ9VaihDq2xmERGAhsH9GXD2WelUQgSuwgU8gHQpSbahqm/tTo5qRFkXpG0ddAO0YXNtBcQyJCCTUOsl4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4X7xDb5XCgz4f3jYK for ; Wed, 18 Sep 2024 19:26:23 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id 95A6C1A0359 for ; Wed, 18 Sep 2024 19:26:39 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgD3LMnsuOpmuiKqBg--.12650S9; Wed, 18 Sep 2024 19:26:39 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: jack@suse.cz, zhangxiaoxu5@huawei.com Subject: [PATCH 5/5] jbd2: remove useless 'block_error' variable Date: Wed, 18 Sep 2024 19:36:04 +0800 Message-Id: <20240918113604.660640-6-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240918113604.660640-1-yebin@huaweicloud.com> References: <20240918113604.660640-1-yebin@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: gCh0CgD3LMnsuOpmuiKqBg--.12650S9 X-Coremail-Antispam: 1UD129KBjvJXoW7urWDJw1DAF1kGFWxKw1kuFg_yoW8WF4Dpr yUCwsrKryDC340qF9rJFWDXFyj93WjyFy8GF1qk3ZayFW5Gry2gr1Fgw13tFyUKF97uayU tFW8Z34rKw1Ik3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPvb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64 vIr41l4c8EcI0Ec7CjxVAaw2AFwI0_JF0_Jw1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2Iq xVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r 126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY 6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67 AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuY vjxUwuWlUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ From: Ye Bin The judgement 'if (block_error && success == 0)' is never valid. Just remove useless 'block_error' variable. Signed-off-by: Ye Bin --- fs/jbd2/recovery.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 05ea449b95c4..0bcbb58d634b 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -490,7 +490,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal, struct buffer_head *bh, unsigned long *next_log_block, unsigned int next_commit_ID, - int *success, int *block_error) + int *success) { char *tagp; int flags; @@ -542,7 +542,6 @@ static __always_inline int jbd2_do_replay(journal_t *journal, *success = -EFSBADCRC; pr_err("JBD2: Invalid checksum recovering data block %llu in journal block %lu\n", blocknr, io_block); - *block_error = 1; goto skip_write; } @@ -596,7 +595,6 @@ static int do_one_pass(journal_t *journal, unsigned int sequence; int blocktype; __u32 crc32_sum = ~0; /* Transactional Checksums */ - int block_error = 0; bool need_check_commit_time = false; __u64 last_trans_commit_time = 0, commit_time; @@ -721,8 +719,7 @@ static int do_one_pass(journal_t *journal, * done here! */ err = jbd2_do_replay(journal, info, bh, &next_log_block, - next_commit_ID, &success, - &block_error); + next_commit_ID, &success); if (err) goto failed; @@ -913,8 +910,6 @@ static int do_one_pass(journal_t *journal, success = err; } - if (block_error && success == 0) - success = -EIO; return success; failed: