linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: z00520423 <zhangqilong3@huawei.com>, <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH -next] f2fs: add f2fs_gc exception handle in f2fs_ioc_gc_range
Date: Tue, 23 Jun 2020 17:34:52 +0800	[thread overview]
Message-ID: <45f5e30c-e8eb-b587-c029-57fafe4dcf4f@huawei.com> (raw)
In-Reply-To: <20200623071446.44106-1-zhangqilong3@huawei.com>

On 2020/6/23 15:14, z00520423 wrote:
> From: Qilong Zhang <zhangqilong3@huawei.com>
> 
> When f2fs_ioc_gc_range performs multiple segments gc ops, the return
> value of f2fs_ioc_gc_range is determined by the last segment gc ops.
> If its ops failed, the f2fs_ioc_gc_range will be considered to be failed
> despite some of previous segments gc ops succeeded. Therefore, so we
> fix: only all of segments gc ops are finished will return success.
> 
> Signed-off-by: Qilong Zhang <zhangqilong3@huawei.com>
> ---
>  fs/f2fs/file.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 3268f8dd59bb..b81fcf9b123d 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2527,6 +2527,10 @@ static int f2fs_ioc_gc_range(struct file *filp, unsigned long arg)
>  	}
>  
>  	ret = f2fs_gc(sbi, range.sync, true, GET_SEGNO(sbi, range.start));
> +	if (ret) {

-ENODATA means 1) target section has no valid blocks or 2) the section has valid blocks,
but it is opened segment, IMO, for 1) condition, we can wrap return value to zero,
continue to gc later sections, for 2) condition, we'd better to return -EBUSY as a hint
to user to call the interface later again.

get_victim_by_default():

	if (*result != NULL_SEGNO) {
		if (get_valid_blocks(sbi, *result, false) &&
			!sec_usage_check(sbi, GET_SEC_FROM_SEG(sbi, *result)))
			p.min_segno = *result;
		goto out;
	}

> +		ret = -EAGAIN;
> +		goto out;
> +	}
>  	range.start += BLKS_PER_SEC(sbi);
>  	if (range.start <= end)
>  		goto do_more;
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2020-06-23  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  7:14 [f2fs-dev] [PATCH -next] f2fs: add f2fs_gc exception handle in f2fs_ioc_gc_range z00520423
2020-06-23  9:34 ` 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=45f5e30c-e8eb-b587-c029-57fafe4dcf4f@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zhangqilong3@huawei.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).