On 5.12.18 г. 14:28 ч., Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgold...@suse.com>
> 
> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com>
> ---
>  fs/btrfs/dax.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/dax.c b/fs/btrfs/dax.c
> index d614bf73bf8e..5a297674adec 100644
> --- a/fs/btrfs/dax.c
> +++ b/fs/btrfs/dax.c
> @@ -54,7 +54,12 @@ ssize_t btrfs_file_dax_read(struct kiocb *iocb, struct 
> iov_iter *to)

nit: I think it's better if you rename the iterator variable to "iter".

>  
>                  BUG_ON(em->flags & EXTENT_FLAG_FS_MAPPING);
>  
> -                ret = em_dax_rw(inode, em, pos, len, to);
> +             if (em->block_start == EXTENT_MAP_HOLE) {
> +                     u64 zero_len = min(em->len - (em->start - pos), len);

Shouldn't this be em->len - (pos - em->start) since this gives the
remaining length of the extent? Isn't pos guaranteed to be >= em->start ?

> +                     ret = iov_iter_zero(zero_len, to);
> +             } else {
> +                     ret = em_dax_rw(inode, em, pos, len, to);
> +             }
>                  if (ret < 0)
>                          goto out;
>                  pos += ret;
> 

Reply via email to