[RFC 2/4] mm/zswap: modify zswap_decompress to accept page instead of folio

Usama Arif
2024-10-18T10:50:42Z

This is a prerequisite for zswap_load to be able to decompress
large folios. zswap_load will iterate through each page in a folio
and decompress into it.

Signed-off-by: Usama Arif <usamaarif642@gmail.com>
---
mm/zswap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index f4b03071b2fb..9cc91ae31116 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -953,7 +953,7 @@ static bool zswap_compress(struct page *page, struct zswap_entry *entry,
return comp_ret == 0 && alloc_ret == 0;
}

-static void zswap_decompress(struct zswap_entry *entry, struct folio *folio)
+static void zswap_decompress(struct zswap_entry *entry, struct page *page)
{
struct zpool *zpool = entry->pool->zpool;
struct scatterlist input, output;
@@ -982,7 +982,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct folio *folio)

sg_init_one(&input, src, entry->length);
sg_init_table(&output, 1);
- sg_set_folio(&output, folio, PAGE_SIZE, 0);
+ sg_set_page(&output, page, PAGE_SIZE, 0);
acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, PAGE_SIZE);
BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait));
BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE);
@@ -1055,7 +1055,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry,
return -ENOMEM;
}

- zswap_decompress(entry, folio);
+ zswap_decompress(entry, &folio->page);

count_vm_event(ZSWPWB);
if (entry->objcg)
@@ -1666,7 +1666,7 @@ bool zswap_load(struct folio *folio)
if (!entry)
return false;

- zswap_decompress(entry, folio);
+ zswap_decompress(entry, &folio->page);

count_vm_event(ZSWPIN);
if (entry->objcg)
--
2.43.5