Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d373a0e authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

f2fs: flush dirty data for bmap



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

Reviewed-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 84e4214f
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1667,12 +1667,13 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
{
	struct inode *inode = mapping->host;

	/* we don't need to use inline_data strictly */
	if (f2fs_has_inline_data(inode)) {
		int err = f2fs_convert_inline_inode(inode);
		if (err)
			return err;
	}
	if (f2fs_has_inline_data(inode))
		return 0;

	/* make sure allocating whole blocks */
	if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
		filemap_write_and_wait(mapping);

	return generic_block_bmap(mapping, block, get_data_block_bmap);
}