Re: [PATCH 05/15] btrfs: return whether extent is nocow or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 26.03.19 г. 21:02 ч., Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
> 
> We require this to set the IOMAP_F_COW flag in
> iomap structure, in the later patches.
> 
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
> ---
>  fs/btrfs/ctree.h | 2 +-
>  fs/btrfs/inode.c | 9 +++++++--
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index b7bbe5130a3b..2c49d3c46170 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -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, int *nocow);

If this is going to be used as a boolean flag, then define is as boolean *
>  struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
>  				    struct page *page, size_t pg_offset,
>  				    u64 start, u64 end, int create);
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 80184d0c3b52..c8702e0b5e66 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -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, int *nocow)
>  {
>  	struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
>  	struct extent_map *em = *map;
>  	int ret = 0;
>  
> +	if (nocow)
> +		*nocow = 0;
> +
>  	/*
>  	 * 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 = 1;
>  			/* 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;
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux