From 21a6287ae2489426d23979e2213033dd204aa9fa Mon Sep 17 00:00:00 2001 From: Aditya Prakash Srivastava Date: Fri, 3 Jul 2026 09:00:44 +0000 Subject: [PATCH] ecryptfs: use filemap_dirty_folio for address space operations ecryptfs does not use buffer_heads. The legacy block_dirty_folio and block_invalidate_folio mapping operations were only added as a temporary compatibility fallback under CONFIG_BLOCK. Since ecryptfs does not attach private metadata (such as buffer_heads) to its folios, block_dirty_folio is unnecessary. Modernize ecryptfs to use filemap_dirty_folio for its dirty_folio address space operation. This allows removing the block_dirty_folio and block_invalidate_folio fallbacks, removing the buffer_head header include, and removing the CONFIG_BLOCK dependency inside ecryptfs_aops. Signed-off-by: Aditya Prakash Srivastava Reviewed-by: Christoph Hellwig Signed-off-by: Tyler Hicks --- fs/ecryptfs/mmap.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 0222f98143ab..07a6c8448100 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -503,21 +503,8 @@ static sector_t ecryptfs_bmap(struct address_space *mapping, sector_t block) return block; } -#include - const struct address_space_operations ecryptfs_aops = { - /* - * XXX: This is pretty broken for multiple reasons: ecryptfs does not - * actually use buffer_heads, and ecryptfs will crash without - * CONFIG_BLOCK. But it matches the behavior before the default for - * address_space_operations without the ->dirty_folio method was - * cleaned up, so this is the best we can do without maintainer - * feedback. - */ -#ifdef CONFIG_BLOCK - .dirty_folio = block_dirty_folio, - .invalidate_folio = block_invalidate_folio, -#endif + .dirty_folio = filemap_dirty_folio, .writepages = ecryptfs_writepages, .read_folio = ecryptfs_read_folio, .write_begin = ecryptfs_write_begin,