]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: preallocate blocks for encrypted file
authorYunlei He <heyunlei@huawei.com>
Sun, 18 Sep 2016 00:16:56 +0000 (08:16 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 22 Sep 2016 18:43:08 +0000 (11:43 -0700)
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>
fs/f2fs/data.c
fs/f2fs/segment.c

index 25e3c302b72f81c709820387e60adfbd6875a65d..637b81d0f9f0ade57ed171f3e0da74d7979306d8 100644 (file)
@@ -639,9 +639,6 @@ ssize_t f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
 
        map.m_next_pgofs = NULL;
 
-       if (f2fs_encrypted_inode(inode))
-               return 0;
-
        if (iocb->ki_flags & IOCB_DIRECT) {
                ret = f2fs_convert_inline_inode(inode);
                if (ret)
@@ -1532,8 +1529,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) ||
index 101b58f1d63677588f3e30f0555ede9764214f39..c4d0472cf47d5eefc39a2e466565f0db37945399 100644 (file)
@@ -1675,11 +1675,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);