diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-12-05 17:37:37 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-12-08 13:35:15 -0500 |
commit | 126622343a8488917c5e0891eae1bc936a63f49a (patch) | |
tree | 854d81340f5b0c96a01e22c7f085099e23cd57e3 /fs/f2fs | |
parent | 0722b1011a5f6b03b73334ecd80e121a95e8d4e0 (diff) |
f2fs: release inmemory pages when the file was closed
If file is closed, let's drop inmemory pages.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 146e58ab716e..b6f3fbf2a376 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -901,6 +901,14 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) | |||
901 | return f2fs_convert_inline_inode(inode); | 901 | return f2fs_convert_inline_inode(inode); |
902 | } | 902 | } |
903 | 903 | ||
904 | static int f2fs_release_file(struct inode *inode, struct file *filp) | ||
905 | { | ||
906 | /* some remained atomic pages should discarded */ | ||
907 | if (f2fs_is_atomic_file(inode) || f2fs_is_volatile_file(inode)) | ||
908 | commit_inmem_pages(inode, true); | ||
909 | return 0; | ||
910 | } | ||
911 | |||
904 | static int f2fs_ioc_commit_atomic_write(struct file *filp) | 912 | static int f2fs_ioc_commit_atomic_write(struct file *filp) |
905 | { | 913 | { |
906 | struct inode *inode = file_inode(filp); | 914 | struct inode *inode = file_inode(filp); |
@@ -1010,6 +1018,7 @@ const struct file_operations f2fs_file_operations = { | |||
1010 | .read_iter = generic_file_read_iter, | 1018 | .read_iter = generic_file_read_iter, |
1011 | .write_iter = generic_file_write_iter, | 1019 | .write_iter = generic_file_write_iter, |
1012 | .open = generic_file_open, | 1020 | .open = generic_file_open, |
1021 | .release = f2fs_release_file, | ||
1013 | .mmap = f2fs_file_mmap, | 1022 | .mmap = f2fs_file_mmap, |
1014 | .fsync = f2fs_sync_file, | 1023 | .fsync = f2fs_sync_file, |
1015 | .fallocate = f2fs_fallocate, | 1024 | .fallocate = f2fs_fallocate, |