mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: <jaegeuk@kernel.org>
Cc: <linux-f2fs-devel@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>, <chao@kernel.org>,
	Chao Yu <yuchao0@huawei.com>
Subject: [PATCH 4/4] f2fs: compress: release compress context in caller of f2fs_read_multi_pages()
Date: Mon, 6 Jan 2020 16:01:44 +0800	[thread overview]
Message-ID: <20200106080144.52363-4-yuchao0@huawei.com> (raw)
In-Reply-To: <20200106080144.52363-1-yuchao0@huawei.com>

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


      parent reply	other threads:[~2020-01-06  8:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  8:01 [PATCH 1/4] f2fs: compress: fix panic in mkwrite Chao Yu
2020-01-06  8:01 ` [PATCH 2/4] f2fs: compress: revert error path fix Chao Yu
2020-01-06 19:26   ` Jaegeuk Kim
2020-01-08  9:33     ` Chao Yu
2020-01-06  8:01 ` [PATCH 3/4] f2fs: compress: fix error path in prepare_compress_overwrite() Chao Yu
2020-01-06 19:08   ` Jaegeuk Kim
2020-01-07  1:35     ` Chao Yu
2020-01-08 20:49       ` Jaegeuk Kim
2020-01-06  8:01 ` Chao Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106080144.52363-4-yuchao0@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®