linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Yunlong Song <yunlong.song@huawei.com>, <jaegeuk@kernel.org>,
	<chao@kernel.org>, <yunlong.song@icloud.com>
Cc: <miaoxie@huawei.com>, <bintian.wang@huawei.com>,
	<linux-fsdevel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] f2fs: discard small invalid blocks in current active segments
Date: Mon, 28 Aug 2017 17:59:52 +0800	[thread overview]
Message-ID: <fd445a69-d860-2185-bfef-bf037a1f513e@huawei.com> (raw)
In-Reply-To: <1503751772-158812-1-git-send-email-yunlong.song@huawei.com>

On 2017/8/26 20:49, Yunlong Song wrote:
> 1. write file A with 5 blocks to current empty active segment
> 2. remove file A
> 3. write checkpoint
> 4. write file B with 507 blocks to the same active segment
> 
> If file B is alive all the time, the blocks used by file A will never be
> discarded. So current active segment should also be treated as a candidate
> for small discards.

I don't think that would be a big issue, since there will not be any freezing
log headers, once log header moves, later invalid blocks could be discarded.

Thanks,

> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
>  fs/f2fs/segment.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8375257..a2e7c8f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -1339,7 +1339,9 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
>  		return false;
>  
>  	if (!force) {
> -		if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
> +		if (!test_opt(sbi, DISCARD) ||
> +			(!se->valid_blocks &&
> +			!IS_CURSEG(sbi, cpc->trim_start)) ||
>  			SM_I(sbi)->dcc_info->nr_discards >=
>  				SM_I(sbi)->dcc_info->max_discards)
>  			return false;
> 

  reply	other threads:[~2017-08-28 10:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 12:49 [PATCH] f2fs: discard small invalid blocks in current active segments Yunlong Song
2017-08-28  9:59 ` Chao Yu [this message]
2017-08-28 13:21   ` Yunlong Song
2017-08-29 10:06     ` Chao Yu

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=fd445a69-d860-2185-bfef-bf037a1f513e@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=bintian.wang@huawei.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=yunlong.song@huawei.com \
    --cc=yunlong.song@icloud.com \
    /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).