From patchwork Tue Jan 20 23:43:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1722 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=1768952719; bh=bsdCynDuzCWrT1qAjE1a7F2aSsSmlBEOZlgNlU18xHA=; 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=alN96UKwDr/Z6dz1xrNTmb/TLh4GFiwH7dmIVINoKC7T2ddgZfYe1gehb/PbRKPCd 0O3KTMZLktQQRCLaV389COQYXQo+9nJWewlDrJUbf0nkUZ52ejsYFmYQp51qxnBGbg WDIDkZmlPMsx+shSiMkeiHTWNzG2GhU89C7HtJ4A1oZtwnlyFUjAbmCeBV3eq8Wzdn XV4ISjAJRM0186f7GFKIjTgw1Z9/2no4QUNyWT+SzFWLrLJ0uIJRQjslAh2wn5ufqZ hZsObWvYUWpmsZmAFe2xjOpG6QitSw+JuEpWfpgUSv+JzKxKkne4F3ik87pzAZGYDu w22LjLXR3cWNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5872C69597 for ; Tue, 20 Jan 2026 16:45:19 -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 BehyLPgFxlFr for ; Tue, 20 Jan 2026 16:45:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952719; bh=bsdCynDuzCWrT1qAjE1a7F2aSsSmlBEOZlgNlU18xHA=; 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=alN96UKwDr/Z6dz1xrNTmb/TLh4GFiwH7dmIVINoKC7T2ddgZfYe1gehb/PbRKPCd 0O3KTMZLktQQRCLaV389COQYXQo+9nJWewlDrJUbf0nkUZ52ejsYFmYQp51qxnBGbg WDIDkZmlPMsx+shSiMkeiHTWNzG2GhU89C7HtJ4A1oZtwnlyFUjAbmCeBV3eq8Wzdn XV4ISjAJRM0186f7GFKIjTgw1Z9/2no4QUNyWT+SzFWLrLJ0uIJRQjslAh2wn5ufqZ hZsObWvYUWpmsZmAFe2xjOpG6QitSw+JuEpWfpgUSv+JzKxKkne4F3ik87pzAZGYDu w22LjLXR3cWNA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 470C6695AD for ; Tue, 20 Jan 2026 16:45:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952718; bh=Jp3P70XGlOmF5FfMRFBVnYxCjLzqmjScuXHDxBt6iGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r8vl98j3//kZNg/e6SUUzCPmrErRbd7FpqJE5DHvoK7lksUobXzkERhvs9Rn/ZS24 5BitXS7o1OO61n3V0meLJ1ieXg6Znm/p/FHQHXOonxYH6J3aUBt48t34+7ZtLtkHhR 1wm15YeSVjGZYerZiQ/LaboevgcoqWLAfVO0K5o6hLmZyfu08Iz4X1x+rg5gKALB0S WdcBdz5h+0CiBWJMYpQYkOIohcbL7kRPVPUtEEemN7tlbHgZ2Q0ySi0qxezQ1qNvJ2 2TKvwSexk5r1rr0jnXFiFJC/oIJArxh0LXevqiH+LQ4MV95kxKD/XLFRVm/uj2po7Y gOUAEn6no0Vcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C21369597; Tue, 20 Jan 2026 16:45: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 WLoP2vU06OMZ; Tue, 20 Jan 2026 16:45:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952710; bh=tK9F53YLDOoqQ1Xo3YbnlEuOiVE/WYr+5YtkzMx+0kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYg4vV1VoaYspsAK8OR357Dh0KKbst8GtIhC1Ilm757xo9f3LmLAGYCE/6U3wzIb8 N1vgkxIdmVOpluzqf/DIRV1OhqAgrlkRmPN2MqGzxgtOwA0tZkBkL45jmJDQcoIyNf jslPVnqN8WB70D2EiPO4AOwXgh2TZqHiEhVTOTYlYmq2cf6PDme9J+RnC8EQuWaI7o YuQWG9/Nulyx5ilUdoGr+4zrSIUovAS4MMYVyLURKDZ4dsBT2aFkpS5f5AOlE/WlOj bnvlwRuGS3pcnLdurmi5prFcMTFznjAO0RmkSX546YgATJ6OIBJq6+oKZzrBwK/PE1 pauQSdOZwb4jA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B5500695AD; Tue, 20 Jan 2026 16:45:09 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:33 -0700 Message-ID: <20260120234344.495605-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260120234344.495605-1-sjg@u-boot.org> References: <20260120234344.495605-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RYD2GIIZEM7H6J7FME4IKHDKRJ6L56NM X-Message-ID-Hash: RYD2GIIZEM7H6J7FME4IKHDKRJ6L56NM 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 13/17] ext4l: Move folio operations to proper headers 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 Move folio-related definitions to their proper Linux headers: - folio_batch_release() to linux/pagevec.h - Block/buffer folio operations: bh_offset(), block_invalidate_folio(), block_dirty_folio(), block_read_full_folio(), etc. to linux/buffer_head.h - Folio function declarations: __filemap_get_folio(), folio_put(), folio_get(), etc. to linux/pagemap.h - Folio writeback and read stubs to linux/pagemap.h - Writeback control stubs: wbc_init_bio(), wbc_account_cgroup_owner() to linux/pagemap.h Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 49 ++++++------------------------------- include/linux/buffer_head.h | 19 ++++++++++++++ include/linux/pagemap.h | 18 ++++++++++++++ include/linux/pagevec.h | 11 +++++++++ 4 files changed, 56 insertions(+), 41 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 49dd566262b..12250b8daf4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -690,14 +690,7 @@ struct dx_hash_info { /* 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 */ - -/* Folio operations - implemented in support.c */ -struct folio *__filemap_get_folio(struct address_space *mapping, - pgoff_t index, unsigned int fgp_flags, - gfp_t gfp); -void folio_put(struct folio *folio); -void folio_get(struct folio *folio); -void mapping_clear_folio_cache(struct address_space *mapping); +/* __filemap_get_folio, folio_put, folio_get, mapping_clear_folio_cache are in linux/pagemap.h */ /* projid_t is now in linux/projid.h */ @@ -748,7 +741,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* inode_is_open_for_write, inode_is_dirtytime_only are in linux/fs.h */ /* Folio operations and writeback stubs are in linux/pagemap.h */ -#define folio_batch_release(fb) do { } while (0) +/* folio_batch_release is in linux/pagevec.h */ /* Quota stubs are in linux/quotaops.h */ @@ -757,20 +750,8 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* Filemap operations are in linux/pagemap.h */ /* try_to_writeback_inodes_sb is in linux/writeback.h */ -/* Buffer operations - additional */ -/* getblk_unmovable is in linux/buffer_head.h */ -#define create_empty_buffers(f, s, flags) ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) -/* bh_offset returns offset of b_data within the folio */ -#define bh_offset(bh) ((bh)->b_folio ? \ - (unsigned long)((char *)(bh)->b_data - (char *)(bh)->b_folio->data) : 0UL) -#define block_invalidate_folio(f, o, l) do { } while (0) -#define block_write_end(pos, len, copied, folio) ({ (void)(pos); (void)(len); (void)(folio); (copied); }) -#define block_dirty_folio(m, f) ({ (void)(m); (void)(f); false; }) -#define try_to_free_buffers(f) ({ (void)(f); true; }) -#define block_commit_write(f, f2, t) do { } while (0) -#define block_page_mkwrite(v, f, g) ((vm_fault_t)0) -#define map_bh(bh, sb, block) do { } while (0) -#define write_begin_get_folio(iocb, m, idx, l) ({ (void)(iocb); (void)(m); (void)(idx); (void)(l); (struct folio *)NULL; }) +/* Buffer/block folio operations are in linux/buffer_head.h */ +/* write_begin_get_folio is in linux/pagemap.h */ /* fscrypt_name, fscrypt_match_name, and fscrypt stubs are in ext4_fscrypt.h */ @@ -1283,17 +1264,8 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* fscrypt page-io stubs are in ext4_fscrypt.h */ -/* folio writeback operations */ -#define folio_end_writeback(f) do { (void)(f); } while (0) -#define folio_start_writeback(f) do { (void)(f); } while (0) -#define folio_start_writeback_keepwrite(f) do { (void)(f); } while (0) -bool __folio_start_writeback(struct folio *folio, bool keep_write); - -/* writeback control stubs */ -#define wbc_init_bio(wbc, bio) do { (void)(wbc); (void)(bio); } while (0) -#define wbc_account_cgroup_owner(wbc, folio, bytes) \ - do { (void)(wbc); (void)(folio); (void)(bytes); } while (0) - +/* folio writeback operations are in linux/pagemap.h */ +/* writeback control stubs are in linux/pagemap.h */ /* bio_add_folio is in linux/bio.h */ /* @@ -1303,10 +1275,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* mempool is now in linux/mempool.h */ #include -/* folio read operations */ -#define folio_end_read(f, success) do { (void)(f); (void)(success); } while (0) -#define folio_set_mappedtodisk(f) do { (void)(f); } while (0) - +/* folio read operations are in linux/pagemap.h */ /* fscrypt readpage stubs are in ext4_fscrypt.h */ /* fsverity stubs are in linux/fsverity.h */ @@ -1316,9 +1285,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* prefetch operations */ #define prefetchw(addr) do { (void)(addr); } while (0) -/* block read operations */ -#define block_read_full_folio(folio, get_block) \ - ({ (void)(folio); (void)(get_block); 0; }) +/* block_read_full_folio is in linux/buffer_head.h */ /* * Stubs for fast_commit.c diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 3e5893ab99d..ea317a6488d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -268,4 +268,23 @@ static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) #define __find_get_block_nonatomic(bdev, block, size) \ ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) +/* + * Block/buffer folio operations - U-Boot stubs + */ +#define create_empty_buffers(f, s, flags) \ + ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) +/* bh_offset returns offset of b_data within the folio */ +#define bh_offset(bh) ((bh)->b_folio ? \ + (unsigned long)((char *)(bh)->b_data - (char *)(bh)->b_folio->data) : 0UL) +#define block_invalidate_folio(f, o, l) do { } while (0) +#define block_write_end(pos, len, copied, folio) \ + ({ (void)(pos); (void)(len); (void)(folio); (copied); }) +#define block_dirty_folio(m, f) ({ (void)(m); (void)(f); false; }) +#define try_to_free_buffers(f) ({ (void)(f); true; }) +#define block_commit_write(f, f2, t) do { } while (0) +#define block_page_mkwrite(v, f, g) ((vm_fault_t)0) +#define map_bh(bh, sb, block) do { } while (0) +#define block_read_full_folio(folio, get_block) \ + ({ (void)(folio); (void)(get_block); 0; }) + #endif /* _LINUX_BUFFER_HEAD_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 19a64993955..eb689fa885f 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -94,11 +94,29 @@ struct folio { #define folio_end_writeback(f) do { (void)(f); } while (0) #define folio_start_writeback(f) do { (void)(f); } while (0) #define folio_start_writeback_keepwrite(f) do { (void)(f); } while (0) +bool __folio_start_writeback(struct folio *folio, bool keep_write); #define folio_end_read(f, success) do { (void)(f); (void)(success); } while (0) #define folio_set_mappedtodisk(f) do { (void)(f); } while (0) #define folio_redirty_for_writepage(wbc, folio) \ ({ (void)(wbc); (void)(folio); false; }) +/* Folio operations - implemented in ext4l/support.c */ +struct folio *__filemap_get_folio(struct address_space *mapping, + pgoff_t index, unsigned int fgp_flags, + gfp_t gfp); +void folio_put(struct folio *folio); +void folio_get(struct folio *folio); +void mapping_clear_folio_cache(struct address_space *mapping); + +/* Writeback control stubs */ +#define wbc_init_bio(wbc, bio) do { (void)(wbc); (void)(bio); } while (0) +#define wbc_account_cgroup_owner(wbc, folio, bytes) \ + do { (void)(wbc); (void)(folio); (void)(bytes); } while (0) + +/* Write begin helper */ +#define write_begin_get_folio(iocb, m, idx, l) \ + ({ (void)(iocb); (void)(m); (void)(idx); (void)(l); (struct folio *)NULL; }) + /* * offset_in_folio - calculate offset of pointer within folio's data * diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index b794ff8f47c..b83a8420b3d 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -43,4 +43,15 @@ static inline unsigned int folio_batch_add(struct folio_batch *fbatch, return PAGEVEC_SIZE - fbatch->nr; } +/** + * folio_batch_release() - release a batch of folios + * @fbatch: batch to release + * + * U-Boot stub - no-op. + */ +static inline void folio_batch_release(struct folio_batch *fbatch) +{ + (void)fbatch; +} + #endif /* _LINUX_PAGEVEC_H */