From patchwork Tue Dec 30 20:51:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1110 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=1767127942; bh=Pm7RtlnWIma/TBimBjMb8YaCCYNkfadT+It+sEpUkyc=; 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=sv+qumf0UXxgV9SBl7Z2Ln3GXWPYACOkUvbuZs1HlmNgTteVtZGuQkA3x4iLHR+R8 nUJZJtWZBJCzxDmPO3PbXBiW4ttV1n/fbnM0qdwiBhWXUkxs6P9jI/ZKY1G9sgLr6/ H4l2fXIipyTwlQZFf+lwMs00Tx9eEzGoiyb39b00fjYtlwZ9KzjzfyN8mxRgEdd4v4 +gqe650pRXGJ9xEhkTNXMcC1ijaLZuiwVg2TXTlWtn/PKFrbWUJO1e42W6jyFYqkSs tf6mn5p5opnuB1XTZ4tankwp9qRE+VlBsKiVN6P2QYWIs6WCSWMcWuwR/g9dL/qogO Xbt5X8WGTA+HA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 69C0668F88 for ; Tue, 30 Dec 2025 13:52:22 -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 gD0VlBB_KMEc for ; Tue, 30 Dec 2025 13:52:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127940; bh=Pm7RtlnWIma/TBimBjMb8YaCCYNkfadT+It+sEpUkyc=; 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=kLoERdeoWwpO9GXHSdK8J7dpEB2PrJSTDVmUjiHgcnB5OeRqUbno6NXtAWDjfTgCQ YXt7LmroCSfGS6CfrN7HgJW4u2Q4Ud4T7ncXm8qs721MfN9o3RmFmfwTnB4JzfHgwg VUXTk7C1DN2OdVz/R+MXtM2j01rESC2bPeu9yXTJHATJkOddGQmVGc0kycxQu1Th6h qCiLEntYQG+pQf7ZWS1wanjQd+T1tY1mRKfioB1Ccm/qaeDUXcUf9j5d3mmzc5vRqh 0U8LbIDRwPRgOnbyg6sNEeIOd/P1qie+tuMCe+voZZ4AODDTdc7lVRlbF5lMY76Ez2 EsP9xxVC1XQsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 61DE368C0D for ; Tue, 30 Dec 2025 13:52:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127938; bh=8nOsVMdX8T1mapHbE/0WrYcErFqCrDlTiwnPi7kURsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYs30wQZ0SSf0NgzwuVovPPwltZJrVgVp+ZAHypJ4RQz2fsOv+Nr/yZT0EMFCKBA/ Y6DGZIAlj0KbOK4Su6I0O4/bzA8Ju3DZopfSr4J2aAuobL8DM8/OgCH2H3bR6YTCjz a5/IXJRNyA1mGC4ZWCMOLSDcDgsE6I0gMazyEglMKwfYwmSXPQU+7QJG9I3S6hNlvs xclY4BTkVfq8bWSsnZ0Vd2F9imdjYoQ8Q31pOzOhgmckE1PkvkyB5a4EP1aExx/lY3 WaEOVBGb5Dtk8DuO4BigDK1Z4Ny+A0hJgkyZCCiCjkgjqoFXg/kcx0RzlRwrdx5rkQ hTE8sHwl6TQuw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 45D9068F73; Tue, 30 Dec 2025 13:52:18 -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 PkD9uEIsfpYD; Tue, 30 Dec 2025 13:52:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767127937; bh=cSoIfSmBtO+SvZq7NoznbVZwG2EarEZQNtDbcbLPAmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxUi+LdRxRkBck3h6VVChXs0ehiyeqefdvzVDsEsj9NmUfh6NX0VO5JBh9CizG/vv uAGak9CbrYPFVRpNQVBViDys0AqKtZkYmlhhie2lbD0sJ+NFcMMFyqnwF0HinfSfy7 7St3o8KSHYJk93PZdqnvvg3baWva08neFCPK7kkqh5qUUw0t5f9AiJYfBBTUJW3t+Q b4afExnW+rE2jIfc3rmyTJ8Klp40DOwlMN9jG7V+qaaukmdYTcR118+SKSz/KJy94Y vJw+MW4cWvz/Gfgj31da4OE73cd9A6PCVbj5aSCBHHDgCrYTLoj7sqz1c+vRV7dsNx jiZeg/3SFZCCQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A725464C8A; Tue, 30 Dec 2025 13:52:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Dec 2025 13:51:38 -0700 Message-ID: <20251230205157.3383926-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230205157.3383926-1-sjg@u-boot.org> References: <20251230205157.3383926-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TCF5NDE7JXOYTLX5YRW5OLB3BKDEM3RC X-Message-ID-Hash: TCF5NDE7JXOYTLX5YRW5OLB3BKDEM3RC 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 01/14] linux: ext4l: Fix REQ_OP and BH_OwnsData bit positions 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 The REQ_OP flags (REQ_SYNC, REQ_FUA) use bits 0-1, which collide with REQ_OP_WRITE (value 1). Move the flags to bits 8+ and add REQ_OP_MASK to properly separate operation from flags. Move BH_OwnsData from buffer_head.h to ext4_uboot.h to keep Linux headers unmodified. Define it as BH_JBDPrivateStart to avoid conflicts with JBD2 state bits (17-25). Co-developed-by: Claude Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 17 +++++++++++++---- fs/ext4l/support.c | 2 +- include/linux/buffer_head.h | 2 -- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a90289c8fa5..39bade68654 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -515,8 +515,14 @@ struct sb_writers { /* Buffer head - from linux/buffer_head.h */ #include +#include -/* BH_JBDPrivateStart is defined in jbd2.h as an enum value */ +/* + * U-Boot: marks buffer owns b_data and should free it. + * Use BH_JBDPrivateStart to avoid conflicts with JBD2 state bits. + */ +#define BH_OwnsData BH_JBDPrivateStart +BUFFER_FNS(OwnsData, ownsdata) /* Forward declare for get_block_t */ struct inode; @@ -2153,10 +2159,13 @@ struct fs_parse_result { #define BLK_OPEN_WRITE (1 << 1) #define BLK_OPEN_RESTRICT_WRITES (1 << 2) -/* Request flags */ +/* Request operation (bits 0-7) and flags (bits 8+) */ #define REQ_OP_WRITE 1 -#define REQ_SYNC (1 << 0) -#define REQ_FUA (1 << 1) +#define REQ_OP_MASK 0xff + +/* ensure these values are outside the operations mask */ +#define REQ_SYNC (1 << 8) +#define REQ_FUA (1 << 9) /* blk_holder_ops for block device */ struct blk_holder_ops { diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 05efa8d067c..a046654ca54 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -565,7 +565,7 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, int submit_bh(int op, struct buffer_head *bh) { int ret; - int op_type = op & 0xff; /* Mask out flags, keep operation type */ + int op_type = op & REQ_OP_MASK; /* 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); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5fbcc757c80..b22df564119 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -37,8 +37,6 @@ 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)