diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-03-17 17:16:35 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-10 15:08:46 -0700 |
commit | 3c6c2bebef79999b1827041696dc1881e637e3af (patch) | |
tree | 32391cbf119529871a6663ed62d5ab0b2e94a09e /fs/f2fs/file.c | |
parent | 83e21db6939dd6ff50a81d54aaef4b44847aefff (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.c | 6 |
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) dn->data_blkaddr = NULL_ADDR; f2fs_update_extent_cache(dn); invalidate_blocks(sbi, blkaddr); + if (dn->ofs_in_node == 0 && IS_INODE(dn->node_page)) + clear_inode_flag(F2FS_I(dn->inode), + FI_FIRST_BLOCK_WRITTEN); nr_free++; } if (nr_free) { @@ -1005,6 +1008,9 @@ static int f2fs_ioc_release_volatile_write(struct file *filp) if (!f2fs_is_volatile_file(inode)) return 0; + if (!f2fs_is_first_block_written(inode)) + return truncate_partial_data_page(inode, 0, true); + punch_hole(inode, 0, F2FS_BLKSIZE); return 0; } |