return err;
}
-bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len)
+static bool __f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len,
+ bool check_first)
{
struct f2fs_map_blocks map;
block_t last_lblk;
if (err || map.m_len == 0)
return false;
map.m_lblk += map.m_len;
+ if (check_first)
+ break;
}
return true;
}
+bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len)
+{
+ return __f2fs_overwrite_io(inode, pos, len, false);
+}
+
static int f2fs_xattr_fiemap(struct inode *inode,
struct fiemap_extent_info *fieinfo)
{
* f2fs_map_lock and f2fs_balance_fs are not necessary.
*/
if ((flags & IOMAP_WRITE) &&
- !f2fs_overwrite_io(inode, offset, length))
+ !__f2fs_overwrite_io(inode, offset, length, true))
map.m_may_create = true;
err = f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DIO);