aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
authorToshiyuki Okajima <toshi.okajima@jp.fujitsu.com>2009-01-05 22:38:14 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-01-05 22:38:14 -0500
commit6b082b531228c43d454c082fc0f969da1695b060 (patch)
treedbd2f64945064e31383a24729fcdb672a23f65e9 /fs/ext3
parent87d8fe1ee6b8d2f95076142d58c440dba4e7bdc2 (diff)
ext3: provide function to release metadata pages under memory pressure
Pages in the page cache belonging to ext3 data files are released via the ext3_releasepage() function specified in the ext3 inode's address_space_ops. However, metadata blocks (such as indirect blocks, directory blocks, etc) are managed via the block device address_space_ops, and they can not be released by try_to_free_buffers() if they have a journal head attached to them. To address this, we supply a try_to_free_pages() function which calls journal_try_to_free_buffers() function to free the metadata, and which is called by the block device's blkdev_releasepage() function. Signed-off-by: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/super.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 541d5e4f7f6e..6900ff05e3ab 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -682,6 +682,26 @@ static struct dentry *ext3_fh_to_parent(struct super_block *sb, struct fid *fid,
682 ext3_nfs_get_inode); 682 ext3_nfs_get_inode);
683} 683}
684 684
685/*
686 * Try to release metadata pages (indirect blocks, directories) which are
687 * mapped via the block device. Since these pages could have journal heads
688 * which would prevent try_to_free_buffers() from freeing them, we must use
689 * jbd layer's try_to_free_buffers() function to release them.
690 */
691static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
692 gfp_t wait)
693{
694 journal_t *journal = EXT3_SB(sb)->s_journal;
695
696 WARN_ON(PageChecked(page));
697 if (!page_has_buffers(page))
698 return 0;
699 if (journal)
700 return journal_try_to_free_buffers(journal, page,
701 wait & ~__GFP_WAIT);
702 return try_to_free_buffers(page);
703}
704
685#ifdef CONFIG_QUOTA 705#ifdef CONFIG_QUOTA
686#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") 706#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
687#define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) 707#define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
@@ -746,6 +766,7 @@ static const struct super_operations ext3_sops = {
746 .quota_read = ext3_quota_read, 766 .quota_read = ext3_quota_read,
747 .quota_write = ext3_quota_write, 767 .quota_write = ext3_quota_write,
748#endif 768#endif
769 .bdev_try_to_free_page = bdev_try_to_free_page,
749}; 770};
750 771
751static const struct export_operations ext3_export_ops = { 772static const struct export_operations ext3_export_ops = {