aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-03-17 20:16:35 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2015-04-10 18:08:46 -0400
commit3c6c2bebef79999b1827041696dc1881e637e3af (patch)
tree32391cbf119529871a6663ed62d5ab0b2e94a09e /fs/f2fs/file.c
parent83e21db6939dd6ff50a81d54aaef4b44847aefff (diff)
f2fs: avoid punch_hole overhead when releasing volatile data
This patch is to avoid some punch_hole overhead when releasing volatile data. If volatile data was not written yet, we just can make the first page as zero. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 36dc7581a28b..39a07a59b134 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -437,6 +437,9 @@ int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
437 dn->data_blkaddr = NULL_ADDR; 437 dn->data_blkaddr = NULL_ADDR;
438 f2fs_update_extent_cache(dn); 438 f2fs_update_extent_cache(dn);
439 invalidate_blocks(sbi, blkaddr); 439 invalidate_blocks(sbi, blkaddr);
440 if (dn->ofs_in_node == 0 && IS_INODE(dn->node_page))
441 clear_inode_flag(F2FS_I(dn->inode),
442 FI_FIRST_BLOCK_WRITTEN);
440 nr_free++; 443 nr_free++;
441 } 444 }
442 if (nr_free) { 445 if (nr_free) {
@@ -1005,6 +1008,9 @@ static int f2fs_ioc_release_volatile_write(struct file *filp)
1005 if (!f2fs_is_volatile_file(inode)) 1008 if (!f2fs_is_volatile_file(inode))
1006 return 0; 1009 return 0;
1007 1010
1011 if (!f2fs_is_first_block_written(inode))
1012 return truncate_partial_data_page(inode, 0, true);
1013
1008 punch_hole(inode, 0, F2FS_BLKSIZE); 1014 punch_hole(inode, 0, F2FS_BLKSIZE);
1009 return 0; 1015 return 0;
1010} 1016}