summaryrefslogtreecommitdiff
path: root/fs/f2fs/inode.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-03-17 17:16:35 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2015-04-10 15:08:46 -0700
commit3c6c2bebef79999b1827041696dc1881e637e3af (patch)
tree32391cbf119529871a6663ed62d5ab0b2e94a09e /fs/f2fs/inode.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/inode.c')
-rw-r--r--fs/f2fs/inode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index b5087443be41..bb5800969bcc 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -51,6 +51,13 @@ static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)
}
}
+static bool __written_first_block(struct f2fs_inode *ri)
+{
+ if (ri->i_addr[0] != NEW_ADDR && ri->i_addr[0] != NULL_ADDR)
+ return true;
+ return false;
+}
+
static void __set_inode_rdev(struct inode *inode, struct f2fs_inode *ri)
{
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
@@ -143,6 +150,9 @@ static int do_read_inode(struct inode *inode)
/* get rdev by using inline_info */
__get_inode_rdev(inode, ri);
+ if (__written_first_block(ri))
+ set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN);
+
f2fs_put_page(node_page, 1);
stat_inc_inline_inode(inode);