Re: [PATCH] zram: extra zram_get_element call in zram_read_from_zspool()

From: Sergey Senozhatsky
Date: Tue Nov 07 2023 - 21:48:49 EST


On (23/11/06 23:03), Vasily Averin wrote:
> On 11/6/23 22:55, Vasily Averin wrote:
> > 'element' and 'handle' are union in struct zram_table_entry.
>
> struct zram_table_entry {
> union {
> unsigned long handle;
> unsigned long element;
> };
>
> I do not understand the sense of this union.
> From my POV it just makes it harder to check the code because an reviewer doesn't
> expect that the zram element can't be used together.
> Can I remove this union at all and replace zram_get/set_element calls by zram_get/set_handle instead?

I guess it sort of helps API-wise to distinguish zram_handle (allocated
zsmalloc object handle) and zram_element (same-filled entry).

I'll leave it to Minchan to decide.