Skip to content

Commit 3b672e3

Browse files
zhangyi089tytso
authored andcommitted
ext4: remove bdev_try_to_free_page() callback
After we introduce a jbd2 shrinker to release checkpointed buffer's journal head, we could free buffer without bdev_try_to_free_page() under memory pressure. So this patch remove the whole bdev_try_to_free_page() callback directly. It also remove many use-after-free issues relate to it together. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent dbf2bab commit 3b672e3

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

fs/ext4/super.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,26 +1442,6 @@ static int ext4_nfs_commit_metadata(struct inode *inode)
14421442
return ext4_write_inode(inode, &wbc);
14431443
}
14441444

1445-
/*
1446-
* Try to release metadata pages (indirect blocks, directories) which are
1447-
* mapped via the block device. Since these pages could have journal heads
1448-
* which would prevent try_to_free_buffers() from freeing them, we must use
1449-
* jbd2 layer's try_to_free_buffers() function to release them.
1450-
*/
1451-
static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
1452-
gfp_t wait)
1453-
{
1454-
journal_t *journal = EXT4_SB(sb)->s_journal;
1455-
1456-
WARN_ON(PageChecked(page));
1457-
if (!page_has_buffers(page))
1458-
return 0;
1459-
if (journal)
1460-
return jbd2_journal_try_to_free_buffers(journal, page);
1461-
1462-
return try_to_free_buffers(page);
1463-
}
1464-
14651445
#ifdef CONFIG_FS_ENCRYPTION
14661446
static int ext4_get_context(struct inode *inode, void *ctx, size_t len)
14671447
{
@@ -1656,7 +1636,6 @@ static const struct super_operations ext4_sops = {
16561636
.quota_write = ext4_quota_write,
16571637
.get_dquots = ext4_get_dquots,
16581638
#endif
1659-
.bdev_try_to_free_page = bdev_try_to_free_page,
16601639
};
16611640

16621641
static const struct export_operations ext4_export_ops = {

0 commit comments

Comments
 (0)