From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8323C43460 for ; Tue, 4 May 2021 15:56:36 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CAD4611AC for ; Tue, 4 May 2021 15:56:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CAD4611AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1ldxPX-0007jJ-AE; Tue, 04 May 2021 15:56:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1ldxPV-0007j7-Rz for linux-f2fs-devel@lists.sourceforge.net; Tue, 04 May 2021 15:56:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qU4pCq/rMYt75F9yz64CzAKLNLIH+T0Q1CLl+UwXz5Y=; b=l66QgMnuVk8mthwN+g6QH3+Vea Jcb47e8DtrjJBaCupcRVzB0PW4hJMxSeSKj5pzGzIi5xlAuP3eRnw4lMAJdD+lcy+dH4hECkAZfCj qSeJOKOA/zahCcK/sNnq/X19DhtaeU+ZGCeqmjOwtVoHVksTxFUenkG8Ld9STRX/Jhlg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qU4pCq/rMYt75F9yz64CzAKLNLIH+T0Q1CLl+UwXz5Y=; b=DnjLiMaLZxVgu3vV0j9xyvXyfr Ei27U47Yjh8X5N8eRLtytYWzQyhufuGywsbLla0DwC60q4w1aPO7s3R1bfHbMM3U8qHhcWu0HU3YE MAntTFE/veyzIx9XJNq73rWNjfbUoD3729lrtmyHksNP2wpSsGnkuY2kRlf6mdzfiEpQ=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1ldxPN-0005jx-PY for linux-f2fs-devel@lists.sourceforge.net; Tue, 04 May 2021 15:56:33 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84136610FC; Tue, 4 May 2021 15:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620143780; bh=NK9m8tiVx6odPyaA3BKfmydWZs7t+vIqZIMo/gaC7iY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ER0OirxyugSEnUH663gYuGCAPBlGv9cPfjvYbJ7xmBdqQX6AOhlmVF+fnfl1SaSSo /8+JcznzBUDXd2d4CvdaAN/43tN3p9HJVscnf9tWmTE6F8tWcsducJTdj8ooZo034q jjg7he716H74q67BBwk+99/gCRRJv9V2WS2rdAo7ct8YF2te6K+ndBo23DY1adYaqC Lz5CGUb/mp8wJG056YL+tI868JKQIgwI4btAEqSTSTRrxmOmWh+DCQZacHtVvAmvcl B/LvGlP9ww3UVfggp2/Q/5+PDBdnbhtS9bJhBszgYK7Lha77Hr2Xks011d65VOEfxb ZuvQcdnKWnVgQ== Date: Tue, 4 May 2021 08:56:18 -0700 From: Jaegeuk Kim To: Fengnan Chang Message-ID: References: <20210428024927.645-1-changfengnan@vivo.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210428024927.645-1-changfengnan@vivo.com> X-Headers-End: 1ldxPN-0005jx-PY Subject: Re: [f2fs-dev] [PATCH v2] f2fs: compress: avoid unnecessary check in f2fs_prepare_compress_overwrite X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 04/28, Fengnan Chang wrote: > when write compressed file with O_TRUNC, there will be a lot of > unnecessary check valid blocks in f2fs_prepare_compress_overwrite, > especially when written in page size, remove it. > > Signed-off-by: Fengnan Chang > --- > fs/f2fs/data.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index cf935474ffba..4cfc0472bc2d 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -3270,6 +3270,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, > struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > struct page *page = NULL; > pgoff_t index = ((unsigned long long) pos) >> PAGE_SHIFT; > +#ifdef CONFIG_F2FS_FS_COMPRESSION > + pgoff_t end = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; Need to move this below? > +#endif > bool need_balance = false, drop_atomic = false; > block_t blkaddr = NULL_ADDR; > int err = 0; > @@ -3306,6 +3309,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, > > *fsdata = NULL; > > + if (index >= end) > + goto repeat; > + > ret = f2fs_prepare_compress_overwrite(inode, pagep, > index, fsdata); > if (ret < 0) { > -- > 2.29.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel