mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-06-01 23:23:46 -04:00
zram: rename zram_free_page()
We don't free page in zram_free_page(), not all slots even have any memory associated with them (e.g. ZRAM_SAME). We free the slot (or reset it), rename the function accordingly. Link: https://lkml.kernel.org/r/20251201094754.4149975-6-senozhatsky@chromium.org Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Brian Geffon <bgeffon@google.com> Cc: David Stevens <stevensd@google.com> Cc: Minchan Kim <minchan@google.com> Cc: Richard Chang <richardycc@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
910bbb441c
commit
7ad688c0cd
@@ -56,7 +56,7 @@ static size_t huge_class_size;
|
||||
|
||||
static const struct block_device_operations zram_devops;
|
||||
|
||||
static void zram_free_page(struct zram *zram, size_t index);
|
||||
static void zram_slot_free(struct zram *zram, u32 index);
|
||||
#define slot_dep_map(zram, index) (&(zram)->table[(index)].dep_map)
|
||||
|
||||
static void zram_slot_lock_init(struct zram *zram, u32 index)
|
||||
@@ -984,7 +984,7 @@ static int zram_writeback_complete(struct zram *zram, struct zram_wb_req *req)
|
||||
huge = zram_test_flag(zram, index, ZRAM_HUGE);
|
||||
}
|
||||
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_set_flag(zram, index, ZRAM_WB);
|
||||
zram_set_handle(zram, index, req->blk_idx);
|
||||
|
||||
@@ -2025,7 +2025,7 @@ static void zram_meta_free(struct zram *zram, u64 disksize)
|
||||
|
||||
/* Free all pages that are still in this zram device */
|
||||
for (index = 0; index < num_pages; index++)
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
|
||||
zs_destroy_pool(zram->mem_pool);
|
||||
vfree(zram->table);
|
||||
@@ -2057,7 +2057,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void zram_free_page(struct zram *zram, size_t index)
|
||||
static void zram_slot_free(struct zram *zram, u32 index)
|
||||
{
|
||||
unsigned long handle;
|
||||
|
||||
@@ -2256,7 +2256,7 @@ static int write_same_filled_page(struct zram *zram, unsigned long fill,
|
||||
u32 index)
|
||||
{
|
||||
zram_slot_lock(zram, index);
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_set_flag(zram, index, ZRAM_SAME);
|
||||
zram_set_handle(zram, index, fill);
|
||||
zram_slot_unlock(zram, index);
|
||||
@@ -2294,7 +2294,7 @@ static int write_incompressible_page(struct zram *zram, struct page *page,
|
||||
kunmap_local(src);
|
||||
|
||||
zram_slot_lock(zram, index);
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_set_flag(zram, index, ZRAM_HUGE);
|
||||
zram_set_handle(zram, index, handle);
|
||||
zram_set_obj_size(zram, index, PAGE_SIZE);
|
||||
@@ -2359,7 +2359,7 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
|
||||
zcomp_stream_put(zstrm);
|
||||
|
||||
zram_slot_lock(zram, index);
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_set_handle(zram, index, handle);
|
||||
zram_set_obj_size(zram, index, comp_len);
|
||||
zram_slot_unlock(zram, index);
|
||||
@@ -2581,7 +2581,7 @@ static int recompress_slot(struct zram *zram, u32 index, struct page *page,
|
||||
zs_obj_write(zram->mem_pool, handle_new, zstrm->buffer, comp_len_new);
|
||||
zcomp_stream_put(zstrm);
|
||||
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_set_handle(zram, index, handle_new);
|
||||
zram_set_obj_size(zram, index, comp_len_new);
|
||||
zram_set_priority(zram, index, prio);
|
||||
@@ -2784,7 +2784,7 @@ static void zram_bio_discard(struct zram *zram, struct bio *bio)
|
||||
|
||||
while (n >= PAGE_SIZE) {
|
||||
zram_slot_lock(zram, index);
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_slot_unlock(zram, index);
|
||||
atomic64_inc(&zram->stats.notify_free);
|
||||
index++;
|
||||
@@ -2892,7 +2892,7 @@ static void zram_slot_free_notify(struct block_device *bdev,
|
||||
return;
|
||||
}
|
||||
|
||||
zram_free_page(zram, index);
|
||||
zram_slot_free(zram, index);
|
||||
zram_slot_unlock(zram, index);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user