Message ID | b15e98a7c6129f8b5f0a7748061e93865bb944e1.1599750901.git.anand.jain@oracle.com |
---|---|
State | New |
Headers | show |
Series | [stable-5.4,1/6] Btrfs: send, allow clone operations within the same file | expand |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 196ddbcd2936..1dba45d43485 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5712,7 +5712,7 @@ static int __btrfs_map_block_for_discard(struct btrfs_fs_info *fs_info, } offset = logical - em->start; - length = min_t(u64, em->len - offset, length); + length = min_t(u64, em->start + em->len - logical, length); stripe_len = map->stripe_len; /*