From: Chao Yu <chao@kernel.org>
To: Yangtao Li <frank.li@vivo.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: compress: do cleanup in f2fs_truncate_partial_cluster()
Date: Sat, 9 Dec 2023 17:07:40 +0800 [thread overview]
Message-ID: <1332b650-0415-47a0-b439-053060c869f1@kernel.org> (raw)
In-Reply-To: <20231130092310.1297336-1-frank.li@vivo.com>
On 2023/11/30 17:23, Yangtao Li wrote:
> Remove unnecessary code logic.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/f2fs/compress.c | 30 +++++++++++++-----------------
> 1 file changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index 36e5dab6baae..de55c266509a 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1170,7 +1170,9 @@ int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock)
> int log_cluster_size = F2FS_I(inode)->i_log_cluster_size;
> pgoff_t start_idx = from >> (PAGE_SHIFT + log_cluster_size) <<
> log_cluster_size;
> - int err;
> + struct page **rpages = fsdata;
fsdata is NULL here.
Thanks,
> + int cluster_size = F2FS_I(inode)->i_cluster_size;
> + int err, i;
>
> err = f2fs_is_compressed_cluster(inode, start_idx);
> if (err < 0)
> @@ -1190,25 +1192,19 @@ int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock)
> if (err <= 0)
> return err;
>
> - if (err > 0) {
> - struct page **rpages = fsdata;
> - int cluster_size = F2FS_I(inode)->i_cluster_size;
> - int i;
> -
> - for (i = cluster_size - 1; i >= 0; i--) {
> - loff_t start = rpages[i]->index << PAGE_SHIFT;
> + for (i = cluster_size - 1; i >= 0; i--) {
> + loff_t start = rpages[i]->index << PAGE_SHIFT;
>
> - if (from <= start) {
> - zero_user_segment(rpages[i], 0, PAGE_SIZE);
> - } else {
> - zero_user_segment(rpages[i], from - start,
> - PAGE_SIZE);
> - break;
> - }
> + if (from <= start) {
> + zero_user_segment(rpages[i], 0, PAGE_SIZE);
> + } else {
> + zero_user_segment(rpages[i], from - start,
> + PAGE_SIZE);
> + break;
> }
> -
> - f2fs_compress_write_end(inode, fsdata, start_idx, true);
> }
> +
> + f2fs_compress_write_end(inode, fsdata, start_idx, true);
> return 0;
> }
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2023-12-09 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 9:23 [f2fs-dev] [PATCH] f2fs: compress: do cleanup in f2fs_truncate_partial_cluster() Yangtao Li via Linux-f2fs-devel
2023-12-09 9:07 ` 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=1332b650-0415-47a0-b439-053060c869f1@kernel.org \
--to=chao@kernel.org \
--cc=frank.li@vivo.com \
--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;
as well as URLs for NNTP newsgroup(s).