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) {