aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-08-25 17:45:59 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-25 17:52:09 -0400
commitc2e69583a4787b252f6be9a9daea4662eebc26f8 (patch)
treeb5a5e1dc0d992337f098675a710307f5fb85a36d /fs/f2fs/node.c
parentb5b822050ca3c4fc1f475100cc197cc00ba2d492 (diff)
f2fs: truncate stale block for inline_data
This verifies to truncate any allocated blocks, offset[0], by inline_data. Not figured out, but for making sure. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 044395c20ee9..45378196e19a 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -823,22 +823,26 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
823 */ 823 */
824void remove_inode_page(struct inode *inode) 824void remove_inode_page(struct inode *inode)
825{ 825{
826 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
827 struct page *page;
828 nid_t ino = inode->i_ino;
829 struct dnode_of_data dn; 826 struct dnode_of_data dn;
830 827
831 page = get_node_page(sbi, ino); 828 set_new_dnode(&dn, inode, NULL, NULL, inode->i_ino);
832 if (IS_ERR(page)) 829 if (get_dnode_of_data(&dn, 0, LOOKUP_NODE))
833 return; 830 return;
834 831
835 if (truncate_xattr_node(inode, page)) { 832 if (truncate_xattr_node(inode, dn.inode_page)) {
836 f2fs_put_page(page, 1); 833 f2fs_put_dnode(&dn);
837 return; 834 return;
838 } 835 }
836
837 /* remove potential inline_data blocks */
838 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
839 S_ISLNK(inode->i_mode))
840 truncate_data_blocks_range(&dn, 1);
841
839 /* 0 is possible, after f2fs_new_inode() has failed */ 842 /* 0 is possible, after f2fs_new_inode() has failed */
840 f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1); 843 f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1);
841 set_new_dnode(&dn, inode, page, page, ino); 844
845 /* will put inode & node pages */
842 truncate_node(&dn); 846 truncate_node(&dn);
843} 847}
844 848