From patchwork Mon Jan 19 06:15:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1615 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=1768803386; bh=Mic27KilWgc8xUHQaIEJq5EHmfHR0FH3w39ryte6fKU=; 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=kLD/SzJvlcxgbprI8s6o6P77M1FmV2bAVnhdfz+SN8dXTCtYq5swb79MP/1W3W1WU oYqONET4aKSX7vDDUziTmrGQsSI5U44Sp51SNsCAPBz6UmtNT8/KADn1MyDp4ewoE7 tfJItOc98lnyu2rkjd+DHMG0MyBRQ2qTrJiYkN4tmO/wYq40aJ1GzxJFPb+3yDLmZa psoYoJ7G8KpP9umV7NvBrdjXcx39FdgrkuvfaPIZ+9nqOXfZEpZ/uD71YuTdZQsnxC 1QEK3Xil71a4DpbRHGKlYl/Wk0aaFfrR8lwyBLEkFcU7GcgJPyO2BHl2mniB2I1xRF gdZLC9yJc2GtA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1FAD6694D3 for ; Sun, 18 Jan 2026 23:16:26 -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 lFM4F2_2uoQX for ; Sun, 18 Jan 2026 23:16:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803386; bh=Mic27KilWgc8xUHQaIEJq5EHmfHR0FH3w39ryte6fKU=; 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=kLD/SzJvlcxgbprI8s6o6P77M1FmV2bAVnhdfz+SN8dXTCtYq5swb79MP/1W3W1WU oYqONET4aKSX7vDDUziTmrGQsSI5U44Sp51SNsCAPBz6UmtNT8/KADn1MyDp4ewoE7 tfJItOc98lnyu2rkjd+DHMG0MyBRQ2qTrJiYkN4tmO/wYq40aJ1GzxJFPb+3yDLmZa psoYoJ7G8KpP9umV7NvBrdjXcx39FdgrkuvfaPIZ+9nqOXfZEpZ/uD71YuTdZQsnxC 1QEK3Xil71a4DpbRHGKlYl/Wk0aaFfrR8lwyBLEkFcU7GcgJPyO2BHl2mniB2I1xRF gdZLC9yJc2GtA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0DC30694C7 for ; Sun, 18 Jan 2026 23:16:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803383; bh=O1Wu+zICDVqp+9npmdu0HSamute3K2Era+RWDJCKMOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/uklxMz/cVWD5cRukvZZ/7PdKhSQY2zx74Nc5eCRV4O+KoKj/LuBexLclKButMBw Ib9Bx44ufRHwAB5RsoRkh2c8pZXV/05YL1rNXLjcO7juztLj9g1OJDu+/31yp+Ay3K u5pNa0c5QVikSAUGLO9QeT1px3+zrtJio4scZpbsLb09q8tTlRcMArd60y2zL/nvb2 s5l7ohL3ZaFzGMUsSMP4DS1a1Ahas8bEnuKEisKRdatB0IONDZbLLB/vfcr+kxOamm VahkyE74c4m4n0RTiejsYz7u0J6d/WuYbrRjjdQFnFGM4seJmfrWgko/M8cWgvpm1o nvkBllanWmvZg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 112C6694C0; Sun, 18 Jan 2026 23:16:23 -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 V_lN2Vrf0IL8; Sun, 18 Jan 2026 23:16:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768803378; bh=x/8M1NJlwPu4F/3qLqCfUUNiMDoX0GeWVYuoDHz+JP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4vAHg2nDHACdkfsZtXRkUBcpPHX9emoSUYox/7C/Px4QbGEkiVwk2nZbqcu5LogI 6DDQKIOHYeV/uQCbrnaC/hN2CavyRbwyf1Avxt8sfWRXu7MvTEeTtEGx145YaVFP+z EbKsSMa0gfwCR8PwuWnVZOXrltx7XFYBiUsY1jGbkfGmLF1CrbsPeWJ/JfEJLPdtqm /GTiwwDj2/GPh7HBEsqxQgMVF8v9YMHXhg69CBXz+GcdYHcwCKtGVvXDIzU7/ao/DI sHHvOS+Dar6jXqH6wjdXtTt6sHp1eYtaBr//2ADXQZ1tyqT1ALCqBLMeOaIHtHP5Jb tB1oBKDiArtgA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 98246693AE; Sun, 18 Jan 2026 23:16:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 23:15:06 -0700 Message-ID: <20260119061529.3383191-9-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: KSZRQXFMGDDMO2U2RNDR5GFOFH5XGOAM X-Message-ID-Hash: KSZRQXFMGDDMO2U2RNDR5GFOFH5XGOAM 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 08/23] linux: quotaops: Add more quota 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 Extend linux/quotaops.h with additional quota stubs needed by ext4l: - dquot_alloc_block_nofail, dquot_alloc_block, dquot_free_block - dquot_claim_block, dquot_reclaim_block, dquot_reserve_block - dquot_release_reservation_block, dquot_initialize_needed - dquot_alloc_space_nodirty, dquot_free_space_nodirty - is_quota_modification, dquot_writeback_dquots - sb_any_quota_suspended The block allocation macros update inode->i_blocks to track allocated blocks without actual quota enforcement. Update ext4_uboot.h to use linux/quotaops.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 | 35 +++++-------------------- fs/ext4l/stub.c | 30 +-------------------- include/linux/quotaops.h | 56 +++++++++++++++++++++++++++++++++------- 3 files changed, 54 insertions(+), 67 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index dc8c9a97877..83dcf772c45 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -239,13 +239,8 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); /* Group permission - stub */ #define in_group_p(gid) (0) -/* Quota operations - stubs */ -#define dquot_alloc_block_nofail(inode, nr) \ - ({ (inode)->i_blocks += (nr) << ((inode)->i_blkbits - 9); 0; }) -#define dquot_initialize(inode) ({ (void)(inode); 0; }) -#define dquot_free_inode(inode) do { (void)(inode); } while (0) -#define dquot_alloc_inode(inode) ({ (void)(inode); 0; }) -#define dquot_drop(inode) do { (void)(inode); } while (0) +/* Quota operations - use linux/quotaops.h */ +#include /* icount - inode reference count */ #define icount_read(inode) (1) @@ -818,8 +813,7 @@ static inline unsigned long memweight(const void *ptr, size_t bytes) /* in_range - use linux/minmax.h */ #include -/* Quota stub */ -#define dquot_reclaim_block(i, n) do { } while (0) +/* dquot_reclaim_block is in linux/quotaops.h */ /* fiemap stubs are now in linux/fiemap.h */ @@ -923,8 +917,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* fsverity_file_open is in linux/fsverity.h */ #include -/* Quota file open - stub */ -#define dquot_file_open(i, f) ({ (void)(i); (void)(f); 0; }) +/* dquot_file_open is in linux/quotaops.h */ /* Inode I/O list management */ #define inode_io_list_del(inode) do { } while (0) @@ -934,13 +927,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* Folio operations and writeback stubs are in linux/pagemap.h */ #define folio_batch_release(fb) do { } while (0) -/* Quota stubs - additional */ -#define dquot_claim_block(i, n) ({ (void)(i); (void)(n); 0; }) -#define dquot_reserve_block(i, n) ({ (void)(i); (void)(n); 0; }) -#define dquot_release_reservation_block(i, n) do { } while (0) -#define dquot_initialize_needed(i) (0) -#define dquot_transfer(m, i, a) ({ (void)(m); (void)(i); (void)(a); 0; }) -#define is_quota_modification(m, i, a) ({ (void)(m); (void)(i); (void)(a); 0; }) +/* Quota stubs are in linux/quotaops.h */ /* percpu_counter_sub is in linux/percpu_counter.h */ @@ -1455,12 +1442,7 @@ void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, /* Filesystem sync - declaration for stub.c */ int sync_filesystem(void *sb); -/* Quota - declarations for stub.c */ -#define dquot_suspend(sb, type) ({ (void)(sb); (void)(type); 0; }) -int dquot_alloc_space_nodirty(struct inode *inode, loff_t size); -void dquot_free_space_nodirty(struct inode *inode, loff_t size); -int dquot_alloc_block(struct inode *inode, loff_t nr); -void dquot_free_block(struct inode *inode, loff_t nr); +/* Quota operations are in linux/quotaops.h */ /* Block device file operations - stubs */ #define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) @@ -1468,10 +1450,7 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* flush_workqueue is now in linux/workqueue.h */ -/* Quota stubs for super.c */ -#define dquot_writeback_dquots(sb, type) do { (void)(sb); (void)(type); } while (0) -#define dquot_resume(sb, type) do { (void)(sb); (void)(type); } while (0) -#define sb_any_quota_suspended(sb) ({ (void)(sb); 0; }) +/* Quota stubs for super.c are in linux/quotaops.h */ /* * Stubs for mballoc.c diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index e223ec21936..bdb8b8bb675 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -620,35 +620,7 @@ long ext4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) /* nop_mnt_idmap - no-op mount ID map for xattr.c */ struct mnt_idmap nop_mnt_idmap; -/* Quota stubs for xattr.c */ -int dquot_alloc_space_nodirty(struct inode *inode, loff_t size) -{ - return 0; -} - -void dquot_free_space_nodirty(struct inode *inode, loff_t size) -{ -} - -int dquot_alloc_block(struct inode *inode, loff_t nr) -{ - /* - * Update i_blocks to reflect the allocated blocks. - * i_blocks is in 512-byte units, so convert from fs blocks. - */ - inode->i_blocks += nr << (inode->i_blkbits - 9); - - return 0; -} - -void dquot_free_block(struct inode *inode, loff_t nr) -{ - /* - * Update i_blocks to reflect the freed blocks. - * i_blocks is in 512-byte units, so convert from fs blocks. - */ - inode->i_blocks -= nr << (inode->i_blkbits - 9); -} +/* Quota stubs are now macros in linux/quotaops.h */ /* * JBD2 stubs - temporary stubs until other jbd2 files are added diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 04988ace843..b32e7b7ab70 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -6,27 +6,62 @@ * Author: Marco van Wieringen * * Stub definitions for quota operations. - * U-Boot doesn't support disk quotas. + * U-Boot does not support disk quotas. */ #ifndef _LINUX_QUOTAOPS_H #define _LINUX_QUOTAOPS_H +#include + struct inode; struct dentry; struct kqid; +struct mnt_idmap; +struct iattr; +struct super_block; + +/* Quota initialisation and cleanup */ +#define dquot_initialize(inode) ({ (void)(inode); 0; }) +#define dquot_initialize_needed(inode) (0) +#define dquot_drop(inode) do { (void)(inode); } while (0) + +/* Inode quota operations */ +#define dquot_alloc_inode(inode) ({ (void)(inode); 0; }) +#define dquot_free_inode(inode) do { (void)(inode); } while (0) -#define dquot_initialize(inode) 0 -#define dquot_drop(inode) do { } while (0) -#define dquot_alloc_inode(inode) 0 -#define dquot_free_inode(inode) do { } while (0) -#define dquot_transfer(inode, attr) 0 +/* Block quota operations */ +#define dquot_alloc_block(inode, nr) \ + ({ (inode)->i_blocks += (nr) << ((inode)->i_blkbits - 9); 0; }) +#define dquot_alloc_block_nofail(inode, nr) \ + ({ (inode)->i_blocks += (nr) << ((inode)->i_blkbits - 9); 0; }) +#define dquot_free_block(inode, nr) \ + do { (inode)->i_blocks -= (nr) << ((inode)->i_blkbits - 9); } while (0) +#define dquot_claim_block(inode, nr) ({ (void)(inode); (void)(nr); 0; }) +#define dquot_reclaim_block(inode, nr) do { } while (0) +#define dquot_reserve_block(inode, nr) ({ (void)(inode); (void)(nr); 0; }) +#define dquot_release_reservation_block(inode, nr) \ + do { (void)(inode); (void)(nr); } while (0) + +/* Space quota operations */ +#define dquot_alloc_space_nodirty(inode, size) ({ (void)(inode); (void)(size); 0; }) +#define dquot_free_space_nodirty(inode, size) do { (void)(inode); (void)(size); } while (0) #define dquot_claim_space_nodirty(inode, nr) 0 #define dquot_reclaim_space_nodirty(inode, nr) do { } while (0) -#define dquot_disable(sb, type, flags) 0 -#define dquot_suspend(sb, type) 0 -#define dquot_resume(sb, type) 0 -#define dquot_file_open(inode, file) 0 +/* Transfer and modification checks */ +#define dquot_transfer(idmap, inode, attr) \ + ({ (void)(idmap); (void)(inode); (void)(attr); 0; }) +#define is_quota_modification(idmap, inode, attr) \ + ({ (void)(idmap); (void)(inode); (void)(attr); 0; }) + +/* Quota control */ +#define dquot_disable(sb, type, flags) 0 +#define dquot_suspend(sb, type) ({ (void)(sb); (void)(type); 0; }) +#define dquot_resume(sb, type) do { (void)(sb); (void)(type); } while (0) +#define dquot_writeback_dquots(sb, type) do { (void)(sb); (void)(type); } while (0) +#define dquot_file_open(inode, file) ({ (void)(inode); (void)(file); 0; }) + +/* Quota status queries */ #define sb_has_quota_usage_enabled(sb, type) 0 #define sb_has_quota_limits_enabled(sb, type) 0 #define sb_has_quota_suspended(sb, type) 0 @@ -34,5 +69,6 @@ struct kqid; #define sb_has_quota_active(sb, type) 0 #define sb_any_quota_loaded(sb) 0 #define sb_any_quota_active(sb) 0 +#define sb_any_quota_suspended(sb) ({ (void)(sb); 0; }) #endif /* _LINUX_QUOTAOPS_H */