From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Yu Subject: Re: [PATCH] f2fs: forbid to do fstrim if fs has some error Date: Fri, 9 Sep 2016 00:02:47 +0800 Message-ID: <0de900d6-3e79-0932-51aa-1b0357137f96@kernel.org> References: <1472696079-7063-1-git-send-email-heyunlei@huawei.com> <177e0232-b89b-1540-f315-c1ca6a92e3ba@kernel.org> <20160908000225.GA14665@jaegeuk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1bi1nI-0007YC-O6 for linux-f2fs-devel@lists.sourceforge.net; Thu, 08 Sep 2016 16:03:16 +0000 Received: from mail.kernel.org ([198.145.29.136]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1bi1nF-0003Dw-57 for linux-f2fs-devel@lists.sourceforge.net; Thu, 08 Sep 2016 16:03:16 +0000 In-Reply-To: <20160908000225.GA14665@jaegeuk> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Jaegeuk Kim , Yunlei He Cc: heyunlei@huwei.com, linux-f2fs-devel@lists.sourceforge.net On 2016/9/8 8:02, Jaegeuk Kim wrote: > 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 >>> --- >>> 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."); Hmm.. leave some dmesg looks okay to me. So, Yunlei, how do you think of it? Thanks, > > Thanks, > ------------------------------------------------------------------------------