Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4811174iog; Wed, 22 Jun 2022 06:23:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tVkpDz5E4/7islXehwt89gxHfUCFnQK73jbOfVjLM+YQj4JpokrPYPzjKJ945xkgSsdIKJ X-Received: by 2002:a17:902:930c:b0:167:8960:2c39 with SMTP id bc12-20020a170902930c00b0016789602c39mr34195239plb.33.1655904222592; Wed, 22 Jun 2022 06:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655904222; cv=none; d=google.com; s=arc-20160816; b=WsEjRlIMKKn2SUJYgxdoSAWDeyHZUyKYU29VO/fFY4YLMAoXxPvRHIaxVKLmkvLHG3 CM9W6egdlS86ZTIlB6II7mfYEcvfMWG4SBktAOglC11A+VoW97L4X2Oz1acnWpUKSuui Sgwla2xW/4FwLENeGZuN6/5tPMnt1253e/PSva/ZTXGyHoX4pVX3gZnAvwP2hvqEzey1 nZSkASEl+I/It9w9XuyhqcpmWtu+BF6up4odbFtkyYDXiKStUERhgdvNe4nRll3q+iO7 8yMfnSWMbe/QZHLAa4MYke7gpjOdr/+ltxyH+fZxmLdsgPY9EkFs4oI/QUROmS7GYVGz 6Eng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nKjfZVkv31vlj8fjRLrdB6+HAMmb2SOZLqRnnAudKuY=; b=EIRlHCk5YmlOfEdMc/tcFHouZV05vGGSoMu+MgNFS8evcT4lFh3d2DvruT+WIB/q/I ViGM1oLUWwRQwfTkCwed61djFNYIUpE6k7RidqmS17URLgRMhBgUdlvJsWRf90ypeJlI PHs4l8eqrXN+wI7pPeUiOEa7lfB+n0KPAjYlZ4ysUJmZqViVecNz5BB7am/Ldnj0bLY5 Jr8eoUZ42GLxbF1tXAb5u5QzDLREzbJJReTkiFlePClEwgDfwKgCFqzB99+LAaPmT9wO qsSHAxClKpGMHnmTvldgqm3T/F2Tun4pywbkPHmRLzpoDGYuonpcQXTVN+Al/yzXke4b 8yoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fLZ3mqtY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020aa78081000000b00525035dde61si15914438pff.163.2022.06.22.06.23.27; Wed, 22 Jun 2022 06:23:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fLZ3mqtY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347638AbiFVMun (ORCPT + 99 others); Wed, 22 Jun 2022 08:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347354AbiFVMul (ORCPT ); Wed, 22 Jun 2022 08:50:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857C910F for ; Wed, 22 Jun 2022 05:50:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45387B81EAB for ; Wed, 22 Jun 2022 12:50:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E54C34114; Wed, 22 Jun 2022 12:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655902238; bh=LXxV2XdWo9ODoRTaLbjoba11bZZU9SlnRfAgm8n7JzY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fLZ3mqtYAJa53yiCfNTiRj1aEhHPpsRxRTyyUS3j7nvWZTQETvpeH+NcsscuD0ZSF ZBRmPM252tNBMwjpni8AgN8bi0TmY2KfS62hwVOA47xp6kcqeGSd/uW2LXl/Gdgx9n b+n22ovai8cT4CUN1I3AHrgRojLQ/YZjXPP11+PLypEko5iOv9/1Ti2WiWsidNiJun UevxTFy3LRLL5Av02OEz+N/NQwqBAU/LjUp3Iz4Z86zaTYU4ewURivE4YiL9Oz7BNs Nj7JuCKAfXj+arqj2uEMsPvoAy8j5NP/912yVnaBE3Qnd6aXtHRXP4npLQN2TxyMpq V1qAxU+/OaGPg== Message-ID: <7fb689d9-11ba-a173-8ad4-a328a03298a8@kernel.org> Date: Wed, 22 Jun 2022 20:50:33 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] f2fs: allow compression of files without blocks Content-Language: en-US To: Chao Liu , Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yue Hu , Wayne Zhang , Chao Liu References: <20220621064202.1078536-1-chaoliu719@gmail.com> From: Chao Yu In-Reply-To: <20220621064202.1078536-1-chaoliu719@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/6/21 14:42, Chao Liu wrote: > From: Chao Liu > > Files created by truncate have a size but no blocks, so I didn't get it, how can we create file by truncation... Thanks, > they can be allowed to enable compression. > > Signed-off-by: Chao Liu > --- > fs/f2fs/file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 2d1114b0ceef..daaa0dfd2d2e 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -1879,7 +1879,7 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) > if (iflags & F2FS_COMPR_FL) { > if (!f2fs_may_compress(inode)) > return -EINVAL; > - if (S_ISREG(inode->i_mode) && inode->i_size) > + if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode)) > return -EINVAL; > > set_compress_context(inode);