Re: [PATCH v3 2/6] mm: remove swap_free() and always use swap_free_nr()

From: Barry Song
Date: Sat May 04 2024 - 00:47:27 EST


On Sat, May 4, 2024 at 12:29 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> On Sat, May 04, 2024 at 12:27:11PM +0800, Barry Song wrote:
> > swap_free_nr() isn't separate, after this patch, it is the only one left.
> > there won't be swap_free() any more. it seems you want to directly
> > "rename" it to swap_free()?
>
> Yes. Avoid the pointless suffix if it is the only variant.

well. it seems you are right. We usually use a suffix to differentiate
two or more cases, but now, there is only one case left, the suffix
seems no longer useful.

one more problem is that free_swap_and_cache_nr() and
swap_free_nr() are not quite aligned.

extern void free_swap_and_cache_nr(swp_entry_t entry, int nr);

static inline void free_swap_and_cache(swp_entry_t entry)
{
free_swap_and_cache_nr(entry, 1);
}

The problem space is the same. I feel like in that case, we can also drop
free_swap_and_cache_nr() and simply add the nr parameter?