summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-06-14 08:05:32 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2017-07-04 02:11:49 -0700
commita9bcf9bcd01499001834273ac1114ec76668f048 (patch)
tree3f9caab372434dfb75d2dc0c188a78159ac149cd /fs/f2fs
parent0eb0adadf2e49d82bc4ecd65ec3bb69251f7564c (diff)
downloadop-kernel-dev-a9bcf9bcd01499001834273ac1114ec76668f048.zip
op-kernel-dev-a9bcf9bcd01499001834273ac1114ec76668f048.tar.gz
f2fs: don't need to check encrypted inode for partial truncation
The cache_only is always false, if inode is encrypted. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7ea63d8..6a201c6 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -534,8 +534,10 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
truncate_out:
f2fs_wait_on_page_writeback(page, DATA, true);
zero_user(page, offset, PAGE_SIZE - offset);
- if (!cache_only || !f2fs_encrypted_inode(inode) ||
- !S_ISREG(inode->i_mode))
+
+ /* An encrypted inode should have a key and truncate the last page. */
+ f2fs_bug_on(F2FS_I_SB(inode), cache_only && f2fs_encrypted_inode(inode));
+ if (!cache_only)
set_page_dirty(page);
f2fs_put_page(page, 1);
return 0;
OpenPOWER on IntegriCloud