On 2025/3/6 7:41, NeilBrown wrote:
On Wed, 05 Mar 2025, Yunsheng Lin wrote:
quoted
For the existing btrfs and sunrpc case, I am agreed that there
might be valid use cases too, we just need to discuss how to
meet the requirements of different use cases using simpler, more
unified and effective APIs.
We don't need "more unified".
What I meant about 'more unified' is how to avoid duplicated code as
much as possible for two different interfaces with similar functionality.
The best way I tried to avoid duplicated code as much as possible is
to defragment the page_array before calling the alloc_pages_bulk()
for the use case of btrfs and sunrpc so that alloc_pages_bulk() can
be removed of the assumption populating only NULL elements, so that
the API is simpler and more efficient.
If there are genuinely two different use cases with clearly different
needs - even if only slightly different - then it is acceptable to have
two different interfaces. Be sure to choose names which emphasise the
differences.
The best name I can come up with for the use case of btrfs and sunrpc
is something like alloc_pages_bulk_refill(), any better suggestion about
the naming?
Thanks,
NeilBrown