From patchwork Mon Jan 19 06:15:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1611 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=1768803365; bh=GiBN7vfd8LA3EkoSWbBaxIamxCeO+vcmj0zBMOwVZyg=; 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=M6fBRaomR7/x4gN5ea5xyHz+W9yFMYxanMtml3NaB0fu3fv6P51clr8l41uuNw6iJ vJwyFirC9nWRcwl2oDpJT57PekRBhTGlQMZsyKuQ/t+ARndXfGeb9W5IuILtz3Qpu5 5dP3kkS2/bGbPNLfG8bEsKGAIUuSK/E3NdYs+083GP/WZYcts5cv8QSnl4r81mTwFT u85yzV5zQfh6CKz8edyHWcTU5G6Na1XU/n9k0AhDl9SI9WxRE6Pv57X5xCBJHFwxMq crVzrAZpVEuA+MlpFGSzvGdvbeEvCraaDRltsovaa2Cu4r8QStsygUwHKD9U8nDdl4 /lVX3Qby2gtww== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E311E6913F for ; Sun, 18 Jan 2026 23:16: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 10024) with ESMTP id lGGIRstx5qoJ for ; Sun, 18 Jan 2026 23:16:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803365; bh=GiBN7vfd8LA3EkoSWbBaxIamxCeO+vcmj0zBMOwVZyg=; 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=M6fBRaomR7/x4gN5ea5xyHz+W9yFMYxanMtml3NaB0fu3fv6P51clr8l41uuNw6iJ vJwyFirC9nWRcwl2oDpJT57PekRBhTGlQMZsyKuQ/t+ARndXfGeb9W5IuILtz3Qpu5 5dP3kkS2/bGbPNLfG8bEsKGAIUuSK/E3NdYs+083GP/WZYcts5cv8QSnl4r81mTwFT u85yzV5zQfh6CKz8edyHWcTU5G6Na1XU/n9k0AhDl9SI9WxRE6Pv57X5xCBJHFwxMq crVzrAZpVEuA+MlpFGSzvGdvbeEvCraaDRltsovaa2Cu4r8QStsygUwHKD9U8nDdl4 /lVX3Qby2gtww== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0295694C7 for ; Sun, 18 Jan 2026 23:16:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803364; bh=CtqbVfyj0oufBBY4oGx+QTc5Pj62RNU6BjSa8dEtcXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oaqWIHoeSA6egCn3qpELpggDlD73qjkmlw+6lfTy0aHcSoF6sn/OvjaXLix6mmQOJ +5GrsufVPr4ZrNo+5BVB/aFzn+uXY9NGY4pBY8Fmhugpivt7yffa5Ec7ARie13/G83 Z2/Bc3lrqwdQ9shKikCmpswnkdu9zWjM6eUxhc1A4kwMluTGK0iSB8F8LtxZcaqfxF 6hxIl/0jLK7puDHX7gSbflt5NrYr5Oh3tNPPKO6Okp5YyZgjP3oCE0D+OQ1/ZAfvLY OIerHe0r7o8rhTGTzRZFwATiUan24nt/x/3VEPz1eB1yIFQP9NIs4on6w2tYudVb0H wzOKAj/AS/ufg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4F4606913F; Sun, 18 Jan 2026 23:16:04 -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 uc59JhcK4Ype; Sun, 18 Jan 2026 23:16:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803360; bh=pq0bD2IThZgoHAk/GedFDH+JP1MwJmXsel6YbvJchv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nLRScLJrVFaWU8ggOfxEp9+Lup367bOcZzVmX4nQkOQzBmsrApOLEsO6qth51pUgA vDjTeAs2Q5yYq/KbW/55PmZw9cUU3uO5SMi40EBjSrrV99usqdrp+oUbnCF1gsuWlk CD4Yl8ZdUAj4bgMJYIjBq6oXO+ZFZZIPZM9I6tF50cROxqn7/oQXxyoBP/AYO/Dg5p ISLJuBj/sSJLewaAsXDBoSof5QAD69whvR7+rAe/khQ55DzZLpmwbwQkKuyL++7HV2 NNnXrd1JYHrJg5yt0iy/kLVEHWt7cRTsA05RxS7CwwvBMrRbGgRxGg4W5TrjTqNKmI W2LXlZ8u9np2w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F1D50693AE; Sun, 18 Jan 2026 23:15:59 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 23:15:02 -0700 Message-ID: <20260119061529.3383191-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260119061529.3383191-1-sjg@u-boot.org> References: <20260119061529.3383191-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZH6CONUK6JN63HZUHBFOXQAZKVBX6WPQ X-Message-ID-Hash: ZH6CONUK6JN63HZUHBFOXQAZKVBX6WPQ 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/23] linux: Add writeback.h with writeback operation stubs 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 Create linux/writeback.h with wbc_to_tag() function, WB_REASON_* constants, and try_to_writeback_inodes_sb() stub for filesystem writeback control. Update ext4_uboot.h to use linux/writeback.h instead of duplicating these definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 14 +++-------- include/linux/writeback.h | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 include/linux/writeback.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index bfeb31f465c..873f02cf508 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -863,19 +863,11 @@ static inline unsigned long memweight(const void *ptr, size_t bytes) #include #include -/* wbc_to_tag - convert writeback control to pagecache tag */ -static inline xa_mark_t wbc_to_tag(struct writeback_control *wbc) -{ - if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) - return PAGECACHE_TAG_TOWRITE; - return PAGECACHE_TAG_DIRTY; -} +/* wbc_to_tag, WB_REASON_* - use linux/writeback.h */ +#include /* blk_plug is now in linux/blkdev.h */ -/* Writeback reasons */ -#define WB_REASON_FS_FREE_SPACE 0 - /* address_space_operations is in linux/fs.h */ /* buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio are in linux/buffer_head.h */ /* readahead_control, FGP_*, kmap/kunmap, folio stubs are in linux/pagemap.h */ @@ -952,7 +944,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* percpu_counter_sub is in linux/percpu_counter.h */ /* Filemap operations are in linux/pagemap.h */ -#define try_to_writeback_inodes_sb(sb, r) do { } while (0) +/* try_to_writeback_inodes_sb is in linux/writeback.h */ /* Buffer operations - additional */ #define getblk_unmovable(bdev, block, size) sb_getblk(bdev->bd_super, block) diff --git a/include/linux/writeback.h b/include/linux/writeback.h new file mode 100644 index 00000000000..e408e3ddebb --- /dev/null +++ b/include/linux/writeback.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Writeback definitions for U-Boot + * + * Based on Linux writeback.h - writeback control and operations. + * U-Boot stub - writeback operations are no-ops. + */ +#ifndef WRITEBACK_H +#define WRITEBACK_H + +#include +#include + +/* Forward declarations */ +struct super_block; +struct writeback_control; + +/* Writeback reasons */ +#define WB_REASON_FS_FREE_SPACE 0 +#define WB_REASON_SYNC 1 +#define WB_REASON_PERIODIC 2 +#define WB_REASON_LAPTOP_TIMER 3 +#define WB_REASON_VMSCAN 4 +#define WB_REASON_FORKER_THREAD 5 + +/** + * wbc_to_tag() - convert writeback control to pagecache tag + * @wbc: writeback control structure + * + * Return: PAGECACHE_TAG_TOWRITE for sync writes, PAGECACHE_TAG_DIRTY otherwise + */ +static inline xa_mark_t wbc_to_tag(struct writeback_control *wbc) +{ + if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) + return PAGECACHE_TAG_TOWRITE; + return PAGECACHE_TAG_DIRTY; +} + +/** + * try_to_writeback_inodes_sb() - try to start writeback on superblock + * @sb: superblock to writeback + * @reason: reason for writeback + * + * U-Boot stub - no-op since writeback is synchronous. + */ +#define try_to_writeback_inodes_sb(sb, reason) \ + do { (void)(sb); (void)(reason); } while (0) + +#endif /* WRITEBACK_H */