summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/f2fs.h2
-rw-r--r--fs/f2fs/file.c6
-rw-r--r--fs/f2fs/inode.c4
-rw-r--r--fs/f2fs/super.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 38ba525c3d6f..e73f2e2453f9 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1579,7 +1579,7 @@ static inline bool f2fs_may_extent_tree(struct inode *inode)
int f2fs_sync_file(struct file *, loff_t, loff_t, int);
void truncate_data_blocks(struct dnode_of_data *);
int truncate_blocks(struct inode *, u64, bool);
-void f2fs_truncate(struct inode *);
+void f2fs_truncate(struct inode *, bool);
int f2fs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
int f2fs_setattr(struct dentry *, struct iattr *);
int truncate_hole(struct inode *, pgoff_t, pgoff_t);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d0114710648e..15df014aadc7 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -579,7 +579,7 @@ out:
return err;
}
-void f2fs_truncate(struct inode *inode)
+void f2fs_truncate(struct inode *inode, bool lock)
{
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)))
@@ -593,7 +593,7 @@ void f2fs_truncate(struct inode *inode)
return;
}
- if (!truncate_blocks(inode, i_size_read(inode), true)) {
+ if (!truncate_blocks(inode, i_size_read(inode), lock)) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
mark_inode_dirty(inode);
}
@@ -656,7 +656,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
if (attr->ia_size <= i_size_read(inode)) {
truncate_setsize(inode, attr->ia_size);
- f2fs_truncate(inode);
+ f2fs_truncate(inode, true);
f2fs_balance_fs(F2FS_I_SB(inode));
} else {
/*
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 5b7547f0bdea..cc4f1082419a 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -343,7 +343,7 @@ void f2fs_evict_inode(struct inode *inode)
i_size_write(inode, 0);
if (F2FS_HAS_BLOCKS(inode))
- f2fs_truncate(inode);
+ f2fs_truncate(inode, true);
f2fs_lock_op(sbi);
remove_inode_page(inode);
@@ -385,7 +385,7 @@ void handle_failed_inode(struct inode *inode)
i_size_write(inode, 0);
if (F2FS_HAS_BLOCKS(inode))
- f2fs_truncate(inode);
+ f2fs_truncate(inode, false);
remove_inode_page(inode);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0083b8559c9b..12eb69dd38af 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -467,7 +467,7 @@ static int f2fs_drop_inode(struct inode *inode)
i_size_write(inode, 0);
if (F2FS_HAS_BLOCKS(inode))
- f2fs_truncate(inode);
+ f2fs_truncate(inode, true);
sb_end_intwrite(inode->i_sb);