[PATCH] f2fs: compress: fix f2fs_put_rpages_mapping()
From: Chao Yu
Date: Sat Jan 11 2020 - 03:58:20 EST
Signed-off-by: Chao Yu <yuchao0@xxxxxxxxxx>
---
fs/f2fs/compress.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 502cd0ddc2a7..5c6a31d84ce4 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -74,18 +74,10 @@ static void f2fs_put_compressed_page(struct page *page)
}
static void f2fs_drop_rpages(struct compress_ctx *cc,
- struct address_space *mapping, int len, bool unlock)
+ int len, bool unlock)
{
unsigned int i;
for (i = 0; i < len; i++) {
- if (mapping) {
- pgoff_t start = start_idx_of_cluster(cc);
- struct page *page = find_get_page(mapping, start + i);
-
- put_page(page);
- put_page(page);
- cc->rpages[i] = NULL;
- }
if (!cc->rpages[i])
continue;
if (unlock)
@@ -97,18 +89,25 @@ static void f2fs_drop_rpages(struct compress_ctx *cc,
static void f2fs_put_rpages(struct compress_ctx *cc)
{
- f2fs_drop_rpages(cc, NULL, cc->cluster_size, false);
+ f2fs_drop_rpages(cc, cc->cluster_size, false);
}
static void f2fs_unlock_rpages(struct compress_ctx *cc, int len)
{
- f2fs_drop_rpages(cc, NULL, len, true);
+ f2fs_drop_rpages(cc, len, true);
}
static void f2fs_put_rpages_mapping(struct compress_ctx *cc,
- struct address_space *mapping, int len)
+ struct address_space *mapping,
+ pgoff_t start, int len)
{
- f2fs_drop_rpages(cc, mapping, len, false);
+ int i;
+ for (i = 0; i < len; i++) {
+ struct page *page = find_get_page(mapping, start + i);
+
+ put_page(page);
+ put_page(page);
+ }
}
static void f2fs_put_rpages_wbc(struct compress_ctx *cc,
@@ -680,7 +679,8 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
if (!PageUptodate(page)) {
f2fs_unlock_rpages(cc, i + 1);
- f2fs_put_rpages_mapping(cc, mapping, cc->cluster_size);
+ f2fs_put_rpages_mapping(cc, mapping, start_idx,
+ cc->cluster_size);
f2fs_destroy_compress_ctx(cc);
goto retry;
}
@@ -714,7 +714,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
unlock_pages:
f2fs_unlock_rpages(cc, i);
release_pages:
- f2fs_put_rpages_mapping(cc, mapping, i);
+ f2fs_put_rpages_mapping(cc, mapping, start_idx, i);
f2fs_destroy_compress_ctx(cc);
return ret;
}
--
2.18.0.rc1
>
> One another fix in f2fs-tools as well.
> https://github.com/jaegeuk/f2fs-tools
>
>>
>>>
>>> Thanks,
> .
>