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=-15.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 E4E07C11F67 for ; Thu, 1 Jul 2021 22:52:19 +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 9C8EB6140E; Thu, 1 Jul 2021 22:52:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C8EB6140E 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-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lz5Xe-00014W-9l; Thu, 01 Jul 2021 22:52:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lz5Xc-000141-6f for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Jul 2021 22:52:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: 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=Yxu04MJappAHeh8Mf8jouf5zPAI1RPYsr1ZAl/E8j9M=; b=E8kA0GMnC7pAK1bzV6Pr9kWJGA 8umYOuUFUYlIJxWxUbawCnzJUpTVXPPdMABqusaF4t5PqCTQe3B+ZI1rtx5gE1Of0AH1D95EGJmNQ ECcwYMPmJxVvPbPhcSoSx3+hf56jo3Dpig2PWNMh475H4uq7m8/it5CZh98sOcugD67U=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: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=Yxu04MJappAHeh8Mf8jouf5zPAI1RPYsr1ZAl/E8j9M=; b=VCSSsuQfxFSwsA4YMSY96vDmMZ yGC5ri5nt1vChNi7wWaAdCLl5F+R8s4U9SPBl1DD0wGrTmvVw6nP1Pv3m4EKWW2Bd/S1xLE4lUE9X n/yynnczs0m9g6unwKbAheWMtvGiT0XwL8NiArstjdsaOW+SyV4+EQy9Uo0hAK6kZb/0=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lz5XT-006chj-42 for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Jul 2021 22:52:16 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 124E661154; Thu, 1 Jul 2021 22:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625179921; bh=AjeYj4JYmSsMFnV4khsdyiCBTTGKkmrJEyE7/OYhHWo=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IiR9H+tq1o+OtLsgmN3V/9nnJOYFgT0Dvpr2DKvy26u3D00EY7oOQ1n1rZJ8DCU6L ZcfEi8sHmUZjKlEv4LixyCiP2Sb6/WKGzA94KgHg9zqyOttK+mglV4Gxef9Jb3SMxN T/Hq5dn/suClpfBBfr9V1lUQ802ZTQqlM2HS382WCRkxINd5ahvfl4OQkbXKoFzTIg 0rAPCiydLRmCT5WnuMTCC7UuwlXWZ3g5BNsuJC9dAfyMw7oO76frmAYw8BprLpnCxB mdm2pW4c2cifTo4aG+5F5DybBZ6vf5UVmxoPExv7spLyYBJjJhk1hmeC2+Q8htDwW1 81fY5g3biyHdQ== To: Jaegeuk Kim , Fengnan Chang References: <20210628130550.39696-1-changfengnan@vivo.com> From: Chao Yu Message-ID: <47b9737f-b0e0-8483-773e-646a8cf3e2ec@kernel.org> Date: Fri, 2 Jul 2021 06:52:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Headers-End: 1lz5XT-006chj-42 Subject: Re: [f2fs-dev] [PATCH] f2fs: compress: allow write compress released file after truncate to zero 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 2021/7/2 1:01, Jaegeuk Kim wrote: > On 06/28, Fengnan Chang wrote: >> We should allow write compress released file after truncate to zero. >> >> Signed-off-by: Fengnan Chang >> --- >> fs/f2fs/file.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >> index 6afd4562335f..b91ae8f751c5 100644 >> --- a/fs/f2fs/file.c >> +++ b/fs/f2fs/file.c >> @@ -730,9 +730,13 @@ int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock) >> * for compressed file, only support cluster size >> * aligned truncation. >> */ >> - if (f2fs_compressed_file(inode)) >> + if (f2fs_compressed_file(inode)) { >> free_from = round_up(from, >> F2FS_I(inode)->i_cluster_size << PAGE_SHIFT); >> + if (!free_from) >> + clear_inode_flag(inode, FI_COMPRESS_RELEASED); > > We can do after truncating all the blocks successfully? Agreed, but please document this behavior as well. Thanks, > >> + } >> + >> #endif >> >> err = f2fs_do_truncate_blocks(inode, free_from, lock); >> -- >> 2.29.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel