From patchwork Mon Jan 19 06:15:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1616 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=1768803390; bh=Zu6yAPrPDxm+Nywy8AHPcWuip2LJvr7NHZVp7qjhR5g=; 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=HTkbfokc8nR4MbNSoaV6RTW9ZGh7t/3D6iZtDaHEXcRaV6m0xrogPDZCMTsZPWW++ o4QBUu2CL5OIvArldp18Q0EyyE39b2DhuDLevwF6LVHwYN+RP70hnZ/z1h0ALdxVl5 LgJtUQxghg02oY6WEU87vDJmmhPRoAiLkPc2LMyFJgKXZq7PEsHo7IRmsWLSyqbwNy cBAtlMmY+5WQhlSa4eP5tdg5Zb4sua0kemDdWAIyuNvFjaUTmd+lyjDoo57+8nComm s8SusHah60FyIQfrEPcqEDnZrNpQCoNlkrU+8duEIhXQU3RwKWx1wZRBj7BSEAfd63 6QZv4oWTXvJEA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A2D24694D3 for ; Sun, 18 Jan 2026 23:16: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 OgoKBE8TRkIK for ; Sun, 18 Jan 2026 23:16:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803390; bh=Zu6yAPrPDxm+Nywy8AHPcWuip2LJvr7NHZVp7qjhR5g=; 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=HTkbfokc8nR4MbNSoaV6RTW9ZGh7t/3D6iZtDaHEXcRaV6m0xrogPDZCMTsZPWW++ o4QBUu2CL5OIvArldp18Q0EyyE39b2DhuDLevwF6LVHwYN+RP70hnZ/z1h0ALdxVl5 LgJtUQxghg02oY6WEU87vDJmmhPRoAiLkPc2LMyFJgKXZq7PEsHo7IRmsWLSyqbwNy cBAtlMmY+5WQhlSa4eP5tdg5Zb4sua0kemDdWAIyuNvFjaUTmd+lyjDoo57+8nComm s8SusHah60FyIQfrEPcqEDnZrNpQCoNlkrU+8duEIhXQU3RwKWx1wZRBj7BSEAfd63 6QZv4oWTXvJEA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 90D05694C7 for ; Sun, 18 Jan 2026 23:16:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803388; bh=X7r/tZHNNuVMKUG5zG+sfBle+GwUCEPXijAuBkt0w+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPASOKcXhrukq986LKUWw613QxRF+gbPLj9NUSwibP/BM+5BcGHs3saR6DLJUx/Wh 8G6NpzR5kMOaEiY+z2T12sZ9t66h0FbxHYgxXL7nul8hie+nCIRcIgGgFdZSiizAOe RjITzL1bFOO9cFdS9IE3hMSLWlAQitbDA1VDd3NUhWlhpifUn1XMyz0hsfLAxs4QUV 3Z9onJk+csMxZjAM4fPYOzCp4J087ikK+K4cR5MsA/WTlSR8mBUTWDaGWv2IYw6PkY yZ6/yxsHGHu+FZrgeUF5IQK8R1cob0KbPRaItwQ1AC7C9EbbvzvSCrfJ1g9eakFLpV nBvWN8fF4PnLQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 91773694C7; Sun, 18 Jan 2026 23:16:28 -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 jSyCUzds_66a; Sun, 18 Jan 2026 23:16:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803383; bh=1Xg50rSD3uB/VdrdJ/eednEThNWhytnoh9EYesus24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4mpQNCVbuDyjEJQSwyV+bvGtFIyhFEp8S03p9L9Zxq5gxZmzq93EZFqnRuj/vXVA yYi3u5z9jwey8Bs6E794HTsV3djUpViDm0k/hRcjDYPQHOnGdLLEam6auMsVa1gcMB vdARVURqZpzeDK31Hr3e7h8Rzp73K4GJr+Vs8UKSy0LgydiQNyS20t6Akr+L3zSu7b hOZOHk27asc7TUDwxaYJF6z46EH3MNVca7aPRf1YXYWBKh7T49RfgceKxVKoedxdbM dCtHpIwWdOP3oomnAKRxWproxPwoIu0oRwVxPBhsK+qES6uVRTRKRXE/4zygXNbWuF 0BRt7rCblkjFg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 54E98693AE; Sun, 18 Jan 2026 23:16:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 23:15:07 -0700 Message-ID: <20260119061529.3383191-10-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: YSKV6LGGRYPHJJBRP7LPRGKJOTXHBBKZ X-Message-ID-Hash: YSKV6LGGRYPHJJBRP7LPRGKJOTXHBBKZ 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/23] linux: Add ioprio.h with I/O priority definitions 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/ioprio.h with I/O priority class definitions and helper macros including IOPRIO_CLASS_*, IOPRIO_PRIO_VALUE(), IOPRIO_PRIO_CLASS(), get_current_ioprio(), and set_task_ioprio(). Update ext4_uboot.h to use linux/ioprio.h and remove the function implementations from stub.c since they are now macros. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 13 ++++----- fs/ext4l/stub.c | 10 +------ include/linux/ioprio.h | 64 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 include/linux/ioprio.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 83dcf772c45..aae248a6930 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1243,8 +1243,8 @@ void ext4_unregister_li_request(struct super_block *sb); /* Path lookup flags - use linux/namei.h */ #include -/* I/O priority classes */ -#define IOPRIO_CLASS_BE 2 +/* I/O priority classes - use linux/ioprio.h */ +#include /* SB_INLINECRYPT, SB_SILENT, SB_POSIXACL are in linux/fs.h */ #define SB_I_CGROUPWB 0 /* Not supported in U-Boot */ @@ -1343,8 +1343,7 @@ int inode_generic_drop(struct inode *inode); /* Path operations - path_put, d_path are in linux/path.h */ -/* I/O priority - declaration for stub.c */ -int IOPRIO_PRIO_VALUE(int class, int data); +/* I/O priority stubs are in linux/ioprio.h */ /* kmemdup_nul is in linux/slab.h */ /* fscrypt declarations are in ext4_fscrypt.h */ @@ -1393,8 +1392,7 @@ unsigned int bdev_max_discard_sectors(struct block_device *bdev); /* bgl_lock_init is now in linux/blockgroup_lock.h */ -/* Task I/O priority - declaration for stub.c */ -void set_task_ioprio(void *task, int ioprio); +/* set_task_ioprio is in linux/ioprio.h */ /* Superblock identity functions */ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, @@ -1617,8 +1615,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* d_alloc, d_drop are now in linux/dcache.h */ -/* get_current_ioprio - I/O priority (not used in U-Boot) */ -#define get_current_ioprio() (0) +/* get_current_ioprio is in linux/ioprio.h */ /* JBD2 checkpoint.c stubs */ #define mutex_lock_io(m) mutex_lock(m) diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index bdb8b8bb675..1b9c72a6cc2 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -400,15 +400,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) return 1; } -/* I/O priority */ -int IOPRIO_PRIO_VALUE(int class, int data) -{ - return (class << 13) | data; -} - -void set_task_ioprio(void *task, int ioprio) -{ -} +/* I/O priority stubs are now in linux/ioprio.h */ /* ext4_fc_init is now in fast_commit.c */ diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h new file mode 100644 index 00000000000..2cec5cac818 --- /dev/null +++ b/include/linux/ioprio.h @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * I/O priority definitions for U-Boot + * + * Based on Linux ioprio.h - I/O scheduling priority. + * U-Boot stub - I/O priority not supported. + */ +#ifndef IOPRIO_H +#define IOPRIO_H + +/* I/O priority classes */ +#define IOPRIO_CLASS_NONE 0 +#define IOPRIO_CLASS_RT 1 +#define IOPRIO_CLASS_BE 2 +#define IOPRIO_CLASS_IDLE 3 + +/* I/O priority levels (0-7, lower is higher priority) */ +#define IOPRIO_NR_LEVELS 8 +#define IOPRIO_BE_NR IOPRIO_NR_LEVELS + +/** + * IOPRIO_PRIO_VALUE() - create I/O priority value from class and level + * @class: I/O priority class + * @data: priority level within class + * + * Return: encoded priority value + */ +#define IOPRIO_PRIO_VALUE(class, data) (((class) << 13) | (data)) + +/** + * IOPRIO_PRIO_CLASS() - extract class from priority value + * @ioprio: encoded priority + * + * Return: I/O priority class + */ +#define IOPRIO_PRIO_CLASS(ioprio) (((ioprio) >> 13) & 0x3) + +/** + * IOPRIO_PRIO_DATA() - extract data/level from priority value + * @ioprio: encoded priority + * + * Return: priority level + */ +#define IOPRIO_PRIO_DATA(ioprio) ((ioprio) & 0x1fff) + +/** + * get_current_ioprio() - get I/O priority of current task + * + * U-Boot stub - always returns 0. + * + * Return: I/O priority value + */ +#define get_current_ioprio() (0) + +/** + * set_task_ioprio() - set I/O priority of a task + * @task: task to modify (ignored) + * @ioprio: priority to set (ignored) + * + * U-Boot stub - no-op. + */ +#define set_task_ioprio(task, ioprio) do { (void)(task); (void)(ioprio); } while (0) + +#endif /* IOPRIO_H */