diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index e4db3b7932a3..dd1caba46eed 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -690,9 +690,7 @@ static int f2fs_compress_pages(struct compress_ctx *cc) vm_unmap_ram(cc->cbuf, cc->nr_cpages); vm_unmap_ram(cc->rbuf, cc->cluster_size); - for (i = 0; i < cc->nr_cpages; i++) { - if (i < new_nr_cpages) - continue; + for (i = new_nr_cpages; i < cc->nr_cpages; i++) { f2fs_compress_free_page(cc->cpages[i]); cc->cpages[i] = NULL; }