[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200106080144.52363-4-yuchao0@huawei.com>
Date: Mon, 6 Jan 2020 16:01:44 +0800
From: Chao Yu <yuchao0@...wei.com>
To: <jaegeuk@...nel.org>
CC: <linux-f2fs-devel@...ts.sourceforge.net>,
<linux-kernel@...r.kernel.org>, <chao@...nel.org>,
Chao Yu <yuchao0@...wei.com>
Subject: [PATCH 4/4] f2fs: compress: release compress context in caller of f2fs_read_multi_pages()
Execute initialize/destroy flow of compress context outside of
f2fs_read_multi_pages()
Signed-off-by: Chao Yu <yuchao0@...wei.com>
---
fs/f2fs/compress.c | 1 +
fs/f2fs/data.c | 10 +++-------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 3390351d2e39..7727b6553a14 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -615,6 +615,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
ret = f2fs_read_multi_pages(cc, &bio, cc->cluster_size,
&last_block_in_bio, false);
+ f2fs_destroy_compress_ctx(cc);
if (ret)
goto release_pages;
if (bio)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5476d33f2d76..e68b9f4b7913 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2121,7 +2121,6 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
false);
f2fs_free_dic(dic);
f2fs_put_dnode(&dn);
- f2fs_destroy_compress_ctx(cc);
*bio_ret = bio;
return ret;
}
@@ -2139,7 +2138,6 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
f2fs_put_dnode(&dn);
- f2fs_destroy_compress_ctx(cc);
*bio_ret = bio;
return 0;
@@ -2213,10 +2211,9 @@ int f2fs_mpage_readpages(struct address_space *mapping,
max_nr_pages,
&last_block_in_bio,
is_readahead);
- if (ret) {
- f2fs_destroy_compress_ctx(&cc);
+ f2fs_destroy_compress_ctx(&cc);
+ if (ret)
goto set_error_page;
- }
}
ret = f2fs_is_compressed_cluster(inode, page->index);
if (ret < 0)
@@ -2257,8 +2254,7 @@ int f2fs_mpage_readpages(struct address_space *mapping,
max_nr_pages,
&last_block_in_bio,
is_readahead);
- if (ret)
- f2fs_destroy_compress_ctx(&cc);
+ f2fs_destroy_compress_ctx(&cc);
}
}
#endif
--
2.18.0.rc1
Powered by blists - more mailing lists