Message ID | 20190326190301.32365-6-rgoldwyn@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/15] btrfs: create a mount option for dax | expand |
On 26.03.19 г. 21:02 ч., Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > We require this to set the IOMAP_F_COW flag in > iomap structure, in the later patches. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> > --- > 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; >
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); 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;