From patchwork Mon Dec 22 11:56:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1031 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=1766404621; bh=8FSmBAzbbPRiC9bPd1m92bE0GgIIUruExVE2joAfUNY=; 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=Gxb2Xk+/vIdXUOfAiZJpcDNIaX0hsUB6V5IrmqMmr7hms8XTjLyKnunfqLSc7yiQ+ o1fqGH2ifd69e4oskpzXcD5O6JMkjraE/NvtzW1BcqgrtpTejOds8zbXIV/OsfnuRH y05xJGkLnMEzGkyp4SEQZUdKZq4N46Rg3J2laUpg4MHwlKUwxcjM3U/rjbQ79zJmaw TTu/XHHlGdAPHdX2SJzVp10Pjm34nT+DUycX5oQuPzBs/JUC23P47iOX/xZ+k48WKx LGh/lzhTlIE0RXswAGn6g9PTnyiIjxEoh8+/N5kQa4aLHXzuiiuTybKEgLLGiSRSck HuQRxcdIiwngg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DEF1664D60 for ; Mon, 22 Dec 2025 04:57: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 tQ0UwUrHeGkm for ; Mon, 22 Dec 2025 04:57:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404621; bh=8FSmBAzbbPRiC9bPd1m92bE0GgIIUruExVE2joAfUNY=; 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=Gxb2Xk+/vIdXUOfAiZJpcDNIaX0hsUB6V5IrmqMmr7hms8XTjLyKnunfqLSc7yiQ+ o1fqGH2ifd69e4oskpzXcD5O6JMkjraE/NvtzW1BcqgrtpTejOds8zbXIV/OsfnuRH y05xJGkLnMEzGkyp4SEQZUdKZq4N46Rg3J2laUpg4MHwlKUwxcjM3U/rjbQ79zJmaw TTu/XHHlGdAPHdX2SJzVp10Pjm34nT+DUycX5oQuPzBs/JUC23P47iOX/xZ+k48WKx LGh/lzhTlIE0RXswAGn6g9PTnyiIjxEoh8+/N5kQa4aLHXzuiiuTybKEgLLGiSRSck HuQRxcdIiwngg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CDFE364D59 for ; Mon, 22 Dec 2025 04:57:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404620; bh=/xuYJZpqGHaKIU3whqkkOBjuECsQwkNqzdhtnjsB9Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7XoOYHOPUY8+nyA4k3bh76GSjtQn7fvoDXRGVOQqe8YdvGYW2OA1WkGnCTzZaUIS 6wmJyQDuMm3KJt1bgcgekUwlEzrNv5DX7YKEEdvhuWNjmr65WwM92sRH1FxHRMOH/L 62+hDdgE3RRfwW5Oq2WZaGOnrl2XegOsnNReS0xXDTX/mRPIFxZfRRV3U8rGuTfe9f vhxkdkCrZouDA2vWODYvBJS5Pyq9OOi+IuTFFKU6HGT5o3YmTP+L5Ss6eqBiNAfL8V zInVrvlnXFOv0ag75R9057GqKWD6uxdRA73gpdv4TY+YLyGijFjL+wqQbWfGXbHpGX mKszSWYbbsFGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D513164D5E; Mon, 22 Dec 2025 04:57:00 -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 f4HLBUk8KNUv; Mon, 22 Dec 2025 04:57:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404620; bh=RSNStL2Id/1nz+kSnJpssgT7b7MECqBZEtm/zx46JTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JiQYmBJWWKlLe1Q2CGbyQW24Rd2NAfS2rH5VNj2Wbh78eTOU+vKCuIe8nC6oDfhAT ak4taNdxzP4f4g4cIRhP6UG+g1E3TmwVoCHBuFTPdP0b2vpeBXSq2sh2gIVFXmJqTw ha4y1mnwjdfbnyTBuDHxaEmkd2YmPauYlg1eU6Jf25lVrrXGUn7fOlyCwtknm5JFeo chuUn+xg4uZKonUfjycf+BGDJLFegj4Hnv3pi+4KCvS6YBxWbrDylIPl4XlmaDQyai dar3CPoCWhlV5Uro3Kv5SpEAzlEyTajspNCjW9uBqXPb6L6k8E1KYQ47d6ILt3QyG4 f/LYl96fF5tkg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0013264D59; Mon, 22 Dec 2025 04:56:59 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:05 -0700 Message-ID: <20251222115639.700578-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: S3N5FSZJV6VIQ36CUSWHTSND6HFXNNA7 X-Message-ID-Hash: S3N5FSZJV6VIQ36CUSWHTSND6HFXNNA7 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 01/26] fs: ext4l: Add minimal probe support 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 a minimal ext4l probe function that: - Reads the superblock from the block device - Validates the ext4 magic number - Returns proper error codes (-EINVAL, -ENOMEM, -EIO) Create include/ext4l.h header with function declarations and documentation. Update fs_legacy.c to use the header. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/interface.c | 57 ++++++++++++++++++++++++++++++++++++++++++-- fs/fs_legacy.c | 5 ++-- include/ext4l.h | 31 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 include/ext4l.h diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 455e101b65f..eb625e0b1a5 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -2,19 +2,72 @@ /* * U-Boot interface for ext4l filesystem (Linux port) * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * * This provides the minimal interface between U-Boot and the ext4l driver. - * Currently just stubs - the filesystem doesn't work yet. */ #include #include +#include +#include +#include +#include + +#include "ext4_uboot.h" +#include "ext4.h" + +/* Global state */ +static struct blk_desc *ext4l_dev_desc; +static struct disk_partition ext4l_part; int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { - return -1; + loff_t part_offset; + __le16 *magic; + u8 *buf; + int ret; + + if (!fs_dev_desc) + return -EINVAL; + + buf = malloc(BLOCK_SIZE + 512); + if (!buf) + return -ENOMEM; + + /* Calculate partition offset in bytes */ + part_offset = fs_partition ? (loff_t)fs_partition->start * fs_dev_desc->blksz : 0; + + /* Read sectors containing the superblock */ + if (blk_dread(fs_dev_desc, + (part_offset + BLOCK_SIZE) / fs_dev_desc->blksz, + 2, buf) != 2) { + ret = -EIO; + goto out; + } + + /* Check magic number within superblock */ + magic = (__le16 *)(buf + (BLOCK_SIZE % fs_dev_desc->blksz) + + offsetof(struct ext4_super_block, s_magic)); + if (le16_to_cpu(*magic) != EXT4_SUPER_MAGIC) { + ret = -EINVAL; + goto out; + } + + /* Save device info for later operations */ + ext4l_dev_desc = fs_dev_desc; + if (fs_partition) + memcpy(&ext4l_part, fs_partition, sizeof(ext4l_part)); + + ret = 0; +out: + free(buf); + return ret; } void ext4l_close(void) { + ext4l_dev_desc = NULL; } diff --git a/fs/fs_legacy.c b/fs/fs_legacy.c index 405aa8aba54..5b96e1465d8 100644 --- a/fs/fs_legacy.c +++ b/fs/fs_legacy.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -262,8 +263,8 @@ static struct fstype_info fstypes[] = { .fstype = FS_TYPE_EXT, .name = "ext4", .null_dev_desc_ok = false, - .probe = fs_probe_unsupported, - .close = fs_close_unsupported, + .probe = ext4l_probe, + .close = ext4l_close, .ls = fs_ls_unsupported, .exists = fs_exists_unsupported, .size = fs_size_unsupported, diff --git a/include/ext4l.h b/include/ext4l.h new file mode 100644 index 00000000000..5a300fd6559 --- /dev/null +++ b/include/ext4l.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * ext4l filesystem interface + * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + */ + +#ifndef __EXT4L_H__ +#define __EXT4L_H__ + +struct blk_desc; +struct disk_partition; + +/** + * ext4l_probe() - Probe a block device for an ext4 filesystem + * + * @fs_dev_desc: Block device descriptor + * @fs_partition: Partition information + * Return: 0 on success, -EINVAL if no device or invalid magic, + * -ENOMEM on allocation failure, -EIO on read error + */ +int ext4l_probe(struct blk_desc *fs_dev_desc, + struct disk_partition *fs_partition); + +/** + * ext4l_close() - Close the ext4 filesystem + */ +void ext4l_close(void); + +#endif /* __EXT4L_H__ */ From patchwork Mon Dec 22 11:56:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1032 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=1766404627; bh=OLyoAH9IljX1FqYXRMeGmJskNWnnOTRhCcDfFshkTEg=; 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=UFdhzMiTaJ0hkPr59hnNTxCCj5VLnEFnSimU+vpgcETAfkgkKK3cD1OJkOdO1Brsh 5sw22ZIawhsFvDXJRRtwN+H40Amkh44xcuz2CA04vS+k4hW4M13wHKpn7gToIN4VXG mRu+u6bgc1jq8FWQeOUcTVm7Y8sh96B26OZwLfVaiTOWtBnJxneIRHC9H/RrP+pWlu TiVAR7h01T+fAFSL/YzPN19phTaDovhYsbY5xLC6nV2o6r3IvCUepk7RQL1Y2ZHEPE dSkxrDYhp7rsWZKvYuKDU7/vgo0kfMO5rg559NXvygAQuB5hxhLkLawyrLyxjuDxH3 F6Uepa+gliAOw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 55CD464D3E for ; Mon, 22 Dec 2025 04:57:07 -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 GuvDO1_cO8k7 for ; Mon, 22 Dec 2025 04:57:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404627; bh=OLyoAH9IljX1FqYXRMeGmJskNWnnOTRhCcDfFshkTEg=; 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=UFdhzMiTaJ0hkPr59hnNTxCCj5VLnEFnSimU+vpgcETAfkgkKK3cD1OJkOdO1Brsh 5sw22ZIawhsFvDXJRRtwN+H40Amkh44xcuz2CA04vS+k4hW4M13wHKpn7gToIN4VXG mRu+u6bgc1jq8FWQeOUcTVm7Y8sh96B26OZwLfVaiTOWtBnJxneIRHC9H/RrP+pWlu TiVAR7h01T+fAFSL/YzPN19phTaDovhYsbY5xLC6nV2o6r3IvCUepk7RQL1Y2ZHEPE dSkxrDYhp7rsWZKvYuKDU7/vgo0kfMO5rg559NXvygAQuB5hxhLkLawyrLyxjuDxH3 F6Uepa+gliAOw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 443B864D59 for ; Mon, 22 Dec 2025 04:57:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404625; bh=UW07Wny9in71ex8xLQGUzi3rVnKt8D8uaoavruJiK74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aSufuMmq4KFGlLHp6uDcPKDMQdJMQRIDRpCxMDmByajJ4cy7GbJJFGub/QeDmp8/R DhD+Y/7ZRnXCvyZBPWf/7Ux4pVFvAeqhFXmIOwtTHzrJ6a5gtP0JXLHF/xQjmHmkOC T+528hlV4dgfWAWmDv79ubPGniRxBb8SkUrnhh4WD7h7nY/I8OhR6NUYg2KtGOXpLc +uQkOwrnSkGAHY1sWkmbOG0t3RHW+p+5qx0mBIFzAVznjU9p+MK0ja1G2jOHnYETqO 583HoD1VEA5IVVbNLJ7B9nPmxqxkwUbnCUeK+dtM/QYJO6IBhYlfkyQf86PsvS7YGA Uoh6qJu7KDR4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2A39864D3E; Mon, 22 Dec 2025 04:57:05 -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 wtM1G-EvjuSd; Mon, 22 Dec 2025 04:57:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404621; bh=4kqFfLi4fUKzedG0CJFcKOE1d3Y0UTumy0fIG29AW18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OR/7Jxv5/xEwh0w2w6hC6wEU8V/6NojWkZk+fLRzlZUKMTQTdiJityGBC7qCVzY3B urZ+XGWCNTtxma49QDdRCq8WZImnQWQ4AOXrq63pkHHY3gzTGp+APFkFheF9Ym88d/ 6wyGHZkfmPjNmeb3XxuVgqLoQQKES1SUjIzBercXJG00Xghd6aaT+OvC8J2Y3+T5iW MD0HJDV/fY94JBguzJ04fEU+6CFNm8wE5Ore2fKk2oC+VcKN4ZbzlzuKn9tAsEj1vk 1XihuyjlVgItxWlv6xLwI0O8NgTfnDGd6hgAWS3IuXOP+gFmt1EmY0YaZsgqXaoctz eTkBrfrDOENdg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CD08C64C31; Mon, 22 Dec 2025 04:57:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:06 -0700 Message-ID: <20251222115639.700578-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HXQXS2YDK43WEDN52TGEK5MNWFU7INYK X-Message-ID-Hash: HXQXS2YDK43WEDN52TGEK5MNWFU7INYK 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/26] linux: Move common types to types.h 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 Move ktime_t, sector_t, blkcnt_t, atomic_t, and atomic64_t to linux/types.h to match Linux kernel header organisation. Remove the duplicate definitions from linux/compat.h and fs/ext4l/ext4_uboot.h since they are now in the canonical location. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 24 ++++++++++-------------- include/linux/compat.h | 16 +--------------- include/linux/types.h | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1ad9ad7f47a..d0e60c02d77 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2,6 +2,9 @@ /* * U-Boot compatibility header for ext4l filesystem * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * * This provides minimal definitions to allow Linux ext4 code to compile * in U-Boot. */ @@ -52,8 +55,11 @@ struct timespec64 { long tv_nsec; }; -/* ktime_t - kernel time type */ -typedef s64 ktime_t; +/* + * ktime_t, sector_t are in linux/types.h + * atomic_t, atomic64_t are in asm-generic/atomic.h + */ +#include /* Jiffy constants */ #define MAX_JIFFY_OFFSET ((~0UL >> 1) - 1) @@ -61,16 +67,7 @@ typedef s64 ktime_t; /* Block device name size */ #define BDEVNAME_SIZE 32 -/* Atomic types - stubs for single-threaded U-Boot */ -typedef struct { int counter; } atomic_t; -typedef struct { long counter; } atomic64_t; - -#define atomic_read(v) ((v)->counter) -#define atomic_set(v, i) ((v)->counter = (i)) -#define atomic_inc(v) ((v)->counter++) -#define atomic_dec(v) ((v)->counter--) -#define atomic64_read(v) ((v)->counter) -#define atomic64_set(v, i) ((v)->counter = (i)) +/* Extra atomic operations not in asm-generic/atomic.h */ #define atomic_dec_if_positive(v) (--(v)->counter) /* SMP stubs - U-Boot is single-threaded */ @@ -510,8 +507,7 @@ struct sb_writers { /* mapping_large_folio_support stub */ #define mapping_large_folio_support(m) (0) -/* sector_t - needed before buffer_head.h */ -typedef unsigned long sector_t; +/* sector_t is now in linux/types.h */ /* Buffer head - from linux/buffer_head.h */ #include diff --git a/include/linux/compat.h b/include/linux/compat.h index 26f0ef3f101..df67b775b5b 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -110,21 +110,7 @@ static inline void led_trigger_event(struct led_trigger *trigger, /* uapi/linux/limits.h */ #define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ -/** - * The type used for indexing onto a disc or disc partition. - * - * Linux always considers sectors to be 512 bytes long independently - * of the devices real block size. - * - * blkcnt_t is the type of the inode's block count. - */ -#ifdef CONFIG_LBDAF -typedef u64 sector_t; -typedef u64 blkcnt_t; -#else -typedef unsigned long sector_t; -typedef unsigned long blkcnt_t; -#endif +/* sector_t and blkcnt_t are now defined in linux/types.h */ /* character device */ diff --git a/include/linux/types.h b/include/linux/types.h index 9df930afd13..957284d37ab 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -151,6 +151,20 @@ typedef __u32 __bitwise __wsum; typedef unsigned __bitwise__ gfp_t; +/* Nanosecond scalar representation for kernel time values */ +typedef s64 ktime_t; + +/** + * The type used for indexing onto a disc or disc partition. + * + * Linux always considers sectors to be 512 bytes long independently + * of the devices real block size. + * + * blkcnt_t is the type of the inode's block count. + */ +typedef u64 sector_t; +typedef u64 blkcnt_t; + #ifdef __linux__ struct ustat { __kernel_daddr_t f_tfree; From patchwork Mon Dec 22 11:56:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1033 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=1766404627; bh=CA1kgn+3ODZmnzNUeTg4SpYSbsWDGRSkO+Hg7kHQ/uw=; 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=rm0IkBfQvSRwWPyFaEaf/yLcgqjUT56JLV1Skcsa/8GBJTkHarr/ljico2nwgokSp ZXABLuecCniZ2+FY4r2HnV+W043jnz/Y/zr6qyVl+5lXSJab8fzZwkAqp/CcuYZ2sv Z+tXSU9NJ9Sdv25jo6MRzLuX/WapU4x/EbjjjNjUzVH3HvKnuLPN7cJa+W9+9VjX18 gbNxWRT9Eg4IqQGPx3VQ07j6+C1RzWCI5muqXFhkcT8sr3oypwyuTfzV9CjmnSa8lb NZhmNpPXzuvwr4bH/OBvgCAR9NTGIGWDcGITqF1VqxMlA9gMyXW1CyVK2s3Tvf63uq t/8NV81292w6g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E73D064D62 for ; Mon, 22 Dec 2025 04:57:07 -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 KFM1bYuxe9xQ for ; Mon, 22 Dec 2025 04:57:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404627; bh=CA1kgn+3ODZmnzNUeTg4SpYSbsWDGRSkO+Hg7kHQ/uw=; 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=rm0IkBfQvSRwWPyFaEaf/yLcgqjUT56JLV1Skcsa/8GBJTkHarr/ljico2nwgokSp ZXABLuecCniZ2+FY4r2HnV+W043jnz/Y/zr6qyVl+5lXSJab8fzZwkAqp/CcuYZ2sv Z+tXSU9NJ9Sdv25jo6MRzLuX/WapU4x/EbjjjNjUzVH3HvKnuLPN7cJa+W9+9VjX18 gbNxWRT9Eg4IqQGPx3VQ07j6+C1RzWCI5muqXFhkcT8sr3oypwyuTfzV9CjmnSa8lb NZhmNpPXzuvwr4bH/OBvgCAR9NTGIGWDcGITqF1VqxMlA9gMyXW1CyVK2s3Tvf63uq t/8NV81292w6g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF5ED64D5E for ; Mon, 22 Dec 2025 04:57:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404625; bh=2MNJcQu7GO3oi1jxJjls/YVXftWBoNjIb3M39K6V70I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdxSUcYTcWpXfgcM1QaGYVqIamQTRGoShXA4I9pz+Mn+IpT0iVQoImoMwMbDQteRc KPW/RwwCgIRu0IMd67wEm1zVhqnhb1awVD+NNbVeqdkXdFfHsxOrQGSz+6G4jKfV1A E6VEkB/qmatSxTfSyQHU8vPhSj82JB9NnIcnMN950rJO5glKAX02Mw8kF7a8i7w5iI KoVNRoOLhI9qHG87VwDxj7vXKrHSvtJggwRb1kwL0BRULqlb4XeWXncOOf/+yLLEh8 1Ypc8czPZwH5VD6eYpOGJ9uzaWilor7TkugeHSYUHsbwKa2jpvnOtx+pb2PXI/ayGk Rsibr21XS+hcg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E314164D3E; Mon, 22 Dec 2025 04:57:05 -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 ikopQiYqrbXS; Mon, 22 Dec 2025 04:57:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404625; bh=5JTQGw5c5gDPLG+x9/0T6hS/ZTXf1OwSV3Dggm2eF8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lzS/jtZI7nJP7auXkRAQfcgpCsTJP+U0NjomRJ9mbfTv3vfAaqCY/Jtw/svl7Kk0K H87ww9vjexMmmP/CJRZADgxG7HKskIPIGLzXprZl0HwN3eay5B8ijrGxj4flg5qmtF DzsG4BPwN/qZnIqXmXnJYqhko47uPk/B691lvRoBS+Jxrn++TyVZJ/crh2DmuhfnIf wczDRIz7E1anatx6tdqcrpKER21jrg02XFWAuZqNV3MlOW9FzDXrPUK7UQplOpBsIY 0vz7ywuQo90PUexU7oZ6Oc/eYf4r4a+Ugi8u180XmJagsMyi7y7+l5tk+AoVMEBrMc lT4GcmzdURQAw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7252E64C31; Mon, 22 Dec 2025 04:57:05 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:07 -0700 Message-ID: <20251222115639.700578-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IH6JXONNXPKBBDOR6G46ZCH6MVDMQ6R6 X-Message-ID-Hash: IH6JXONNXPKBBDOR6G46ZCH6MVDMQ6R6 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/26] fs: ext4l: Add CONFIG_EXT4_JOURNAL option 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 a config option to control whether journal (jbd2) support is included for ext4 filesystems. This defaults to y Update fs/Makefile to conditionally include jbd2/ based on this config instead of FS_EXT4L. Signed-off-by: Simon Glass --- fs/Makefile | 2 +- fs/ext4l/Kconfig | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/Makefile b/fs/Makefile index b6d4f7a9cf7..969888a81da 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -22,7 +22,7 @@ obj-$(CONFIG_CMD_CRAMFS) += cramfs/ obj-$(CONFIG_FS_EXFAT) += exfat/ obj-$(CONFIG_FS_EXT4) += ext4/ obj-$(CONFIG_FS_EXT4L) += ext4l/ -obj-$(CONFIG_FS_EXT4L) += jbd2/ +obj-$(CONFIG_EXT4_JOURNAL) += jbd2/ obj-$(CONFIG_FS_FAT) += fat/ obj-$(CONFIG_FS_JFFS2) += jffs2/ obj-$(CONFIG_SANDBOX) += sandbox/ diff --git a/fs/ext4l/Kconfig b/fs/ext4l/Kconfig index b6c2329db4a..f1fbe3b1000 100644 --- a/fs/ext4l/Kconfig +++ b/fs/ext4l/Kconfig @@ -1,4 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only +# +# Copyright 2025 Canonical Ltd +# Written by Simon Glass config FS_EXT4L bool "Enable ext4 filesystem support (Linux port)" @@ -8,3 +11,14 @@ config FS_EXT4L FS_EXT4 (the existing U-Boot ext4 implementation). This requires 64-bit LBA support for proper block counting. + +config EXT4_JOURNAL + bool "Enable ext4 journal support" + depends on FS_EXT4L + default y + help + This enables journal (jbd2) support for ext4 filesystems. The + journal provides crash-consistency by logging metadata changes + before committing them to the filesystem. + + If unsure, say Y. From patchwork Mon Dec 22 11:56:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1034 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=1766404632; bh=JN243x7yWHbZFHP6xgmSnCcM5WYAKxv42xhP5Q/o6WQ=; 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=IRHA8+/pi2bTlVwhQ+iTpGxAVtTyHXkl50pNB+jMXHQ8/nGa334BR3q2KGEtfjF1E 8M4G+LQ5T1nR6TPlIS5S//gqjNFTI6oXlFWeHSE0HpXb6TdW6tdLgYdRxNEdhhhCoZ 21djyZlX6PxdBZkUY69mHLiXxYw3cdpc2Lo5hLWFB26yVgnmixeRGkvboGsh7fNVrv XoL7woJ/PvvsqGWuEsnQa95CTCwmxl6xaw76Xg7rLtoYCG4WcdK5hG1lOB+C21LVue 1ewo2ISu6sI2M1ewRIOYZHxSkiaz4ifu55cXWWAq9LJo3ekyHR1hEhIXMwjdA0aplB /C3afzVQnKa3g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 84C6364D66 for ; Mon, 22 Dec 2025 04:57:12 -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 jRRz9xFa2z0r for ; Mon, 22 Dec 2025 04:57:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404632; bh=JN243x7yWHbZFHP6xgmSnCcM5WYAKxv42xhP5Q/o6WQ=; 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=IRHA8+/pi2bTlVwhQ+iTpGxAVtTyHXkl50pNB+jMXHQ8/nGa334BR3q2KGEtfjF1E 8M4G+LQ5T1nR6TPlIS5S//gqjNFTI6oXlFWeHSE0HpXb6TdW6tdLgYdRxNEdhhhCoZ 21djyZlX6PxdBZkUY69mHLiXxYw3cdpc2Lo5hLWFB26yVgnmixeRGkvboGsh7fNVrv XoL7woJ/PvvsqGWuEsnQa95CTCwmxl6xaw76Xg7rLtoYCG4WcdK5hG1lOB+C21LVue 1ewo2ISu6sI2M1ewRIOYZHxSkiaz4ifu55cXWWAq9LJo3ekyHR1hEhIXMwjdA0aplB /C3afzVQnKa3g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7289164D59 for ; Mon, 22 Dec 2025 04:57:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404630; bh=BOJVbEcB/6A0iJ6QhT9pnVbLG/hX78/BO1Yb7/ZYRb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ofTBJxr0gE1+JtqPuKX1e6Cc7C4QNeK3sSZF1Xp7miUC4Oiikts0C5wWYbGIkOsrD vjIM2Gtyiy0Ho4rgmuc0TcJk5jRtBTtBzW4pG9VACfKWOELMmTWGOd48/i7X/72ejr T0mB+91f77y3aeoh/RWxrz5+8/qrm6RXf0M5Ze0JSTRU0chbBe4V2pbr2dHHELSS4X MViiQHGwdgCFD4y96yMiv3RD4rNcAnmOAy9alhA7lFC5lVr7xUS6ZxnSckQxrddVxR +ZuuIrh/G8RSgEobTmYnN2KaX6wRggkFkfuyN+a66X4uBSYWclQPjqS12PZ4faOb2C L7+DxuVZm5ogg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 82BF15FB5A; Mon, 22 Dec 2025 04:57:10 -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 VfC_fwT77XEr; Mon, 22 Dec 2025 04:57:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404626; bh=7PNlsZdWPfSBBv1qZRDNQqx7v53lU7mYeWjCNbSKzzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHT6HD4c0woWTFt7KdAs05uPkwTK7IO1ytxeEJp/VtksyIvMu+PVytZOTKxE3+L+v gCek9NuZiEVNx9YHE9T+iTGHB9MfVbp4DxpEqg99h1mNTqWTx+e4sO/M+MYJ3XCSuT Yb5RiKnl9ieY5EYy5RMuFcZ/nrzb3xEWH+ns/SH2ljOn2HUaJ+uO8sHi48qldNXOPl gyatg0agF/mx6wyhVuKFt6vUwkZqliFKisrS+EYTyR2GSPabnQGqeO3WDsXT8CBTND 0YkSD16yaAdr3tfB2q2m1lvQ2XidgOUqQ/okcYaXvnD8tMPJTVwTQV2JMEyLJpyJbO b2YurExqdONQQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3473A64C31; Mon, 22 Dec 2025 04:57:06 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:08 -0700 Message-ID: <20251222115639.700578-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3V3C4O62FWLL2C63LNWJ4KEOHW44CDBZ X-Message-ID-Hash: 3V3C4O62FWLL2C63LNWJ4KEOHW44CDBZ 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 04/26] linux: Add jiffies.h with MAX_JIFFY_OFFSET 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 a minimal jiffies.h header with MAX_JIFFY_OFFSET definition, matching the Linux kernel header location for this constant. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/jiffies.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/linux/jiffies.h diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h new file mode 100644 index 00000000000..daef4a337a2 --- /dev/null +++ b/include/linux/jiffies.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Jiffies and time conversion + * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * + * Minimal version for U-Boot - based on Linux + */ +#ifndef _LINUX_JIFFIES_H +#define _LINUX_JIFFIES_H + +#include +#include + +#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1) - 1) + +#endif /* _LINUX_JIFFIES_H */ From patchwork Mon Dec 22 11:56:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1035 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=1766404635; bh=k178PRH8kerZkdEiHXl4XDyvjt3s0rqn6Ln+MzV9pt8=; 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=hNetbU6OBwvqg7/PME8yUjfFf+v6KFOEWYaGDYS04FlLenHCXwJLjzKhErgPHad+F Y4e1cKxu9nuQC4vN+TgNpvLCRdwvIpX2+SfM93QU8MzpHlS64dJa5Dgn5nnEGUsJmk 0r33JgccMf8ZPU2So6rv5BXiqMNGT3W6eI/9pYHB8k4Gxc42N97KGrxFLgET+sb61g yExxsy1Jjj6HG4swjqVMilcWqkrV041QPzy7mYEWxfoLxxTsUbtJyujSo9s1idBl39 ElQjanT6vmDhpGypwTn9ObHrjKtDGn5NIfq/fjSS3yKvEJQNJ1LpmQzyctW6VgdsBQ ZKfXbsWeEDSGw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0BF2964D68 for ; Mon, 22 Dec 2025 04:57:15 -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 Cvin0JT9vaSE for ; Mon, 22 Dec 2025 04:57:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404632; bh=k178PRH8kerZkdEiHXl4XDyvjt3s0rqn6Ln+MzV9pt8=; 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=iJK0zXLgwR7S01KTGAvGhGKnGpVSxB9A7XSKm1Z7td32G8ll4aujyjcjoDFCc1sy7 wT3GiylFuUyMI6DL6axW/ebSNfFl9mfUcibgcX98bR3JdIvNhVK49/hqrfhOOBebO3 xZmdxFxVEgZPhndlJIoHgoImrx5N1ghmFnnCf5un6WHoQHvVqnnM4JivCaUBzsa8Kx QXQ72SDo2C9F+HLDQ5z52tqT9vAE+DmXLyhV5WZ0il4QK4YpWIkmmMvSeh9eQzr+Og AhPYGYu14GwaVx0C8jyXnlKiq7YDIwlYRruq7PjN4zP34g654W/49UVOrBWNjN9E0C cTklPybNv5ySg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EEDF45FB5A for ; Mon, 22 Dec 2025 04:57:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404631; bh=hxwrgW8xGnUQobUT1NeHPPO4X1WK7p1I5upf9s8thW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o97QJDbrwc8/7ET8Em/Ge+5C78Oja/zApnvCoF9PGmHhWB8KauayDizl6+9tJn3Zs EuHReVhAeaSetdh9B53TLM5tMKAL0Aem8atC+mUCDoZHD7f4R0PcNCLGhHcAUbKM6A qYEAZEGobfHUF2kdrnoq6C/9+C5TBD/HEef2YgP6HprsxFn2ml2G5z+ygdZBBoV8qi 0d/fT6asURPQxmdSvT5YTBD7QDfzGfBSo4s24RXguRyvoPALTU56F9/Lb/1loX3WG8 ugX9JbmfChmiKlKSkKlUbCyTko7jt1u0KWMhiTSaOpYsJ22lj8KwYBKmGGm8dRqxAK ZUhu80fL6gAug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 486B25FB5A; Mon, 22 Dec 2025 04:57:11 -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 07UkHRaoNCko; Mon, 22 Dec 2025 04:57:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404631; bh=n5/b4wjhxEAO8juK2XDMNrdM+DJsbd5fVYgoUXDODcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKrnS9KUyh1p8eXzSYC5QUfTGemZ9GA2putVQlSM1BDfk5NvgQGy7KE85lZKR8uvU UgZQmaSZXYhHHH0+XtTXF7rgJPm0/E3gdomH/mM0lCkhU4uRVdbmY6qRNS3uf+Pkwn sQOEC6YBBWpi5PspOURMwQ1S6apyNFhTF5AfyOoWxbpBfrcCxLDTPrQ+E6WKshJOXF 3E956Y7oNzwHMUzhaN8uuQg7i8cYJyvTZFTQrblh6SPa8nXwyHdgtWi2IBe0YlxDLQ GBZvS1+muaka5oszTgBKj15GrrkN67oKBJPi0cSSLWluoh+lz99xYTqYq15GtAEVKM yaw/yxMgCm7og== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C067E64C31; Mon, 22 Dec 2025 04:57:10 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:09 -0700 Message-ID: <20251222115639.700578-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZY6WOKKEHCBSSERJ6E6IBWYI56CX5U7J X-Message-ID-Hash: ZY6WOKKEHCBSSERJ6E6IBWYI56CX5U7J 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 05/26] linux: Add blk_types.h with blk_opf_t 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 a minimal blk_types.h header with blk_opf_t type definition, matching the Linux kernel header location. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/blk_types.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/linux/blk_types.h diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h new file mode 100644 index 00000000000..aa7ea50d233 --- /dev/null +++ b/include/linux/blk_types.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Block I/O types + * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * + * Minimal version for U-Boot - based on Linux + */ +#ifndef _LINUX_BLK_TYPES_H +#define _LINUX_BLK_TYPES_H + +#include + +/* Block I/O operation flags */ +typedef __u32 __bitwise blk_opf_t; + +#endif /* _LINUX_BLK_TYPES_H */ From patchwork Mon Dec 22 11:56:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1036 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=1766404635; bh=qWiZrmo//2QD3r9aaK1p0ddYE5yBgpIu9SNCySwW/vE=; 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=UeEBSPhPOSAICmptPibyPQGE6z3MhDxX1djqwuerHR+3MUWZtgnZx3Hc1UDouiGz0 lDGuM6krJQDUKd5ZPHl0+3QHbp3xV3NfvM2L0mNDBvFF4GDMJHTOMvPYxV3yaz2V25 jGLf7enqxUz2/YVm7rJ3rB/6sXxknM3f7px2yg0yBGOgQJGEMAxvd5yxxCWcdnx0ns BwI9SoKogncIyAV8Z411q3RR422rR3JrBGEod7qJfsqTnLEX9RYcIGH2RPPIATazAJ qtW6yevHUZGRc2XlLI+qbY1Rb8G6P+ZKxkP5wfDWgCVkpx+2SpUMbZRdFTPBxPm7ao GiYXoDtQHm5cA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4B35564D66 for ; Mon, 22 Dec 2025 04:57:15 -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 7iFiwM8-IeoB for ; Mon, 22 Dec 2025 04:57:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404633; bh=qWiZrmo//2QD3r9aaK1p0ddYE5yBgpIu9SNCySwW/vE=; 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=Yy8bZZTFZE+FgdqzLGgKGPUHa51/rhFn1u+nSU3JUkFOsm1AL5AUJk6xyvZ1RIwVB 8dASEuECu+OEyaqkB4knzVK+aRBGWreZt0vMTOyztQOrGK9qzyrPAJQEiny8oIVz5y I4VV9pINLEd6zFKj/mjbtbnWRoBx6fb7DMBJujz4ewiAWF9mxIPCGjZBeTopQLrhM9 whtWd4e36OC4NCB79Jj56t+bvABUG5TgzS5P2F/7xL3lr6tvknOOA0D1ynCUBjFPBu xguNOSDmNs1E4Z0ex0oFnMWnPtJQ/T0DLMRMfz+uQnCgUzvfuxyaju/v9ycEqCaWdP /aW5zRocgu4Jg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 568F064D73 for ; Mon, 22 Dec 2025 04:57:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404632; bh=U36VRejDLLfAqXguROG8Qh7jgodeQoULwlvVgTue70E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DjK1JGWTtQhuZbSWTy7gdHpqAZDdDkBB+YTFPa0gIcqkQa7vLoAIR1e3qdDMrdC0L NAsxCwkcxtmx0LM6w7teVZdO6WidL2u+BGR8hDl9hiDD5FNlO+nMf8WxvbqP1O8tpF av83VwUh6rMLLpJPNkHTHGfhj85Y2W0ItdyGuhaOEFrd+yRa7wU+m6yrwBuzzTF4H0 7FdtKOKduMquio7eQWxLTt4CBNAPRd19r+GCuOHjezWqXwKw+BkUpta8T8o2tswF6r P4BL/sEDuLFnfNKKC5NPfrIg0xSzXCyGBEjC1vFJxFN+jKxpmhNCaIb6I0KJylSevE gSktZV8IjL2bw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 226365FB5A; Mon, 22 Dec 2025 04:57:12 -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 ZzJzrPUwoAoU; Mon, 22 Dec 2025 04:57:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404631; bh=iNudRf33QleJMHNg6ocs2iF46TcEFNo+dNChYDBE5YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whMv8bZpViPmj5iqRxj8KBuhrUX9seRc+psAN00BZAuVZvwNoPtyALWIpsDowPY2O WIDg+XoJQdUnGfX6awRpDM1Xz3vUZGMrpROKueOpznLRjssIqd0qfYsJ9SSRSB1xMZ C0/77v/2Ypcyebtrh7T4e4Clr8C32+GNsMxwTDF39svtV8FqazaQeieRbkN24l5vxX 4aGic4jW7YLhV0hpk4AlsAsoMYDGiINulA9q0JZsQmWPX6jbfBcIwS5BtZj2QDIKAc Zak8HNcJMyWXwhKKyih0SunBhsCTFNrqmBkBnntFDsO+bMpuOWAkHzwh8MgzrDvqaV aXKbwZAB9k4Zw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8DBF064C31; Mon, 22 Dec 2025 04:57:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:10 -0700 Message-ID: <20251222115639.700578-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SHZ7LHTJKFDETURHSQJJM32AGLWQCRRH X-Message-ID-Hash: SHZ7LHTJKFDETURHSQJJM32AGLWQCRRH 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 06/26] linux: Add BDEVNAME_SIZE to blkdev.h 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 BDEVNAME_SIZE definition to blkdev.h, matching the Linux kernel header location for this constant. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/blkdev.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1a8851c4b4c..92878b01c3e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -12,6 +12,9 @@ struct block_device; struct gendisk; +/* Largest string for a blockdev identifier */ +#define BDEVNAME_SIZE 32 + /* Block size helpers */ #define bdev_logical_block_size(bdev) 512 From patchwork Mon Dec 22 11:56:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1037 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=1766404637; bh=MI+O/MWFbtvvkmXUq0VFzLFJdSbkOQxghYDYrfcacv8=; 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=gsHyX8V9EXet1QUYjM1BsSl16x7tFqoldfgTzvnqzjWZ57IBX8QYo18fnbRsmLuKH 5RcZHDUy2CR+iAzVasTqjuj3sLl1RnIXhVmiQdUSD6WWaHcfbVRpzqxSWM04dvb8Sf wdS5vu1+3Jwyz3pieYxs7yydmeRbB3/9uQaJjl1KLZ4rGpn0+srUe8EWRWkbhagAe0 95K3LCD57bzJGn6czeilOeaTrQHOWjy6hUF3BgaVrqeBPbFvkKwW7MlqLHx7xJ8e7c z/YJGppWX7p/Ap0YaY4rtFiDJGWW06V6o9vvMkdKGdkT+7KOJ6eJyX9/Yr2/CoeV6q K5frUlNzP6qDg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E2BE64CCE for ; Mon, 22 Dec 2025 04:57:17 -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 8QVN85k2zg14 for ; Mon, 22 Dec 2025 04:57:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404636; bh=MI+O/MWFbtvvkmXUq0VFzLFJdSbkOQxghYDYrfcacv8=; 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=voX71Ng/lDq1mJW89Rk6CueWuEz4lwMumzOyt2w1bGuLI3NUiFvdRqKod3CAxNh78 ucP72jergGzZeHTYyqm9MGiTZ5dGyGZepPU5sKDtSLPbiUIJ8vK+EhfGfvMIZupfkU pz7x3TinJ6UoBJVptX1UuJnHs3glAGQCSURPQNTWoWmerZoj/HOpVwKDZL3/klO79h +NjndfM/sKhQcz8BucRdD4GUSqqtNPmqUKKL3fZn38XY9H3SbfdfXF3d5jC/VeQZBB bwkDlGqMi9XkrTRjxefexbNWJ6pxE11RAsebYlFQ6emvEddJnRevu6494va+Ez44vt nTwGquQn1qstA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3F45264D59 for ; Mon, 22 Dec 2025 04:57:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404634; bh=s8WW4EYics3Mx8Chac273BP3CCc2hjHON6Ns6vfjc4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=He6rxc5F8VcW7yUcVatZ2E91btTBBBPj9KblJ07wv2KYH7wIw2M1bVVhHrTvkeUPS NFoEgo/RZy3dob6D/nI/mU4LEOG/otY5N+GmXCLwn2cn+XmyPBf3zR7w1N1XRvZKRO 9RkMVtelXt0xTpAtCjmNlgRmlzBunQFni6PKcYfc02YU+A9z/E9AYbKwiGPrPPlRmG ojSBROJkT+QnVv8jIb0/rg8R90oMQdOO6llehiQuhaTNzFg5D/WLVaz0wB+v/KbBV/ h5MaUU2E6Fk70El4iaojFAKjwonkAeDeBUu2YMgpv0yOqDUgaY/XUFU3Fzd+5BXV/l kIgpk7n04Ou1Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EEB2864D67; Mon, 22 Dec 2025 04:57:14 -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 TUwxVB690cyu; Mon, 22 Dec 2025 04:57:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404632; bh=hSZTw6RQPY77h1NkmBFP4Yw1GY5W/GcM7KQSv8ptyKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rV+nQIRxB2YrdhOA9iTUf/Vpyof9TY3fIf6HyUwwpkOaTUwYYNzd0eviaxGZM3P3E ejvgawsq4AEmfQQj8WZRABV9K2DCDAcv815utmGvWAuDMcR8rS3aCJgulUkVBrrkD9 CVLVQi8xeBCkTwnbTWyWlWRMA47rLuCNitzQlgnOelUNsN2SupqQkyth3Xdy3RByS0 ovQ7eV3Fk8UV7vFblRCbKBuA2y7e74gtzhtHTTSdWJmQbFsiGnMEOKXQOshP9Ab3ZS U+ZLcSeoHv8KWgYi4ItPy9ZsHQeu6JqGYtE1hZyyou4YePJAW8ZZCk1l+luaKZgjov hu53Ntgy+cOzA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6297764D4C; Mon, 22 Dec 2025 04:57:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:11 -0700 Message-ID: <20251222115639.700578-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YDE3O6CCUDTXKD5KGZ7HU7DS2O3CIWME X-Message-ID-Hash: YDE3O6CCUDTXKD5KGZ7HU7DS2O3CIWME 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 07/26] linux: Update jbd2.h includes 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 includes for the new header files (blk_types.h, jiffies.h, percpu_counter.h, spinlock.h) to jbd2.h so it can be included standalone. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/jbd2.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 35b68ffc0fd..41725fb42af 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -20,14 +20,18 @@ #else #include +#include #include #include #include #include #include #include +#include #include #include +#include +#include #include #include #include @@ -70,6 +74,7 @@ void __jbd2_debug(int level, const char *file, const char *func, extern void *jbd2_alloc(size_t size, gfp_t flags); extern void jbd2_free(void *ptr, size_t size); +extern int jbd2_journal_init_global(void); #define JBD2_MIN_JOURNAL_BLOCKS 1024 #define JBD2_DEFAULT_FAST_COMMIT_BLOCKS 256 From patchwork Mon Dec 22 11:56:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1038 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=1766404641; bh=Y2vfsbwFvvU2MM0auscvPsx7vRl8YZyWWKrI2JHw6KA=; 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=IfCG+Y17zlWh8fva6ju/SeAHPjSIL9HUGzHdnr+1jmZqum6O/4KYahcIP+PO2NaWg n47ce0XPELtC0/xHk9v2sVsFvQe3AWSHB7y2oTpAJIQT4YAGtd0jxSOS9J2yrADO4y 2fLHNrpN8l3uGR9gWVa7WW9RYS4OIJlzJvKpfFWSBK08agwGSxZnQyPNsPOdg3se+e l/JD/7z/5TVKGRt5hTbAGC9RtnOG6rkrN6D9cY3cb2pSZEIzqFU9cbqCS50+I9Ar8q hUX4fYq6drB6/8rT92YFXnPYt4V0/SUi7WihsLdbsieIbUYOpWCxlI7AcMxDdfMY3n XU/dR0ULN34Yw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C47F464D62 for ; Mon, 22 Dec 2025 04:57:21 -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 Ci5a4RHlUE-i for ; Mon, 22 Dec 2025 04:57:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404641; bh=Y2vfsbwFvvU2MM0auscvPsx7vRl8YZyWWKrI2JHw6KA=; 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=IfCG+Y17zlWh8fva6ju/SeAHPjSIL9HUGzHdnr+1jmZqum6O/4KYahcIP+PO2NaWg n47ce0XPELtC0/xHk9v2sVsFvQe3AWSHB7y2oTpAJIQT4YAGtd0jxSOS9J2yrADO4y 2fLHNrpN8l3uGR9gWVa7WW9RYS4OIJlzJvKpfFWSBK08agwGSxZnQyPNsPOdg3se+e l/JD/7z/5TVKGRt5hTbAGC9RtnOG6rkrN6D9cY3cb2pSZEIzqFU9cbqCS50+I9Ar8q hUX4fYq6drB6/8rT92YFXnPYt4V0/SUi7WihsLdbsieIbUYOpWCxlI7AcMxDdfMY3n XU/dR0ULN34Yw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B083F64CCE for ; Mon, 22 Dec 2025 04:57:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404639; bh=zJkzr6wbAKlxV+AMxr4/HJbXE/0CqhcVG7lNkXufWQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rdC9FZh+21GXAC+4b4Tdw3En0m6CxMC3z95VVwU17SnYK0Qm72BCcuG1gWcc6dnBu ab39eMTCGUCXwNe+6TEyRagiAeY7J+9U9Fg1PQTl6/1DFnAfTDBULQfD9tgNmCiQ8t XolZBelTStVJZV6a8cD7FCbJ+D0cN4eZBp5ZXqVFW9PchqYtiYLXsQTN25vNo4x3sd DgRlaePxZXoFKLvKyaJfn/PIvVzKAVJHw0iDIPbeE+RL9K+mZSn0HhdmRKbGzJxZLu UDQ0QH50jeTkXrnA1Z0ZlgKrptHmryjEGK5YnLnplsI3D7GWjoqAZuEPdnNRhq5FQf uu14gOae101wg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D95EC5FB5A; Mon, 22 Dec 2025 04:57:19 -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 CRH6270fcFil; Mon, 22 Dec 2025 04:57:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404633; bh=7Hi0ValM6Z+hG+Ri/k5SxuheuYPBVHfExCVNlo/OgEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7C3tDnVQrilgTCC5Q3e4t8ta7A1zj0bBo66eB6FKHNiiR6kBZgI29LUw9KpTbOp8 0X5BV2mv5dIXqE6B6fnEQHDb3Xs1oNezQPMgxoFpfTk5CXyg1DiokycgY9rlKy3MY7 7r9qEVDvW0GOT5zKQpVItpLxx39n9i+PBng4pnusxvghMfrPrxWizYsx2a4EFnzR3D w/odCFRUuaLZ22vFs78Mf6lOM0EfpLRbLbE8iAYQEuiguRwYqqy/OpOo8qmPNCBDfq RNQIbrbLLYVS63i6YuQp3eHIavLqQn+7nfJ+8a9D1zsQl+Rh2Qz7phL1y7DONSmgnn gVz+bHhEB3UTg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3918564D71; Mon, 22 Dec 2025 04:57:13 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:12 -0700 Message-ID: <20251222115639.700578-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RIRS4TACQJBWJYXWWPG76SPLCV44EQXY X-Message-ID-Hash: RIRS4TACQJBWJYXWWPG76SPLCV44EQXY 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/26] linux: printk: Fix KERN_* macros for string concatenation 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 Change KERN_* macros from empty definitions to empty strings (""). This fixes string concatenation in printf-style calls like: printk(KERN_ERR "message") Without this fix, KERN_ERR expands to nothing and the string concatenation fails. Co-developed-by: Claude Signed-off-by: Simon Glass --- include/linux/printk.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index edf149f52c7..00452944c48 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -5,15 +5,15 @@ #include #include -#define KERN_EMERG -#define KERN_ALERT -#define KERN_CRIT -#define KERN_ERR -#define KERN_WARNING -#define KERN_NOTICE -#define KERN_INFO -#define KERN_DEBUG -#define KERN_CONT +#define KERN_EMERG "" +#define KERN_ALERT "" +#define KERN_CRIT "" +#define KERN_ERR "" +#define KERN_WARNING "" +#define KERN_NOTICE "" +#define KERN_INFO "" +#define KERN_DEBUG "" +#define KERN_CONT "" #define printk(fmt, ...) \ printf(fmt, ##__VA_ARGS__) From patchwork Mon Dec 22 11:56:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1039 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=1766404646; bh=ArKxYkSF+iQC0fRdbAdKGgOCFg6PAuJSKcWM/xCytmk=; 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=aBw3mYp2tcr5KAi4dBFWNjyGumSmITXr4KjbgmSeZfMe3SEj97BwJCMbBl84NLXGD SHLv9UMeJZr2p/mq20lLEQL1UoTBsBNy7U7yoOY32cxdViWKj4He5+303AHgUEtcjX Io0nchyO3ZwwK8gWuEuj8sidSbQyGvMJJHpsZS9Hxhakun8eqH4i46Grc2csQP5Q8/ kGjBq3if7sYSenCLwDDxTvqckUapljRbq9f7FQw7mFyK1lekGOg5Am8TpDWWp1mcGK VLjiAaUnwXZHcf8ZUz0T8EScPXI2qnXZmz0344szJZdOMGnoVG9PiB9mWNP9w97NKp h7BS/Z8viAQoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 74F7B64D66 for ; Mon, 22 Dec 2025 04:57:26 -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 WOPmTB5T0I9m for ; Mon, 22 Dec 2025 04:57:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404646; bh=ArKxYkSF+iQC0fRdbAdKGgOCFg6PAuJSKcWM/xCytmk=; 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=aBw3mYp2tcr5KAi4dBFWNjyGumSmITXr4KjbgmSeZfMe3SEj97BwJCMbBl84NLXGD SHLv9UMeJZr2p/mq20lLEQL1UoTBsBNy7U7yoOY32cxdViWKj4He5+303AHgUEtcjX Io0nchyO3ZwwK8gWuEuj8sidSbQyGvMJJHpsZS9Hxhakun8eqH4i46Grc2csQP5Q8/ kGjBq3if7sYSenCLwDDxTvqckUapljRbq9f7FQw7mFyK1lekGOg5Am8TpDWWp1mcGK VLjiAaUnwXZHcf8ZUz0T8EScPXI2qnXZmz0344szJZdOMGnoVG9PiB9mWNP9w97NKp h7BS/Z8viAQoA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62A0164D62 for ; Mon, 22 Dec 2025 04:57:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=YAfcOmBC/A3PHLi4HEIJjpxKtP5vo8xHtUZLE38SPS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGdxHV2XGm32SxGQDphLuxenh8vdUhc+IbHw9bvxYgOg4vys82+4ffU+ybnyN59dn x2LPvELum6ce1zh2c2PaBzjPTAf2LVoItwIbGnKk2HRsI7R3/bcFasEkZXbJf7mmJr GxrZae38pggugcWs8ihKDadPwFNa/GceljeE1Ld1eVYIc7HOA/cnhvh0VPu/czPqEt wruBJV0CxlnxHv/geE3Dq8Lm2Z1tk4Tx84rX87L9hQy9WE8SXeQkpWmEXPSDDfmLH6 4wVphOt1zmt99+TeNTqEvWLzhK/XRN1prvu0RLV7Jq1UqlPnZF5FY1ufJjX6vqmbbs XlkxQzM/v18fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CD5764CD4; Mon, 22 Dec 2025 04:57:24 -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 nMVPOUeMu-uq; Mon, 22 Dec 2025 04:57:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404638; bh=k61NCBWo0X26P08OIp2at10DzSPH/3We6Z15WR6oh04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avRKXjPzG9TFp5+63VDcEZ40/Ba8mZO7t6+B1NIKPTEAdL+A4SoYIzn1kIdWS5shH uwKltqwC6Sbxb66KeiUaHM/QM+hY6g1eYdU8XTgpPd//Jfo4hVp7IL/NBHhTsoiOiE cirnsemf5K7W42YwuA2mnW0Hzwz9XZXZQLg4TwbelilzhP0h/j7MMwQIl8YuJvkW+N C+qRWnwqyWSz2QDld9j9bUQXzdWcUoWSBJOaeSEoJLoecH3PjNX/b2s9nRqKO9VSXP TeIlwJVyJD40pJ8LCJ6P8YGHVaB937bONzsP33FmCP5e93Le2SDbA0e/1J73n5fEl2 aWrPcEsj9nh9Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C44D664D6D; Mon, 22 Dec 2025 04:57:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:13 -0700 Message-ID: <20251222115639.700578-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GHOZ5WAEL22E2SM6MEVW4PDWPBLH3V3E X-Message-ID-Hash: GHOZ5WAEL22E2SM6MEVW4PDWPBLH3V3E 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 09/26] linux: Add rwlock support to spinlock.h 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 rwlock_t type and read/write lock operation stubs to spinlock.h. These are no-ops for single-threaded U-Boot but provide the API needed by Linux-derived code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/spinlock.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 906766931b4..75afad92b9e 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -78,4 +78,25 @@ typedef struct { /* Assert variants */ #define assert_spin_locked(lock) do { } while (0) +/* Read-write lock type - just an int for U-Boot */ +typedef int rwlock_t; + +#define __RW_LOCK_UNLOCKED(lockname) (0) +#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) + +/* Read-write lock operations - all no-ops for single-threaded U-Boot */ +#define rwlock_init(lock) do { } while (0) +#define read_lock(lock) do { } while (0) +#define read_unlock(lock) do { } while (0) +#define write_lock(lock) do { } while (0) +#define write_unlock(lock) do { } while (0) +#define read_lock_irq(lock) do { } while (0) +#define read_unlock_irq(lock) do { } while (0) +#define write_lock_irq(lock) do { } while (0) +#define write_unlock_irq(lock) do { } while (0) +#define read_lock_irqsave(lock, flags) do { (void)(flags); } while (0) +#define read_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) +#define write_lock_irqsave(lock, flags) do { (void)(flags); } while (0) +#define write_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) + #endif /* __LINUX_SPINLOCK_H */ From patchwork Mon Dec 22 11:56:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1040 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=1766404647; bh=1ZvKAlPWM0djR/L0bF5kZA9Mkw/QQs2WQ5xkW9cR/Mo=; 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=vQRowNdv4fEKKj73gxdSg313eG46FpymFxFDdEG5rR1kAfXMwL4Y+heRBQkZKjsFO ckZWtgSSKaiLMdFrS4ujoAywlkcnLjlG29PYNziqAgfWQpf11p+BNoJmyLFsRaiBvS fCqGjuIXtguE1lYmEj4UZYOhR7NaDfNEv4woThWB/x7frWJovn4iM2Wxo0SUKY8enU qg8+lsd/fhgyM82SnXr+ef678Fz+VeRZDkH6GaLU3wFoJTT69siF3Ye0WkvjeKhe98 EYGgl0NV0AvGX0HhyRRZX2K5QYiAJijQ4K7wb25RZlB1etb+VdFn5koErblnIDhKnt NBDL4k1on10Og== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4D68664D66 for ; Mon, 22 Dec 2025 04:57:27 -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 CCh_Z2RwZxXo for ; Mon, 22 Dec 2025 04:57:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404647; bh=1ZvKAlPWM0djR/L0bF5kZA9Mkw/QQs2WQ5xkW9cR/Mo=; 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=vQRowNdv4fEKKj73gxdSg313eG46FpymFxFDdEG5rR1kAfXMwL4Y+heRBQkZKjsFO ckZWtgSSKaiLMdFrS4ujoAywlkcnLjlG29PYNziqAgfWQpf11p+BNoJmyLFsRaiBvS fCqGjuIXtguE1lYmEj4UZYOhR7NaDfNEv4woThWB/x7frWJovn4iM2Wxo0SUKY8enU qg8+lsd/fhgyM82SnXr+ef678Fz+VeRZDkH6GaLU3wFoJTT69siF3Ye0WkvjeKhe98 EYGgl0NV0AvGX0HhyRRZX2K5QYiAJijQ4K7wb25RZlB1etb+VdFn5koErblnIDhKnt NBDL4k1on10Og== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3BAC464CCE for ; Mon, 22 Dec 2025 04:57:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=SCt0hx1GC16NithRuzvQ5R5E+gh5vY+r7e0SIrb/pgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZ4aPpDHoDohwAilNBRT50+hPRDq+GdkFj5u6i4N2Untxxju3F1Xcw9T58mtE6lK/ jxZcrFvch4k73nv+nyQk0DwpvZgfHSOqlPrZ44ujp/+jhiXFc5xzU03asKCkURTnI0 i1Xr/KjMfv+AjY3WLDJPVNDYKPm0VVir0LfeycQeLkTzB2NF3q6cqQro3MWG/Ct+df akUztmregeFwry+PEJEgII0bcVpK32JNxONL2GXtaBPor5WRAodFwYQRrm3EUFOpuS u1GnLs7rysnh3W3tC/FlndedJGGxAGOnx8iYGBUL2g6mpbhzyrher7GPMAkwebfzpG 9GfdF8DU/Pamw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CF7964D66; Mon, 22 Dec 2025 04:57:24 -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 uEYcMzPSRbTh; Mon, 22 Dec 2025 04:57:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404642; bh=1GuK01G+Y+FXIBsXA1lr4AGfyFFFIJ1VFreD99RzMD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sR+Y+QIiPJZPZZPaOG01Kp0dWW4qbXXeOOIHTAang2jJZVzyMMARTbq3FeADsohDR sPJuw1fLjK7HgcaN+pVIupadiaUbRH+yjNb3NE3DfvbE0PXr+S1UXk2TsCoo8CwazY SjW2jgm+9oOg2FcbGbXkcg3mnNbfFEm85LqvrBybeKdcGCg+ku6JMgue+dV7wFNqch wQaPGsxa8Gv9/VwpdjxjUbD4dZHMu/xavsZwOguA1/KrK358Bco4tSBNAtylk/DMrX CD+23Qp3QQ8xtZAWZtts9fRkJ7LPBc+FU7t8PBAuZyFfYY0CJwf+EbA6MOhZlNdVXB C6FcmJR0o9mGw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6114A5FB5A; Mon, 22 Dec 2025 04:57:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:14 -0700 Message-ID: <20251222115639.700578-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VUPYOIAAFYX5NY3KLUD76Q2QUVYT6FBE X-Message-ID-Hash: VUPYOIAAFYX5NY3KLUD76Q2QUVYT6FBE 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/26] fs: ext4l: Use types from linux headers 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 Update ext4_uboot.h to include the new linux headers instead of defining types locally. Remove duplicate definitions of: - MAX_JIFFY_OFFSET (now in linux/jiffies.h) - BDEVNAME_SIZE (now in linux/blkdev.h) - rwlock_t (now in linux/spinlock.h) Remove rwlock_init() stub from stub.c since it's now a macro. Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 23 +++++++---------------- fs/ext4l/stub.c | 8 ++++---- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index d0e60c02d77..1f823ba6ea3 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -58,14 +58,12 @@ struct timespec64 { /* * ktime_t, sector_t are in linux/types.h * atomic_t, atomic64_t are in asm-generic/atomic.h + * MAX_JIFFY_OFFSET is in linux/jiffies.h + * BDEVNAME_SIZE is in linux/blkdev.h */ #include - -/* Jiffy constants */ -#define MAX_JIFFY_OFFSET ((~0UL >> 1) - 1) - -/* Block device name size */ -#define BDEVNAME_SIZE 32 +#include +#include /* Extra atomic operations not in asm-generic/atomic.h */ #define atomic_dec_if_positive(v) (--(v)->counter) @@ -86,14 +84,8 @@ struct timespec64 { /* Reference count type */ typedef struct { atomic_t refs; } refcount_t; -/* Lock types - stubs for single-threaded U-Boot */ -typedef int rwlock_t; -/* spinlock_t is defined in linux/compat.h */ - -#define read_lock(l) do { } while (0) -#define read_unlock(l) do { } while (0) -#define write_lock(l) do { } while (0) -#define write_unlock(l) do { } while (0) +/* rwlock_t and read_lock/read_unlock are now in linux/spinlock.h */ +#include /* RB tree types - stubs */ struct rb_node { @@ -2202,8 +2194,7 @@ void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, void inode_set_iversion(struct inode *inode, u64 version); int inode_generic_drop(struct inode *inode); -/* Lock init - declaration for stub.c */ -void rwlock_init(rwlock_t *lock); +/* rwlock_init is a macro in linux/spinlock.h */ /* Trace stubs */ #define trace_ext4_drop_inode(i, d) do { } while (0) diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 93315d10fa8..e13685bf8fa 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -2,6 +2,9 @@ /* * Stub functions for ext4l filesystem * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * * These stubs allow the ext4l code to link during development while not all * source files are present. They will be removed once the full ext4l * implementation is complete. @@ -352,10 +355,7 @@ void inode_set_iversion(struct inode *inode, u64 version) { } -/* rwlock stubs */ -void rwlock_init(rwlock_t *lock) -{ -} +/* rwlock_init is now a macro in linux/spinlock.h */ /* trace_ext4_drop_inode is now a macro in ext4_uboot.h */ From patchwork Mon Dec 22 11:56:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1041 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=1766404649; bh=P6oPkCwonh2Q9tTPW3+JsN56aiZsaRRltQ1K7DtG4X4=; 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=Ce1h28a8k4kbDaGKB/PLhhzL+l4voMLP7vq/3R2sOVif7jo+NFJ3AyoEOhPY/+ygH AGBS1b7y6Kbk5vg+tb3HXNQYXRI+AuPbLsZHabys3MiT0rrJfqiyWq0i1eXBewseYH 2RYYcm1bJTu2FedPeKQjK3+5hwVzYb5dKh5F6px2+eFGqDFlFg1dCRFENmUWK1m6Fp gHQg7Hbt4PeN8jHhC6QkGtZJcKWaqpVvordcScmR3H/6ySKGgJH57x6NJScc5+ees9 IVVHTtQyUx7dux7FGV8CMCIr8ZLkI2bGer0nXJ9iiO6tlXg56sgQ9+FDz2AJmR7PP9 X3Me5/iP6XLTA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ABD9864D8C for ; Mon, 22 Dec 2025 04:57:29 -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 c_P2ugYJhBVR for ; Mon, 22 Dec 2025 04:57:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404647; bh=P6oPkCwonh2Q9tTPW3+JsN56aiZsaRRltQ1K7DtG4X4=; 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=EMV0CyA2M7WCsTi6tmnBkOcLEg7+wJd1DHTRuwnLy8oIky3ne1Tl6UQW8VAhrF6+1 g8n/6qHg4fMf+7O+qxPrbcBnxYei1/pRHHko2WzmyXAGL0G1cU0KYWANImifRsEdKA qHkRLg2hJcLtmM8w4ILmfzVZ08fksRVlm5y+icz1KtKgaFUwwErVjZT0irxnQeyRWW FylaBn8nLWmxwpVPu+ZsGWqfer6CEVo7sKLDpw0l8IJYc98u8JpqGTzIF0R1KLZHoE Z+5rrZtYo7HqkXhPtuhYPryWJ3FwXO/ntk81ZyN2/MkkqnvWV0VkkyzO6aDoASSHDK x7ohsTU/CXEng== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A83B05FB5A for ; Mon, 22 Dec 2025 04:57:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=R3mNxPM94dxb2J0hrqLjFG4lkfzpmsW/KhMVPXBDrV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lg/vlQDDCF0j1luf6GYdgiv3i851TR8f+nfqkgUlXtUPWvMYWGdLcKetq9X/lL7EV xiiPjdkjkJmiYPMd743Cq8Tssce3nZ+vpHYMLOZc38Kue8wEYhVlcMhHfA7w/QZpM9 uVqJG/+XkiKF7fmLv92Ih1yEDtH8Ui7N3Xtr8SeyiDoSM5VVYysIAZ6YpobrGWumKS Yduoop4loSs7OSvkwswuOmWsySDpaGqS2AXwRODqJFd2atTLBOUxhQnynWKbT1VZ8k a8NHVr4VPWV8iRkalxoWoZJDX/YDj8BsYNOSnJejfjf96aCEurTvHccXwjrBn5ixnu P6gboYe+nfO3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 410D95FB5A; Mon, 22 Dec 2025 04:57:24 -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 X3f9em9zGyAs; Mon, 22 Dec 2025 04:57:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404643; bh=PPNqQuxAu30xmobO/5SM4m72N7wrbWLl/w3j5y795pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/fcPD40XWx/LXMjaOYF/fTrbbD1WseYvbwfDMzJXJn4fVPLR8BLnPPRxH20Qz8Vh /uYtyx4M7K+9Na3zOWr4xDwG4bOGCqUqaLnGznsXMzQ6+M5YVdoA9/0mGOfdiL7fET 8/BXDmrOGx17pOqONdpxoLyAq4UL/TKh1tdLPyhOlSCe9r2mJmchUdRgU0/L0fyQz+ KBpeIcCNfTlfwXYBuObI2blOU0W8N19VkacPwFC0HFV35+Q4pzQFK4v41mcQGq4zgR kCVZgHQ1LNMkIyvaAs0cnEsVJNdPip20ElQ0230LMpFOHz60T/8idzgC5Eu9sfwE8f zLqtHgd5ROqiw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2649764D62; Mon, 22 Dec 2025 04:57:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:15 -0700 Message-ID: <20251222115639.700578-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7HEHMTGIBY2BSMH2KW4OZF3PLE3F7ORZ X-Message-ID-Hash: 7HEHMTGIBY2BSMH2KW4OZF3PLE3F7ORZ 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 11/26] fs: jbd2: Add jbd2_journal_init_global() for ext4l 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 jbd2_journal_init_global() which initializes the JBD2 journal subsystem caches. This wraps the existing journal_init() with a static guard to ensure it's only called once. Call this from ext4l_probe() when CONFIG_EXT4_JOURNAL is enabled to initialize the journal subsystem before any journal operations. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/interface.c | 8 ++++++++ fs/jbd2/journal.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index eb625e0b1a5..546017efd16 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "ext4_uboot.h" @@ -33,6 +34,13 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, if (!fs_dev_desc) return -EINVAL; + /* Initialise journal subsystem if enabled */ + if (IS_ENABLED(CONFIG_EXT4_JOURNAL)) { + ret = jbd2_journal_init_global(); + if (ret) + return ret; + } + buf = malloc(BLOCK_SIZE + 512); if (!buf) return -ENOMEM; diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 0b77fd0f34b..0cd95df8192 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -3118,6 +3118,28 @@ static int __init journal_init(void) return ret; } +/** + * jbd2_journal_init_global() - Initialize JBD2 global state + * + * This must be called before any journal operations. It initializes + * the journal caches and other global state. + * + * Return: 0 on success, negative error code on failure + */ +int jbd2_journal_init_global(void) +{ + static bool initialized; + + if (initialized) + return 0; + + if (journal_init()) + return -ENOMEM; + + initialized = true; + return 0; +} + static void __exit journal_exit(void) { #ifdef CONFIG_JBD2_DEBUG From patchwork Mon Dec 22 11:56: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: 1042 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=1766404649; bh=b7Govn8T/8+o85/b3v+T+a225/v+BvyfO91pb77lR3s=; 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=LzoIiZHGeRP2OPpdiCVFCjxltPhA4J+rwNwA/1uAYYquOLtcJduA1mdd+A5I6u7Q2 jGiKXZkATrQ3tncMv9zhh5Ku+IHvCzjtPYUuD7x31Tx8Jos7ocAJobQ6CKiBlAHcAN /MoPVKYis/LejUM0v244GYi+iaXhJopbg8AB+9M3y4sfiVqbgxxvgiQEBch5Ljfvla 27Wd1NKtH+YexLnJLTd1+UdMOd5WSneoWGGPyJNNrLgfL8lW2HFMpi7P+NmuMgiOUs Ldz7+0srw2QyFHISf1PFMn5yZ5qRyAy6A6OQgcrW5CFjpcjSVbNVNfhXH7Df23aCMj FHHvGaj9YtQCA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F370164D62 for ; Mon, 22 Dec 2025 04:57:29 -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 7Qt2M8dX_wjt for ; Mon, 22 Dec 2025 04:57:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404648; bh=b7Govn8T/8+o85/b3v+T+a225/v+BvyfO91pb77lR3s=; 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=Ny7WsioeiHfZ9hDvBzqmBL1IHiTbYO6M9/pjip7Ho6iJ1b4e2836dn9tNLxmPPV1Q MltoV3Da2oMsAj7ifgFiUACMpzL3A58YKai2hz6NqLMeDgGkCVQuAWcs+JCXOmmhg4 LGHdnp7/2bChhJ28H0nLNnOi3SgA2ZkfN3/SPzybha4TpY/bd094o/VdX48Sa9tE2y vpzsH6r8JiYd5LaMxWFRZMzZimRRzSAgE6EzCC/vgcFbS7keiiynf6DU/+ojIz0ag5 uuaYTsW3mzWoLmYdBX+p602ivylNsFMzIr7cmf3CFxEW9i5ap7Lfoak6qigmHry6LO 2zXMrMKhvh3fw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 93FA464D67 for ; Mon, 22 Dec 2025 04:57:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=dMH3PQM4LMhVmtvo4V0Cqrezd9/cpLErXOQ94zUU6eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbSnSAc/+JJB49yQnJ1kRYwJO7uwZhiv03OIWTfcGfzA13MUngEHOYQP2oOaWP5Na ZNavTSNT3WqLzAGuTXAUfU+08JKptzedipJ0s9Wq76nm1kmylBVzfKI6bV3DJoOJmM j+bjHqOuAOFwzi97WBitZHtjaIHTwh+rIlsR+WF/x+6NZOyvLz+KApw6wS7HfnXNzB SFDxhWvw8uXFER0YMXwwx/JnwLehXgSVdCWxxGLxsIwbRirOEpd+VB1l8O79ppFHqt FX33HLUWs2kql7sddI/cSFo+l9cViZ0HUNhQ0dY8rfHV06xK3pUT1ZN++viEVLUlTg 29U/XUJ2K+DMQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 65F5964D62; Mon, 22 Dec 2025 04:57:24 -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 ddxbmsj9HC8z; Mon, 22 Dec 2025 04:57:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=clhosoTU38xNFzE5Avtq3SenAvySW/ab6EnpQ3/dRCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9JnOE3pNFofql84ZngBOPg1w9cwwvIfvLvdY2OfWPg5ybWO8yASWTuRygGHzQG13 5M3XVShrDbyVZRH4RFEKJFNcJcNU9auH5jF3HT48Y92YJKUxFUYk0nSSyTiP9XIdKC fjs67dfytjscdntVMstD34a8em059nDvG9T0YfOJBLrjvU2lbXdR4VyOW9VThmU7Pu Qm3EkD7Mh+bGDEf9AukGRkhzfXmvNYib/2FmNJjEIjRA8gKAK+13M6hXUugSoa2Yvu +C6NCUeaJXgGA1h3qrAuBVfQPew0CGwuvBHqSxu1WP5F4b3CANeaEzarpugmBTjCkf 4SE0gEP4vOrtw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E4FC264C31; Mon, 22 Dec 2025 04:57:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:16 -0700 Message-ID: <20251222115639.700578-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FUMHEJXXZ6QSBH4L7TCEYLDVKS6UYJMC X-Message-ID-Hash: FUMHEJXXZ6QSBH4L7TCEYLDVKS6UYJMC 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 12/26] fs: ext4: Allow EXT4_WRITE with FS_EXT4L 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 Update CONFIG_EXT4_WRITE to depend on either FS_EXT4 or FS_EXT4L, allowing write support to be enabled for the Linux-ported ext4l filesystem as well. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig index 26cf7469d73..d7798cfb6b9 100644 --- a/fs/ext4/Kconfig +++ b/fs/ext4/Kconfig @@ -8,7 +8,7 @@ config FS_EXT4 config EXT4_WRITE bool "Enable ext4 filesystem write support" - depends on FS_EXT4 + depends on FS_EXT4 || FS_EXT4L help This provides support for creating and writing new files to an existing ext4 filesystem partition. From patchwork Mon Dec 22 11:56:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1043 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=1766404650; bh=HKsDk8uZ3b5E4MGmBHz1+T5g2ub8z4tBAyE7aAhkBPw=; 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=doH7G5xoM3P8GPmi5lbydSJJh9qXL/tde2rozKbD028CBV7M2Nbmqs/+4+E75ktNW tZK1mm8Sts0oIRPvQvICC5X9bgUKVFQVAL30v9GKs69gVQ4l47oguvSfAg9okIpt8r wt+HCr6NEEErcL9DIXcNewu1sP1KlBdm+8w8IXzu953Aa1bEKw6cHwjLPkTdi6zR8F hOoPWa6ktILm4ORnLUmq65DCJDGlQWj8nNwtp818P/S369f0AntTU4S/AJq/QpykyB 7tJq9EkKVhK6Hqts5c/1Yz0YpiyqoFxz1E80mfZBZqNTa+Wn8lYsjMSkUraeFvEzDh bniDklo+xBi1A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C0D364D78 for ; Mon, 22 Dec 2025 04:57:30 -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 VFPW0lvZmhsI for ; Mon, 22 Dec 2025 04:57:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404648; bh=HKsDk8uZ3b5E4MGmBHz1+T5g2ub8z4tBAyE7aAhkBPw=; 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=cnz+gxwcMHjwDstSAvKFExzdOyN2JhES8iAG2UQFTmyHby7A5HRgndBSTA2mkXZ0i 6S63fqhFfQ7t1wcZ4VUPh2FNFSET/5czqc3VC111/QsaDZxIt50VqUe0HHehZenscA sIlQ/4M596I9xx7Npkrx1zGMfNANDJwCxJ4fUqkD1kx5YmQCMBatrMPfZQZlxVQyeq 1W57s6tOYyX8zRrhIvfPTkPKTSMQ2gT/GDWDrqx6oQkKCXjZNM85VP2xW3U9TkXNih oal+BhcJOGXOk0JItbmYXkrNt6Q313qMmzfqCTIu9btjgDRIZLVExpGcoXMjDeIOzG ApTirZcjuBPLQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F1EB864D80 for ; Mon, 22 Dec 2025 04:57:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404645; bh=A7u0NRgUpYzGZHBejjMgqgXn4mhLI8UjVzIwQgBYAe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UimD0r19iUe1Q5QKmrMPzWSQyAQasSRZfP8TfIsa+2Pfjzy0tCayXLpjS75mRDndE FkJ+CrY5s7O+lP7dKEvUARtrXDZZn1DiT0qyfswbnivZK3M7Ja2TufL3P3DEQUpcSf Tbe+TPFBLRfv5klC81aMaM0VXesQhn19ata0yvsy8DgzrCQ2KUBFphIaSTkL2q3SFO FVNt6HUoY2kAS76NrFrnSlBlMxFdDtXhTnoBpGUjMkQxPS6i2N3cXKSrH04u14C8BE mN2Tivh2kt0Eux85eQujz8d3bJ4SQ4XVXRejRe01zTL03+YPo2H1ZluEF9X1Zo53aB fY2pYFPXV8hfQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A0D85FB5A; Mon, 22 Dec 2025 04:57:25 -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 zwyaAVzUt_Rd; Mon, 22 Dec 2025 04:57:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404645; bh=nzZV8oaYlcL+yVB8q96j5OnohWUgjsCVMFJ7SrauOq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FbqrfSXcGSM9yOFSbMNf5JnKN4VUMTXP4fiNF/Of1jQno9bXTtTeZJwWhQsGOPiQ2 +he91C9r42Ju1Z2H7bRoCk2eFscEWgOcUVZbA25+uAel0NJizV2hnv5HR1Wq+zryc9 9vrS/5bDpXbI6rJvXac5MvffdxNRMx1f1HaAm755q36iB/UlC9Rj6DddqGM/M9UFri pGbAFU0vKA/mms0OrTde4Yq6tojOrCySIRhjz4sGGCaaQOKv+71NgxU9StM/5u5/hs ScnXIHrIpp2AUCJE57WyaBFs13X27I9Rq5hAK5iz+ewiOaff7EpaGV1K73OgSA91L4 3EiL2N6+eDN/A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A9B5164C31; Mon, 22 Dec 2025 04:57:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:17 -0700 Message-ID: <20251222115639.700578-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CX4WE22PY4PNZWJRHAARYXRIUAGNV2YG X-Message-ID-Hash: CX4WE22PY4PNZWJRHAARYXRIUAGNV2YG 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 13/26] fs: ext4l: Initialise multi-block allocator 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 Call ext4_init_mballoc() from ext4l_probe() when CONFIG_EXT4_WRITE is enabled to initialise the multi-block allocator caches before any write operations. Include ext4.h to get the function declaration. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/interface.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 546017efd16..ca71843b58e 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -41,6 +41,13 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, return ret; } + /* Initialise multi-block allocator for write support */ + if (IS_ENABLED(CONFIG_EXT4_WRITE)) { + ret = ext4_init_mballoc(); + if (ret) + return ret; + } + buf = malloc(BLOCK_SIZE + 512); if (!buf) return -ENOMEM; From patchwork Mon Dec 22 11:56:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1044 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=1766404650; bh=Y/r0xAaPjyLNj41asXVIRFd170v+pOua1YbinRLtdxs=; 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=W9GrRw1VNfa2AOcFKDvUp/Ed/RXlwqyakJKI7hoPh1z9zfNLw2684nEMb1ZxV5rtk qHsgkh2NYQtPgHu5BLKKWAcpHzDIU8JXfOA7t+/rIiWCDCi5OQUfY96Bjq0aLJgZrP g1fq2El/HWnc3JOEs0Rr6lZxQjrmg7z/HLLorkebkLvw40V3xj3znp7HwMKG7NN44D 3ZpVgOTqgnmeWToFdtK4vNOmn+hd9KdmAY/zqfMP4TMD6RfW1wLG6F+kMgiz/4jtOH kGM1oJ178pmmLKrtNE7n9ocppE8+gwuQrL9y41Dpttd+CbF3I1Xt3B6HTKIOEC/fLK VtKiXlQs1suGw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8AC9C64D70 for ; Mon, 22 Dec 2025 04:57:30 -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 QSoo6fJlGFur for ; Mon, 22 Dec 2025 04:57:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404649; bh=Y/r0xAaPjyLNj41asXVIRFd170v+pOua1YbinRLtdxs=; 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=bS9utN6iSkkCVmJqkcnY6YBQp2najXAk6zhW5h9aZh8MqfInYfPs5OVwjp4Da01dQ jZfqpNInu3jV17Dtcuc5ZtJqAVjExAgluAVn4BRzJDgE/jI2fSuZUvaEO3hegpj0MH IQNroK6fFmiCRKYS3RBSyidd7ui8IDjHy2d1zm/FYa6KSrn7Bd2YDe2rV0zePL69ru fGGXYy/TuuTLAnbeRr3vorkWNQ+6/qlQ8xZt+ftNMDiETHiXcJTzCpfUq1tExoVRaS MYKBNamVbVtYHTlf4TPeprffpmuniXRTQqGroIf5Pc7MdKqNRorDOvmVriMg79GGt6 Ncn+/9k8R/lUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5FD8664D85 for ; Mon, 22 Dec 2025 04:57:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404646; bh=mSVLUIGY6F3JQWtavNl7e6y4rWT1J7STRk3KVN+3wfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iIvy9Z4txRLlXTbUBuLU6BANJZiynS6cKdxWUZYAZ6a96NA/HjGDdOhIjTkR/BRY4 7y+hLKgvzUXX+CMwx9Sm5+o8z52jM3/KQ9mpj1hfS0VKHgToyT4aXo99tHwiYeDHX6 nn//tZ1b6trrPBbw//wXuMYOFjcBmJy+jDyPvYL0e6zlrrQ4Zmu+6Uh0/NZuqPtp6b wdjocYCYpNR2+mHHEw6bNaDKqojOxWEYDrEJT6xZMdZrGue4sYakX4OYwHZDoMFM8n ApRbJmRIdbF1Wh0YeG6r1OA288m2dglRxOsUx2AsunHFGpIWBdUnC4tDXHFXdvxcs+ p9Qcnlit2eljw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 110745FB5A; Mon, 22 Dec 2025 04:57:26 -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 3k8Pvj8Iok8j; Mon, 22 Dec 2025 04:57:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404645; bh=nq3SaXofVMjuzDOyr6mXMuYbewLFQh1m3YB0iZEHD/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RME+x/zHiZiorf03fd8orrOsq5JD33hfOHzloJFjDtiILMe6eP3zIZ70/geocz2q4 xf8MdnDGnNJ7U+oazpB8r0OUVSTrkjx0DqaMhid8y9UASAEnOIaOfrDzcxh093AEo/ 0+Qdns7Z2qq6Pa1pAM1G0qT2t+koliOgEOVwvQyrIAld5pzQ2NUBYrRa47YhQx5rUb 6Y7KA9YYCcgMtq9kgdClH2PuAJrq0r1Tk2WWzVJTuxlWKFDuTaXD/mps00nENeFUs5 lsuj3RfvW7H2xjl3/zSsAT0m659T3X+UBbu824VPgfxXRu554uVrPdNGmkY/C3h4Ot lasfs1hZye60A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7AB1D64C31; Mon, 22 Dec 2025 04:57:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:18 -0700 Message-ID: <20251222115639.700578-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YVSHB6QTMMJEKHO5KNMA2TSHUSEJKVM2 X-Message-ID-Hash: YVSHB6QTMMJEKHO5KNMA2TSHUSEJKVM2 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 14/26] fs: ext4l: Initialise extent status cache 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 ext4_init_es() call to initialise the extent status cache. This is needed for ext4 to track the status of extents in memory. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4.h | 2 ++ fs/ext4l/interface.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 836ea2612b9..8fed7194d84 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -2960,6 +2960,8 @@ extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, extern void ext4_discard_preallocations(struct inode *); extern int __init ext4_init_mballoc(void); extern void ext4_exit_mballoc(void); +extern int __init ext4_init_es(void); +extern void ext4_exit_es(void); extern ext4_group_t ext4_mb_prefetch(struct super_block *sb, ext4_group_t group, unsigned int nr, int *cnt); diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index ca71843b58e..c18ed306f1f 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -48,6 +48,11 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, return ret; } + /* Initialise extent status cache */ + ret = ext4_init_es(); + if (ret) + return ret; + buf = malloc(BLOCK_SIZE + 512); if (!buf) return -ENOMEM; From patchwork Mon Dec 22 11:56:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1045 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=1766404654; bh=BT18H0fH1Z2CSiOSJJALcGzVGHN59bJvrLiyL6h/uw0=; 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=ENzP3arKjQ6/B5QbS6aB1aQkVmbTwSsqeT2i2uTDw/hwiU5fgJW6j27tmh92iKeqJ wpyiDqppzdPshz04MUJJrJXiyya42nBfdtmhA1r1R93bJwu7VsvKe8+bRPkKkWlf92 229kTaxExLQ+EmObcluCNeUe1HscC2gRumQ80SJO5fgvrUlzcqC8VfKL9MkZ8jhIRC HKeG1UqUTeQz1iwNxUOB0gi7TTgoiMf0I3jF9oU3/sihsO53OctwU3lfYdgapNmVWD I0PwjiwJA57GkUxAke7n5QHXJZvgo3vsbPPOEx18XauprIN1tHXC1I8jlF4l8tzpmR Qb8vq5xk1aU+Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E22BF64D62 for ; Mon, 22 Dec 2025 04:57:34 -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 2hn_UEn8le8G for ; Mon, 22 Dec 2025 04:57:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404654; bh=BT18H0fH1Z2CSiOSJJALcGzVGHN59bJvrLiyL6h/uw0=; 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=ENzP3arKjQ6/B5QbS6aB1aQkVmbTwSsqeT2i2uTDw/hwiU5fgJW6j27tmh92iKeqJ wpyiDqppzdPshz04MUJJrJXiyya42nBfdtmhA1r1R93bJwu7VsvKe8+bRPkKkWlf92 229kTaxExLQ+EmObcluCNeUe1HscC2gRumQ80SJO5fgvrUlzcqC8VfKL9MkZ8jhIRC HKeG1UqUTeQz1iwNxUOB0gi7TTgoiMf0I3jF9oU3/sihsO53OctwU3lfYdgapNmVWD I0PwjiwJA57GkUxAke7n5QHXJZvgo3vsbPPOEx18XauprIN1tHXC1I8jlF4l8tzpmR Qb8vq5xk1aU+Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CEB0464D3E for ; Mon, 22 Dec 2025 04:57:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404652; bh=GKgXSWM/PXBKMWaM6y4T37b0M/cG6HkNIMC+x9+QmiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BKKrSMYrIJo4qYaKG6CUyENVTr/CbqNgKZTZqzkAeZbnPzACayoFv4k4jKrpIu95b MnU6DTC/b/Y2Q+kSzmJlHzDfub4MO7RrfNHHLPSyLckqYJ+UX6q37xTqfWOX1LTeMR RXPVbm/yEpR5UTriEQ476jnLU8xmkmQyxRW3vdhwQyWSD493iD2ulUPqPOOseI1qxB dd6b75KDYZsuwDtredzkUNAy28PQxrbXK7gVG65yOMbeWiNrfujnl662S49Xfo4Je9 5BkgFqDKtqrEZ4+C2pMY+4AhUeKy/SNp0YsQeP+JssUHYwgGV8NsJw/T4fcgNZ9u5r DFQ7n1V6bWtYA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CA3D064D3E; Mon, 22 Dec 2025 04:57:32 -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 d-yxdpUEzsXj; Mon, 22 Dec 2025 04:57:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404646; bh=KmvpoClRXf9Gk+ihquXQFEp5EQi3FoFGC06NzwCWDQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/ujp3q1kH9YEMm6WVe21Yp/XMbjzcpvfGIqhZRantGBWDt92eagVB/Fi+j5q4/Py NV6VLfpVk+R5H62BJiKXtW5tjgT9gMApJZQ1O/Lk5a3VjSMD4R4952BrNXHswgH0Hf /PH1M3UTqNiG9p7iZObFi+wSJUPABb0bEQEiQg967U0dNOg1OBwOogfTwP9lUwkn38 57iMTZ9ytO06vxTmZMCymyaqD6C+08QzbRFiO0kNj9ZJ27XoM9UQKxWQJCiQm+tn2I OP1hSe5x5QVl6x5I1/66eAaxMtusdwJMNcjawZZnvQYkyUwVKGNU+kZqZQMURWWZrK k1qgIEXZfDNBg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 52ACA64C31; Mon, 22 Dec 2025 04:57:26 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:19 -0700 Message-ID: <20251222115639.700578-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XKXGANO42V52AB7K47PPVFEUY6SJRQMG X-Message-ID-Hash: XKXGANO42V52AB7K47PPVFEUY6SJRQMG 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 15/26] fs: ext4l: Add super_block and block_device allocations 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 allocations for super_block, block_device, and address_space structures in ext4l_probe(). These will be needed for the full filesystem mount operation. Use goto-based error handling for proper cleanup on failure. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/interface.c | 49 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index c18ed306f1f..792928b4b6c 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -26,6 +26,7 @@ static struct disk_partition ext4l_part; int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { + struct super_block *sb; loff_t part_offset; __le16 *magic; u8 *buf; @@ -53,9 +54,31 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, if (ret) return ret; + /* Allocate super_block */ + sb = kzalloc(sizeof(struct super_block), GFP_KERNEL); + if (!sb) { + ret = -ENOMEM; + goto err_exit_es; + } + + /* Allocate block_device */ + sb->s_bdev = kzalloc(sizeof(struct block_device), GFP_KERNEL); + if (!sb->s_bdev) { + ret = -ENOMEM; + goto err_free_sb; + } + + sb->s_bdev->bd_mapping = kzalloc(sizeof(struct address_space), GFP_KERNEL); + if (!sb->s_bdev->bd_mapping) { + ret = -ENOMEM; + goto err_free_bdev; + } + buf = malloc(BLOCK_SIZE + 512); - if (!buf) - return -ENOMEM; + if (!buf) { + ret = -ENOMEM; + goto err_free_mapping; + } /* Calculate partition offset in bytes */ part_offset = fs_partition ? (loff_t)fs_partition->start * fs_dev_desc->blksz : 0; @@ -65,7 +88,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, (part_offset + BLOCK_SIZE) / fs_dev_desc->blksz, 2, buf) != 2) { ret = -EIO; - goto out; + goto err_free_buf; } /* Check magic number within superblock */ @@ -73,7 +96,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, offsetof(struct ext4_super_block, s_magic)); if (le16_to_cpu(*magic) != EXT4_SUPER_MAGIC) { ret = -EINVAL; - goto out; + goto err_free_buf; } /* Save device info for later operations */ @@ -81,9 +104,23 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, if (fs_partition) memcpy(&ext4l_part, fs_partition, sizeof(ext4l_part)); - ret = 0; -out: free(buf); + kfree(sb->s_bdev->bd_mapping); + kfree(sb->s_bdev); + kfree(sb); + + return 0; + +err_free_buf: + free(buf); +err_free_mapping: + kfree(sb->s_bdev->bd_mapping); +err_free_bdev: + kfree(sb->s_bdev); +err_free_sb: + kfree(sb); +err_exit_es: + ext4_exit_es(); return ret; } From patchwork Mon Dec 22 11:56:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1046 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=1766404655; bh=brffyqS5vRVoFUysliwLc3vSwaPy2PFtbbupamPh02I=; 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=MZQMpkqXIJNkzkNj7494TES0ehP5XySOCyv1oo6cQmxcisEFyze5uG4b7uUVvEU9e hbNqeG/yOghPqn95Pjw28pus6ADTJ4X0wVuFpbZ0nmtEI/NlGalTytOBMw/oZcVoI6 eHgWGaEXnH7YweKFKmvxqe49dNiDCJPjIiMBHWkWXTMgfkAhJeAPY2gO5iWWDGFlK3 S3h//fhoUY14F8VfqxbeJQQJO/2TMNSrXGeD03s8IJ4D9lp6PoDX360WkUzwpSU/sK 3XSu6hKN0u95J7qairwqDPWae5yWP7FYLlCdtLwJ/+hItiWo9f/DvBVE9uUbYI3Q7I viqWM1iy5ojqg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5270364D75 for ; Mon, 22 Dec 2025 04:57:35 -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 5a9VwLeDKSVO for ; Mon, 22 Dec 2025 04:57:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404655; bh=brffyqS5vRVoFUysliwLc3vSwaPy2PFtbbupamPh02I=; 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=MZQMpkqXIJNkzkNj7494TES0ehP5XySOCyv1oo6cQmxcisEFyze5uG4b7uUVvEU9e hbNqeG/yOghPqn95Pjw28pus6ADTJ4X0wVuFpbZ0nmtEI/NlGalTytOBMw/oZcVoI6 eHgWGaEXnH7YweKFKmvxqe49dNiDCJPjIiMBHWkWXTMgfkAhJeAPY2gO5iWWDGFlK3 S3h//fhoUY14F8VfqxbeJQQJO/2TMNSrXGeD03s8IJ4D9lp6PoDX360WkUzwpSU/sK 3XSu6hKN0u95J7qairwqDPWae5yWP7FYLlCdtLwJ/+hItiWo9f/DvBVE9uUbYI3Q7I viqWM1iy5ojqg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4280A64D3E for ; Mon, 22 Dec 2025 04:57:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404652; bh=nN+CG2/nDtDPJRW+4SGFtnk4zhijZLQEe1YNHi1TyrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJUhNfHpZuUZ5qzN0ACJKlJ1oOl6CsjNfp5tLyQm53gJazlhsn+ws6ReKFdJuCEdt Y16Hdh8I6LOz0WTan/kH9bGHfzoSm8DIEnJcIN4ZOJW7aDMO9jCCIDs3YMPGPgAz+z v9XUIPPryUwisYihhAJZdSJcJ20oIKJFr/Zh48HbdsF9eiiSHSj+1sQwxR0qRYHyts WxahAOPPZYIw6Ph4HLjYo+WI2mvWzXaeeabaVeIZHn2SZf+j9mY1ZCSKKbGss31NxM re2F+268M35NjL33grij4bDjnwa2GEMnOkbHnr8mc+3onUvUVuBNexUJKpp3nKyu3o ZkImX0iLHe3Kg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D467164C31; Mon, 22 Dec 2025 04:57:32 -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 muXamyGv7Me6; Mon, 22 Dec 2025 04:57:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404651; bh=yLeUWJsj8RhS0OkNaRyK6MS6Ek7hz8Knsz4/dY5tpf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aD3FxpiSjFIstEC8/04RzqW/nAWrCiTvu2b4bwSTXyvsPCnK8z67mdRy8EIrcYqP5 LyJyOmPIg0+f+sKXVNt+LwuvektaLkoSKER4JsHo0I6JHDSjeVPE4DTtDD3EQH/0Wd 8KG4kDXJoa4/f5oVq1hCn9u6LGEVHhYlgcMZInpzHrGnp+O5sSRy0tTOXyVji2iJf8 rpDFBaCtqh78oE5YJVEZGSCS1dFhcSlfSjhCL3jZc00hq5F9rY96v3pzQxKgESXjW1 BSFsUMvvEWcUzev7hrzCCg5tB9tROfqm2RDslok6Y6NyFkWn+wFDvqDN6+t/22nlI4 XgY/cYewBwnSA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E6A9A5FB5A; Mon, 22 Dec 2025 04:57:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:20 -0700 Message-ID: <20251222115639.700578-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TKGQFD4E5PNMJ3B63IKSAXIVM363AHRI X-Message-ID-Hash: TKGQFD4E5PNMJ3B63IKSAXIVM363AHRI 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 16/26] fs: ext4l: Allocate fs_context 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 allocation of fs_context structure which will be needed for mounting the filesystem via ext4_fill_super(). Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/interface.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 792928b4b6c..b653b7ef981 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -27,6 +27,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { struct super_block *sb; + struct fs_context *fc; loff_t part_offset; __le16 *magic; u8 *buf; @@ -74,10 +75,17 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, goto err_free_bdev; } + /* Allocate fs_context */ + fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL); + if (!fc) { + ret = -ENOMEM; + goto err_free_mapping; + } + buf = malloc(BLOCK_SIZE + 512); if (!buf) { ret = -ENOMEM; - goto err_free_mapping; + goto err_free_fc; } /* Calculate partition offset in bytes */ @@ -105,6 +113,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, memcpy(&ext4l_part, fs_partition, sizeof(ext4l_part)); free(buf); + kfree(fc); kfree(sb->s_bdev->bd_mapping); kfree(sb->s_bdev); kfree(sb); @@ -113,6 +122,8 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, err_free_buf: free(buf); +err_free_fc: + kfree(fc); err_free_mapping: kfree(sb->s_bdev->bd_mapping); err_free_bdev: From patchwork Mon Dec 22 11:56:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1047 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=1766404658; bh=PXiNyOBWov48H3LT2X3q5ioyoOJj0pKiRmTN33Y/Csc=; 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=arKpdkZlTk/85M5YVfuEzNQZ9WdPlvzTPoJNB7OFHvQOjXA+sVEW6ScIdZJlRjI6J hkXahW4YYvmnvw0e8+utjFljD9DnAbBr9USQTwalsBT+E1/sNbD4kjribk5rPMigeI ZZzaueP/iEFpOQ0DSb/2MCs/bH47r1pPjSH8a5FmmeseGb20mN4Qu2sGpXZi1mTgsD eLK5KY0F5/ILTGrKpITY0ZsI7+0CHobzLQVQiHucI8NPKRprcA6ZWY6Ow41WmzMXgY XFI0E4w3I1w4aArZmPVNK3CR09TecJX+3Wlu9K98qnE++nFf34JXzVStGYxpIlmIA9 N0pz45D/43pCA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D5A9E5FB5A for ; Mon, 22 Dec 2025 04:57:38 -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 BGjUmSIAQO4M for ; Mon, 22 Dec 2025 04:57:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404658; bh=PXiNyOBWov48H3LT2X3q5ioyoOJj0pKiRmTN33Y/Csc=; 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=arKpdkZlTk/85M5YVfuEzNQZ9WdPlvzTPoJNB7OFHvQOjXA+sVEW6ScIdZJlRjI6J hkXahW4YYvmnvw0e8+utjFljD9DnAbBr9USQTwalsBT+E1/sNbD4kjribk5rPMigeI ZZzaueP/iEFpOQ0DSb/2MCs/bH47r1pPjSH8a5FmmeseGb20mN4Qu2sGpXZi1mTgsD eLK5KY0F5/ILTGrKpITY0ZsI7+0CHobzLQVQiHucI8NPKRprcA6ZWY6Ow41WmzMXgY XFI0E4w3I1w4aArZmPVNK3CR09TecJX+3Wlu9K98qnE++nFf34JXzVStGYxpIlmIA9 N0pz45D/43pCA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C10C464D38 for ; Mon, 22 Dec 2025 04:57:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404657; bh=6Jmf2UhYWg5v0hdSj55q0EIDHsyhiDL1O7YHr+WUfXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vQav1/2f+ilK2neCvTKg7bsdj2/Uv4790ZQJek+owS5szJfpLz5iE+e3sBp8bXoex uKInaIqY2We0gjP0Kef0F1lNbViQR8r2f/257+Wsq7SLRCYM0wWUU0IzROzu71mNnl SPOtnbngR0Zjb2QY5PtLfYb2sr3ILeaaTizxbPcor6SbPjAruuECrle+tAsXuYZbLC 1XUapkwnAnSreUJ8czngGW78hTXPwcaocMORPFT//1nWuNHiWcZTRtei23HwjGbXas z57bJyhZLH1EHTIG6iAgNaDI27NDXrUvt3BFvqFRIOgMBcXZ1UEBmpGV3ecgzM6Wdz nH0L8T0tnMIGQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AAE8E64D62; Mon, 22 Dec 2025 04:57:37 -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 ISMsLyRmEp6A; Mon, 22 Dec 2025 04:57:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404652; bh=HlTM6S9WkHGZBecrHGegLW92rXbkYs3ZIcPZ7ZSQwY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rhByQZgTFHSgiJY1Kenw7rKqHjG6mJNSaatyCjTDGgw7ntogs3I/AGnaMcznd5Y9/ lHAkjkXiy9DpY1wOMbEKkU/fV3xJCgQGHN747OxDgrOLcaon1vSOJP5LINOXG+R/a8 py17/J1EdC5EIT4CxRosadKC4t45jLmp/AOP5dUtaxrlJq8PQnMT6SaFGNuWry0EKx +b40hGSkiXPPOz1fP2/YxSNuJPyB5ytNV1Zm68tpQoocC8r3upcEYzYphL8LavaWtb /TyE4NlxUNzL7yPWgkoBKtrAfTA0ftg+/mtITjpGwmxENnyV59L4U9s7DqFumFJY1Y AhqYxsk2Yh7PA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BA63964CCE; Mon, 22 Dec 2025 04:57:31 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:21 -0700 Message-ID: <20251222115639.700578-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VNIOP7I3CLYSB33QBWAYNQ3333QB3WIB X-Message-ID-Hash: VNIOP7I3CLYSB33QBWAYNQ3333QB3WIB 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 17/26] fs: ext4l: Allocate ext4_fs_context 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 allocation of ext4_fs_context structure which holds mount options and will be needed for mounting the filesystem. Move struct ext4_fs_context definition from super.c to ext4.h so it can be used by interface.c. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4.h | 29 +++++++++++++++++++++++++++++ fs/ext4l/interface.c | 17 ++++++++++++++++- fs/ext4l/super.c | 31 +------------------------------ 3 files changed, 46 insertions(+), 31 deletions(-) diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 8fed7194d84..5c37fcd76f9 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -2962,6 +2962,35 @@ extern int __init ext4_init_mballoc(void); extern void ext4_exit_mballoc(void); extern int __init ext4_init_es(void); extern void ext4_exit_es(void); + +struct ext4_fs_context { + char *s_qf_names[EXT4_MAXQUOTAS]; + struct fscrypt_dummy_policy dummy_enc_policy; + int s_jquota_fmt; + unsigned short qname_spec; + unsigned long vals_s_flags; + unsigned long mask_s_flags; + unsigned long journal_devnum; + unsigned long s_commit_interval; + unsigned long s_stripe; + unsigned int s_inode_readahead_blks; + unsigned int s_want_extra_isize; + unsigned int s_li_wait_mult; + unsigned int s_max_dir_size_kb; + unsigned int journal_ioprio; + unsigned int vals_s_mount_opt; + unsigned int mask_s_mount_opt; + unsigned int vals_s_mount_opt2; + unsigned int mask_s_mount_opt2; + unsigned int opt_flags; + unsigned int spec; + u32 s_max_batch_time; + u32 s_min_batch_time; + kuid_t s_resuid; + kgid_t s_resgid; + ext4_fsblk_t s_sb_block; +}; + extern ext4_group_t ext4_mb_prefetch(struct super_block *sb, ext4_group_t group, unsigned int nr, int *cnt); diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index b653b7ef981..20fdf3c908c 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -26,6 +26,7 @@ static struct disk_partition ext4l_part; int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { + struct ext4_fs_context *ctx; struct super_block *sb; struct fs_context *fc; loff_t part_offset; @@ -82,10 +83,21 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, goto err_free_mapping; } + /* Allocate ext4_fs_context */ + ctx = kzalloc(sizeof(struct ext4_fs_context), GFP_KERNEL); + if (!ctx) { + ret = -ENOMEM; + goto err_free_fc; + } + + /* Initialise fs_context fields */ + fc->fs_private = ctx; + fc->sb_flags |= SB_I_VERSION; + buf = malloc(BLOCK_SIZE + 512); if (!buf) { ret = -ENOMEM; - goto err_free_fc; + goto err_free_ctx; } /* Calculate partition offset in bytes */ @@ -113,6 +125,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, memcpy(&ext4l_part, fs_partition, sizeof(ext4l_part)); free(buf); + kfree(ctx); kfree(fc); kfree(sb->s_bdev->bd_mapping); kfree(sb->s_bdev); @@ -122,6 +135,8 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, err_free_buf: free(buf); +err_free_ctx: + kfree(ctx); err_free_fc: kfree(fc); err_free_mapping: diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index 2a67c6d8156..af5b9b1986d 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -1926,36 +1926,7 @@ ext4_sb_read_encoding(const struct ext4_super_block *es) #define EXT4_SPEC_s_sb_block (1 << 18) #define EXT4_SPEC_mb_optimize_scan (1 << 19) -struct ext4_fs_context { - char *s_qf_names[EXT4_MAXQUOTAS]; - struct fscrypt_dummy_policy dummy_enc_policy; - int s_jquota_fmt; /* Format of quota to use */ -#ifdef CONFIG_EXT4_DEBUG - int s_fc_debug_max_replay; -#endif - unsigned short qname_spec; - unsigned long vals_s_flags; /* Bits to set in s_flags */ - unsigned long mask_s_flags; /* Bits changed in s_flags */ - unsigned long journal_devnum; - unsigned long s_commit_interval; - unsigned long s_stripe; - unsigned int s_inode_readahead_blks; - unsigned int s_want_extra_isize; - unsigned int s_li_wait_mult; - unsigned int s_max_dir_size_kb; - unsigned int journal_ioprio; - unsigned int vals_s_mount_opt; - unsigned int mask_s_mount_opt; - unsigned int vals_s_mount_opt2; - unsigned int mask_s_mount_opt2; - unsigned int opt_flags; /* MOPT flags */ - unsigned int spec; - u32 s_max_batch_time; - u32 s_min_batch_time; - kuid_t s_resuid; - kgid_t s_resgid; - ext4_fsblk_t s_sb_block; -}; +/* struct ext4_fs_context is defined in ext4.h */ static void ext4_fc_free(struct fs_context *fc) { From patchwork Mon Dec 22 11:56:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1048 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=1766404663; bh=SyPPAQSdnvkGFeYuld9xZ2WRHRbVwn2Op4EJeBrIbGU=; 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=ZI9tJWZv07hFNIoPkaZQlFSYLVeuu7tPnZunW1M3mGv3ZAldmIKS52u/jAasFoXnR WYZHbBTQetDmZ4KY+mZ/4Q1pezFhtvEiJfiigMURvgZYfxQFiC+w2sXl+LA1CyBDsf NjSh/6xKkSY+fxLjDkbs3XB3kVPmHhZBKo/9X5f5zl0o2xfp5eHT5g4RVRz5ztNSgP 8wk5kf+b6Xm5gvokuNEh4WyelVzFMKXf2h3O3FHigt1IIToMIXsHMhdEe9r/Qbe/xl sBy42BWEb8KbhWE7NZ+227lxJuyJ3dTgSzH/sgUViQfstykoJk2kOZHtWNWJDE19AJ Z/Gm6Ig1TgkiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8030764C31 for ; Mon, 22 Dec 2025 04:57:43 -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 ZL5x5tTxbt5C for ; Mon, 22 Dec 2025 04:57:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404663; bh=SyPPAQSdnvkGFeYuld9xZ2WRHRbVwn2Op4EJeBrIbGU=; 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=ZI9tJWZv07hFNIoPkaZQlFSYLVeuu7tPnZunW1M3mGv3ZAldmIKS52u/jAasFoXnR WYZHbBTQetDmZ4KY+mZ/4Q1pezFhtvEiJfiigMURvgZYfxQFiC+w2sXl+LA1CyBDsf NjSh/6xKkSY+fxLjDkbs3XB3kVPmHhZBKo/9X5f5zl0o2xfp5eHT5g4RVRz5ztNSgP 8wk5kf+b6Xm5gvokuNEh4WyelVzFMKXf2h3O3FHigt1IIToMIXsHMhdEe9r/Qbe/xl sBy42BWEb8KbhWE7NZ+227lxJuyJ3dTgSzH/sgUViQfstykoJk2kOZHtWNWJDE19AJ Z/Gm6Ig1TgkiA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6E12664CCE for ; Mon, 22 Dec 2025 04:57:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404661; bh=1CS+jhTbGi9wTtWQKlbEXh8Ts8GUuXqRCcB/VtlbNEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGgWKHvBdGO9oSFgdNniisgocm0CpyDgV4WNPyccITgx6DPQdVtfz8dQ+HRL7Ejaa z3uKzbkLjhkTionqXYTQMDJG4E3Qcp4u5JKYvsicPgaZw7XGiUn5pjs5vjS/EbklJ6 s4/kBpikplKmJ+wSTbvQZiH9Q+mJ/k040GOtbXD6P7p41VKnAc6laClhUwklSr558Z GNcHgOFTQwqo4FP959Xjyrcup8J9XNRZEW8YvQbTWMZBNZvw4GPsRjxktEoU2nFyXf q6P8Ff19zXGnStgxS4nUpoo0xV+2NEkQROiyG+uSUaaAFN0Z7iwXZorfUhVgrjDoGS uW+Gs9aFNrkcg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 69AA664D38; Mon, 22 Dec 2025 04:57:41 -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 JlXKQG_aAWsy; Mon, 22 Dec 2025 04:57:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404656; bh=oDQbnKuh1burUlDasfVm67OfM6Yu7p1sC+4sj4YA510=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9RBuNx1rmrCGbBKShpC5RC/Auzta7rMxLAsu5ltmrOrJ3DK5H28aRadDl4hyFSaj u6fksK2kprWd6tRDmUeHVU/L4+z3aXvoIGkcs5NTqp4NTJ732IENFufe3frmPJmkjb YqnEDjuU4+BaxROvRIoSz/x0TL4df7849djMF7meZ8YvO0q8EPFZRPm8UBTyNDTvcy cYi0HYndfLnIZ4BeGhunNZvip4fpSjoK45ntQBDiHXNqNz0gP8BFBD6f4oFEyhkSbM 8eH5DCreUGhN9NS2ZrUWNckc3rq74i0ozDyKJIfetm1VeLiRk1RAORN9NAF2uxYw4E /NxCeb2GmowYg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5698F64C31; Mon, 22 Dec 2025 04:57:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:22 -0700 Message-ID: <20251222115639.700578-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HQHAX47FKTPKJIJD6VSYMTVHN4PHWGL6 X-Message-ID-Hash: HQHAX47FKTPKJIJD6VSYMTVHN4PHWGL6 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 18/26] fs: ext4l: Initialise super_block and call ext4_fill_super() 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 Set up essential super_block fields after allocation: - Link bd_super back to super_block - Set initial blocksize to 1024 (will be updated by ext4_fill_super) - Clear flags for read-write mount - Clear s_fs_info (will be set by ext4_fill_super) Add the call to ext4_fill_super() which performs the actual filesystem mount. This requires making ext4_fill_super() non-static in super.c. Also fix an uninitialised variable warning in ext4_journalled_submit_inode_data_buffers(). Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 9 ++++++--- fs/ext4l/extents_status.c | 5 ++++- fs/ext4l/interface.c | 22 ++++++++++++++++------ fs/ext4l/super.c | 4 ++-- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1f823ba6ea3..7c65aa8567e 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -457,8 +457,8 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* Memory allocation - use linux/slab.h which is already available */ #include -/* KMEM_CACHE macro - not in U-Boot's slab.h */ -#define KMEM_CACHE(s, flags) ((struct kmem_cache *)1) +/* KMEM_CACHE macro - use kmem_cache_create */ +#define KMEM_CACHE(s, flags) kmem_cache_create(#s, sizeof(struct s), 0, flags, NULL) /* RB tree operations - stubs */ #define rb_entry(ptr, type, member) \ @@ -650,7 +650,7 @@ struct super_block { struct rw_semaphore s_umount; struct sb_writers s_writers; struct block_device *s_bdev; - const char *s_id; + char s_id[32]; struct dentry *s_root; uuid_t s_uuid; struct file_system_type *s_type; @@ -2026,6 +2026,9 @@ struct fs_context { bool silent; }; +/* ext4 superblock initialisation */ +int ext4_fill_super(struct super_block *sb, struct fs_context *fc); + /* fs_parameter stubs */ struct fs_parameter { const char *key; diff --git a/fs/ext4l/extents_status.c b/fs/ext4l/extents_status.c index 485f3a2f5cc..a3ab26624e7 100644 --- a/fs/ext4l/extents_status.c +++ b/fs/ext4l/extents_status.c @@ -197,7 +197,10 @@ int __init ext4_init_es(void) void ext4_exit_es(void) { - kmem_cache_destroy(ext4_es_cachep); + if (ext4_es_cachep) { + kmem_cache_destroy(ext4_es_cachep); + ext4_es_cachep = NULL; + } } void ext4_es_init_tree(struct ext4_es_tree *tree) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 20fdf3c908c..4652f8c835f 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -76,6 +76,15 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, goto err_free_bdev; } + /* Initialise super_block fields */ + sb->s_bdev->bd_super = sb; + sb->s_blocksize = 1024; + sb->s_blocksize_bits = 10; + snprintf(sb->s_id, sizeof(sb->s_id), "ext4l_mmc%d", + fs_dev_desc->devnum); + sb->s_flags = 0; + sb->s_fs_info = NULL; + /* Allocate fs_context */ fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL); if (!fc) { @@ -93,6 +102,7 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, /* Initialise fs_context fields */ fc->fs_private = ctx; fc->sb_flags |= SB_I_VERSION; + fc->root = (struct dentry *)sb; /* Hack: store sb for ext4_fill_super */ buf = malloc(BLOCK_SIZE + 512); if (!buf) { @@ -119,17 +129,17 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, goto err_free_buf; } + free(buf); + /* Save device info for later operations */ ext4l_dev_desc = fs_dev_desc; if (fs_partition) memcpy(&ext4l_part, fs_partition, sizeof(ext4l_part)); - free(buf); - kfree(ctx); - kfree(fc); - kfree(sb->s_bdev->bd_mapping); - kfree(sb->s_bdev); - kfree(sb); + /* Mount the filesystem */ + ret = ext4_fill_super(sb, fc); + if (ret) + goto err_free_ctx; return 0; diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index af5b9b1986d..f986ca6e0b6 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -526,7 +526,7 @@ static int ext4_journalled_submit_inode_data_buffers(struct jbd2_inode *jinode) .range_end = jinode->i_dirty_end, }; struct folio *folio = NULL; - int error; + int error = 0; /* * writeback_iter() already checks for dirty pages and calls @@ -5654,7 +5654,7 @@ out_fail: return err; } -static int ext4_fill_super(struct super_block *sb, struct fs_context *fc) +int ext4_fill_super(struct super_block *sb, struct fs_context *fc) { struct ext4_fs_context *ctx = fc->fs_private; struct ext4_sb_info *sbi; From patchwork Mon Dec 22 11:56:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1049 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=1766404665; bh=76CGbE8gV+USdUz7SnXuSrh5Z40LvTbrjcnWQXdJWk4=; 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=KtQkKlV72kr84vTw6MNMlcY1wVjLbRs9Te/b2OuXUO3bEBqRg+xp+ftfGri28u8on sonhEoVBD64EhWiHgYWb2O2R4d8MZTTiWHExK2DLuN0Z2s+Ya0dftBj/kalsNv4nN2 g+ueDPywDD179oagaLJr+4ZpsYrvilzN/UDysTitrqE3E9WUcM9FdZz0S/cx/AKISH hOnjLq/litEtiEMsMzgKAKNPC4qS5T2g9QVDi8CLdE10zMz/HZXK2rq3/PtK7vIQV/ jyuELQIRS8E6jWwOTNKf5J547Hd56j1uoBSXio287vhnm+BIuOE9LcbPRDiaeZRmHA Ao58PFdAblHBg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA01264D75 for ; Mon, 22 Dec 2025 04:57:45 -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 oe9yGYjr56_9 for ; Mon, 22 Dec 2025 04:57:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404663; bh=76CGbE8gV+USdUz7SnXuSrh5Z40LvTbrjcnWQXdJWk4=; 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=JGMLUh2PuWBnJngw1ARognP58PzJEZNgnWCJhW12aHEOut+zg8qofRRwuSH2Kvenq JzB5lmb2bqIL2mv3JDHfFpnmkk3HV6knhBnjxVLQocWDjCXYrQ8Fw8sus+yY5EIJJI EwkQL6CYrS/8sSa5Q5PcS6IRlTELb1rJ/B7ybsI+RayNJAD9RqnXwko0A+gTtPSMvw X+whLEw2Z4Srx6kJjc3U+u696j48OZoe9hZ7ghZakQtDVLg+a46+SmxL9b+JaSFNqn XtR3/BcA2sr9UXchq/9sUkOsHn6IDvDX+bmukYONroSzk8TizFb4qS7whqCgUA0BFq gmtJEIE08exsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F0E7864CCE for ; Mon, 22 Dec 2025 04:57:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404661; bh=lwRi0A8IX/fQTM8XuEhv297Petq1kWgUvhDQJQpU3bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XrJudCT2nL+VcuEU35LnFqQpVajYTNTuTw59hdXRT27F3l7VKEP0SlPXRsebNhKNT hCriPUpSFhctf5FRa7glNSLumbDPFeqR7xTlKsEmDaS7+1m5vAR0LpeWZYeDqlgN9w I+Fgvm+N2Roy6RubJkoUrFFyqol341JeQ3kLEtCDY3TmykS2LXVXph59UewIO9dBYS +btLlAYJcBKISXIfeueFuXMLNYkUywAwwM37F1lMAZsX5ID2Fr4Zm8gFivzx0W3J9q ZExC/kBPkdS8IrJIep7/HQARWNIjZ0Ws4p1a+Jj9B1EXrRrGncCmOznn3lblVY5qIG HbqxBzT7wQ7zQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E1C3064C31; Mon, 22 Dec 2025 04:57:41 -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 pc4lsv1ofeiU; Mon, 22 Dec 2025 04:57:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404661; bh=03ruZr2QkXIJNYfObcHs3ihzCulHKm6P6azSUWgkTFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAFkG5BZ6oQLlnAV7Ny+7RhRTvq8vvRbF2qa/+6hCw88EciWLGO6nSBoX4Msk9gtp BN5vT6jWpvsmRXLyKy9Lk1XQ0wq5NPJXq/FkCSI9EMWYc34IHHRZxBo4LMP+E2knOi akl0SultmMNRNI07zMewgCbWbxj5ApROuGhrJi7FqBMMkXRk5ZV1mvBom607h4kDZi BVILiTsatUwA9tKdgpXhLMuLHf2mbGjHBKOIXOgC7FeMcDd6ciiOiupVF//2fkbLd0 7FR2t0VvGvENNB5448wllpP1Y9WGIEVbczAuBIy0X3rcCyv6Uf8hALgGQUOjgIo7Kz 2g+Jdi6o9rn+g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EEC665FB5A; Mon, 22 Dec 2025 04:57:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:23 -0700 Message-ID: <20251222115639.700578-20-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KZKQPFM44FW22IQ3XPPCRBEEJDWHVNCL X-Message-ID-Hash: KZKQPFM44FW22IQ3XPPCRBEEJDWHVNCL 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 19/26] fs: ext4l: Add buffer_head I/O infrastructure 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 support.c with buffer_head I/O infrastructure for ext4l: - Buffer cache for caching buffer_heads across lookups - Buffer allocation/free functions - Block I/O functions (sb_getblk, sb_bread, brelse, submit_bh, bh_read) This keeps interface.c focused on the U-Boot filesystem layer interface. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 36 ++- fs/ext4l/interface.c | 60 ++++- fs/ext4l/stub.c | 18 +- fs/ext4l/support.c | 428 ++++++++++++++++++++++++++++++++++++ include/linux/buffer_head.h | 8 +- 6 files changed, 528 insertions(+), 24 deletions(-) create mode 100644 fs/ext4l/support.c diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index e99b900ca6d..7bb843c3fad 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -3,7 +3,7 @@ # Makefile for the ext4l filesystem (Linux port) # -obj-y := interface.o stub.o +obj-y := interface.o support.o stub.o obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ extents_status.o file.o fsmap.o fsync.o hash.o ialloc.o \ diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 7c65aa8567e..dfa362389a8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -313,9 +313,9 @@ extern struct user_namespace init_user_ns; #define __bforget(bh) do { } while (0) #define mark_buffer_dirty_inode(bh, i) do { } while (0) #define mark_buffer_dirty(bh) do { } while (0) -#define lock_buffer(bh) do { } while (0) -#define unlock_buffer(bh) do { } while (0) -#define sb_getblk(sb, block) ((struct buffer_head *)NULL) +#define lock_buffer(bh) set_buffer_locked(bh) +#define unlock_buffer(bh) clear_buffer_locked(bh) +struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); #define test_clear_buffer_dirty(bh) ({ (void)(bh); 0; }) #define wait_on_bit_io(addr, bit, mode) do { (void)(addr); (void)(bit); (void)(mode); } while (0) @@ -1026,7 +1026,7 @@ static inline unsigned long memweight(const void *ptr, size_t bytes) #define rwsem_is_locked(sem) (1) /* Buffer operations */ -#define sb_getblk_gfp(sb, blk, gfp) ((struct buffer_head *)NULL) +#define sb_getblk_gfp(sb, blk, gfp) sb_getblk((sb), (blk)) #define bh_uptodate_or_lock(bh) (1) /* ext4_read_bh is stubbed in interface.c */ @@ -1870,7 +1870,14 @@ struct file_system_type { #define FS_ALLOW_IDMAP 32 /* Buffer read sync */ -#define end_buffer_read_sync NULL +static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) +{ + if (uptodate) + set_buffer_uptodate(bh); + else + clear_buffer_uptodate(bh); + unlock_buffer(bh); +} #define REQ_OP_READ 0 /* Superblock flags */ @@ -2377,7 +2384,7 @@ void dquot_free_block(struct inode *inode, loff_t nr); /* Block device file operations - stubs */ #define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) -#define __bread(bdev, block, size) ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) +struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned size); /* Trace stubs for super.c */ #define trace_ext4_sync_fs(sb, wait) do { (void)(sb); (void)(wait); } while (0) @@ -2823,7 +2830,16 @@ struct wait_bit_entry { #define filemap_fdatawait_range_keep_errors(m, s, e) \ ({ (void)(m); (void)(s); (void)(e); 0; }) #define crc32_be(crc, p, len) crc32(crc, p, len) -#define free_buffer_head(bh) kfree(bh) +void free_buffer_head(struct buffer_head *bh); + +/* ext4l support functions (support.c) */ +void bh_cache_clear(void); +int ext4l_read_block(sector_t block, size_t size, void *buffer); + +/* ext4l interface functions (interface.c) */ +struct blk_desc *ext4l_get_blk_dev(void); +struct disk_partition *ext4l_get_partition(void); + #define sb_is_blkdev_sb(sb) ({ (void)(sb); 0; }) /* DEFINE_WAIT stub - creates a wait queue entry */ @@ -2850,7 +2866,7 @@ struct wait_bit_entry { #define trace_jbd2_lock_buffer_stall(...) do { } while (0) /* JBD2 journal.c stubs */ -#define alloc_buffer_head(gfp) ((struct buffer_head *)kzalloc(sizeof(struct buffer_head), gfp)) +struct buffer_head *alloc_buffer_head(gfp_t gfp_mask); #define __getblk(bdev, block, size) ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) #define bmap(inode, block) ({ (void)(inode); (void)(block); 0; }) #define trace_jbd2_update_log_tail(j, t, b, f) \ @@ -2897,8 +2913,8 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); do { (void)(j); (void)(f); } while (0) /* 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) +int bh_read(struct buffer_head *bh, int flags); +#define bh_read_nowait(bh, flags) bh_read(bh, flags) #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) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 4652f8c835f..e1458ea6bfe 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -5,13 +5,13 @@ * Copyright 2025 Canonical Ltd * Written by Simon Glass * - * This provides the minimal interface between U-Boot and the ext4l driver. + * This provides the interface between U-Boot's filesystem layer and + * the ext4l driver. */ #include #include #include -#include #include #include #include @@ -23,6 +23,58 @@ static struct blk_desc *ext4l_dev_desc; static struct disk_partition ext4l_part; +/* Global block device tracking for buffer I/O */ +static struct blk_desc *ext4l_blk_dev; +static struct disk_partition ext4l_partition; +static int ext4l_mounted; + +/** + * ext4l_get_blk_dev() - Get the current block device + * Return: Block device descriptor or NULL if not mounted + */ +struct blk_desc *ext4l_get_blk_dev(void) +{ + if (!ext4l_mounted) + return NULL; + return ext4l_blk_dev; +} + +/** + * ext4l_get_partition() - Get the current partition info + * Return: Partition info pointer + */ +struct disk_partition *ext4l_get_partition(void) +{ + return &ext4l_partition; +} + +/** + * ext4l_set_blk_dev() - Set the block device for ext4l operations + * @blk_dev: Block device descriptor + * @partition: Partition info (can be NULL for whole disk) + */ +void ext4l_set_blk_dev(struct blk_desc *blk_dev, struct disk_partition *partition) +{ + ext4l_blk_dev = blk_dev; + if (partition) + memcpy(&ext4l_partition, partition, sizeof(struct disk_partition)); + else + memset(&ext4l_partition, 0, sizeof(struct disk_partition)); + ext4l_mounted = 1; +} + +/** + * ext4l_clear_blk_dev() - Clear block device (unmount) + */ +void ext4l_clear_blk_dev(void) +{ + /* Clear buffer cache before unmounting */ + bh_cache_clear(); + + ext4l_blk_dev = NULL; + ext4l_mounted = 0; +} + int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { @@ -37,6 +89,9 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, if (!fs_dev_desc) return -EINVAL; + /* Set up block device for buffer I/O */ + ext4l_set_blk_dev(fs_dev_desc, fs_partition); + /* Initialise journal subsystem if enabled */ if (IS_ENABLED(CONFIG_EXT4_JOURNAL)) { ret = jbd2_journal_init_global(); @@ -162,5 +217,6 @@ err_exit_es: void ext4l_close(void) { + ext4l_clear_blk_dev(); ext4l_dev_desc = NULL; } diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index e13685bf8fa..eff54bb540c 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -309,20 +309,14 @@ void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, return ERR_PTR(-ENODEV); } -struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, - unsigned int size, gfp_t gfp) -{ - return NULL; -} +/* bdev_getblk implemented in interface.c */ int trylock_buffer(struct buffer_head *bh) { return 1; } -void submit_bh(int op, struct buffer_head *bh) -{ -} +/* submit_bh implemented in interface.c */ /* NFS export stubs */ struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, @@ -519,6 +513,14 @@ void fs_put_dax(void *dax, void *holder) /* Block size */ int sb_set_blocksize(struct super_block *sb, int size) { + /* Validate block size */ + if (size != 1024 && size != 2048 && size != 4096) + return 0; + + /* Update superblock fields */ + sb->s_blocksize = size; + sb->s_blocksize_bits = ffs(size) - 1; + return size; } diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c new file mode 100644 index 00000000000..0765065a99f --- /dev/null +++ b/fs/ext4l/support.c @@ -0,0 +1,428 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Internal support functions for ext4l filesystem + * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + * + * This provides internal support functions for the ext4l driver, + * including buffer_head I/O and buffer cache. + */ + +#include +#include +#include +#include +#include + +#include "ext4_uboot.h" +#include "ext4.h" + +/* + * Buffer cache implementation + * + * Linux's sb_getblk() returns the same buffer_head for the same block number, + * allowing flags like BH_Verified, BH_Uptodate, etc. to persist across calls. + * This is critical for ext4's bitmap validation which sets buffer_verified() + * and expects it to remain set on subsequent lookups. + */ +#define BH_CACHE_BITS 8 +#define BH_CACHE_SIZE (1 << BH_CACHE_BITS) +#define BH_CACHE_MASK (BH_CACHE_SIZE - 1) + +struct bh_cache_entry { + struct buffer_head *bh; + struct bh_cache_entry *next; +}; + +static struct bh_cache_entry *bh_cache[BH_CACHE_SIZE]; + +static inline unsigned int bh_cache_hash(sector_t block) +{ + return (unsigned int)(block & BH_CACHE_MASK); +} + +/** + * bh_cache_lookup() - Look up a buffer in the cache + * @block: Block number to look up + * @size: Expected block size + * Return: Buffer head if found with matching size, NULL otherwise + */ +static struct buffer_head *bh_cache_lookup(sector_t block, size_t size) +{ + unsigned int hash = bh_cache_hash(block); + struct bh_cache_entry *entry; + + for (entry = bh_cache[hash]; entry; entry = entry->next) { + if (entry->bh && entry->bh->b_blocknr == block && + entry->bh->b_size == size) { + atomic_inc(&entry->bh->b_count); + return entry->bh; + } + } + return NULL; +} + +/** + * bh_cache_insert() - Insert a buffer into the cache + * @bh: Buffer head to insert + */ +static void bh_cache_insert(struct buffer_head *bh) +{ + unsigned int hash = bh_cache_hash(bh->b_blocknr); + struct bh_cache_entry *entry; + + /* Check if already in cache */ + for (entry = bh_cache[hash]; entry; entry = entry->next) { + if (entry->bh && entry->bh->b_blocknr == bh->b_blocknr) + return; /* Already cached */ + } + + entry = malloc(sizeof(struct bh_cache_entry)); + if (!entry) + return; /* Silently fail - cache is optional */ + + entry->bh = bh; + entry->next = bh_cache[hash]; + bh_cache[hash] = entry; + + /* Add a reference to keep the buffer alive in cache */ + atomic_inc(&bh->b_count); +} + +/** + * bh_cache_clear() - Clear the entire buffer cache + * + * Called on unmount to free all cached buffers. + */ +void bh_cache_clear(void) +{ + int i; + struct bh_cache_entry *entry, *next; + + for (i = 0; i < BH_CACHE_SIZE; i++) { + for (entry = bh_cache[i]; entry; entry = next) { + next = entry->next; + if (entry->bh) { + /* Release the cache's reference */ + if (atomic_dec_and_test(&entry->bh->b_count)) + free_buffer_head(entry->bh); + } + free(entry); + } + bh_cache[i] = NULL; + } +} + +/** + * alloc_buffer_head() - Allocate a buffer_head structure + * @gfp_mask: Allocation flags (ignored in U-Boot) + * Return: Pointer to buffer_head or NULL on error + */ +struct buffer_head *alloc_buffer_head(gfp_t gfp_mask) +{ + struct buffer_head *bh; + + bh = malloc(sizeof(struct buffer_head)); + if (!bh) + return NULL; + + memset(bh, 0, sizeof(struct buffer_head)); + + /* Note: b_data will be allocated when needed by read functions */ + atomic_set(&bh->b_count, 1); + + return bh; +} + +/** + * alloc_buffer_head_with_data() - Allocate a buffer_head with data buffer + * @size: Size of the data buffer to allocate + * Return: Pointer to buffer_head or NULL on error + */ +static struct buffer_head *alloc_buffer_head_with_data(size_t size) +{ + struct buffer_head *bh; + + bh = malloc(sizeof(struct buffer_head)); + if (!bh) + return NULL; + + memset(bh, 0, sizeof(struct buffer_head)); + + bh->b_data = malloc(size); + if (!bh->b_data) { + free(bh); + return NULL; + } + + bh->b_size = size; + /* Allocate a folio for kmap_local_folio() to work */ + bh->b_folio = malloc(sizeof(struct folio)); + if (bh->b_folio) { + memset(bh->b_folio, 0, sizeof(struct folio)); + bh->b_folio->data = bh->b_data; + } + atomic_set(&bh->b_count, 1); + /* Mark that this buffer owns its b_data and should free it */ + set_bit(BH_OwnsData, &bh->b_state); + + return bh; +} + +/** + * free_buffer_head() - Free a buffer_head + * @bh: Buffer head to free + * + * Only free b_data if BH_OwnsData is set. Shadow buffers created by + * jbd2_journal_write_metadata_buffer() share b_data with the original + * buffer and should not free it. + */ +void free_buffer_head(struct buffer_head *bh) +{ + if (!bh) + return; + + /* Only free b_data if this buffer owns it */ + if (bh->b_data && test_bit(BH_OwnsData, &bh->b_state)) + free(bh->b_data); + if (bh->b_folio) + free(bh->b_folio); + free(bh); +} + +/** + * ext4l_read_block() - Read a block from the block device + * @block: Block number (filesystem block, not sector) + * @size: Block size in bytes + * @buffer: Destination buffer + * Return: 0 on success, negative on error + */ +int ext4l_read_block(sector_t block, size_t size, void *buffer) +{ + struct blk_desc *blk_dev; + struct disk_partition *part; + lbaint_t sector; + lbaint_t sector_count; + unsigned long n; + + blk_dev = ext4l_get_blk_dev(); + part = ext4l_get_partition(); + if (!blk_dev) + return -EIO; + + /* Convert block to sector */ + sector = (block * size) / blk_dev->blksz + part->start; + sector_count = size / blk_dev->blksz; + + if (sector_count == 0) + sector_count = 1; + + n = blk_dread(blk_dev, sector, sector_count, buffer); + if (n != sector_count) + return -EIO; + + return 0; +} + +/** + * sb_getblk() - Get a buffer, using cache if available + * @sb: Super block + * @block: Block number + * Return: Buffer head or NULL on error + */ +struct buffer_head *sb_getblk(struct super_block *sb, sector_t block) +{ + struct buffer_head *bh; + + if (!sb) + return NULL; + + /* Check cache first - must match block number AND size */ + bh = bh_cache_lookup(block, sb->s_blocksize); + if (bh) + return bh; + + /* Allocate new buffer */ + bh = alloc_buffer_head_with_data(sb->s_blocksize); + if (!bh) + return NULL; + + bh->b_blocknr = block; + bh->b_bdev = sb->s_bdev; + bh->b_size = sb->s_blocksize; + + /* Don't read - just allocate with zeroed data */ + memset(bh->b_data, '\0', bh->b_size); + + /* Add to cache */ + bh_cache_insert(bh); + + return bh; +} + +/** + * sb_bread() - Read a block via super_block + * @sb: Super block + * @block: Block number to read + * Return: Buffer head or NULL on error + */ +struct buffer_head *sb_bread(struct super_block *sb, sector_t block) +{ + struct buffer_head *bh; + int ret; + + if (!sb) + return NULL; + + bh = sb_getblk(sb, block); + if (!bh) + return NULL; + + /* If buffer is already up-to-date, return it without re-reading */ + if (buffer_uptodate(bh)) + return bh; + + bh->b_blocknr = block; + bh->b_bdev = sb->s_bdev; + bh->b_size = sb->s_blocksize; + + ret = ext4l_read_block(block, sb->s_blocksize, bh->b_data); + if (ret) { + brelse(bh); + return NULL; + } + + /* Mark buffer as up-to-date */ + set_buffer_uptodate(bh); + + return bh; +} + +/** + * brelse() - Release a buffer_head + * @bh: Buffer head to release + */ +void brelse(struct buffer_head *bh) +{ + if (!bh) + return; + + if (atomic_dec_and_test(&bh->b_count)) + free_buffer_head(bh); +} + +/** + * __brelse() - Release a buffer_head (alternate API) + * @bh: Buffer head to release + */ +void __brelse(struct buffer_head *bh) +{ + brelse(bh); +} + +/** + * bdev_getblk() - Get buffer via block_device + * @bdev: Block device + * @block: Block number + * @size: Block size + * @gfp: Allocation flags + * Return: Buffer head or NULL + */ +struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, + unsigned size, gfp_t gfp) +{ + struct buffer_head *bh; + + /* Check cache first - must match block number AND size */ + bh = bh_cache_lookup(block, size); + if (bh) + return bh; + + bh = alloc_buffer_head_with_data(size); + if (!bh) + return NULL; + + bh->b_blocknr = block; + bh->b_bdev = bdev; + bh->b_size = size; + + /* Don't read - just allocate with zeroed data */ + memset(bh->b_data, 0, bh->b_size); + + /* Add to cache */ + bh_cache_insert(bh); + + return bh; +} + +/** + * __bread() - Read a block via block_device + * @bdev: Block device + * @block: Block number to read + * @size: Block size + * Return: Buffer head or NULL on error + */ +struct buffer_head *__bread(struct block_device *bdev, sector_t block, + unsigned size) +{ + struct buffer_head *bh; + int ret; + + bh = alloc_buffer_head_with_data(size); + if (!bh) + return NULL; + + bh->b_blocknr = block; + bh->b_bdev = bdev; + bh->b_size = size; + + ret = ext4l_read_block(block, size, bh->b_data); + if (ret) { + free_buffer_head(bh); + return NULL; + } + + /* Mark buffer as up-to-date */ + set_bit(BH_Uptodate, &bh->b_state); + + return bh; +} + +/** + * submit_bh() - Submit a buffer_head for I/O + * @op: Operation (REQ_OP_READ, REQ_OP_WRITE, etc.) + * @bh: Buffer head to submit + */ +void submit_bh(int op, struct buffer_head *bh) +{ + int ret; + int op_type = op & 0xff; /* Mask out flags, keep operation type */ + + if (op_type == REQ_OP_READ) { + ret = ext4l_read_block(bh->b_blocknr, bh->b_size, bh->b_data); + if (ret) { + clear_buffer_uptodate(bh); + return; + } + set_buffer_uptodate(bh); + } else if (op_type == REQ_OP_WRITE) { + /* Write support not implemented yet */ + clear_buffer_uptodate(bh); + } +} + +/** + * bh_read() - Read a buffer_head from disk + * @bh: Buffer head to read + * @flags: Read flags + * Return: 0 on success, negative on error + */ +int bh_read(struct buffer_head *bh, int flags) +{ + if (!bh || !bh->b_data) + return -EINVAL; + + submit_bh(REQ_OP_READ | flags, bh); + return buffer_uptodate(bh) ? 0 : -EIO; +} diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index b7596a74108..0f8f5b6caf1 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -40,6 +40,8 @@ enum bh_state_bits { BH_PrivateStart,/* not a state bit, but the first bit available * for private allocation by other entities */ + /* U-Boot specific: marks buffer owns b_data and should free it */ + BH_OwnsData = BH_PrivateStart, }; #define MAX_BUF_PER_PAGE (PAGE_SIZE / 512) @@ -176,8 +178,8 @@ static inline void put_bh(struct buffer_head *bh) atomic_dec(&bh->b_count); } -/* Stubs for U-Boot */ -#define brelse(bh) do { if (bh) put_bh(bh); } while (0) -#define __brelse(bh) do { put_bh(bh); } while (0) +/* Buffer release functions - implemented in ext4l/interface.c */ +void brelse(struct buffer_head *bh); +void __brelse(struct buffer_head *bh); #endif /* _LINUX_BUFFER_HEAD_H */ From patchwork Mon Dec 22 11:56:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1050 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=1766404666; bh=uBLJF2q0IfVpkEchTdxsy+UuzvlAtgJsMHCACwvnJ0M=; 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=L9P91YNgGzYkCbvRRg7uGd3mTfXB3NiRL99Yf9v4EV/q0YhZQkUPBvpJyRZblzGsP j2654tI6LDAKFFKNA7ZGm7P/mHqlWjXUYqEIf1fpIo8A2QOGYDsDDM2Tva+5zUcSHR mE1dgU2MTRBgYEXtHbpy1IRhBpXZORJe1d6rmlH7QR6u4N0Aau9167Q9xGITNR189m EtTOHy8LIIlBSIfH5SyyL1W9HHkzColiDUbWFEgbFacSu5a2THmIF1PTgi1baUX9Lq AYgvebAtGk7lv0O7TjSZ3skDsKv50yM2Kje4eaysl7HjjILIrgT1YaBTc4szdihxC0 skrTWm/27sndQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 422EC64C31 for ; Mon, 22 Dec 2025 04:57:46 -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 HoEErhQsAeRm for ; Mon, 22 Dec 2025 04:57:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404664; bh=uBLJF2q0IfVpkEchTdxsy+UuzvlAtgJsMHCACwvnJ0M=; 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=dHU3GKq4Mx3QetoutHFsHSxS/bfgu6FVOIPmDCXw9mZfQcfeowN2JZzk1F8LPDTUC dYmyDIeJdfloN4pVaC57OhYb84AKUf2m0+ujkndrMfQLRkagYyvciDMgWtM72KwIE5 haSyyYX1uKOqWTLsdV+iN+F7phg+1BGc+WvwyYlnEzxL06+5I6m4+pzazL8jkOSFJQ c4XnEOXjkDhgoVs60QNtic0SmLnRLJ/A/oqydlzX7EUTlhTWK3HnbaM7JyScfQfjYK 99cP6VIhEazFu3zFIfk1Lb8bs/0RS8WdbtH8mPsxfQtbsXmEqpGdKCXT90YowBM2Y2 6SQYVPYsVO45w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C8F5364D80 for ; Mon, 22 Dec 2025 04:57:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404662; bh=3kza/BzyOJadaYt6QUeXw+xRJQhKVtgrVix8EK6fRoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TRCjm/2OSfoREMOTfo/paL4I9ILFfcCuBMBP17nk3mQFWZ59V1qBiLxPZ11G9LJZ9 zBg3U6R9wcxdCwhotubfGJ4hfu9liVXZ2NUIwTPjk4aXGAUmrpyp2Umh3olgHvxVne JfpgHKQhZUT2WJRTHxaj1J3TcXxnGxxvVI8BnZWaA0R2QJyuXXGf5yQp4sEH46E9sQ n3WSQFtVC9j0ggq1hMrSa7aYYAyfV9UvF9YMFqK3tOjN+BzVy6fPKLo9i/ps+Jx7Au Nju2N5jnOscud1K66IT3+F9S/+A/d3O9dxkMhqmLuiklHJ2Jwx+CyGlb7dqykMh9bL ckXQGB0MjcQ7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A54B964CCE; Mon, 22 Dec 2025 04:57:42 -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 MNj1Q50SeYRl; Mon, 22 Dec 2025 04:57:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404662; bh=GLLrDQeXQidR/eh39mHUCL9q0IHynSYcVttQ53iX+64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrG2pf69omWV220Gmt4+o+EoVjfhQK+KkF0ZRQreBrxOGmz+cEbmgj3oBR0248/NE gxBOBW9kjJb/jo6fwogDpX88AcjN3fKo32J2d+ANMAZ8ThYvHl3JJPNhVnBATxW4nh hT7Zqrg+uftieZ01tp+aXyEvIbI1/CP5VEEnuPQV3ls7/eQ0w0uZongQYtTCTIldg5 N0qe/lHWq6NPpLvZd3gWjL5QqJDPRVYe6GAI9RcMPkzHY6CPFLUsrJ6LPhSKTRylCE 1DJ7Tl8pkTqWPzitCKtsZe39XgmEugUA6Z0U3uKqEiq3DOpuglSKK6/ppv5+eMe0VY lsQqFsYbmKbdg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2B00E5FB5A; Mon, 22 Dec 2025 04:57:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:24 -0700 Message-ID: <20251222115639.700578-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VJQQKHVXBSLSHNKGF3VYGRMWGYRRKPBY X-Message-ID-Hash: VJQQKHVXBSLSHNKGF3VYGRMWGYRRKPBY 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 20/26] fs: ext4l: Add CONFIG_EXT4L_DEBUG to control messages 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 a Kconfig option to control ext4_msg() output. By default, mount messages and other informational output are suppressed to reduce console noise. Enable CONFIG_EXT4L_DEBUG to restore these messages for debugging. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Kconfig | 9 +++++++++ fs/ext4l/super.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/fs/ext4l/Kconfig b/fs/ext4l/Kconfig index f1fbe3b1000..998f0f45474 100644 --- a/fs/ext4l/Kconfig +++ b/fs/ext4l/Kconfig @@ -22,3 +22,12 @@ config EXT4_JOURNAL before committing them to the filesystem. If unsure, say Y. + +config EXT4L_DEBUG + bool "Enable ext4l debug messages" + depends on FS_EXT4L + help + Enable debug and informational messages from the ext4l filesystem. + This includes mount messages and other ext4_msg() output. + + If unsure, say N. diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index f986ca6e0b6..47e0b2c92e8 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -946,6 +946,9 @@ void __ext4_msg(struct super_block *sb, struct va_format vaf; va_list args; + if (!IS_ENABLED(CONFIG_EXT4L_DEBUG)) + return; + if (sb) { atomic_inc(&EXT4_SB(sb)->s_msg_count); if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), From patchwork Mon Dec 22 11:56:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1051 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=1766404670; bh=gOnfGbwvuP0oek6I0Pr0mDpPLm1r+MAAkMPSY884oQQ=; 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=bm/fGhBfcKwmRLBpGIEd0szwKNmWIvlO5U8lSYNyR/kmu7DWThTigWuonjov5Z50t wAnP1JzjV6wOus85Bq9rBilN5jAvmLP9B3oq/fS6SRXYZm/qs8Zl5Hdc77bbpRmZyW 5fbz/jPaSUFSI7PKrvkLXHe10JKgiTcB7GMhuKsQQbzMPqm0faEjoX0RoEjR0s3lC6 tvs1pnsV66D5RulPiTh/rm/kV6l2Aj3BHU+/EtVopb3Q4gyYc1CcMqdLNBpaYI4QRu NTaU40hgfWNO0Wy5ZEgCmhOhGjCwC8PWS+oEDxpuXknuyr5kZrvRU7vBCuGywS5pQ6 5tNSq8IAcF0gw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 20BD364D70 for ; Mon, 22 Dec 2025 04:57:50 -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 zQ35Z2sfNFPP for ; Mon, 22 Dec 2025 04:57:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404670; bh=gOnfGbwvuP0oek6I0Pr0mDpPLm1r+MAAkMPSY884oQQ=; 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=bm/fGhBfcKwmRLBpGIEd0szwKNmWIvlO5U8lSYNyR/kmu7DWThTigWuonjov5Z50t wAnP1JzjV6wOus85Bq9rBilN5jAvmLP9B3oq/fS6SRXYZm/qs8Zl5Hdc77bbpRmZyW 5fbz/jPaSUFSI7PKrvkLXHe10JKgiTcB7GMhuKsQQbzMPqm0faEjoX0RoEjR0s3lC6 tvs1pnsV66D5RulPiTh/rm/kV6l2Aj3BHU+/EtVopb3Q4gyYc1CcMqdLNBpaYI4QRu NTaU40hgfWNO0Wy5ZEgCmhOhGjCwC8PWS+oEDxpuXknuyr5kZrvRU7vBCuGywS5pQ6 5tNSq8IAcF0gw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0FDE95FB5A for ; Mon, 22 Dec 2025 04:57:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404668; bh=S/7O+q2ovoOLIuQYbCNqfo145rKXaNro/IjwV466WqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TecgSx7/aLKDg1vZbXFHKxhWGZ84LZScLkwSlfZWYWcQ4lSRVjOauqXsFzYeLsulh 4apuwVQ81GMET4vhWq3RZa8MCyhW7iWgBlpMxx0G57APyZna7SikpUWrFhymLg75YV BpJGdzJlegLhW1ZTQgaNCc1pzKJXJqhtjt3DdU9qZRv14LTA9kbHblxyAecoi35mTP SssXeeGHzaVpcTxQOPWB0AQzdREfnv1lNQ1FuKVaPBXQkz9xQP9u6snkiQ9NQkA3SB Y0eZG7+qNC30KfA5amKGhjGT2ZpsOEGLiloycZXde4FdL1DfO4hdHBIqvFPHMf+ZJt YplcItyq832Yw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 813A164D6D; Mon, 22 Dec 2025 04:57:48 -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 BDQwdOYRoJO6; Mon, 22 Dec 2025 04:57:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404663; bh=pZG+H/8HdEtoIL1PEvNE5HjqcQ/+ZIf+h3u3S7T0pow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHpzfqMg4/nkKsPl/LulXoYg1OG0Y7t6DIZ6bejo0VONzvla/uce5vzYA0kFgjYv0 uLL03EFf7KES5a3oHJjJwXMecSlwpfHbF/TbSBhC7UeLdLh/t48FtWvPJ7h3iRgkOA j9bBrjtkbj/YmGXTfzv+8GMeeSj3honQoWwSZhWxAwwes692/zXTHPTNMTtF5QUjtl 5cYe6u+Cta5gdGW7NHeei+5xnaSEbJ4pmNBNFHNU06eA8JJp4NvJBB5bOU7nvnRhOC p6+N5mNcj5wBYZqRw5+RLcIRD1uW7bQ0pUeKPkd4W3mn2xxE6LekAOcCfRP0q2jBgz MdIz7pRZdEeRg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E7C4D5FB5A; Mon, 22 Dec 2025 04:57:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:25 -0700 Message-ID: <20251222115639.700578-22-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VPRLMRDJCDIDVWZNYU3HO5AREMY5N7NE X-Message-ID-Hash: VPRLMRDJCDIDVWZNYU3HO5AREMY5N7NE 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 21/26] fs: ext4l: Use real rbtree implementation 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 Replace broken rbtree stubs with the real implementation from lib/rbtree.c. The previous stubs had critical bugs: - rb_link_node() only did *(rb_link) = node without initializing rb_left and rb_right to NULL, causing crashes when traversing the extent status tree - rb_next/rb_prev were wrong (just returned right/left child) - rb_insert_color was a no-op, breaking tree balancing Include and remove the conflicting struct definitions and broken operation macros. Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index dfa362389a8..96b1c06a05b 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -34,6 +34,7 @@ #include #include #include +#include /* Real rbtree implementation */ /* * Override no_printk to avoid format warnings in disabled debug prints. @@ -87,18 +88,7 @@ typedef struct { atomic_t refs; } refcount_t; /* rwlock_t and read_lock/read_unlock are now in linux/spinlock.h */ #include -/* RB tree types - stubs */ -struct rb_node { - unsigned long __rb_parent_color; - struct rb_node *rb_right; - struct rb_node *rb_left; -}; - -struct rb_root { - struct rb_node *rb_node; -}; - -#define RB_ROOT (struct rb_root) { NULL, } +/* RB tree types - from included above */ /* percpu_counter - use Linux header */ #include @@ -460,18 +450,13 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* KMEM_CACHE macro - use kmem_cache_create */ #define KMEM_CACHE(s, flags) kmem_cache_create(#s, sizeof(struct s), 0, flags, NULL) -/* RB tree operations - stubs */ -#define rb_entry(ptr, type, member) \ - container_of(ptr, type, member) -#define rb_first(root) ((root)->rb_node) -#define rb_next(node) ((node)->rb_right) -#define rb_prev(node) ((node)->rb_left) -#define rb_insert_color(node, root) do { } while (0) -#define rb_erase(node, root) do { } while (0) -#define rb_link_node(node, parent, rb_link) do { *(rb_link) = (node); } while (0) -#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) -#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \ - for (pos = NULL, (void)(n); pos != NULL; ) +/* + * RB tree operations - use real rbtree implementation from lib/rbtree.c + * and include/linux/rbtree.h. rb_entry, rb_first, rb_next, rb_prev, + * rb_insert_color, rb_erase, rb_link_node, RB_EMPTY_ROOT, and + * rbtree_postorder_for_each_entry_safe are all provided by the real + * implementation - do not stub them! + */ /* RCU barrier - stub */ #define rcu_barrier() do { } while (0) From patchwork Mon Dec 22 11:56:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1052 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=1766404674; bh=3Eok8OAaMmmU8uojCXYdKMYxbR2SOggyOkfvrsEojnY=; 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=D6kAVwKTYPoPlLfzovZ2BBeOn5Ov72RZQa+W3cOoLDzixGNdBPgSm8BsEegq8V7Ce mTk2rwmdyctgWB4ILdvYyTM+vofphC6p3kcgfadjyHONMozw7/mCnC23vdK9sbBTkT T6azV9XQNaRxk15xdtWMWy7YAQN/WV+yJvHupxGx3bxsSPiQ4ocv7pr8hw8sOWVQvn QgYZ2i1WQmGsGpK39/cnP+s5QGVcmTP6MNVut03HphmXegmY+XXZwgjf4XkAKgyjSQ PsJPD/vjNFGdH9jsrkblHs7e2VjgVIIhWz+r27TKXqzskI4ArMgqN8asIoCeH39Yds z2ONO5dSwvu2w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B32B964D79 for ; Mon, 22 Dec 2025 04:57:54 -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 aSD4ap3KQKIE for ; Mon, 22 Dec 2025 04:57:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404674; bh=3Eok8OAaMmmU8uojCXYdKMYxbR2SOggyOkfvrsEojnY=; 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=D6kAVwKTYPoPlLfzovZ2BBeOn5Ov72RZQa+W3cOoLDzixGNdBPgSm8BsEegq8V7Ce mTk2rwmdyctgWB4ILdvYyTM+vofphC6p3kcgfadjyHONMozw7/mCnC23vdK9sbBTkT T6azV9XQNaRxk15xdtWMWy7YAQN/WV+yJvHupxGx3bxsSPiQ4ocv7pr8hw8sOWVQvn QgYZ2i1WQmGsGpK39/cnP+s5QGVcmTP6MNVut03HphmXegmY+XXZwgjf4XkAKgyjSQ PsJPD/vjNFGdH9jsrkblHs7e2VjgVIIhWz+r27TKXqzskI4ArMgqN8asIoCeH39Yds z2ONO5dSwvu2w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A161864D62 for ; Mon, 22 Dec 2025 04:57:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404672; bh=osHBIVqI00K/9tWH2KqyqCb4hsURfxkTjLZofHE6StA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPtXAMcpdHS2P4h/vwgmOM/DbCjQ6RPNTjFrSkgzzda3EVjpY+eHa3Qe4Zu+FbSY0 3+4YkF/byUmdh73Eytt1cwS6SBUbzK4P3bUZOLonha03O9/bD10xeoFARMF57jAv6B 2oc3y57w6+bf/p3Boz3c9MzK5j9Mp6SXq6XFlnhTwxr/85t4GmOECCf8uEnuEf+5FO 87YhDZlOc8Twj7g0bTVQuThzCw57AraIuR7MiUsAQdUQ3PuuZc2EqH+P5KLkjzGyEk V0MyUKzNNboruUpOBrFpcA9ZDXlxWcvStDiXG9ZEBgyutkqYdLXT6I3C2LL49RmY/+ /mUSJ9btTKfgQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 807EE64D62; Mon, 22 Dec 2025 04:57:52 -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 VdgLm-8qP38j; Mon, 22 Dec 2025 04:57:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404667; bh=EwHc3GP1hAZnDsuPpoEHS9jGCsarZ0Fa2BPb+b7oj9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TBqTQiFTIfjU69z+s3SmRuMRFswIZLEMr8XIKsbPN/nyre+HWKNigOBrGUV9htnsE I9p+avZncYsIYqdv/6cvL4N2vMoMy+2PXbVqbSBiJH4Yqgm7rs1hJM1GuyFIx3FH80 918sQNZow657EgXdGOeYAj3i9IhLWAvOEHE13P4wNT+aHlnrYJ1C7nm5MYdWcaKyek Xbl3wZJAsnN3EA8oRomQKQNXhJPedddvMCOA3Z7PWorSUBKl+CTqai5LxVjaMUt2gL o4geL98W7pPyL5dUWoluHstQa2HifuXRRT08+n8I0e3rNIcBsMlerUSqyvcYNlmKL/ ocrqzVHHmBBtQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8393264C31; Mon, 22 Dec 2025 04:57:47 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:26 -0700 Message-ID: <20251222115639.700578-23-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: W5MBGW3OZ5XIVLXOPAKSKCW6IL46YGC3 X-Message-ID-Hash: W5MBGW3OZ5XIVLXOPAKSKCW6IL46YGC3 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 22/26] fs: ext4l: Add CRC32C implementation 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 ext4l_crc32c() which uses the Castagnoli polynomial (0x82F63B78) required for ext4 checksums. The table is initialised on first mount. Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 2 ++ fs/ext4l/interface.c | 2 ++ fs/ext4l/support.c | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 96b1c06a05b..8b70bbcb75c 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -35,6 +35,7 @@ #include #include #include /* Real rbtree implementation */ +#include /* For crc32() used by crc32_be */ /* * Override no_printk to avoid format warnings in disabled debug prints. @@ -2818,6 +2819,7 @@ struct wait_bit_entry { void free_buffer_head(struct buffer_head *bh); /* ext4l support functions (support.c) */ +void ext4l_crc32c_init(void); void bh_cache_clear(void); int ext4l_read_block(sector_t block, size_t size, void *buffer); diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index e1458ea6bfe..141afc42c17 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -92,6 +92,8 @@ int ext4l_probe(struct blk_desc *fs_dev_desc, /* Set up block device for buffer I/O */ ext4l_set_blk_dev(fs_dev_desc, fs_partition); + ext4l_crc32c_init(); + /* Initialise journal subsystem if enabled */ if (IS_ENABLED(CONFIG_EXT4_JOURNAL)) { ret = jbd2_journal_init_global(); diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 0765065a99f..2040ad5f480 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -12,12 +12,33 @@ #include #include #include +#include #include #include #include "ext4_uboot.h" #include "ext4.h" +/* + * CRC32C support - uses Castagnoli polynomial 0x82F63B78 + * Table is initialised on first mount + */ +static u32 ext4l_crc32c_table[256]; +static bool ext4l_crc32c_inited; + +void ext4l_crc32c_init(void) +{ + if (!ext4l_crc32c_inited) { + crc32c_init(ext4l_crc32c_table, 0x82F63B78); + ext4l_crc32c_inited = true; + } +} + +u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length) +{ + return crc32c_cal(crc, address, length, ext4l_crc32c_table); +} + /* * Buffer cache implementation * From patchwork Mon Dec 22 11:56:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1053 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=1766404677; bh=7trlqVKfV2w/owHeMLCF1XqNZMIDcwK4yxYdNl62zsg=; 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=HPLnI1k1DgipMmw0PPqaRnNFu7fAUzxpu9EPvfFCizo1IUcDNX4IVbY0xgMAayqJJ Lr/d5vXvsQ+Get7mM4M6MHQNf+KaSFMNGCMg2+WhYkUg0AhcXtNT3GzZIb0ClSifpf jiJ4X8RnmVAlsjIAxvP7oTzU9DV1vu+S9kJJG9CvtVTVMPgyb6wXEmCkyyDcRIL95R PCcdwwHumSpqqTIQGNUsNPUE2JGFnohgw39M/vrHl/Mlu42r/hvtEOAxBSJtEIS/hu 4jUjFmbWrxfOPvsmNxblmENseqQM7bBFdEOzNb5DS8apRwTEahvi3z9YxgWWcVrqLv jEtujnETWYOdQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2940D64D7E for ; Mon, 22 Dec 2025 04:57: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 10024) with ESMTP id kus7R73-pCXs for ; Mon, 22 Dec 2025 04:57:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404675; bh=7trlqVKfV2w/owHeMLCF1XqNZMIDcwK4yxYdNl62zsg=; 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=Cyoo3mNvyBSzw3wX91QpSYM1on7LDcanuW6N+V1Q0MV40beyWzmaZBZNWfOUAbua/ QfV525NMAdB1k5eKy13Di5Ct5QZeNySkQ6gcX2F5nwXLr5dkykBTA6+hbB4LTtiQeu IpZ73TCSmzy+CahQQDuqQmP5nb4LbYpGbxaCmdFUSrJm6RKp8pas+7fGqRPZ8lor+s Gko05+3JOT7Szu4+KmiXffw//Bb8JUQUMlSGnbothJmmhqcaomXzqirX/C+wk17ZhU xjt2lzuvsT1rSYBF4q3mR0ETYEbWlhukfQ0gMtj4hs1JRVafL0DrNjfa2jDL0+3sOr kPgPTRBDrPoBg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2824E64C31 for ; Mon, 22 Dec 2025 04:57:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404672; bh=OOKcKZkh5Gy2rOQZrCCvapRDMXUbHBCxsXiWmXCuW/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wf0xqCVKqErKg5xHuIJyaWwfHSxRbHkykgJbqblVbzcjXH+0l2CpNOMm6ZuAST059 G6rpPxyrg+dtF+PWpmri8V/uaQlf9RWiWcpsG2b/ECLV1ty5nr9K09SP4EUlwZLWHL m44/FlBp7xGb9V9+SCMFo0EJ/Pv1C7I7xB/15xtc2AobV8Eoc5Di3roqwkKwGGAfd/ ls4t3qSmtr3EQnVFK8HIq4sKwJyolZCfXBQV80dTTe1RwhRlQJjT7hwcGAsujOfOAo uet0wXaJTeV9ciTAFajco+fjQt4FM2hzKXkMkSAUE0lv2HHzwN3FvLaTQsuwSLGEUD 3n1DI1Qj5pV5g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9052E64C31; Mon, 22 Dec 2025 04:57:52 -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 7qs33F_1vTJb; Mon, 22 Dec 2025 04:57:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404672; bh=OlpkaqvjROPp1w/zOqwMfHEgV0BU7x4MT/pdXTt2WIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PF7djnkMrwHBmQrfkqNxDDhuA+hTwMxvDxf0pBCS6yoUyQSk/PG+nceyCeykuXvLT wVkgFkEwBBBcTDu2mC6cnzWrzzwa0QGGgxz9/PVbjMgiQ30tmqzIDSb1NwmbNsTOHD QvffJjNe8WoDUHq6beIn1GV8r0cm5I+Xf5ZISGFmJXBmCNkl7vblJXZr8XNXizqtCH O4n8UV6wthxP/nGVQBE+ZiZyy2GB/gSUY8RYwcnUSl8xjjzqGKFOUJSCGH8w0pUgdH YSs/dwEQH2wm4rFcdtndrkI1I7qH/C9XRthJ5YwZ/C4IjUoVWVa96M0+Qo7Eyk9tty wkQGU+SZlbDMg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 13D2B5FB5A; Mon, 22 Dec 2025 04:57:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:27 -0700 Message-ID: <20251222115639.700578-24-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7PAPOB4YLXC7BNAVQG4UGQM2XJGBAYTE X-Message-ID-Hash: 7PAPOB4YLXC7BNAVQG4UGQM2XJGBAYTE 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 23/26] linux: crc32c: Use ext4l CRC32C implementation 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 Update include/linux/crc32c.h to map crc32c() and crc32c_le() macros to ext4l_crc32c(), which uses the correct Castagnoli polynomial (0x82F63B78) required for ext4 checksums. This avoids conflicts with other filesystems like btrfs that have their own crc32c() implementation. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/crc32c.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h index 44e64d3a3df..53498ce4bfb 100644 --- a/include/linux/crc32c.h +++ b/include/linux/crc32c.h @@ -1,21 +1,22 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* - * CRC32C definitions + * CRC32C definitions for ext4l * - * Minimal version for U-Boot ext4l - based on Linux 6.18 + * CRC32C (Castagnoli) uses polynomial 0x1EDC6F41 (bit-reflected: 0x82F63B78) + * This is different from standard CRC32 (IEEE 802.3) which uses 0x04C11DB7. + * + * ext4l provides its own implementation to avoid conflicts with other + * filesystems (e.g., btrfs) that have their own crc32c(). */ #ifndef _LINUX_CRC32C_H #define _LINUX_CRC32C_H +#include #include -#include -/* Use U-Boot's CRC32 implementation */ -static inline u32 crc32c(u32 crc, const void *address, unsigned int length) -{ - return crc32(crc, address, length); -} +u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length); -#define crc32c_le(crc, p, len) crc32c(crc, p, len) +#define crc32c(crc, p, len) ext4l_crc32c(crc, p, len) +#define crc32c_le(crc, p, len) ext4l_crc32c(crc, p, len) #endif /* _LINUX_CRC32C_H */ From patchwork Mon Dec 22 11:56:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1054 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=1766404677; bh=nXix9h1EXMJaI5XLe/FkfkhIT846Aa8NvixwMZZ5lXI=; 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=qpQA3LkkcUu8CigrEVYqLFIYLIwMVL4z18iWGgXUnCamfSsbYvOmSBKAHCPnKbEYj am98ZScuqSEDtm1M62nYQ1xXJ0nAzdL33i9t+CwJ9RPybKV49lIEJ40IJ7qVYWAsMw JPsa4mrWOX5fSZij2196UFVLhSHvXA9Lo/8J0jyzzwXRDoF7nQasm06BnIDf2QGEfn NVxSJgho6ulYpPfG2gOPJAATIPoCzaHRH8tf65Izje6mkSgTpszd1kXcS2xNoKzG2m A2hON28KoqHMoMSGcpYdmlW/J5IODWTl/QwCSyZ+jje7HJZMwJkJ5BURBnYYSZXO/8 b2f7NFPS65swQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 88D5664D79 for ; Mon, 22 Dec 2025 04:57: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 10024) with ESMTP id iyNhQVgFrBcC for ; Mon, 22 Dec 2025 04:57:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404675; bh=nXix9h1EXMJaI5XLe/FkfkhIT846Aa8NvixwMZZ5lXI=; 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=KHNh+tRNDLvJQX1abJDOSgDy0QVob/BeFArCJlCMfS3hGDhxlq7Om0WfrPOpCwxCL MLwcTeeiV0FTgUC47I67z7xt8d8v8FLSkv2t1GCfcjWUCjE0bW02j0Sl2atf/82szg cDc3UfxKqAiH93LPM7YdcdVqC5CquJafLqhNlhMZ5czaPSI0ahD8lmaq1KaFIboV2E I0Gt+X0k1rSkMFs3NO47mwz3UKDEPdKCTea3ifc5S3PHdhJJr5suS3Laf1E7RRO3j+ h6HJswukZ8GrXbG0IPxenp/LuS+x0U/Cp/VgdJwBh3AVX48NoUJ+3UI4315JQYV/mV x7Zy1vqPoW7SQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 95B9864D7F for ; Mon, 22 Dec 2025 04:57:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404673; bh=GRbMZ67MMQ7Fb3tU6+/FaOX06Yt6i424Xph5Mz3srIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqnKhZbcWwyMcDHgQpLjDhlSrUA+xXRbwrAiVVba1HSkjSrR3BsV8VYVPvEjKjvhQ MU6rdh9Q8na7gXSbKtsElvzY1Xs9d1OnBgs+ZjRFIp21uDjlWgI2h0m1iOElCG24eX fV8DUYQe/MWMp8IUhybF8bd0MDmSvuC5iVDOTABLBS1tdjv0aLNMJWObzlssPQSZBn EJn/+fnb2BJgicjklH0p/7RUSCdbiCVvZpnCUOYl7a28MPpBQwYqGnvuhR8rhS/MHH UJWs1cpf7zHSgIWyJvjst2/uAlYxCkoK8h2siMOFeb2uhQ/ltG5cUw7y+UWX0cxJV2 9YQi0ZYfxC7qw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5823564C31; Mon, 22 Dec 2025 04:57:53 -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 FpVpkkazUtTC; Mon, 22 Dec 2025 04:57:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404673; bh=x+dRCOHP0Lrl84Lp0BL3UrBkYKoPTMBLdg7YdIUZyRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PScWxpKwqQ62H3NUj8+4wZ1acRO9PmrWXZGjvIBrF+ddCiWJeYWCxb3C4erjfyKnJ V2WG8vfzHm2v1pjZsFqQbw1O5gc1U3ib4Nr3ZDCb8qZo4uDNYnnuHb4TsX00SYcj8j xt5sl7pZL/Kp9Np/+g2tEkebqYX17kyHiXXsMPzv2YqJkqkLBDBZbxDNRgFnQ3r5+6 5W0/tDfPiSuK4PXgKUFUqIOku5fDKbU0XYNixVEjlZ0AqmowsMdyIu4xoqfTv2Zl3b 5kEX2wCLfv1HsrUI6Gk9XedKPzY0vBY8Wz4cSrrYi14OpP4EqBZqfUQyPkUJlRumuV 58/3fz/fIE46A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D2F825FB5A; Mon, 22 Dec 2025 04:57:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:28 -0700 Message-ID: <20251222115639.700578-25-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CJUNX2HPG4MY32MHJEUGJKA4V3LUEHRH X-Message-ID-Hash: CJUNX2HPG4MY32MHJEUGJKA4V3LUEHRH 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 24/26] fs: ext4l: Mount filesystems read-only 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 Set sb_rdonly() to return 1 since U-Boot currently only supports read-only filesystem access. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 8b70bbcb75c..5beedb4bb3d 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -289,8 +289,8 @@ extern struct user_namespace init_user_ns; /* might_sleep - stub */ #define might_sleep() do { } while (0) -/* sb_rdonly - stub */ -#define sb_rdonly(sb) (0) +/* sb_rdonly - for now U-Boot mounts filesystems read-only */ +#define sb_rdonly(sb) 1 /* Trace stubs */ #define trace_ext4_journal_start_inode(...) do { } while (0) From patchwork Mon Dec 22 11:56:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1055 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=1766404677; bh=HAX/x3Y0uhlfW1eb02VCPuZEHm7us4zfRQbijwyktw0=; 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=BD4x6svQ0kbAnM+sAS7oqyRLauDj5vnr+lXvLTWHmMo37hBOG46YI4b1v9CZrrI9N vHIC8CB6naOxjLjQq4aOYsW1R8AWwOk/iplgZfRwy9d6TWBKhL0g8I0aE5ZwHwlQYw HLIeeHbIRpmMRuaCWchbOoxhLGZ4NCSJJ/qapjMaMoTdZStI7H6TUweNNJ3UfXoaWY BaTTlutZaqHfYg/NSKiZmDwNWGvQfG/eOdzPF7VjTPBRV2PMupqTbOkxjnSbmp0cjP poSU7lEC5InrcnbCBmzwtLfjiBtnMnUcWPZZZ7gLMj0GSGWiihGxs/TavWVcKmmqnT SZez80AlDJi3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C76F464D3E for ; Mon, 22 Dec 2025 04:57: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 10024) with ESMTP id In25quHaRU7W for ; Mon, 22 Dec 2025 04:57:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404676; bh=HAX/x3Y0uhlfW1eb02VCPuZEHm7us4zfRQbijwyktw0=; 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=F91e5LbQpMWuo/9Oa2xxQtvAtoY6lPQgqRqNKY9MxOxAx0fX/OicPYM1r9Ikum+D+ cyyWddX5L31i0eZi4qeq0majdvQNp54R0fBDGf0M1rFJN4r+AvDbIzrVKdFj0yOq8z Oo9Ke2RHTMq11F+ymhTXe50+SYI6V83dZtXkR8Ngrk0PS64VmPpjicRM1lw8OJ7q7F phil5HC6bUcEvzi91xQa3L93G0ycn7cEGlN1bFbjchbbKAiq6+UqjzVzJA/OufleHN 4cLooA35CKTXn8h1XVPncZwO+Vn3zC3TaJ4tyXkNVyGS+gmz3MbuAbG2fGtvnwQsmx ABVpGLhzSeaLw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4138D64D8C for ; Mon, 22 Dec 2025 04:57:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404674; bh=IPRL/tAh6Z17/lBE794lGNn5ghDrE43JwXZvmjc8tls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W83BHm6oaMcaBBTqutu24Dg9ncsllihrX+fH5ziC8LV+9UkidHUu3vC3DbFXFXKLq aopjnp6h9xa68JLJOppCCNGbGgHKZrMqJN3DmxF4UiIshGP189//YzCSHwG9cZDFmi 4jCqohzUyFPvXktAmbfwRcl09Q0Zo8YfOF1kjBxzOgc1CbVwElavdkbv0XZxjIXhcW 0wb5aNyNKJ//rA2EctYIVeC9J2GpvwjIpJRZLs+GJSOWkcWdlmEknQcTOYfoHFj6of 525SzHBIY1GMMznEDpFUJUoUUGSFUDMArHLkh50ogMI/4YkIpis2aKMG0o3THkRimr WNVaXy/MVTRMA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 421DA64C31; Mon, 22 Dec 2025 04:57:54 -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 P5KrrMFohfVe; Mon, 22 Dec 2025 04:57:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404673; bh=ogdjcBDaNZlu8LgZEDdF6QBeOrqM4rvB4BM5wwF7px8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R2cW6Iad+KWc/4i5l0s9MvZ9iDufYS9DTZbrc6dyNlA6oczKw/w3ksqBjWsE+W7Q/ o5trtiSOcOW6oO40ypwgpXQABdqn7zYs3hovzl8uPA+HYY2SNzUyPkQpJ/m8bWlBS3 o08OtaWzR5ur7mxLSBzPexmSa9tvUCyM/V8NdOorW0D07+DaC7vS/TJmXBGO2VxhI9 r3rRZwhaLFpOdiY6babeVyTpd4xFRG+qGhnrVFKX6K1muTr5Mi2rXbwbWGacZzfYDw qVlljCJR4nKskKQCOOj5O4eSJFs9tZ+9DZ9iG4SPhCW22MRzl43roDr96ShZ3HJYEv VdlbkbqbBInfQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 99C775FB5A; Mon, 22 Dec 2025 04:57:53 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:29 -0700 Message-ID: <20251222115639.700578-26-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GVMV7QMERKPRE6S7HZJ63PCPL5JVWHV6 X-Message-ID-Hash: GVMV7QMERKPRE6S7HZJ63PCPL5JVWHV6 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 25/26] fs: ext4l: Add inode and bmap functions 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 inode allocation and block mapping functions: - iget_locked() - allocate inode by number - new_inode() - allocate new empty inode - ext4_uboot_bmap() - map logical to physical block - bmap() - VFS interface for block mapping Also add i_count reference counter to struct inode. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 9 ++-- fs/ext4l/support.c | 99 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5beedb4bb3d..4c4dd2ca559 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -377,8 +377,8 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); #define ktime_get_real_seconds() (0) #define time_before32(a, b) (0) -/* Inode operations - stubs */ -#define new_inode(sb) ((struct inode *)NULL) +/* Inode operations - iget_locked and new_inode are in interface.c */ +extern struct inode *new_inode(struct super_block *sb); #define i_uid_write(inode, uid) do { } while (0) #define i_gid_write(inode, gid) do { } while (0) #define inode_fsuid_set(inode, idmap) do { } while (0) @@ -820,6 +820,7 @@ struct inode { const struct inode_operations *i_op; const struct file_operations *i_fop; atomic_t i_writecount; /* Count of writers */ + atomic_t i_count; /* Reference count */ struct rw_semaphore i_rwsem; /* inode lock */ const char *i_link; /* Symlink target for fast symlinks */ unsigned short i_write_hint; /* Write life time hint */ @@ -1615,7 +1616,7 @@ static inline unsigned int i_gid_read(const struct inode *inode) #define fs_high2lowgid(gid) ((gid) & 0xFFFF) /* Inode allocation/state operations */ -#define iget_locked(sb, ino) ((struct inode *)NULL) +extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define set_nlink(i, n) do { (i)->i_nlink = (n); } while (0) #define inc_nlink(i) do { (i)->i_nlink++; } while (0) #define drop_nlink(i) do { (i)->i_nlink--; } while (0) @@ -2855,7 +2856,7 @@ struct disk_partition *ext4l_get_partition(void); /* JBD2 journal.c stubs */ struct buffer_head *alloc_buffer_head(gfp_t gfp_mask); #define __getblk(bdev, block, size) ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) -#define bmap(inode, block) ({ (void)(inode); (void)(block); 0; }) +int bmap(struct inode *inode, sector_t *block); #define trace_jbd2_update_log_tail(j, t, b, f) \ do { (void)(j); (void)(t); (void)(b); (void)(f); } while (0) diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 2040ad5f480..d1bc32ae8d6 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -39,6 +39,105 @@ u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length) return crc32c_cal(crc, address, length, ext4l_crc32c_table); } +/* + * iget_locked - allocate a new inode + * @sb: super block of filesystem + * @ino: inode number to allocate + * + * U-Boot implementation: allocates ext4_inode_info and returns the embedded + * vfs_inode. In Linux, this would look up the inode in a hash table first. + * Since U-Boot is single-threaded and doesn't cache inodes, we always allocate. + */ +struct inode *iget_locked(struct super_block *sb, unsigned long ino) +{ + struct ext4_inode_info *ei; + struct inode *inode; + + ei = kzalloc(sizeof(struct ext4_inode_info), GFP_KERNEL); + if (!ei) + return NULL; + + /* Get pointer to the embedded vfs_inode using offsetof */ + inode = (struct inode *)((char *)ei + + offsetof(struct ext4_inode_info, vfs_inode)); + inode->i_sb = sb; + inode->i_blkbits = sb->s_blocksize_bits; + inode->i_ino = ino; + inode->i_state = I_NEW; + inode->i_count.counter = 1; + inode->i_mapping = &inode->i_data; + inode->i_data.host = inode; + INIT_LIST_HEAD(&ei->i_es_list); + + return inode; +} + +/* + * new_inode - allocate a new empty inode + * @sb: super block of filesystem + * + * U-Boot implementation: allocates ext4_inode_info for a new inode that + * will be initialised by the caller (e.g., for creating new files). + */ +struct inode *new_inode(struct super_block *sb) +{ + struct ext4_inode_info *ei; + struct inode *inode; + + ei = kzalloc(sizeof(struct ext4_inode_info), GFP_KERNEL); + if (!ei) + return NULL; + + inode = &ei->vfs_inode; + inode->i_sb = sb; + inode->i_blkbits = sb->s_blocksize_bits; + inode->i_nlink = 1; + inode->i_count.counter = 1; + inode->i_mapping = &inode->i_data; + inode->i_data.host = inode; + INIT_LIST_HEAD(&ei->i_es_list); + + return inode; +} + +/* + * ext4_uboot_bmap - map a logical block to a physical block + * @inode: inode to map + * @block: on entry, logical block number; on exit, physical block number + * + * U-Boot implementation of bmap for ext4. Maps a logical block number + * to the corresponding physical block on disk. + */ +int ext4_uboot_bmap(struct inode *inode, sector_t *block) +{ + struct ext4_map_blocks map; + int ret; + + map.m_lblk = *block; + map.m_len = 1; + map.m_flags = 0; + + ret = ext4_map_blocks(NULL, inode, &map, 0); + if (ret > 0) { + *block = map.m_pblk; + return 0; + } + + return ret < 0 ? ret : -EINVAL; +} + +/* + * bmap - map a logical block to a physical block (VFS interface) + * @inode: inode to map + * @blockp: pointer to logical block number; updated to physical block number + * + * This is the VFS bmap interface used by jbd2. + */ +int bmap(struct inode *inode, sector_t *blockp) +{ + return ext4_uboot_bmap(inode, blockp); +} + /* * Buffer cache implementation *