linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: heyunlei@huwei.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: forbid to do fstrim if fs has some error
Date: Wed, 7 Sep 2016 17:02:25 -0700	[thread overview]
Message-ID: <20160908000225.GA14665@jaegeuk> (raw)
In-Reply-To: <177e0232-b89b-1540-f315-c1ca6a92e3ba@kernel.org>

On Wed, Sep 07, 2016 at 09:24:31PM +0800, Chao Yu wrote:
> Hi Yunlei,
> 
> On 2016/9/1 10:14, Yunlei He wrote:
> > This patch skip fstrim if sbi set SBI_NEED_FSCK flag
> > 
> > Signed-off-by: Yunlei He <heyunlei@huawei.com>
> > ---
> >  fs/f2fs/segment.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index 93c5e26..1b62213 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1353,6 +1353,9 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
> >  	if (end <= MAIN_BLKADDR(sbi))
> >  		goto out;
> >  
> > +	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
> > +		goto out;
> 
> IMO, it's better to check this condition in f2fs_ioc_fstrim, and return error
> number to user, such as EIO?

I don't think it's an error case such as EIO, ENOMEM, EINVAL, and so on.
Instead, It'd be okay to return trimmed size with zero.
Oh, we'd better give a message to notify like this?

	f2fs_msg(sbi->sb, KERN_WARNING,
		"Found FS corruption, run fsck to fix.");

Thanks,

------------------------------------------------------------------------------

  reply	other threads:[~2016-09-08  0:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01  2:14 [PATCH] f2fs: forbid to do fstrim if fs has some error Yunlei He
2016-09-07 13:24 ` Chao Yu
2016-09-08  0:02   ` Jaegeuk Kim [this message]
2016-09-08 16:02     ` Chao Yu
2016-09-09  0:45       ` heyunlei

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=20160908000225.GA14665@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=heyunlei@huwei.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).