'element' and 'handle' are union in struct zram_table_entry.
Fixes: 8e19d540d107 ("zram: extend zero pages to same element pages")
Signed-off-by: Vasily Averin <[email protected]>
---
drivers/block/zram/zram_drv.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 9ac3d4e51d26..f4d342d11b81 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1318,12 +1318,10 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
handle = zram_get_handle(zram, index);
if (!handle || zram_test_flag(zram, index, ZRAM_SAME)) {
- unsigned long value;
void *mem;
- value = handle ? zram_get_element(zram, index) : 0;
mem = kmap_atomic(page);
- zram_fill_page(mem, PAGE_SIZE, value);
+ zram_fill_page(mem, PAGE_SIZE, handle);
kunmap_atomic(mem);
return 0;
}
--
2.34.1
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?
Thank you,
Vasily Averin