Re: [RFC PATCH] mm/filemap: make release_folio mandatory and add block_release_folio

From: Jan Kara

Date: Mon Dec 22 2025 - 10:48:09 EST


On Mon 22-12-25 15:13:26, Matthew Wilcox wrote:
> On Mon, Dec 22, 2025 at 01:38:51PM +0100, Jan Kara wrote:
> > > Filesystems updated: adfs, affs, bfs, exfat, ext2, fat, hpfs, isofs,
> > > jfs, minix, nilfs2, ntfs3, omfs, udf, ufs, plus block/fops.c
> >
> > I think affs_aops_ofs need .release_folio as well...
> >
> > Also befs_aops, ecryptfs_aops, efs_aops, vxfs_aops, hfs_aops, hfsplus_aops,
> > nilfs_buffer_cache_aops, qnx4_aops, qnx6_aops definitely need .release_folio. ntfs_aops_cmpr
> > might need it as well - not sure.
>
> If we were using a real programming language, we'd have a class for
> BH-based filesystems, inherit from it and override each method. But since
> we aren't, let's see what we can do in C ...
>
> #define BH_DEFAULT_AOPS \
> .dirty_folio = block_dirty_folio, \
> .invalidate_folio = block_invalidate_folio, \
> .migrate_folio = buffer_migrate_folio, \
> .is_partially_uptodate = block_is_partially_uptodate, \
> .error_remove_folio = generic_error_remove_folio,
>
> As I understand C, later initialisers override earlier ones [1].

Frankly, I'm not 100% convinced this will be a win and there is definitely
a potential for surprises because filesystems tend to do weird things so
this will need to carefully go filesystem by filesystem... So I wouldn't
complicate this patch with a change like this. Let's clean up
.release_folio first and we can look into cutting boilerplate
initializations later.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR