> @@ -3380,6 +3382,10 @@ static int update_space_info(struct btrfs_fs_info 
> *info, u64 flags,
>       if (!found)
>               return -ENOMEM;
>  
> +     ret = percpu_counter_init(&found->total_bytes_pinned, 0);
> +     if (ret)
> +             return ret;
> +

Leaks *found if percpu_counter_init() fails.

> -     if (space_info->bytes_pinned + delayed_rsv->size < bytes) {
> +     bytes_pinned = percpu_counter_sum(&space_info->total_bytes_pinned);
> +     if (bytes_pinned + delayed_rsv->size < bytes) {

This stood out as being different from the rest of the comparisons.

Why manually sum the counters instead of letting _compare() optimize it
away if it can?  _compare(&, bytes - delayed_rsv->size)?

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to