From patchwork Sun Dec 21 21:20:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1022 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352061; bh=ye/7lYmq0WfbumjXRxozs+lHI5cIwS01pAQEV6uHAjM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LMt7pUe+XT5dNobhEn6pbVJCPvUktGQrEA6+OG7OC0/HBG1lMif3/aqRK06YNbvB3 cNJnQ0sxYZuHn10adWQZDVMDJoos2aG9XCvftIkyqfPtBzVLytrDfsiXojtn3z9jvI sWoE3rjH2Vu7e4BdLAzh2JY9j55uciex0M1XDgpKd0GB9ZBFDbm7xTSV2X2U4LzKCF t/sq2biCOi7Wbi9nQ0RkTZHOew7QHD3Nq8zOc0j2lf4svhwLlpnzsaTIJzf8QP1dxx jsXyMtEvKtfYpzGIp6qTjJplIx1ueOlwuMbPF3a5vkO900Z5bWhJtCOXlHMcW3iUN+ D7FzpKPrHBiuQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1AB4164CDE for ; Sun, 21 Dec 2025 14:21:01 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qzQBKvyYyvui for ; Sun, 21 Dec 2025 14:21:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352060; bh=ye/7lYmq0WfbumjXRxozs+lHI5cIwS01pAQEV6uHAjM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XN/8foJD3bt3nDI/g69O8GqC6Y13EFup296Mg/d8x9ieith+bm+AbWqFvRvcjfQMc qfZu8YZeqYVkIVCBMc5qug47dZRm0W3JYZlMwMShNEIPHFRIkxanyRM7HFzXzXmltQ 9MWttkW704YQmM3OwnpkL+t1BgrfEq/buPFjcSTqv3DcglKMZIZ0N7ZqHcfmDSoeWF 9eO0k/NhSw+AHrcBgAOqU7/hIJfC5uX+lYQGatUp9DShr36V/76ZTBhMPrXCoLh/dd VZsLs8M/lvpwmrWnwr4SjuN3WsJLuGoISkN/s/MS810DV/ODIk9PP5E5TSro905adl 2DA8B+gXEbxlg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 819D764D2C for ; Sun, 21 Dec 2025 14:21:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352057; bh=JjnWH0XTgyTx553Z570tVrECiViyaCm67enS8OO8IQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CT2s/xjlKvqpKt+IEfqYupPs/k3tJOHoLewP0KTmQNDt2MdDfSRrGU3yLOesPrMUJ zJ1o1QT0n99cnj/dab0EL+m/NsozAxk8bo1MIHyDaGkX7i+x2flXisjpGvHJdoBKK2 MithsAplSL/lPVZ26CCvRb3FoKLbR+pw339CUqFCepgr52yV2cdwZqJ5RY9jEEgvqK mrJiuMzzgpr1UJe2TC8j74Zbg989UQ7rYrPuS5KhDryOhUjWccYFcUWWGS+8cm/TNT AuXiYO5Q78APLCODyJDxqm7u7DvHv/2QXA3553Ji+LJKaB3g7BEDgHgftNvjd7D/mO AoJMqttswIUCw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 467C75E415; Sun, 21 Dec 2025 14:20:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ERYIi9AznIEC; Sun, 21 Dec 2025 14:20:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352057; bh=mLpEjWArIuaWNOohcJPMeWyS/iaKSbX8GEySIPWZqfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CClbf5U1TVABewL4RAt01yyfO6TpVNoQyq6nJz4jtcWKg8PwJxInQ2s5+8Y14HOUw bZv3oIWQM4pSwtBD77KVEz9q5kvHwAEeCo9veV8p+qALPz0Hw6rpNCT1+CrV9KFovI nEfUJHp21tziSoB9/u6whrYs78WoRprNwjvhGw5wc7DQms46doYvc2so/r9oFzQutY fEQKf264hq5riSu55nWJrlnm0XApku+k87Rg6xNhgmSBdhS+RD4AvI/NTqQgECxP/u qpUulmZLQXuR/c/AcWdN1mKQsSqTzfX28k8M10tryc+XKUCDPOtyxjRx/67IKwZppW I/b36qwhu4j/g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B1DCE64CDE; Sun, 21 Dec 2025 14:20:56 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 21 Dec 2025 14:20:16 -0700 Message-ID: <20251221212028.857348-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251221212028.857348-1-sjg@u-boot.org> References: <20251221212028.857348-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TIKNZ5PGNVICUHSDBYSDQX3TIHBQOZJG X-Message-ID-Hash: TIKNZ5PGNVICUHSDBYSDQX3TIHBQOZJG X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/15] jbd2: Add recovery.c to the build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add recovery.c to the jbd2 Makefile and update includes to use the ext4l compatibility layer. Add stubs for revoke.c functions that recovery.c depends on and tweak a few so things build. Fix sync_blockdev to return int instead of void. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 4 +++- fs/ext4l/stub.c | 24 +++++++++++++++++++++--- fs/jbd2/Makefile | 2 +- fs/jbd2/recovery.c | 13 ++----------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 0d24940e74e..25756d29cf6 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2162,7 +2162,7 @@ int percpu_init_rwsem(struct percpu_rw_semaphore *sem); void percpu_free_rwsem(struct percpu_rw_semaphore *sem); /* Block device sync - declarations for stub.c */ -void sync_blockdev(struct block_device *bdev); +int sync_blockdev(struct block_device *bdev); void invalidate_bdev(struct block_device *bdev); /* Kobject - declarations for stub.c */ @@ -2867,6 +2867,8 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* Block device operations for journal.c */ #define bh_read(bh, flags) ({ (void)(bh); (void)(flags); 0; }) +#define bh_read_nowait(bh, flags) do { (void)(bh); (void)(flags); } while (0) +#define bh_readahead_batch(n, bhs, f) do { (void)(n); (void)(bhs); (void)(f); } while (0) #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) #define blkdev_issue_discard(bdev, s, n, gfp) \ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index c9d1d3f99eb..b1b5bb93cd8 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -576,8 +576,9 @@ void percpu_free_rwsem(struct percpu_rw_semaphore *sem) } /* Block device ops */ -void sync_blockdev(struct block_device *bdev) +int sync_blockdev(struct block_device *bdev) { + return 0; } void invalidate_bdev(struct block_device *bdev) @@ -823,16 +824,33 @@ int jbd2_journal_destroy_revoke(void *journal) return 0; } -int jbd2_journal_recover(void *journal) +/* jbd2_journal_recover is now in recovery.c */ +/* jbd2_journal_skip_recovery is now in recovery.c */ + +/* JBD2 stubs for recovery.c - functions from revoke.c */ +int jbd2_journal_init_revoke_table(void *journal) +{ + return 0; +} + +int jbd2_journal_test_revoke(void *journal, unsigned long blocknr, unsigned int tid) { return 0; } -int jbd2_journal_skip_recovery(void *journal) +int jbd2_journal_set_revoke(void *journal, unsigned long blocknr, unsigned int tid) { return 0; } +void jbd2_journal_clear_revoke(void *journal) +{ +} + +void jbd2_journal_destroy_revoke_table(void *table) +{ +} + void jbd2_buffer_frozen_trigger(void *jh, void *mapped_data, void *triggers) { } diff --git a/fs/jbd2/Makefile b/fs/jbd2/Makefile index f0f84bfb707..bcc1f47177b 100644 --- a/fs/jbd2/Makefile +++ b/fs/jbd2/Makefile @@ -3,4 +3,4 @@ # Makefile for JBD2 journaling layer (used by ext4l) # -obj-y := checkpoint.o commit.o journal.o +obj-y := checkpoint.o commit.o journal.o recovery.o diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index cac8c2cd4a9..ff2266c7316 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -10,17 +10,8 @@ * part of the ext2fs journaling system. */ -#ifndef __KERNEL__ -#include "jfs_user.h" -#else -#include -#include +#include "../ext4l/ext4_uboot.h" #include -#include -#include -#include -#include -#endif /* * Maintain information about the progress of the recovery job, so that @@ -628,7 +619,7 @@ static int do_one_pass(journal_t *journal, * filesystems. */ hash_size = min(roundup_pow_of_two(info->nr_revokes / 8), - 1U << 20); + 1UL << 20); journal->j_revoke = jbd2_journal_init_revoke_table(hash_size); if (!journal->j_revoke) {