aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2016-09-18 08:16:56 +0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:34:08 +0200
commitcea56e55a0164100f49da28e83751d6b1c27c671 (patch)
treed4bca81e15a3a28735415e20029b37e39b6875ef
parent4f0ce0fa4b39f47a26b1a2b3052114cb60890b56 (diff)
f2fs: preallocate blocks for encrypted file
This patch allow preallocates data blocks for buffered aio writes in encrypted file. Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> [Jaegeuk Kim: fix to avoid BUG_ON] Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Conflicts: fs/f2fs/data.c
-rw-r--r--fs/f2fs/data.c6
-rw-r--r--fs/f2fs/segment.c4
2 files changed, 2 insertions, 8 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 426983284..084b98ba9 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -633,9 +633,6 @@ ssize_t f2fs_preallocate_blocks(struct inode *inode, loff_t pos, size_t count, b
map.m_next_pgofs = NULL;
- if (f2fs_encrypted_inode(inode))
- return 0;
-
if (dio) {
ret = f2fs_convert_inline_inode(inode);
if (ret)
@@ -1523,8 +1520,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
* we already allocated all the blocks, so we don't need to get
* the block addresses when there is no need to fill the page.
*/
- if (!f2fs_has_inline_data(inode) && !f2fs_encrypted_inode(inode) &&
- len == PAGE_SIZE)
+ if (!f2fs_has_inline_data(inode) && len == PAGE_SIZE)
return 0;
if (f2fs_has_inline_data(inode) ||
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index faeb3a255..9970004ce 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1656,11 +1656,9 @@ void f2fs_wait_on_encrypted_page_writeback(struct f2fs_sb_info *sbi,
{
struct page *cpage;
- if (blkaddr == NEW_ADDR)
+ if (blkaddr == NEW_ADDR || blkaddr == NULL_ADDR)
return;
- f2fs_bug_on(sbi, blkaddr == NULL_ADDR);
-
cpage = find_lock_page(META_MAPPING(sbi), blkaddr);
if (cpage) {
f2fs_wait_on_page_writeback(cpage, DATA, true);