f2fs: flush dirty data for bmap

Users expect bmap will give allocated block addresses.
Let's play likewise ext4.

Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2015-10-19 10:29:51 -07:00
Родитель 84e4214f08
Коммит 1d373a0ef7
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -1667,12 +1667,13 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
/* we don't need to use inline_data strictly */ if (f2fs_has_inline_data(inode))
if (f2fs_has_inline_data(inode)) { return 0;
int err = f2fs_convert_inline_inode(inode);
if (err) /* make sure allocating whole blocks */
return err; if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
} filemap_write_and_wait(mapping);
return generic_block_bmap(mapping, block, get_data_block_bmap); return generic_block_bmap(mapping, block, get_data_block_bmap);
} }