On 21.05.19 г. 16:10 ч., Johannes Thumshirn wrote:
> On Thu, May 16, 2019 at 10:47:54AM +0200, Johannes Thumshirn wrote:
> David can you fold this change in:
> 
> 

Reviewed-by: Nikolay Borisov <nbori...@suse.com>

> diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
> index 7281657c859c..ba2405b4931b 100644
> --- a/fs/btrfs/file-item.c
> +++ b/fs/btrfs/file-item.c
> @@ -23,9 +23,13 @@
>  #define MAX_CSUM_ITEMS(r, size) (min_t(u32, __MAX_CSUM_ITEMS(r, size), \
>                                      PAGE_SIZE))
>  
> -#define MAX_ORDERED_SUM_BYTES(fs_info, csum_size) ((PAGE_SIZE - \
> -                                sizeof(struct btrfs_ordered_sum)) / \
> -                                (csum_size) * (fs_info)->sectorsize)
> +static inline size_t max_ordered_sum_bytes(struct btrfs_fs_info *fs_info,
> +                                        u16 csum_size)
> +{
> +     u32 ncsums = (PAGE_SIZE - sizeof(struct btrfs_ordered_sum)) / csum_size;
> +
> +     return ncsums * fs_info->sectorsize;
> +}
>  
>  int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
>                            struct btrfs_root *root,
> @@ -376,7 +380,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 
> start, u64 end,
>                                     struct btrfs_csum_item);
>               while (start < csum_end) {
>                       size = min_t(size_t, csum_end - start,
> -                                  MAX_ORDERED_SUM_BYTES(fs_info, csum_size));
> +                                  max_ordered_sum_bytes(fs_info, csum_size));
>                       sums = kzalloc(btrfs_ordered_sum_size(fs_info, size),
>                                      GFP_NOFS);
>                       if (!sums) {
> 

Reply via email to