Re: [PATCH v3 2/3] btrfs: remove btrfs_bio_alloc() helper

Qu Wenruo
2021-09-20T10:33:27Z

On 2021/9/17 20:49, Nikolay Borisov wrote:
>
>
> On 17.09.21 г. 15:43, David Sterba wrote:
>> So should we add another helper that takes the exact number and drop the
>> parameter everwhere is 0 so it's just btrfs_io_bio_alloc() with the
>> fallback?
>
> But by adding another helper we just introduce more indirection.
>
> Actually I'd argue that if 0 is a sane default then BIO_MAX_VECS cannot
> be any worse because:
>
> a) It's a number which is as good as 0
> b) It's even named. So this is technically better than a plain 0
>

Any final call on this?

I hope this could be an example for future optional parameters.

We have some existing codes using two different inline functions, and
both of them call a internal but exported function with "__" prefix.

We also have call sites passing all needed parameters just like Nikolay
suggested.

Despite that, I have some further optimization for the btrfs_logical_bio
structure, thus I hope this helper situation can be solved soon.

Thanks,
Qu