From patchwork Wed Jan 7 23:44:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1335 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=1767829634; bh=AT2LkD5GPLRt0WUm6ZiH/+VeINjbVIEkqr0XwPgKqmY=; 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=pW7Jmi3BrU7qokgRtIg3ZhTDe4ApGrv48s2I/42ww6WuJgwE8HtwD9XdSgJK3s/b9 vHkYpfyIdRXguCB9GGMz89PwDVeE05yXNFVZOasEgKSIY6G8SIOCirzKmf9D2RPRBK qdOpJ4Re7O5gPt68iEHayGr5sVgQK1AsKuH40QgywRRpTBDv3A9SuNUYy8Sh1e4Kon N5z41eCsfhPftahuJnnWYTXZFu5J/ctd7sB+VNMGhvPEd9VVUNSaTVwerMvZesHDpb PLjvcsVsy6JA3Qb1jNx9KilNa6JobQ+8m12KkbP6BJONdA5DwTRYggMhyvxdZlXO5a KmYWdUjRwqwmQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 12D9B69195 for ; Wed, 7 Jan 2026 16:47: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 10024) with ESMTP id ZR6QQcoKca7W for ; Wed, 7 Jan 2026 16:47:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829633; bh=AT2LkD5GPLRt0WUm6ZiH/+VeINjbVIEkqr0XwPgKqmY=; 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=Qim7J3BI2k4hXiG4g0O9mfi6SL9VYgipmx+QpEKPitDVIwQX9fLVRF+4hUN1/AwU9 EnSnQPXzO1NyTWqbi/bRGsLvUy7HUspQ3wvJVENWgAfcxlQPrmYeh21YcLviWjXrK2 wZny9sMPcA5+C4C3Ab6S4GE5/H5aN/tCyMMX2hP09fIAe8CxMnqpg74QpSdXquxo4n +SkJZwLxyksu6IB7dKqA4o8sYbTwU8iEcskDzeuPt60IVJm1qoaDkBPqlAqkNmIarz i8l16Mf/Tac2RGqp4yc/2x9ow9JecBjktK3Ps538EmENfHnQyLY33ep03gyQRub9TR fvUVlL9QniFPA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D808969146 for ; Wed, 7 Jan 2026 16:47:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829631; bh=W5n7Nq27vE4C43b2Y9YHHFhQohR5teKubwFBadbEExc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZRVRUFmeemw/8m7ZCoGUpjJM5DPY0ICJD2CV2wrnQUW8QcTRmvbm3QKz+C+ZFHUM BmxDKwTYG7Ra2VW3vWQILBAJURWGhnXzlLiQ+qGdbnj2/QbG3B1le2X2WcWfk3R68c yXCDt+Y3P5N7Ah8Wd9urg6gx7NZkIqJ5U1mEJkPqWE7Na+xOTtoYfjgSAN1N/P9xnt 3H4Dc6LG3GkxdyDktXE5oMRFxKf4tLoD0UUWKGjca1FJ0oM0+yF079q2iR1Ji4fXJ6 ZylIOYz7lhoqWB0YhaVlupLqIRxb1XczZFt5EyGjLGiEOQfz+90pYf5MUBj4BtQr/S 4MkPgKfnaEE6w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6407C691A6; Wed, 7 Jan 2026 16:47: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 cdQ50CqDMKCz; Wed, 7 Jan 2026 16:47:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829626; bh=+TqT2Bjx6dLizmt8uJbDQVNhb7tzzlCY38tOaQxGakg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUnZCBAnEFqIIxnxxmdghGcSmwhOZtzzdtObbyqYGsGbmSOYcWaYXF8m/NfylwjYV +y2CG5JXrUTED9aLma43FekWc33RZ6FMCJoq/8CWFri5LiY+m00EekXXwG7vlDFB5p N5/iw5ePkGBW4K70b3Q3MYx2f8vK2lCwswkm9C+1HZvY+b+e26H8HfsMOIAQomZifx 8RzdbWzwDwqz9i9w5bQv+quQH16Mbgvyv0ljUmrxLdyUw28tmZjXqn9Px9Wx+A6pFf h9BITF+9FgTjxH5mTSFYjIJ4KVxqQGwXT/9z6P5KVKanVkzERu0KoNaHEXVURredB9 pn+SE5uFmYZ1w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 538EA69146; Wed, 7 Jan 2026 16:47:06 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 7 Jan 2026 16:44:13 -0700 Message-ID: <20260107234426.3508161-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260107234426.3508161-1-sjg@u-boot.org> References: <20260107234426.3508161-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QOLN24HVZ66SIBLJNQ6BCZWBIMGLZLON X-Message-ID-Hash: QOLN24HVZ66SIBLJNQ6BCZWBIMGLZLON 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 3/9] fs: ext4l: Add m_seq field to ext4_map_blocks struct 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 the m_seq (extent status sequence) field to struct ext4_map_blocks to match the Linux kernel structure. This field is used in Linux for tracking extent status cache coherency but is unused in U-Boot's single-threaded environment. Update ext4_es_lookup_extent() to accept an optional m_seqp parameter matching the Linux kernel API, and update all call sites accordingly. The sequence value is never actually used in U-Boot, but having the field and parameter present allows the code to match Linux more closely. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4.h | 1 + fs/ext4l/extents.c | 2 +- fs/ext4l/extents_status.c | 2 +- fs/ext4l/extents_status.h | 2 +- fs/ext4l/inode.c | 8 ++++---- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4.h b/fs/ext4l/ext4.h index 47054daffc2..1cbeebaf0a6 100644 --- a/fs/ext4l/ext4.h +++ b/fs/ext4l/ext4.h @@ -235,6 +235,7 @@ struct ext4_map_blocks { ext4_lblk_t m_lblk; unsigned int m_len; unsigned int m_flags; + u64 m_seq; /* Extent status sequence (unused in U-Boot) */ }; /* diff --git a/fs/ext4l/extents.c b/fs/ext4l/extents.c index 955f587426b..d2103fbac83 100644 --- a/fs/ext4l/extents.c +++ b/fs/ext4l/extents.c @@ -2200,7 +2200,7 @@ static int ext4_fill_es_cache_info(struct inode *inode, while (block <= end) { next = 0; flags = 0; - if (!ext4_es_lookup_extent(inode, block, &next, &es)) + if (!ext4_es_lookup_extent(inode, block, &next, &es, NULL)) break; if (ext4_es_is_unwritten(&es)) flags |= FIEMAP_EXTENT_UNWRITTEN; diff --git a/fs/ext4l/extents_status.c b/fs/ext4l/extents_status.c index f557c7c23c2..706e267a79f 100644 --- a/fs/ext4l/extents_status.c +++ b/fs/ext4l/extents_status.c @@ -1037,7 +1037,7 @@ void ext4_es_cache_extent(struct inode *inode, ext4_lblk_t lblk, */ int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t *next_lblk, - struct extent_status *es) + struct extent_status *es, u64 *m_seqp) { struct ext4_es_tree *tree; struct ext4_es_stats *stats; diff --git a/fs/ext4l/extents_status.h b/fs/ext4l/extents_status.h index 8f9c008d11e..e668cda0d92 100644 --- a/fs/ext4l/extents_status.h +++ b/fs/ext4l/extents_status.h @@ -148,7 +148,7 @@ extern void ext4_es_find_extent_range(struct inode *inode, struct extent_status *es); extern int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t *next_lblk, - struct extent_status *es); + struct extent_status *es, u64 *m_seqp); extern bool ext4_es_scan_range(struct inode *inode, int (*matching_fn)(struct extent_status *es), ext4_lblk_t lblk, ext4_lblk_t end); diff --git a/fs/ext4l/inode.c b/fs/ext4l/inode.c index 7001c7299cd..04b7c734f7f 100644 --- a/fs/ext4l/inode.c +++ b/fs/ext4l/inode.c @@ -627,7 +627,7 @@ static int ext4_map_create_blocks(handle_t *handle, struct inode *inode, * extent status tree. */ if (flags & EXT4_GET_BLOCKS_PRE_IO && - ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es, &map->m_seq)) { if (ext4_es_is_written(&es)) return retval; } @@ -701,7 +701,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, ext4_check_map_extents_env(inode); /* Lookup extent status tree firstly */ - if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es, &map->m_seq)) { if (ext4_es_is_written(&es) || ext4_es_is_unwritten(&es)) { map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk; @@ -1885,7 +1885,7 @@ static int ext4_da_map_blocks(struct inode *inode, struct ext4_map_blocks *map) ext4_check_map_extents_env(inode); /* Lookup extent status tree firstly */ - if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es, NULL)) { map->m_len = min_t(unsigned int, map->m_len, es.es_len - (map->m_lblk - es.es_lblk)); @@ -1938,7 +1938,7 @@ add_delayed: * is held in write mode, before inserting a new da entry in * the extent status tree. */ - if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es, NULL)) { map->m_len = min_t(unsigned int, map->m_len, es.es_len - (map->m_lblk - es.es_lblk));