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>
 
        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)
         * 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) ||
 
 {
        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);