map->m_flags = F2FS_MAP_MAPPED;
                if (map->m_next_extent)
                        *map->m_next_extent = pgofs + map->m_len;
+
+               /* for hardware encryption, but to avoid potential issue in future */
+               if (flag == F2FS_GET_BLOCK_DIO)
+                       f2fs_wait_on_block_writeback_range(inode,
+                                               map->m_pblk, map->m_len);
                goto out;
        }
 
        goto next_dnode;
 
 sync_out:
+
+       /* for hardware encryption, but to avoid potential issue in future */
+       if (flag == F2FS_GET_BLOCK_DIO && map->m_flags & F2FS_MAP_MAPPED)
+               f2fs_wait_on_block_writeback_range(inode,
+                                               map->m_pblk, map->m_len);
+
        if (flag == F2FS_GET_BLOCK_PRECACHE) {
                if (map->m_flags & F2FS_MAP_MAPPED) {
                        unsigned int ofs = start_pgofs - map->m_lblk;
 
 void f2fs_wait_on_page_writeback(struct page *page,
                        enum page_type type, bool ordered);
 void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr);
+void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr,
+                                                               block_t len);
 void f2fs_write_data_summaries(struct f2fs_sb_info *sbi, block_t start_blk);
 void f2fs_write_node_summaries(struct f2fs_sb_info *sbi, block_t start_blk);
 int f2fs_lookup_journal_in_cursum(struct f2fs_journal *journal, int type,
 
        }
 }
 
+void f2fs_wait_on_block_writeback_range(struct inode *inode, block_t blkaddr,
+                                                               block_t len)
+{
+       block_t i;
+
+       for (i = 0; i < len; i++)
+               f2fs_wait_on_block_writeback(inode, blkaddr + i);
+}
+
 static int read_compacted_summaries(struct f2fs_sb_info *sbi)
 {
        struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);