@@ -3278,7 +3278,7 @@ struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location,
struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
struct btrfs_root *root, int *was_new);
int btrfs_get_extent_map_write(struct extent_map **map, struct buffer_head *bh,
- struct inode *inode, u64 start, u64 len);
+ struct inode *inode, u64 start, u64 len, bool *nocow);
struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
struct page *page, size_t pg_offset,
u64 start, u64 end, int create);
@@ -7499,12 +7499,15 @@ static int btrfs_get_blocks_direct_read(struct extent_map *em,
int btrfs_get_extent_map_write(struct extent_map **map,
struct buffer_head *bh,
struct inode *inode,
- u64 start, u64 len)
+ u64 start, u64 len, bool *nocow)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct extent_map *em = *map;
int ret = 0;
+ if (nocow)
+ *nocow = false;
+
/*
* We don't allocate a new extent in the following cases
*
@@ -7553,6 +7556,8 @@ int btrfs_get_extent_map_write(struct extent_map **map,
*/
btrfs_free_reserved_data_space_noquota(inode, start,
len);
+ if (nocow)
+ *nocow = true;
/* skip COW */
goto out;
}
@@ -7579,7 +7584,7 @@ static int btrfs_get_blocks_direct_write(struct extent_map **map,
struct extent_map *em;
ret = btrfs_get_extent_map_write(map, bh_result, inode,
- start, len);
+ start, len, NULL);
if (ret < 0)
return ret;
em = *map;