Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1144529ybt; Wed, 8 Jul 2020 23:03:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKTDxUiFiIttfb1FMedXtaFkANT6xtAelXJIghp9GF7zUgYc0jRsQaGNbJE+/LieTJidcd X-Received: by 2002:a17:906:a892:: with SMTP id ha18mr56085080ejb.462.1594274592410; Wed, 08 Jul 2020 23:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594274592; cv=none; d=google.com; s=arc-20160816; b=geXZZ9y3mHg55w/FZroa/GgFxQrSAGpJ5nf/6excvRgEq/m/QxYNBZyqePtjSVMr1R 4KxPyrcJzal6J34zeW1YylvQwtd41zprN5eNLx6RJjnvZhZEfsASOQltPPFEnmxKvQ7W hGurHp1kIL07QDg2oD36oW5sYSabKUyf04Gcds1Ed+vvyMN6Ev36F6xUh6DPLYgtG0qn FL+qdoEnV5BqGdjCxZnvt9bHO4bwOvqqq3/vSEoweALnDIjQbr091FUo3Mrp34NO7CU+ KFeF9/bzN52hQWnm+FpbSukf+LwObbfHrA4DkTkE6xs72i9ueIeQUbpHNeDd6bSr/l+X NYVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZameAAM/OSypxl5eP4NQC+AzJS4YHSZiv1p46+Z9Tu4=; b=zzD5yQOaEit/0tvId5SWI1gb2UPluX2lM0Cvkgd1ibEE3/60SkFb3KyXHiMxxxELv2 d0iLAWTO/P1n4LsbVDh7B1VbFFglM1LfpfM856xRd1iNAPWv5hXSDsgKKAUGIvFzxZSb wxvtlAbcZl5QJcuSCBRb4oZroaM31oGTQ8DbL0eAHpSj9RtjKAAISg0oaiqhQB+A/Tme rboqkHMcZeAfWIsQQJWy8ftyG4Ku4BPUb584NQosdbrqIY3hFJeFYVSaNiOrXiuQtm+y 51las3sXQymZfzQklJhgsbxJzYfJ2CIb8Z4BqvgIiUdTTOOmBZGYuQ/FuMhUrpzvzr92 /mTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OaNF3VOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si1045918ejb.157.2020.07.08.23.02.48; Wed, 08 Jul 2020 23:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OaNF3VOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726478AbgGIGAh (ORCPT + 99 others); Thu, 9 Jul 2020 02:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgGIGAh (ORCPT ); Thu, 9 Jul 2020 02:00:37 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77CD2C061A0B for ; Wed, 8 Jul 2020 23:00:36 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e4so1004489ljn.4 for ; Wed, 08 Jul 2020 23:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZameAAM/OSypxl5eP4NQC+AzJS4YHSZiv1p46+Z9Tu4=; b=OaNF3VOdLYAgncGOKs3FAJDYtt5qRwg8iNuVkRLTGMOU+ZRBomDs37eiMoB9nLPry1 iMcFV7ScGdRdWR+pqyLq5EGwH94XI8ALEW9hfxpmY4Qp0eYUOYmiuNzpwSL3asQDTF+c KEFRquXoq/Ppw59TGdgMMaiDVdb3XmoQyxFqb+/qMcyMsmrhGIrqFnIt+g/Aeg+I0XZq 6iODt0uMPESEZVyI2uY8Tdc1ICfQQbN8yKSS1pPXu5pz9M2HsjZP0YIHw2Ejaqbm9VoA SfVjlxeLl57D7n9B/SHGR4F9LYavnspGhADKGFuWg/OxmYvWt7/Sy2jGDm4BWBaSRTyX xB0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZameAAM/OSypxl5eP4NQC+AzJS4YHSZiv1p46+Z9Tu4=; b=tgn0iYa8jlf/9SHp9M3RsiunRAqIrTRZDTeec2lKTlcVBpvUNKE7zY2gQofZ6JHanw OB3ls+IRY0WCqTJPddvTaI9myEBSu3shZBxmsDLM2XbwuCDD0lUf4d818uVAW062iib2 3E8wNY9O/w8ejvACUZrEoTojJAW3oRVBCEMDuFMEsPa+/Gx8i9qT0ZZxr4qc18Kg4kct 9qDFBkq4X2fhGixN8eVXBzLQzrVpR8j0ffqM/2xATMWbLXWIRQzjz0l5EZTzHrP3T1h/ egLCFYtOxQXrTMo/eQP0MOQNOhV8WLRYRR+soKQIEzEy9wPFiWzpwZDV6NTJWH8mDCtO tbig== X-Gm-Message-State: AOAM531Po4nGBy8GnlFqhYBmBC6EJT20ab7Z+V0X2+aU/WjIKkuadkZh uuNJ2Oag/OpkXq6jGTJaPECnQcqodD1qSXTuhXQ= X-Received: by 2002:a2e:8954:: with SMTP id b20mr33948652ljk.262.1594274434661; Wed, 08 Jul 2020 23:00:34 -0700 (PDT) MIME-Version: 1.0 References: <20200709015739.1653668-1-daeho43@gmail.com> <619af72b-2f8a-4a84-f73e-ac49989ba79f@huawei.com> <20200709053943.GA352648@google.com> In-Reply-To: <20200709053943.GA352648@google.com> From: Daeho Jeong Date: Thu, 9 Jul 2020 15:00:23 +0900 Message-ID: Subject: Re: [f2fs-dev] [PATCH] f2fs: ignore when len of range in f2fs_sec_trim_file is zero To: Jaegeuk Kim Cc: Chao Yu , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I can add it~ 2020=EB=85=84 7=EC=9B=94 9=EC=9D=BC (=EB=AA=A9) =EC=98=A4=ED=9B=84 2:39, Ja= egeuk Kim =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On 07/09, Chao Yu wrote: > > On 2020/7/9 9:57, Daeho Jeong wrote: > > > From: Daeho Jeong > > > > > > When end_addr comes to zero, it'll trigger different behaviour. > > > To prevent this, we need to ignore the case of that range.len is > > > zero in the function. > > > > > > Signed-off-by: Daeho Jeong > > > --- > > > fs/f2fs/file.c | 7 +++---- > > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > > index 368c80f8e2a1..98b0a8dbf669 100644 > > > --- a/fs/f2fs/file.c > > > +++ b/fs/f2fs/file.c > > > @@ -3813,15 +3813,14 @@ static int f2fs_sec_trim_file(struct file *fi= lp, unsigned long arg) > > > file_start_write(filp); > > > inode_lock(inode); > > > > > > - if (f2fs_is_atomic_file(inode) || f2fs_compressed_file(inode)) { > > > + if (f2fs_is_atomic_file(inode) || f2fs_compressed_file(inode) || > > > + range.start >=3D inode->i_size) { > > > ret =3D -EINVAL; > > > goto err; > > > } > > > > > > - if (range.start >=3D inode->i_size) { > > > - ret =3D -EINVAL; > > > + if (range.len =3D=3D 0) > > > goto err; > > > - } > > > > > > if (inode->i_size - range.start < range.len) { > > > ret =3D -E2BIG; > > > > How about the case trimming last partial written block? > > > > i_size =3D 8000 > > range.start =3D 4096 > > range.len =3D 4096 > > > > Do we need to roundup(isize, PAGE_SIZE) before comparison? > > If we want to trim whole file, do we need to give the exact i_size? > Wouldn't it be better to give trim(0, -1)? > > > > > Thanks, > > > > > > > > > > > _______________________________________________ > > Linux-f2fs-devel mailing list > > Linux-f2fs-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel