lkml.org 
[lkml]   [2020]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] f2fs: compress: release compress context in caller of f2fs_read_multi_pages()
Date
Execute initialize/destroy flow of compress context outside of
f2fs_read_multi_pages()

Signed-off-by: Chao Yu <yuchao0@huawei.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
\
 
 \ /
  Last update: 2020-01-06 09:03    [W:0.159 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site